0

我需要为 QuickBlox 视频聊天应用视频或音频过滤器。任何人都有一个有效的示例代码吗?

如何为此目的使用 setCustomVideoChatCaptureSession 和 processVideoChatCaptureVideoSample?

4

1 回答 1

0

您可以在应用程序中使用自己的 AVCaptureSession 对象并将所有视频数据包转发到 SDK。所以 SDK 只会发送数据包而不进行任何处理。这是一种方式。

- (void)setup{
    // Create video Chat
    QBVideoChat *videoChat = [[QBChat instance] createAndRegisterVideoChatInstance];
    [videoChat setIsUseCustomVideoChatCaptureSession:YES];

    // Create capture session
    self.captureSession = [[AVCaptureSession alloc] init];
    //
    // ... setup capture session here   

    /*We create a serial queue to handle the processing of our frames*/
    dispatch_queue_t callbackQueue= dispatch_queue_create("cameraQueue", NULL);
    [videoCaptureOutput setSampleBufferDelegate:self queue:callbackQueue];

    /*We start the capture*/
    [self.captureSession startRunning];
}

- (void)captureOutput:(AVCaptureOutput *)captureOutput  didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection {

    // Do something with samples
    // ...

    // forward video samples to SDK
    [videoChat processVideoChatCaptureVideoSample:sampleBuffer];
}

另一种方法是在接收端应用过滤器。只需根据需要覆盖 view.layer setContent: 方法和处理内容

于 2013-08-26T19:29:46.750 回答