Playlist ******** "Playlist" (https://players.castlabs.com/web/latest/docs/api/clpp.Playlist.md) plugin for sequential playback of multiple media items. Items can differ in stream format (for example, mixing HLS and DASH). Transitions between items happen automatically when playback ends. Code samples: * Playlist (https://raw.githubusercontent.com/castlabs/prestoplay-web-code-samples/refs/heads/main/examples/playlist/playlist.js): mixes DASH and HLS items, with previous and next buttons and jumping to an item. Install the plugin ================== import "@castlabs/prestoplay/cl.playlist"; Create a playlist ================= Create a player, then attach a "Playlist" (https://players.castlabs.com/web/latest/docs/api/clpp.Playlist.md) instance to it: const player = new clpp.Player("video", { license: "", viewerId: "", }); const playlist = new clpp.Playlist(player); Add items ========= Add items with "Playlist.append" (https://players.castlabs.com/web/latest/docs/api/clpp.Playlist.md#append). Each item needs a "configuration" object with at least a "source": playlist.append({ title: "Foo 1", configuration: { source: "https://demo.cf.castlabs.com/media/prestodash/Manifest.mpd", autoplay: true, }, }); playlist.append({ title: "Foo 2", configuration: { source: "https://demo.cf.castlabs.com/media/prestodash/Manifest.mpd", autoplay: true, }, }); Start the playlist ================== Call "playlist.start()" to load the first item and register the playlist's automatic item-switching behavior, then "player.play()" to start playback. "start()" is synchronous and doesn't return a value — it triggers loading without waiting for it to finish, so it isn't awaited. The playlist switches to the next item automatically when the current item ends. playlist.start(); player.play(); Listen for changes ================== Listen to "clpp.events.PLAYLIST_ITEM_CHANGED" and "clpp.events.PLAYLIST_MODIFIED" to react to playlist state changes. See "Playlist" (https://players.castlabs.com/web/latest/docs/api/clpp.Playlist.md) for the full API. playlist.on(clpp.events.PLAYLIST_ITEM_CHANGED, () => { // the active item changed }); playlist.on(clpp.events.PLAYLIST_MODIFIED, () => { // an item was added, removed, or reordered }); * MC playlist (mc-playlist.txt): Experimental McPlaylist: faster switching between live channels by preloading neighboring items. * SC playlist (sc-playlist.txt): Experimental ScPlaylist: continuous back-to-back playback across items with one controller, with timeline windows, modes, cropping, and cues.