Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
92 Views

ios SDK 3.3 scale remote stream to fit whole screen without skewing

I am trying to show a remote stream from a desktop camera. 

The desktop camera has a resolution of 640 width and 480 height.

And I would like to show this stream into a full screen portrait phone...

Currently, the stream show up but it is skewed. I believe it is doing UIViewContentModeScaleToFill

So it scales the frame image and fit it in.

But when I change the content mode of remoteview (RTCEAGLVideoView *remoteVideoView)

 into UIViewContentModeScaleAspectFill

 

it is still doing the same thing.

Do you guys know if it is a bug in my code? Or is this a known issue in the ios Webrtc library? Below is the layoutSubviews method in my streamView.m file

 

-(void)layoutSubviews{

    

    screenSize =  [UIScreen mainScreen].bounds;

        

    //mask localVideo

    CALayer* maskLayer = [CALayer layer];

    maskLayer.frame = CGRectMake(0,0,localVideoWidth ,localVideoWidth);

    maskLayer.contents = (__bridge id)[[UIImage imageNamed:@"local_camera_mask"] CGImage];

    _localVideoView.layer.mask = maskLayer;

    

    // remoteVideo

    CGRect remoteVideoViewFrame=CGRectZero;

    remoteVideoViewFrame.origin.x = 0;

    remoteVideoViewFrame.origin.y = 0;

    remoteVideoViewFrame.size.width = screenSize.size.width;

    remoteVideoViewFrame.size.height = screenSize.size.height;

    _remoteVideoView.frame=remoteVideoViewFrame;

    _remoteVideoView.contentMode=UIViewContentModeScaleAspectFill; // <-- Change contentModel here

    [_remoteVideoView setSize:CGSizeMake(remoteVideoViewFrame.size.width, remoteVideoViewFrame.size.height)];

        

}

 

 

Tags (2)
0 Kudos
2 Replies
Highlighted
92 Views

Hi Zhen,

It looks like contentMode does not work at this time. You can customize the way how video renders by creating a new view implements RTCVideoRenderer.

0 Kudos
Highlighted
Beginner
92 Views

Jianjun Z. (Intel) wrote:

Hi Zhen,

It looks like contentMode does not work at this time. You can customize the way how video renders by creating a new view implements RTCVideoRenderer.

How to customsize the way? Could you provide a simple? Thanks a lot!

0 Kudos