如何在Quickblox iOS中从远程视频中捕获视频帧

问题描述 投票:1回答:1

我想在运行时获取远程用户(远程流)的屏幕截图,我试图通过远程视图获取当前的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();
objective-c webrtc quickblox
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.