Thank you!

  • websites



amp-ima-video embeds a video player for instream video ads that are integrated with the IMA SDK.

The plugin provides a video player with controls for your content, and requests and displays ads from a VAST-compliant ad server of your choice using the IMA SDK.


Import the amp-ima-video component.

<script async custom-element="amp-ima-video" src=""></script>

Basic usage

The amp-ima-video component HTML accepts up to two unique types of HTML nodes as children - source tags for content video, and track tags for subtitles. Both of these can be used in the same way as the standard video tag.

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). It has an optional data-poster attribute for a poster image to be displayed before playback.

<amp-ima-video id="myVideo" width="640" height="360" layout="responsive" data-tag="" data-poster="/static/samples/img/ima-poster.jpg">
  <source src="" type="video/mp4">


Provide a format string in the data-ad-label attribute to customize the ad disclosure that is displayed while an ad is playing. This allows users to support ad disclosures in different languages.

A format string should look like "Ad (%s of %s)". The "%s" in the format string is replaced with the current ad number in the sequence and the total number of ads, respectively (e.g. Ad 2 of 3). If no value is given, this defaults to "Ad (%s of %s)".

<amp-ima-video id="myVideo2" width="640" height="360" layout="responsive" data-tag="" data-poster="/static/samples/img/ima-poster.jpg" data-ad-label="Publicidad (%s de %s)">
  <source src="" type="video/mp4">


Use the autoplay attribute to play video automatically without requiring the user to press "play".

Optionally, use data-delay-ad-request="true" to delay an ad request until either the user scrolls the page, or for 3 seconds, whichever occurs first. The default behavior of the amp-ima-video component is to request an ad on the AMP page load which has the effect of being counted as 'code served' even if there is no impression.

<amp-ima-video id="myVideo3" width="640" height="360" layout="responsive" data-tag="" data-src="" data-delay-ad-request="true" autoplay>
هل تحتاج إلى مزيد من التوضيح؟

إذا لم تكن الإيضاحات الموجودة في هذه الصفحة تُجيب على جميع أسئلتك، فلا تتردد في التواصل مع مستخدمي AMP الآخرين لمناقشة حالة الاستخدام المحددة لديك بالضبط.

الذهاب إلى Stack Overflow
هل هي ميزة غير موضحة؟

يشجع مشروع AMP مشاركتك ومساهمتك بشدة! ونأمل أن تكون مشاركًا دائمًا في مجتمعنا مفتوح المصدر، ولكننا نشجع أيضًا المساهمات التي تحدث لمرة واحدة في الأمور التي تتحمس لها.

تعديل العينة على GitHub