1_xm1n2Wo7zovEnwzCK1KK7A.png
视频镜像问题解决
self.preView.track = self.mediaCapturer.videoTrack;
self.preView.videoView.transform = CGAffineTransformMakeScale(-1.0,1.0);
共享屏幕拉伸变形 (IOS 和安卓)
造成拉伸的原因是因为采集视频分辨率不统一 造成视频拉伸变形设置统一的分辨率和帧数
self.capture.captureSession.sessionPreset = [self.capture.captureSession canSetSessionPreset:AVCaptureSessionPreset640x480] ? AVCaptureSessionPreset640x480 : AVCaptureSessionPresetMedium;
[device lockForConfiguration:NULL];
@try {
//设置30帧
[device setActiveVideoMinFrameDuration:CMTimeMake(1, 30)];
[device setActiveVideoMaxFrameDuration:CMTimeMake(1, 30)];
} @catch (NSException *exception) {
NSLog(@"MediaIOS, 设备不支持所设置的分辨率,错误信息:%@",exception.description);
} @finally {
}
[device unlockForConfiguration];
噪音消除设置
// 增加 4个约束 解决回声消除问题 answer内调用传空值
NSDictionary *mandatoryContraints = @{};
@"OfferToReceiveAudio" : @"true",
@"OfferToReceiveVideo" : @"true",
@"googNoiseSuppression": @"true",
@"googEchoCancellation": @"true"
return @{
@"OfferToReceiveAudio" : @"true",
@"OfferToReceiveVideo" : @"true",
@"googNoiseSuppression": @"true",
@"googEchoCancellation": @"true"
};
回到主页视频源关闭断开
appdelegate方法里面设置通知监听
- (void)applicationWillEnterForeground:(UIApplication *)application {
if(self.isback){
self.isback = false;
[[NSNotificationCenter defaultCenter]postNotificationName:@"Foreground" object:nil];
}
}
会议中开启视频源
- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.row == 0) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
dispatch_async(dispatch_get_global_queue(0, 0), ^{
[_mediaCapturer startCapture];
});
});
}
}