I am using dash.js library and achieving Adaptive bitrate with DASH protocol for my audio player.
I am facing issue in one of the case, when instead of changing bit rate adaptively, I want to be it specific i.e. 320 kbps. I am using methods which are provided in dash.js library as following.But not able to get a static bitrate segment for my whole audio file.
(function () {
var url = "https://xxxxxxxxxxxx.xxxxxxxx.net/myplaylist.mpd";
var player = dashjs.MediaPlayer().create();
player.initialize(document.querySelector("#audioPlayer"), url, true);
player.setInitialBitrateFor('audio', 320);
player.setQualityFor('audio', 320);
player.setAutoSwitchQualityFor('audio', false);
player.getDebug().setLogToBrowserConsole(false);
})();
so basically there are two options :: auto and 320kbps
auto will allow adaptive bitrate but when 320 kbps selected at any time after that it should only get segments for that bitrate only.
For the later scenario I am facing the issue.
is there any method to do that ? am I missing something here ?
it was not setting the bitrate b'coz it is doing exact matching for bitrate.
As of now, how bitrate is set with dash.js is as following.
when you do player.setInitialBitrateFor('audio', 320);
first it will get the bandwidth from mpd files.
then there is a internal mechanism which will divide bandwidth by 1000 and then round of the value. so because off this if your mpd files contains values like bandwidth="320000",
then player.setInitialBitrateFor('audio', 320);
will work.
There might be variation in bandwidth like 321684 which will generate bit rate value = 321. in such case you have to do player.setInitialBitrateFor('audio', 321); will work
also setQualityFor method takes index as second parameter. so one can do
player.setQualityFor('audio', indexValue);
where considering there are three adaption set and
low bitrate (64 kbps) ==> 0 (indexValue)
Medium bitrate (128 kbps) ==> 1 (indexValue)
High bitrate (320 kbps) ==> 2 (indexValue)