Preload next content
This is a DASH only feature which does not apply to Safari (HLS) playback.
Introduction
The CONNECT Player SDK offers the optional ability to reduce content change (“zapping”) time by pre-fetching the manifest and the first segments of the next asset(s) before fully committing to playing it where this is appropriate.
This is of course limited by the ability for your App to know or predict which asset will be requested to be played next or soon. The feature is very much suited to where a predictable playlist of assets is played through, for example: series linked content or where a user just steps up/down in channel list.
This is an experimental feature so only clear content is supported currently.
The SDK does not apply a limit to the number of preloaded assets, however, the limited computing resources of the target device and the footprint of pre-fetched segments will need to be considered. As a guideline, it is suggested two preloaded assets maximum.
Preloading an asset ahead of its playback
The preload()
API can be used in the same way to regular playback via the src()
API, passing a source object carrying the new content’s URL, MIME type and optionally start time offset (see Start Time ).
const nextStream = {
src: "https://livesim.dashif.org/livesim-chunked/testpic4_8s/Manifest.mpd",
type: "application/dash+xml",
startTime: 300, // start at 5 minutes into the stream
};
window.player.otvtoolkit().preload(nextStream);
How much is preloaded?
For Live content, only the manifest and init segments are pre-fetched.
For VOD content, in addition to the manifest and init segments, 2 segments are pre-fetched. This can be adjusted via streaming.segmentPrefetchLimit
field with OtvToolkit.configure()
, for example:
window.player
.otvtoolkit()
.configure("streaming.segmentPrefetchLimit", 3);
Retention of preloaded content
If an asset has been preloaded and then played, its preloaded state is considered consumed and would need to be preloaded again if that is desired.
Saving previous stream as a preload
When zapping to a new stream, the retention of details of the previous stream in case it might be desirable to zap back to the old stream can be achieved.
Setting the retainPreviousAsPreload
field to true
in the source object will ensure a prompt zap back to the previous stream will be available.
window.player.src({
src: destinationStreamUrl,
token: token,
type: "application/dash+xml",
retainPreviousAsPreload: true, // New field for this feature
});
On a subsequent zap to the retained content, the SDK will attempt to return the user to continue playback near to the point at which they were when they left the previous stream.