Swift
Summary
How it works
- The Protocol (
OTVideoCapture): You create a custom class (e.g.,BasicVideoCapturer) that conforms to this protocol. This defines the lifecycle methods Vonage SDK needs to control your camera (start, stop, init, release). - The Consumer (
OTVideoCaptureConsumer): When you assign your custom capturer to a publisher, the SDK hands you a "Consumer" object. Think of this as the input pipe to the Vonage session. - The Frame (
OTVideoFrame): Your job is to produce video frames. These are wrappers around raw image data (pixels). - The Loop:
- Capture: You generate a frame.
- Wrap: You wrap the raw byte buffer into an
OTVideoFrame. - Consume: You pass the frame to
videoCaptureConsumer.consumeFrame(frame).
- Transmission: The SDK takes the frame from the consumer, encodes it (e.g., to H.264 or VP8), and transmits it to the session.
Testing
This example should be tested on an iOS device only (don't forget to add proper permissions to your app)
Test on Physical Device
- Connect an iOS device
- Select it as the run destination
- Grant camera permissions when prompted
- You should see your camera feed in grayscale
Test with Multiple Participants
- Run the app on a device or simulator
- Use the Vonage Video Playground to join the same session
- You should see both your custom-rendered stream and the standard subscriber stream
Basic video capture
Learn how set up a basic video capturer using the Vonage Video SDK.
Available on:
Steps
1
Introduction2
Getting Started3
Creating a New Project4
Adding the Vonage Video SDK5
Setting Up Authentication6
Initializing capture7
Capturing video frames8
Summary9
Conclusion