Kotlin
Provide Containers for Video Views
The Vonage SDK returns View objects for publisher and subscriber. The sample hosts them in FrameLayout containers created from Compose via AndroidView:
Pass the containers to your activity so it can add publisher and subscriber views when the session connects:
Attach the View When Ready
In onConnected, publish and attach the publisher view:
override fun onConnected(session: Session) {
if (publisher == null) {
publisher = Publisher.Builder(applicationContext).build()
session.publish(publisher)
publisherViewContainer.addView(publisher?.view)
if (publisher?.view is GLSurfaceView) {
(publisher?.view as GLSurfaceView).setZOrderOnTop(true)
}
}
}
Subscribe when a remote stream arrives:
Picture in Picture
Learn how add Picture in Picture functionality to your app using Vonage Video SDK.
Available on:
Steps
1
Introduction2
Getting Started3
Creating a New Project4
Adding the Android SDK5
Setting Up Authentication6
Requesting Permissions7
Enable Picture-in-Picture on Your Activity8
Provide Containers for Video Views9
Launching Picture-in-Picture10
Managing PiP Mode Changes11
Running the App12
Conclusion