我们遇到短视频 TXUGCRecord工具显示时部分带刘海的手机,视频捕捉区上下有黑色区域。
解决方案:
1.隐藏系统状态栏;
2.设置视频渲染模式为VIDEO_RENDER_MODE_FULL_FILL_SCREEN。
出问题的代码:
if (UGCKitRecordStyleRecord == _config.recordStyle) { [[TXUGCRecord shareInstance] setVideoRenderMode:VIDEO_RENDER_MODE_ADJUST_RESOLUTION]; } else { [[TXUGCRecord shareInstance] setVideoRenderMode:VIDEO_RENDER_MODE_ADJUST_RESOLUTION]; }
具体代码:
1.隐藏导航栏:
- (void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; _navigationBarHidden = self.navigationController.navigationBar.hidden; [self.navigationController setNavigationBarHidden:YES animated:NO]; if (_isCameraPreviewOn == NO) { [self startCameraPreview]; } else { //停止特效的声音 [[[TXUGCRecord shareInstance] getBeautyManager] setMotionMute:NO]; } // 恢复变声与混音效果 if (_voiceChangerType >= 0) { [[TXUGCRecord shareInstance] setVoiceChangerType:_voiceChangerType]; } if (_revertType >= 0) { [[TXUGCRecord shareInstance] setReverbType:_revertType]; } }
2.设置视频渲染模式:
if (UGCKitRecordStyleRecord == _config.recordStyle) { [[TXUGCRecord shareInstance] setVideoRenderMode:VIDEO_RENDER_MODE_FULL_FILL_SCREEN]; } else { [[TXUGCRecord shareInstance] setVideoRenderMode:VIDEO_RENDER_MODE_FULL_FILL_SCREEN]; }
效果: