Playlist

Quick Reference

The plugin can be used by providing a playlist object along an array of media objects in the player config.

var config = {
  plugins: {
    playlist: {
      resources: [
        { src: "${paths.plugins}playlist/Playlist.min.js", debug: "${paths.plugins}playlist/Playlist.js", type: "text/javascript" },
        { src: "${paths.plugins}playlist/Playlist.min.css", debug: "${paths.plugins}playlist/Playlist.css", type: "text/css" }
      ],
      autoadvance: {
        enabled: true,
        interval: 10
      }
    }
  },
  autoplay: true,
  media: [
    { src: "//mdtp-a.akamaihd.net/Video1.mp4", type: "video/mp4" },
    { src: "//mdtp-a.akamaihd.net/Video2.mp4", type: "video/mp4" },
    { src: "//mdtp-a.akamaihd.net/Video3.mp4", type: "video/mp4" }
  ]
}
akamai.amp.AMP.create("amp", config);

Enabling the playlist plugin

In order to enable the playlist plugin is needed to add a playlist configuration object to the player configuration and provide the required resources.

var config = {
  plugins: {
    playlist: {
      resources: [
        { src: "${paths.plugins}playlist/Playlist.min.js", debug: "${paths.plugins}playlist/Playlist.js", type: "text/javascript" },
        { src: "${paths.plugins}playlist/Playlist.min.css", debug: "${paths.plugins}playlist/Playlist.css", type: "text/css" }
      ]
    }
  },
}

Configuring the playlist plugin

The amount of time between videos can be configured by providing an interval as part of the autoadvance configuration.

var config = {
  plugins: {
    playlist: {
      resources: [
        { src: "${paths.plugins}playlist/Playlist.min.js", debug: "${paths.plugins}playlist/Playlist.js", type: "text/javascript" },
        { src: "${paths.plugins}playlist/Playlist.min.css", debug: "${paths.plugins}playlist/Playlist.css", type: "text/css" }
      ],
      autoadvance: {
        enabled: true,
        interval: 10 // Wait time in seconds before the next video
      }
    }
  }
}

Providing a playlist

Finally, a playlist with multiple videos/streams can be provided by passing an array of media objects as part of the configuration object or using the player’s media attribute.

Example

Playlist basic

Playlist with scroll list

Last modified: 16/10/2023, AMP Support.