Change background color of MobileRTCVideoView

#1

Description
Is it possible to change the background color of the MobileRTCVideoView? I would like to change default black to something else. If there is no way to do it does MobileRTCVideoView autofit to content (I always end up having video fullscreen with small horizontal video at center and huge black bars on top and bottom) so perhaps I may embed it in a different view with another background color?

Which version?
latest

0 Likes

#2

Hi dominik,

Thanks for using Zoom SDK. Unfortunately we do not have such interface that could change the background color of the MobileRTCVideoView. Regarding your 2nd question, I will come back to you with more information of the possibilities of doing that.

Thanks!

0 Likes

#3

Hi Dominik,

Regarding your 2nd question, our MobileRTCVideoView is inherited from UIView, so you can instantiate an MobileRTCVideoView object, and then add it as a subview into the view you would like to present. In your own view, you can customize it based on your needs.

Let me know if you have any other questions. Thanks!

0 Likes

#4

Hi Carson! Adding video as subview is excatly what I am trying to do. When view is loaded I’m checking video size by calling getUserVideoSize method but I run into another trouble. This method is suppose to return to me dimensions of user’s video like when video sent by user is horizontal it is eg. width: 300, height: 160 (which sounds reasonable), but when the video is in portrait mode it still returns width greater then height like: width: 600, height: 480 - this is landscape aspect ratio. What getUserVideoSize actually returns? Is there any possibility to check what is user device orientation?

0 Likes

#5

Hi Dominik,
Thanks for the reply. The method getUserVideoSize returns CGSize object(https://zoom.github.io/zoom-sdk-ios/category_mobile_r_t_c_meeting_service_07_video_08.html#a22efa11c5d9898bae8c1c788a1ab948c), you can find more info for CGSize from here: https://developer.apple.com/documentation/coregraphics/cgsize. Our iOS SDK demo contains 2 samples for using getUserVideoSize, one is in the CustomMeetingViewController.m class, line 137-144:

- (void)showAttendeeVideo:(MobileRTCVideoView*)videoView withUserID:(NSUInteger)userID
{
    [videoView showAttendeeVideoWithUserID:userID];
    CGSize size = [[[MobileRTC sharedRTC] getMeetingService] getUserVideoSize:userID];
    if (CGSizeEqualToSize(size, CGSizeZero))
        return;
    [videoView setVideoAspect:MobileRTCVideoAspect_PanAndScan];
}

The other one is in the ThumbView.m class, line 324-332:

- (void)showAttendeeVideo:(MobileRTCVideoView*)videoView withUserID:(NSUInteger)userID
{
    [videoView showAttendeeVideoWithUserID:userID];
    
    CGSize size = [[[MobileRTC sharedRTC] getMeetingService] getUserVideoSize:userID];
    if (CGSizeEqualToSize(size, CGSizeZero))
        return;
    [videoView setVideoAspect:MobileRTCVideoAspect_PanAndScan];
}

The above 2 samples should be helpful for your use cases.
Regarding getting the device orientation, the following 2 methods(also available in our demo) could be helpful:

UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
BOOL landscape = UIInterfaceOrientationIsLandscape(orientation);

Let me know if you have any other questions. Thanks!

0 Likes

#6

Hi Carson, thanks for answers!

I’m familiar with your Sample and what I can say is showAttendeeVideo in CustomMeetingViewController.m is never used, it can be removed from code without any problem. Also, getUserVideoSize:userID in ThumbView is used for checking if there is a video stream ready in order to populate thumb view, so it doesn’t really help.

My question about orientation was not about my device orientation but video stream orientation. If someone sends me a vertical video I get CGSize by getUserVideoSize with width dimension bigger then height which is horizontal aspect ratio. It looks like a bug.

0 Likes

#7

Hi Dominik,

Thanks for the reply.

  • Yes, the local device orientation is been taking care of by our SDK.
  • Regarding the scenario you’ve described in your reply. Unfortunately, we are not able to reproduce that on our side, could you provide more info on how to reproduce the specified issue?
  • Regarding the size and the orientation of the video stream, it really depends on the device or camera of the video source but not on the view. If the video is sent by cellphone, the width should be smaller than the height; If the video is sent by a desktop, then the width should be larger than the height.
  • If the aspect ratio of the video stream is the same the view’s ratio, it should fit perfectly. If the aspect ratio of the video stream is not the same the view’s ratio, you might need to either leave blank space or crop the video view. We provide an interface called setVideoAspect to help you scale your video stream view.

Hope this is helpful. Thank you very much!:slight_smile:

0 Likes

#8

I will try to figure out what is wrong on my side. If I will find anything corresponding to size or dimension I will let you know. Thanks!

0 Likes