Add a playlist
Queue multiple videos in the FastPix Web Player and move between them, either with the built-in panel or your own controls. Each item is a playback ID with optional metadata and tokens, so a playlist can mix public and protected videos.
Before you begin
Make sure you have the following:
- The FastPix Web Player added to your page. See Install the FastPix web player.
- A playback ID for each video you want to queue. For protected videos, have the playback token (and a DRM token for DRM-protected videos) ready.
Add a playlist
Pass an array of items to addPlaylist(). Each item needs a playbackId, and can carry a title and thumbnail for the panel, plus a token or drmToken for protected videos.
The player loads the first item and shows the built-in playlist panel, from which a viewer can pick any item.
Start from a specific item
To open the playlist on a specific video rather than the first, set default-playback-id on the element to that item’s playback ID.
Move between items
Call next() and previous() to navigate the queue from your own controls.
Replace the current source
To play a different video without changing the queue, call loadByPlaybackId(). Pass options for a protected video or a custom domain, and set emitPlaybackChange to true to fire the playbackidchange event for the new source.
React to the current item
The player fires playbackidchange whenever the active item changes, with the new playback ID and its position in the queue.
Build a custom playlist panel
To replace the built-in panel with your own, add hide-default-playlist-panel to the element and provide your UI in the playlist-panel slot. The player fires playlisttoggle when the panel should open or close, so you can show and hide your UI in step with the player.
Reference
Playlist item fields
Methods
Attributes
Events
What’s next
- Play a DRM-protected video to queue protected items with a
drmToken. - Listen to player events for the full set of events the player fires.