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 OTVideoRender protocol required by the Vonage SDK
  • Provides a view property that contains the custom render view
  • Forwards incoming video frames to the render view