Dash-Industry-Forum / dash.js

A reference client implementation for the playback of MPEG DASH via Javascript and compliant browsers.
http://reference.dashif.org/dash.js/nightly/samples/dash-if-reference-player/index.html
Other
5.13k stars 1.68k forks source link

Refresh manifest and set upcoming chunks URL in case of a new http-session #2177

Closed WilbertBongers closed 6 years ago

WilbertBongers commented 7 years ago

When a on-demand stream has been paused or while recovering from a network error our Wowza streaming server disconnects the HTTP-session. As a result all chunks that needs to be downloaded get a 403 error because the session-id is parsed into the chunks URL.

Off course we could raise the interval before the server disconnects an session, but we require a setup where the player would refreshes the manifest and changes the URL of the chunks that needed to be downloaded, to have the same base URL of the manifest (with the new session-id parsed). So the newly downloaded chunks are appended to the buffer.

I created an event in the ScheduleController that fires when the fragmenLoader.load returns an error. So I am able to re- attachSource(url) and seek to the current position. But then the buffer is emptied and there is an gap int the stream which is a crude way of handling this (in my opinion )

Can anyone give me direction how to rewrite the URL for the scheduled chunks or to empty the schedule and rebuild the schedule using the refreshed manifest without emptying the buffer?

davemevans commented 7 years ago

It's not pretty but, once the player has initialised (and therefore when the player is paused), I think you could hack round this by calling MediaPlayer.retrieveManifest with the original url (ie the one with no session-id) and an empty callback. Future requests should pick up the new session-id.

WilbertBongers commented 7 years ago

I tried this but it didn't work, the newly requested chunks still uses the old url. The Wowza server did start a new http session so the manifest is requested. Is there a way of emptying the schedule before requesting the manifest?

davemevans commented 7 years ago

Works for me in the dev-branch reference player (all new requests use the new session ID), so I can't think what else to suggest, sorry.

WilbertBongers commented 7 years ago

Hi, I tried the retrieveManifest and it works when I disable the onAddBlackList callback. However it seems that the chunks that are allready in the queue use the old url. I have to look into it some further. Is there a function you know that refreshes the requestqueue?

epiclabsDASH commented 7 years ago

What if you reload the stream completely (MediaPlayer.attachSource) indicating as the start time the last reported time position? You can do it loading the stream in this way: player.attachSource('http://yourstream#s=' + Math.floor(player.time())).

It is not the most elegant solution but I would give it a try.

WilbertBongers commented 7 years ago

HI epiclabsDASH, that works but you'll get an audible gap. I am trying to come up with a solution that will be seamless.