Working with playlists

Play the n-th item in a playlist via API

Use the following code snippet to instruct the player to start playback of the 3rd video in a playlist.

Example:

$bp().playByIndex(3);

Start playing from specific index in a playlist

To easily start playback of specific video in a playlist, you can do this by passing the index of the video to the player via embed code like this:

Example:

$bp("myDiv", {
    "id":"PLAYER_ID",
    "width":"640",
    "height":"360",
    "playlist":"PLAYLIST_ID",
    "startPlaylistIndex":"4"
});

Limit the number of videos in a playlist

Use the maxItems param in the player's embed to code to limit the number of videos in a playlist.

Example:

$bp("myDiv", {
    "id":"PLAYER_ID",
    "width":"640",
    "height":"360",
    "playlist":"PLAYLIST_ID",
    "maxItems":5
});

Set a playlist of items via an external config

You can use the following example to set up your player to playback a playlist of video items via an external config.

Example:

$bp("myDiv", {
    "id":"player_id",
    "width":"800",
    "height":"600",
    "playlist":"custom_playlist.json"
});
var playerConfig = {
  "id": "YOUR SITE ID",
  "playerId": "YOUR PLAYER ID",
  "playlist": {
    "Video": [{
      "title": "TITLE I",
      "image": "STARTING SNAPSHOT URL",
      "thumbnail": "URL TO THUMBNAIL",
      "videoId": "ARBITRARY VIDEO ID (OPTIONAL)",
      "duration": DURATION OF VIDEO IN SECONDS,
      "source": {
        "sd": "DIRECT URL TO SD RENDITION",
        "hd": "DIRECT URL TO HD RENDITION"
      }
    }, {
      "title": "TITLE 2",
      "image": "STARTING SNAPSHOT URL",
      "thumbnail": "URL TO THUMBNAIL",
      "videoId": "ARBITRARY VIDEO ID (OPTIONAL)",
      "duration": DURATION OF VIDEO IN SECONDS,
      "source": {
        "sd": "DIRECT URL TO SD RENDITION",
        "hd": "DIRECT URL TO HD RENDITION"
      }
    }, {
      "title": "TITLE 3",
      "image": "STARTING SNAPSHOT URL",
      "thumbnail": "URL TO THUMBNAIL",
      "videoId": "ARBITRARY VIDEO ID (OPTIONAL)",
      "duration": DURATION OF VIDEO IN SECONDS,
      "source": {
        "sd": "DIRECT URL TO SD RENDITION",
        "hd": "DIRECT URL TO HD RENDITION"
      }
    }]}}
var bridPlayer = $bp('myDiv', playerConfig);

Example of how JSON playlist should look like:

{
    "Video": [{
      "title": "TITLE I",
      "image": "STARTING SNAPSHOT URL",
      "thumbnail": "URL TO THUMBNAIL",
      "videoId": "ARBITRARY VIDEO ID (OPTIONAL)",
      "source": {
        "sd": "VIDEO_URL",
      }
    }, {
      "title": "TITLE 2",
      "image": "STARTING SNAPSHOT URL",
      "thumbnail": "URL TO THUMBNAIL",
      "videoId": "ARBITRARY VIDEO ID (OPTIONAL)",
      "source": {
        "sd": "VIDEO_URL",
        "hd": "VIDEO_URL"
      }
    }, {
      "title": "TITLE 3",
      "image": "STARTING SNAPSHOT URL",
      "thumbnail": "URL TO THUMBNAIL",
      "videoId": "ARBITRARY VIDEO ID (OPTIONAL)",
      "source": {
        "sd": "VIDEO_URL",
        "hd": "VIDEO_URL"
      }
    }]}

Shuffle playlist items

Use the following code snippet to shuffle an embedded playlist in a Brid player. This option will load a random video from your playlist on each player load.

Example:

$bp("myDiv", {
    "id":"PLAYER_ID",
    "width":"640",
    "height":"480",
    "playlist":"PLAYLIST_ID",
    "shuffle": true
});

Did this page help you?