setHLSMultiBitrateConfig method

Future<void> setHLSMultiBitrateConfig({
  1. void getHlsStreamInfos(
    1. TTMasterPlaylist playlist
    )?,
  2. int? selectHlsVideoStream()?,
  3. int? selectHlsRendition(
    1. int variantIndex
    )?,
  4. void switchHlsVideoBitrate(
    1. int bitrate
    )?,
})

resolution === end master-m3u8 === begin

Implementation

/// master-m3u8 ===  begin
/*
  master-m3u8 Pre-playback quality selection.
  getHlsStreamInfos - quality callback
  selectHlsVideoStream - Video track selection callback, need return bandwidth in stream
  selectHlsRendition - Audio track selection, need return the infoId of the audio rendition.
  switchHlsVideoBitrate - Callback for gear selection, if there is a switch in gear, the callback will return the bandwidth of the selected gear.
 */
Future<void> setHLSMultiBitrateConfig(
    {void Function(TTMasterPlaylist playlist)? getHlsStreamInfos,
    int? Function()? selectHlsVideoStream,
    int? Function(int variantIndex)? selectHlsRendition,
    void Function(int bitrate)? switchHlsVideoBitrate}) async {
  if (getHlsStreamInfos != null) {
    if (_getHlsStreamInfosCallbacks[hashCode] == null) {
      _getHlsStreamInfosCallbacks[hashCode] = getHlsStreamInfos;
    }
  }
  if (selectHlsVideoStream != null) {
    if (_selectHlsVideoStreamCallbacks[hashCode] == null) {
      _selectHlsVideoStreamCallbacks[hashCode] = selectHlsVideoStream;
    }
  }
  if (selectHlsRendition != null) {
    if (_selectHlsRenditionCallbacks[hashCode] == null) {
      _selectHlsRenditionCallbacks[hashCode] = selectHlsRendition;
    }
  }
  if (switchHlsVideoBitrate != null && _hlsStreamSwitchCallbacks[hashCode] == null) {
    _hlsStreamSwitchCallbacks[hashCode] = switchHlsVideoBitrate;
  }
}