我有一个 iOS 应用,它在旋转设备时仅支持纵向,RTCMTLVideoView 捕获的视频会旋转为横向,即使 UI 的其余部分保持纵向也是如此。
到目前为止,我找到的唯一解决方案是监听 UIDeviceOrientationDidChangeNotification 通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:nil];
并禁用它
- (void)orientationChanged:(NSNotification *)notification{
NSLog(@"orientation changed");
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
}
有什么方法可以防止这种行为并在没有这种丑陋的解决方法的情况下将其锁定为纵向?
最佳答案
我遇到的问题是前置摄像头拍摄的视频没有镜像。
我解决了翻转 RTCMTLVideoView 的问题
self.myRTCMTLVideoView.transform = CGAffineTransformMakeScale(-1.0, 1.0)
关于ios - 修复了 RTCMTLVideoView webrtc 的视频捕获方向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53556005/