【问题标题】:How to capture video frames from Remote Video in Quickblox iOS如何在 Quickblox iOS 中从远程视频中捕获视频帧
【发布时间】:2016-11-15 09:11:51
【问题描述】:

我想在运行时获取远程用户(远程流)的屏幕截图, 我试图通过远程视图获取当前的CurrentImageContext 作为UIGraphicsBeginImageContextWithOptions(myRemoteView.bounds.size, myRemoteView.opaque, 0.0f)[myRemoteView drawViewHierarchyInRect:myRemoteView.bounds afterScreenUpdates:YES] 的参数,但是在运行时捕获时出现空白屏幕,关于如何在这方面进行的任何线索? 我正在使用最新版本的 Quickblox、ios 10 和 xcode 8。

此方法在远程用户连接时作为回调调用,

  • (void)session:(QBRTCSession *)session receivedRemoteVideoTrack:(QBRTCVideoTrack *)videoTrack fromUser:(NSNumber *)userID{

    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”作为屏幕截图,但它总是给我一个黑色图像。

【问题讨论】:

标签: objective-c webrtc quickblox


【解决方案1】:

您可以尝试使用此代码在同一视频会议中拍摄远程流的屏幕截图。它对我有用。

UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, 2.0f);
        [self drawViewHierarchyInRect:self.bounds afterScreenUpdates:YES];
        UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();

【讨论】:

    【解决方案2】:
    This helped me to capture the StreamView.
    
    func captureScreen() -> UIImage? {
            guard let streamView = conferenceStreamView else { return nil }
            UIGraphicsBeginImageContextWithOptions(streamView.bounds.size, false, 0);
            streamView.drawHierarchy(in: streamView.bounds, afterScreenUpdates: true)
            let image: UIImage = UIGraphicsGetImageFromCurrentImageContext()!
            UIGraphicsEndImageContext()
            return image
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-03-18
      • 1970-01-01
      • 1970-01-01
      • 2013-07-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多