RTMP Events - Android
VideoSDK provides onLivestreamStateChanged
event which will notify you of the current state of livestream for the meeting.
onLivestreamStateChanged
- This event will be triggered when the meeting's livestream status changed.
- You can implement this method of the abstract Class
MeetingEventListener
and add the listener toMeeting
class using theaddEventListener()
method ofMeeting
Class.
Example
Here is the usage of the event mentioned in this page.
- Kotlin
- Java
private val meetingEventListener: MeetingEventListener = object : MeetingEventListener() {
override fun onLivestreamStateChanged(livestreamState: String?) {
when (livestreamState) {
"LIVESTREAM_STARTING" -> Log.d( "LivestreamStateChanged",
"Meeting livestream is starting"
)
"LIVESTREAM_STARTED" -> Log.d( "LivestreamStateChanged",
"Meeting livestream is started"
)
"LIVESTREAM_STOPPING" -> Log.d("LivestreamStateChanged",
"Meeting livestream is stopping"
)
"LIVESTREAM_STOPPED" -> Log.d("LivestreamStateChanged",
"Meeting livestream is stopped"
)
}
}
}
override fun onCreate(savedInstanceState: Bundle?) {
//...
// add listener to meeting
meeting!!.addEventListener(meetingEventListener)
}
private final MeetingEventListener meetingEventListener = new MeetingEventListener() {
@Override
public void onLivestreamStateChanged(String livestreamState) {
switch (livestreamState) {
case "LIVESTREAM_STARTING":
Log.d("LivestreamStateChanged", "Meeting livestream is starting");
break;
case "LIVESTREAM_STARTED":
Log.d("LivestreamStateChanged", "Meeting livestream is started");
break;
case "LIVESTREAM_STOPPING":
Log.d("LivestreamStateChanged", "Meeting livestream is stopping");
break;
case "LIVESTREAM_STOPPED":
Log.d("LivestreamStateChanged", "Meeting livestream is stopped");
break;
}
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
//...
// add listener to meeting
meeting.addEventListener(meetingEventListener);
}
API Reference
The API references for all the methods and events utilised in this guide are provided below.
Got a Question? Ask us on discord