Amphtml: amp-ima-video returns error when not used in current document

Created on 18 Jan 2019  路  4Comments  路  Source: ampproject/amphtml

What's the issue?

If amp-ima-video is loaded on a page, but not actually used, this breaks the AMP validation.
This is different behavior from amp-video, which can be loaded without having actual video on the page.
Implementing amp-ima-video load only on pages with video could be quite complicated on certain CMS-es.

How do we reproduce the issue?

  1. Create sample AMP page and include amp-ima-video without video
  2. Try to pass validation
  3. Validation fails.

If you repeat, but with actual video, validation passes.

In contrast:

  1. Create sample AMP page and include amp-video without video
  2. Try to pass validation
  3. Validation passes without or with video.

What browsers are affected?

All browsers

Which AMP version is affected?

Current version

Bug

Most helpful comment

What's the issue?

If amp-ima-video is loaded on a page

How do we reproduce the issue?

Create sample AMP page and include amp-ima-video

What browsers are affected?
A

Which AMP version is affected?
Current

All 4 comments

What's the issue?

If amp-ima-video is loaded on a page

How do we reproduce the issue?

Create sample AMP page and include amp-ima-video

What browsers are affected?
A

Which AMP version is affected?
Current

This is by design, most amp components need both the script tag and at least one usage tag to be valid. amp-video does not enforce this for historical backward compatibility reasons.

Well, except that there is ad before the video, there is no much difference between AMP VIDEO and AMP IMA VIDEO. It is logical that both work in the same way...

@cycleos I agree with you that they are the same, however, as mentioned, the discrepancy is due to historical backward compatibility issues (amp-video used to be a built-in component and did not require a script until 2 years ago when we changed that but had to keep it backward compatible).

The reason we prevent including the script without using the tag is purely for performance. There is no point in browser downloading and parsing a JS file that will be thrown away.

Was this page helpful?
0 / 5 - 0 ratings