从vidyo.io访问视频帧

时间:2018-03-14 12:03:44

标签: vidyo

我正在尝试访问视频帧。我已经注册了LocalCameraFrameListener但功能   - (void)onLocalCameraFrame:(VCLocalCamera *)localCamera VideoFrame :( VCVideoFrame *)videoFrame未被调用。

我正在使用入门“Access Raw Frames”中给出的代码。

提前致谢

1 个答案:

答案 0 :(得分:0)

我找到了如何获取videoFrame: 1)你的viewController应该是:

class StreamController: UIViewController, VCConnectorIConnect, VCConnectorIRegisterLocalCameraEventListener,  VCConnectorIRegisterLocalCameraFrameListener {
    ...
}

2)然后你应该在func onLocalCameraSelected中注册cameraframelistener:

func onLocalCameraSelected(_ localCamera: VCLocalCamera!) {
    self.connector?.registerLocalCameraFrameListener(self, localCamera: localCamera, width: UInt32(width), height: UInt32(height), frameInterval: 0)
}

3)所以在onLocalCameraFrame func中你会得到videoFrame:

func onLocalCameraFrame(_ localCamera: VCLocalCamera!, videoFrame: VCVideoFrame!) {
   print(videoFrame)
}

但我的问题是我无法通过此视频框架获取图片。 如果您将找到如何获取UIImage或base64encoded图像,请告诉我。