Starting capture: wiring into the Publisher lifecycle
- Using the custom capturer in the Publisher
Wherever you create your publisher (e.g., in MainActivity or a dedicated call manager), you pass an instance of the custom capturer into the Publisher.Builder:
After you build a Publisher and provide your MirrorVideoCapturer instance - all outgoing video for that publisher comes from your custom capturer instead of the default one.
- Once you create a Publisher with your custom capturer and call
session.publish(publisher), the SDK will call into your capturer’sstartCapture()method.
The high‑level flow is as follows:
Check camera state: ensure the underlying camera resource is initialized and ready. Start capture loop: Open the camera (if not already open). Start a repeating capture request (Camera2) or start the preview pipeline (CameraX / Camera1). Handle “not ready yet” cases: If camera setup is still in progress, queue the actual start until the camera is opened (avoids race conditions). Error handling: If something is fundamentally wrong (e.g., startCapture called too early), throw or signal an error.
After startCapture() succeeds, your capturer starts receiving camera frames and pushing them to the SDK.
Basic video capture
Learn how set up a basic video capturer using the Vonage Video SDK.