看那MediaPlayer.js來源:
你想看看功能是 'setQualityFor':
/**
* Sets the current quality for media type instead of letting the ABR Heuristics automatically selecting it.
* This value will be overwritten by the ABR rules unless setAutoSwitchQualityFor(type, false) is called.
*
* @param {string} type - 'video' or 'audio'
* @param {number} value - the quality index, 0 corresponding to the lowest bitrate
* @memberof module:MediaPlayer
* @see {@link module:MediaPlayer#setAutoSwitchQualityFor setAutoSwitchQualityFor()}
* @see {@link module:MediaPlayer#getQualityFor getQualityFor()}
* @instance
*/
function setQualityFor(type, value) {
if (!playbackInitialized) {
throw PLAYBACK_NOT_INITIALIZED_ERROR;
}
abrController.setPlaybackQuality(type, streamController.getActiveStreamInfo(), value);
}
感謝的尊敬米克 – Maher
好了好了指導我如何使用這個功能?我添加了這兩行「player.setAutoSwitchQuality(false); player.setQualityFor(「video」,0); >>旨在讓玩家以最小的比特率進行比賽,但沒有任何事情發生! – Maher
在AbrController.js中查看onFragmentLoadProgress。這會調用setPlaybackQuality,然後調用setQualityFor來改變質量。這應該給你一個使用感覺和參數等。 – Mick