CONNECT Player SDK 5 for Android
5.42.x 5.41.x 5.40.x 5.39.x 5.38.x 5.37.x 5.36.x 5.35.x 5.34.x 5.33.x 5.32.x 5.31.x 5.30.x 5.29.x 5.28.x 5.27.x 5.26.x 5.25.x 5.24.x 5.23.x 5.22.x 5.21.x 5.20.x 5.19.x 5.18.x 5.17.x 5.16.x 5.15.x 5.14.x 5.13.x 5.12.x 5.11.x 5.10.x 5.9.x 5.8.x 5.7.x 5.6.x 5.5.x
5.42.x 5.41.x 5.40.x 5.39.x 5.38.x 5.37.x 5.36.x 5.35.x 5.34.x 5.33.x 5.32.x 5.31.x 5.30.x 5.29.x 5.28.x 5.27.x 5.26.x 5.25.x 5.24.x 5.23.x 5.22.x 5.21.x 5.20.x 5.19.x 5.18.x 5.17.x 5.16.x 5.15.x 5.14.x 5.13.x 5.12.x 5.11.x 5.10.x 5.9.x 5.8.x 5.7.x 5.6.x 5.5.x

Additional video track information

The OTVTrackInfo class contains additional information about video tracks, each representing a video Adaptation Set extracted from the stream’s manifest. It provides the following methods:

  • isActive() returns true for the selected track, and false for all other video tracks in the list

  • getName() provides a string describing the track (which may be simply the language)

  • getLanguage() provides the language code string in either way of ISO-639-1 or ISO-639-2

  • getEncodeType() always returns 0 for video tracks - the codecs of the underlying video tracks must be retrieved via OTVVideoTrackInfo.getCodecs() - a list of the track’s underlying OTVVideoTrackInfo objects is retrieved via the getVideoTrackInfos() method

  • getCharacteristics() returns a string of track characteristics as advertised in some HLS streams.

  • getMimeType() will return the MIME type for the track

  • getAudioChannelCount() will return -1 for video tracks

  • getVideoTrackInfos() returns a list of OTVVideoTrackInfo objects. Each OTVVideoTrackInfo object corresponds to one of the video Representations belonging to the Adaptation Set for which this OTVTrackInfo holds information. Each Representation - and therefore each OTVVideoTrackInfo - may contain data on resolution, bitrate, framerate and aspect ratio.

The OTVVideoTrackInfo class contains the following methods for retrieving data about a Representation:

  • getBitrate() returns the video Representation’s bitrate

  • getWidth() returns the video Representation’s width in pixels

  • getHeight() returns the video Representation’s height in pixels

  • getFrameRate() returns the video Representation’s framerate

  • getCodecs() returns a string listing the video Representation’s codecs or null if unknown

  • getPixelWidthHeightRatio() returns the video Representation’s floating-point width-to-height ratio, or 1.0 if unknown

Click here to see example demonstrating the use of these methods.
Java
OTVTrackInfo[] tracks = mPlayer.getOTVTrackInfo();
int selectedTrackIndex = -1;
for (int index = 0; index < tracks.size(); ++index) {
  OTVTrackInfo trackInfo = tracks.valueAt(index);
  if (trackInfo.getType() == OTVTrackInfo.MEDIA_TRACK_TYPE_VIDEO) {
    // Video track
    if (trackInfo.isActive()) {
      selectedTrackIndex = index;
    }
    StringBuilder trackNameBuilder = track.getName().equals("") ?
        String.format(Locale.ENGLISH, "Track %d",index + 1) :
        track.getName();
    String semiColon = "";
    List<OTVVideoTrackInfo> videoTrackInfos = track.getVideoTrackInfos();
    if (videoTrackInfos != null) {
      for (OTVVideoTrackInfo videoTrackInfo : videoTrackInfos) {
        sb.append(semiColon);
        semiColon = "; ";
        sb.append(String.format(Locale.ENGLISH, "Bitrate: %d, Res: %dx%d, Codecs: %s", 
        videoTrackInfo.getBitrate(),
        videoTrackInfo.getWidth(),
        videoTrackInfo.getHeight(),
        videoTrackInfo.getCodecs()));
      }
    }
    String trackName = trackNameBuilder.toString();
    ...
  }
}