Description | Displays a YouTube video. |
Availability | Stable |
Required Script | <script async custom-element="amp-youtube" src="https://cdn.ampproject.org/v0/amp-youtube-0.1.js"></script> |
Examples | amp-youtube.html everything.amp.html |
The following lists validation errors specific to the amp-youtube
tag
(see also amp-youtube
in the AMP validator specification):
Validation Error | Description |
---|---|
The 'example1' tag is missing or incorrect, but required by 'example2'. | Error thrown when required amp-youtube extension .js script tag is missing or incorrect. |
The tag 'example1' is missing a mandatory attribute - pick one of example2. | Error thrown when neither data-videoid or src is included. One of these attributes is mandatory. |
Missing URL for attribute 'example1' in tag 'example2'. | Error thrown when data-videoid or src is missing it's URL. |
Malformed URL 'example3' for attribute 'example1' in tag 'example2'. | Error thrown when data-videoid or src URL is invalid. |
Invalid URL protocol 'example3:' for attribute 'example1' in tag 'example2'. | Error thrown data-videoid or src URL is http ; https protocol required. |
The implied layout 'example1' is not supported by tag 'example2'. | Error thrown when implied layout is set to CONTAINER ; this layout type isn't supported. |
The specified layout 'example1' is not supported by tag 'example2'. | Error thrown when specified layout is set to CONTAINER ; this layout type isn't supported. |
The property 'example1' in attribute 'example2' in tag 'example3' is set to 'example4', which is invalid. | Error thrown when invalid value is given for attributes height or width . For example, height=auto triggers this error for all supported layout types, with the exception of NODISPLAY . |
The attribute 'example1' in tag 'example2' is deprecated - use 'example3' instead. | The attribute video-id is deprecated - use data-videoid instead |
With responsive layout the width and height from the example should yield correct layouts for 16:9 aspect ratio videos:
<amp-youtube
data-videoid="mGENRKrdoGY"
layout="responsive"
width="480" height="270"></amp-youtube>
data-videoid
The Youtube video id found in every Youtube video page URL
E.g. in https://www.youtube.com/watch?v=Z1q71gFeRqM Z1q71gFeRqM is the video id.