Kotlin
Creating a custom Renderer (MyRenderer)
Now you'll create a custom renderer that will actually load the frame data and pass it to OpenGL textures. It will be used to apply the inverted-color fragment shader.
Below is an outline; you will adapt shader code later.
- Create a kotlin class MyRenderer (can be internal to InvertedColorsVideoRenderer)
- Let's examine the
displayFramemethod. It is important to note that the frame that the sdk sends to theRendererin theonFramemethod is now property of theRenderer. It is up to this class to destroy the frame when it is not needed anymore. That's why we destroy previous frame when a new one comes to theRenderer
Basic video rendering
Learn how to use a custom video renderer in Kotlin to display a black-and-white version of a video stream using the Vonage Video Android SDK.
手順
1
Introduction2
Getting Started3
Creating a new project4
Adding the Android SDK5
Setting up authentication6
Requesting permissions7
Creating the Inverted Video Renderer8
Creating a custom Renderer (MyRenderer)9
Publishing a stream to the session10
Connecting Custom Renderer to Publisher/Subscriber11
Running the app12
Conclusion