Version: 2.67.0

Using MediaTrack API | How to programmatically detect video track qualities

This article describes how you can use the API to detect video track qualities.

The VideoTrack API, which is a sub-API of the MediaTrack API, can be used to implement this functionality. Implementing this functionality is a common use-case for developers who want to build their own UI to visualize the available video track qualities.

Table of contents

SDKs

Web SDKAndroid SDKAndroid TV SDKiOS SDKtvOS Chromecast SDK YesYesYesNoNoYes

Code examples

The code examples below how to implement the detection of video track qualities across SDK.

Web SDK

The Web SDK leverages the MediaTrack API.

function handleAddTrackEvent(addTrackEvent) {
var videoTrackQualities = addTrackEvent.track.qualities;
}
player.videoTracks.addEventListener('addtrack', handleAddTrackEvent);

Android (TV) SDK

The Android SDK leverages the MediaTrack API.

EventListener<AddTrackEvent> handleAddTrackEvent = new EventListener<AddTrackEvent>() {
@Override
public void handleEvent(AddTrackEvent addTrackEvent) {
QualityList videoTrackQualities = addTrackEvent.getTrack().getQualities();
}
};
tpv.getPlayer().getVideoTracks().addEventListener(VideoTrackListEventTypes.ADDTRACK, handleAddTrackEvent);

iOS (/tvOS) SDK

Currently not available due to iOS limitations.

Remarks

Related articles

  • Page:

How to programmatically select a video track quality

  • Page:

How to programmatically detect audio tracks

  • Page:

How to programmatically enable or disable audio tracks