我想在运行时获取远程用户(远程流)的屏幕截图,我试图通过远程视图获取当前的CurrentImageContext
,并将其作为UIGraphicsBeginImageContextWithOptions(myRemoteView.bounds.size, myRemoteView.opaque, 0.0f)
的[myRemoteView drawViewHierarchyInRect:myRemoteView.bounds afterScreenUpdates:YES]
的参数,但是在捕获运行时时却出现黑屏,这方面如何进行的任何线索?我正在使用最新版本的Quickblox,ios 10和xcode 8。
此方法在连接远程用户时称为回调,
(无效)会话:(QBRTCSession *)会话从用户:(NSNumber *)userID {]接收了RemoteVideoTrack:(QBRTCVideoTrack *)videoTrack
QBRTCVideoTrack * remoteVideoTrak = [self.session remoteVideoTrackWithUserID:@(user.ID)];QBRTCRemoteVideoView * remoteVideoView = [[[QBRTCRemoteVideoView alloc] init];remoteVideoView.frame = self.remoteVV.bounds;
[remoteVideoView setVideoTrack:remoteVideoTrak];
[self.remoteVV addSubview:remoteVideoView];
}
我要捕获'self.remoteVV'作为屏幕截图,但它总是给我黑色图像。
我想在运行时获取远程用户(远程流)的屏幕快照,我尝试使用远程视图获取当前的CurrentImageContext作为UIGraphicsBeginImageContextWithOptions(...]的参数。
UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, 2.0f);
[self drawViewHierarchyInRect:self.bounds afterScreenUpdates:YES];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();