Intel® Collaboration Suite for WebRTC
Community support and discussions on the Intel® Collaboration Suite for WebRTC (Intel® CS for WebRTC).
1146 Discussions

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

Zhen_L_
Beginner
639 Views

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)];

        

}

 

 

0 Kudos
2 Replies
Jianjun_Z_Intel
Employee
639 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
Somnus_Chen
Beginner
639 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
Reply