Kotlin

Implement the Custom Capturer

Create a class that extends BaseVideoCapturer from the Vonage SDK. Your capturer must implement several key methods. For full implementation check the files used here: ScreenSharingCapturer.kt. Let's start by exploring getCaptureSettings()

getCaptureSettings() tells the SDK how your video is formatted: resolution, frame rate, and pixel format.

override fun getCaptureSettings(): CaptureSettings {
    return CaptureSettings().apply {
        this.fps = this@ScreenSharingCapturer.fps // 15 in our case
        this.width = this@ScreenSharingCapturer.width
        this.height = this@ScreenSharingCapturer.height
        format = ABGR
    }
}
  • fps – frames per second (15 fps is typical for screen sharing)
  • width / height – dimensions of the captured frames
  • format – pixel format (e.g. ABGR, NV21)