MC playlist¶
Note
The multi-controller (MC) playlist API is experimental.
The multi-controller (MC) playlist reduces zap time when switching between live TV channels. It creates a dedicated player instance per playlist item behind the scenes, so neighboring channels are preloaded and ready before you switch to them.
Code samples
Fast channel zapping: switches between live DASH channels with
McPlaylistand shows the zap time.
Configure for fast switching¶
To get the best zap time, configure buffering to match your segment length:
set rebufferingGoal and bufferingGoal below the segment duration.
player.open({
source: {
url: "https://.../index.mpd",
},
streaming: {
// For 2-second segments, set both goals below 2 seconds
rebufferingGoal: 1,
bufferingGoal: 1,
startAtSegmentBoundary: true,
ignoreDrift: true,
},
});
For DRM-protected streams, install the
PersistentLicenseComponent and assign an offlineId to
each protected stream — see Persistent DRM licenses.
Browser support for persistent licenses is limited, so this helps only on
some platforms.
import "@castlabs/prestoplay/cl.mse";
import "@castlabs/prestoplay/cl.hls";
import "@castlabs/prestoplay/cl.dash";
import "@castlabs/prestoplay/cl.persistent";
player.open({
source: {
url: "https://.../index.mpd",
},
drm: {
env: "...",
customData: { /* ... */ },
offlineId: "drm-session-4fb0b23a50101171ec90656", // unique ID for local storage
},
});
Create the playlist¶
Pass the Castlabs license and viewer ID through config:
const playlist = new clpp.playlist.McPlaylist({
anchorId: "video-anchor",
config: {
license: "<your_license_key>",
viewerId: "<user_id>",
},
// preloadMedia: true,
// autoplayNext: true,
});
autoplayNextstarts the next item automatically when playback ends. It’s intended for VOD content.preloadMediaprebuffers upcoming items to reduce transition time. It’s intended for VOD content.