Description Embeds a video player for instream video ads that are integrated with the IMA SDK.
Availability Experimental
Required Script <script async custom-element="amp-ima-video" src="https://cdn.ampproject.org/v0/amp-ima-video-0.1.js"></script>
Supported Layouts fixed, responsive
Examples Annotated code example for amp-ima-video

Overview

You can use the amp-ima-video component to embed an IMA SDK enabled video player.

The component requires an ad tag, provided in data-tag, which is a URL to a VAST-compliant ad response (for examples, see IMA Sample Tags).

The component HTML accepts the following types of HTML nodes as children:

  • source tags for content video, used in the same way as the standard video tag.
  • track tags for subtitles, in the same way as the standard video tag.
  • a script tag of type application/json used to provide ImaSdkSettings. Provide the property-translation of the setters in the linked documentation (e.g. to call setNumRedirects(4), provide {"numRedirects": 4}).

Example

<amp-ima-video
    width=640 height=360 layout="responsive"
    data-tag="ads.xml" data-poster="poster.png">
  <source src="foo.mp4" type="video/mp4">
  <source src="foo.webm" type="video/webm">
  <track label="English subtitles" kind="subtitles" srclang="en" src="subtitles.vtt">
  <script type="application/json">
  {
    "locale": "en",
    "numRedirects": 4
  }
  </script>
</amp-ima-video>

Attributes

data-tag (required)

The URL for your VAST ad document. A relative URL or a URL that uses https protocol.

data-src

The URL of your video content. A relative URL or a URL that uses https protocol. This attribute is required if no <source> children are present.

data-poster (optional)

An image for the frame to be displayed before video playback has started. By default, the first frame is displayed.

common attributes

This element includes common attributes extended to AMP components.

Validation

See amp-ima-video rules in the AMP validator specification.