How to programmatically detect video track quality changes on Android
This article describes how you can use the VideoTrack API, a sub-API of the MediaTrack API, to detect video track quality changes. Implementing this functionality is a common use-case for developers who want to build their own UI to visualize the video track quality that is currently active.
Usage
Listen for the ACTIVEQUALITYCHANGEDEVENT
event of a MediaTrack.
// detect video tracks being added to the player
player.videoTracks.addEventListener(VideoTrackListEventTypes.ADDTRACK) { addTrackEvent ->
// detect quality changes of a track
addTrackEvent.track.addEventListener(VideoTrackEventTypes.ACTIVEQUALITYCHANGEDEVENT) { event ->
println("activequalitychanged event detected! ${event.quality}")
}
}