Swift
Create the Custom Video Renderer
Create a new Swift file called CustomVideoRender.swift:
import OpenTok
import UIKit
final class CustomVideoRender: NSObject, OTVideoRender {
let view = CustomRenderView(frame: .zero)
func renderVideoFrame(_ frame: OTVideoFrame) {
view.renderVideoFrame(frame)
}
}
Key Points:
- Implements the
OTVideoRenderprotocol required by the Vonage SDK - Provides a
viewproperty that contains the custom render view - Forwards incoming video frames to the render view
Basic video rendering
Learn how to use a custom video renderer in Swift to display a black-and-white version of a video stream using the Vonage Video iOS SDK.
Steps
1
Introduction2
Getting Started3
Creating a New Project4
Adding the Vonage Video SDK5
Setting Up Authentication6
Understanding the Architecture7
Create the Custom Render View8
Create the Custom Video Renderer9
Integrating with Vonage Video Manager10
Create UIView to SwiftUI Wrapper11
Display in SwiftUI12
How It Works13
Conclusion