Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AVCaptureSession interruption event occurs when camera.startCapture(...) is called #648

Open
david-podcastle opened this issue Apr 28, 2022 · 0 comments

Comments

@david-podcastle
Copy link

Hi,
Before integrating Twilio into our application we have set up audio/video recording which saves 5s length video chunks to local storage and then uploads to the remote server.
Everything is classic here: first, we have var videoSession: AVCaptureSession. Then we add input and output and at the same time setting AVCaptureVideoDataOutputSampleBufferDelegate to the AVCaptureVideoDataOutput instance with setSampleBufferDelegate(...) method call.
The following is easy, we just need to handle the following delegate method:
captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection)
This gives as possibility to capture and save media chunks. Optionally we have also a video preview view setup with a video session object.
The problem started to occur when we decided to integrate Twilio video into our app for video meetings. When the following Twilio method call occurs for a CameraSource object
camera.startCapture(...) then we receive session interruption event with .videoDeviceInUseByAnotherClient reason and my AVCaptureVideoDataOutputSampleBufferDelegate captureOutput() method is stoping to work. If I restart AVCaptureSession then captureOutput() is starting to work but Twilio video is stopping to cast a video. This is a pretty complex situation since we are not applicable to change our video recording code based on pure AVFoundation implementation but at the same time, we should provide a video meeting feature.
As soon as I could understand, a video session can have only one owner, and switching them drops the current owner. I am totally unable to find any solution as I have tried to find anything in Twilio documentation with no luck. Probably I miss something, maybe there is some way to use the existing session to broadcast the user's video?
Any help is really appreciated and thank you in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant