0

I need to apply video or auido filter for QuickBlox video chat. Anyone has a working sample code for this?

How to use setCustomVideoChatCaptureSession and processVideoChatCaptureVideoSample for this purpose?

1 Answers1

0

you can use own AVCaptureSession object in your application and forward all video packets to SDK. So SDK will just send packet without any processing. This is one way.

- (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];
}

Other way is to apply filters on receiver side. Just override view.layer setContent: method and process content as you want

Rubycon
  • 18,156
  • 10
  • 49
  • 70