setHLSMultiBitrateConfig method
Future<void>
setHLSMultiBitrateConfig({
- void getHlsStreamInfos(
- TTMasterPlaylist playlist
- int? selectHlsVideoStream()?,
- int? selectHlsRendition(
- int variantIndex
- void switchHlsVideoBitrate(
- int bitrate
清晰度相关 === end HLS多码率 === begin
Implementation
/// HLS多码率 === begin
/*
master-m3u8起播前档位选择
getHlsStreamInfos - 档位回调
selectHlsVideoStream - 视频档位选择, 返回视频stream的bandwidth
selectHlsRendition - 音轨选择,返回音频renition的infoId
switchHlsVideoBitrate - 档位选择回调, 如发生档位切换,回调选择档位的bandwidth
*/
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;
}
}