setTrack method

void setTrack(
  1. BetterPlayerAsmsTrack track
)

Setup track parameters for currently played video. Can be only used for HLS or DASH data source.

Implementation

void setTrack(BetterPlayerAsmsTrack track) {
  if (videoPlayerController == null) {
    throw StateError("The data source has not been initialized");
  }
  _postEvent(BetterPlayerEvent(BetterPlayerEventType.changedTrack,
      parameters: <String, dynamic>{
        "id": track.id,
        "width": track.width,
        "height": track.height,
        "bitrate": track.bitrate,
        "frameRate": track.frameRate,
        "codecs": track.codecs,
        "mimeType": track.mimeType,
      }));

  videoPlayerController!
      .setTrackParameters(track.width, track.height, track.bitrate);
  _betterPlayerAsmsTrack = track;
}