Swift
Create the Screen Capturer
The Vonage SDK expects a custom video capturer that conforms to OTVideoCapture. Create a new file ScreenCapturer.swift and implement:
- Store a reference to the view to capture – even though our app is set up in SwiftUI, the simplest way to do it is with
UIViewwhich we will pass to the Capturer, alternatively this can be done with aUIViewRepresentablewrapper. - Render the view periodically – use
drawHierarchy(in:afterScreenUpdates:). - Convert to
CVPixelBuffer/OTVideoFrame– and pass frames tovideoCaptureConsumer.
Capture a view
Copy the full ScreenCapturer.swift implementation from this sample project. It handles:
- Timer-based capture at ~10 fps
- Resizing and padding for encoder compatibility
CVPixelBuffercreation andOTVideoFramedelivery
Screen sharing
Learn how to implement tha screensharing capability using the Vonage Video API platform.
Available on:
Steps
1
Introduction2
Getting Started3
Creating a New Project4
Adding the Vonage Video SDK5
Setting Up Authentication6
Create the Screen Capturer7
Expose the Root View for FullScreen Capture8
Expose the Root View for FullScreen Capture9
Summary10
Conclusion