Cast playlist ************* "CastPlaylist" (https://players.castlabs.com/web/latest/docs/api/clpp.cast.playlist.CastPlaylist.md) — higher-level playlist API over the Cast queue, usable from sender or receiver. Initialization ============== const player = new clpp.Player('video'); const castPlaylist = new clpp.cast.playlist.CastPlaylist( player, CHROMECAST_APP_ID, [ { configuration: { source: '...' }, skippable: false }, { configuration: { source: '...' }, skippable: true }, ], ); The SDK forbids skipping non-skippable items in the playlist. If you use the "skippable" property, reflect it in your sender UI. Usage ===== Use "CastPlaylist" methods to read the current and full playlist state, and subscribe to change notifications: castPlaylist.onPlaylistItemChange(updateUI); castPlaylist.onPlaylistModified(updateUI); castPlaylist.onCastStatusChanged(updateUI); function updateUI() { const playlistItems = castPlaylist.getPlaylistItems(); const currentIndex = castPlaylist.getCurrentIndex(); playlistItems.forEach((item, index) => { ... }); } Playing ======= Prepare the playlist: castPlaylist.start(); Start playback: castPlaylist.play(); Destroying and reusing the player ================================= Destroy the "CastPlaylist" instance and reuse the player for a new casting session with the "CastProxy" API: let castProxy = null; async function startNewCastProxy() { // Stop casting first, if active if (castPlaylist.isCasting()) { castPlaylist.toggleCast(); } castPlaylist.destroy(); // Create a new CastProxy, load, and play castProxy = new clpp.cast.CastProxy(player, CHROMECAST_APP_ID); await player.open({ source: '...', type: 'application/dash+xml', }); player.play(); }