Skip to main content
Skip table of contents

Video track selection

When a DASH stream contains multiple video tracks (indicated by multiple video Adaptation Sets in its manifest), you can switch between them using methods on the OTVVideoView instance. Video track selection is not supported for HLS streams.

For clarity, here, the term video track refers to a DASH Adaptation Set represented by an OTVTrackInfo object.

JAVA
OTVTrackInfo[] getOTVTrackInfo()

This returns an array comprising all of the stream’s audio and subtitle tracks and all supported video tracks.

Prerequisites

  • The player has been created, and the application is configured for watching clear content.

  • A clear stream containing more than one video Adaptation Set is available for testing.

Example code

The following example code is used to select video tracks. 

Video tracks are located by interrogating for tracks of type MEDIA_TRACK_TYPE_VIDEO.

JAVA
    OTVTrackInfo[] trackInfo = mOTVVideoView.getOTVTrackInfo();
    for (int i = 0; i < trackInfo.length ; i++) {
      if (trackInfo[i].getType() == OTVTrackInfo.MEDIA_TRACK_TYPE_VIDEO) {
        // Add to video track list with index 'i'
      } else if (trackInfo[i].getType() == OTVTrackInfo.MEDIA_TRACK_TYPE_AUDIO) {
        // Ignore track
      } else if (trackInfo[i].getType() == OTVTrackInfo.MEDIA_TRACK_TYPE_TIMEDTEXT) {
        // Ignore track
      }
    }
    // Return video track list and indexes to present to the user for selection

OTVVideoView.getOTVTrackInfo() will only return video tracks that the device can support

To select a track at an index of the array returned by getOTVTrackInfo().

JAVA
mOTVVideoView.selectTrack(index);

To deselect a track at an index of the array returned by getOTVTrackInfo().

JAVA
mOTVVideoView.deselectTrack(index);

Deselecting the current track is not necessary before selecting another track.

See also the Multi-audio and Subtitles features.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.