How to programmatically detect video track quality changes on Web
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 activequalitychanged
event of a MediaTrack.
// detect video tracks being added to the player
player.videoTracks.addEventListener('addtrack', function (addTrackEvent) {
// detect quality changes of a track
addTrackEvent.track.addEventListener('activequalitychanged', function (event) {
console.log('activequalitychanged event detected!', event);
});
});