withHighestBitrate method

T withHighestBitrate({
  1. String? language,
})

Gets the stream with highest bitrate.

Implementation

T withHighestBitrate({String? language}) {
  return where((stream) {
    if (stream is AudioStreamInfo) {
      if (language == null &&
          (stream.audioTrack == null || stream.audioTrack!.audioIsDefault)) {
        return true;
      }
      return stream.audioTrack?.id == language;
    }
    return true;
  }).sortByBitrate().first;
}