Techdocs

AMP Web SDK

AMP player

Using Dash Ad Markers with AMP.

Important:
This section requires at least `dashjs` 3.2.0 for event message processing.

Ad Marker plugin allows users to get ad avail information as SCTE35 markers are carried in DASH Event Messages (emsg).

Supported SCTE35 outputs

Plugin supports the following Dash ad markers outputs

  • XML
  • Base64 encoded

SCTE35 Markers

Ad marker plugin supports base64 encoded SCT35 and XML ad avail messages. The plugin will throw a scte35 event along with the decoded scte35 message when they are found, if the plugin is not able to decode the scte35 this will be fired as it comes for further client-side decryption.

In order to setup Dash Ad tagging with AMP users must provide the event stream schemeIdUri as part of the plugin config or the media config.

var config = {
  plugins: {
    admarker: {
      resources: [
          { src: "${paths.plugins}admarker/libs/scte35.js", type: "text/javascript" },
          { src: "${paths.plugins}admarker/admarker.js", type: "text/javascript" }]
      },
      schemeIdUri: "urn:scte:scte35:2013:xml"
  }
};
akamai.amp.AMP.create("amp", config, function(event) {
  var amp = event.player;

  amp.admarker.addEventListener('scte35', function(e) {
    var marker = e.details
    //do something
  })
});

Alternatively, schemeIdUri can be provided through media config object for individual content, this setup will override schemeIdUri config property on plugin root config object.

var config = {
  media: {
        guid: "Video 1",
        title: "Dash base64 binary signal",
        temporalType: "live",
        source: [
          { src: "https://akamaized-hd.net/test.mpd", type: "application/dash+xml" }
        ],
        metadata: { 
          config: 
            { schemeIdUri: "urn:scte:scte35:2014:xml+bin" }
          }
  },
  plugins: {
    admarker: {
      resources: [
          { src: "${paths.plugins}admarker/libs/scte35.js", type: "text/javascript" },
          { src: "${paths.plugins}admarker/Admarker.min.js", debug: "${paths.plugins}admarker/Admarker.js", type: "text/javascript" }]
      }
  }
}