NSDictionary* mandatoryConstraints;
NSString *aspectRatio = [NSString stringWithFormat:@"%f",(double)4/3];
if (aspectRatio) {
mandatoryConstraints = @{ kRTCMediaConstraintsMaxAspectRatio: aspectRatio};
}
RTCMediaConstraints *cameraConstraints = [RTCMediaConstraints alloc];
cameraConstraints = [cameraConstraints initWithMandatoryConstraints:mandatoryConstraints optionalConstraints:nil];
Additionally, I also am using RTCAVFoundationVideoSource like so,
self.source = [self.peerConnectionFactory avFoundationVideoSourceWithConstraints:cameraConstraints];
[self.source adaptOutputFormatToWidth:640 height:480 fps:30];
self.source.useBackCamera = YES;//side note. there is a latency when switching from the front (default) camera and to the back one which my app uses. the user can see a glimmer of themselves before the switch. any way to avoid this?
- (void)videoView:(RTCEAGLVideoView *)videoView didChangeVideoSize:(CGSize)size {
/* resize self.localView or self.remoteView based on the size returned */
NSLog(@"Height is %f and Width is %f", size.height, size.width);
}