Switching audio track on LIVE stream stops the playback
Created by: devaublanc
(MacOSX#10.10.3, Chrome#50.0.2661 dash.js#2.1.1)
When I try to switch the audio track using (player.setCurrentTrack(MediaInfo))
. The player stops downloading audio segments. The playback continues until the audio buffer starves, then the play enters rebuffering state, but still no audio segments are downloaded.
I did some investigations
-
I have checked inside NextFragmentRequestRule.execute() The variable
time
computed inside this method (let time = hasSeekTarget ? seekTarget : adapter.getIndexHandlerTime(streamProcessor)
) equals 0 which causes segment lookup to be performed for time 0 instead of something close tovideo.currentTime
-
In the method
getIndexForSegments()
(DashHandler.js) The segments list we iterate over to find the next segment to download seems to be located at the beginning of the DVRWindow, instead of aroundvideo.currentTime
.
I have tested some hacks
- Inside the getSegmentsFromTimeline() method. I tried to force the calculatedRange like this
calculatedRange = {start:0, end: Infinity}
, in order to iterate over the full list of segments and try to hack around 2) - Then if I replace the variable
time
tovideo.currentTime
instead of 0 to hack around 1) (using devTool by setting a break point in NextFragmentRequestRule.execute() once audio buffer is starved), audio segments are downloaded again and playback restarts, but the audio track is not changed (his seems to be a 3rd issue) - If I reload my stream the player uses the audio set in the localStorage (during the former call to
setCurrentTrack
) and the playback start with the good audio track.
Recently I have test again after applying this fix 32f6982f. That works better but sometimes the audio don’t switch after calling player.setCurrentTrack.
@AkamaiDASH , @sebastien4 sent you a MPD url in a private message