StreamController composeStreams() should be smart when selecting initial period for dynamic multiperiod streams
Created by: fvalleeHbbTV
Environment
-
The MPD passes the DASH-IF Conformance Tool on http://dashif.org/conformance.html -
The stream has correct Access-Control-Allow-Origin headers (CORS) -
There are no network errors such as 404s in the browser console when trying to play the stream -
The issue observed is not mentioned on https://github.com/Dash-Industry-Forum/dash.js/wiki/FAQ -
The issue occurs in the latest reference client on http://reference.dashif.org/dash.js/ and not just on my page
- Link to playable MPD file: https://refplayer.cloud.digitaluk.co.uk/dynamic/mperiod.mpd (or any dynamic+multiperiod MPD)
- Dash.js version: 2.9.0
- Browser name/version: all
- OS name/version: all
In composeStreams(), the StreamController is trying to find the correct starting Period, by checking the URI params, then fallback to the first period. This is fine when playing VOD because playback can be expected to start at the beginning of the first period, but when playing live content this is delaying playback if the live edge is not in the first period.
When playing a dynamic multi-period MPD:
- composeStream is selecting the first period (streams[0])
- openMediaSource is called to create and attach the first media source
- the first period init segment is loaded
- onPlaybackSeeking is called to seek to live edge (as computed by the ScheduleController)
- If the seekTime is not in the first period, switchStream is called with the seekingStream
- As the seekingStream is not preloaded, 'compatible' is false in switchStream (even when the 2 periods are compatible)
- openMediaSource is detaching the current media source, then reattach it.
Setting the src (with the blob: url) twice and loading the first period init segment is taking some time, that would be great to avoid it.
I think we can estimate the correct initial period using timelineConverter.calcPresentationTimeFromWallTimeAndMpd composeStream.patch.txt
As far as I can tell it's working ( I didn't run yet many regression tests) but that would be great to get feedback!
Thanks a lot,
Fabien