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> |
Supported Layouts | FILL, FIXED, FIXED_HEIGHT, FLEX_ITEM, NODISPLAY, RESPONSIVE |
Examples | amp-youtube.html everything.amp.html |
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.
data-param-*
All data-param-*
attributes will be added as query parameter to the youtube iframe src. This may be used to pass custom values through to youtube plugins, such as autoplay.
Keys and values will be URI encoded. Keys will be camel cased.
data-param-autoplay=1
becomes&autoplay=1
See Youtube Embedded Player Parameters for more parameter options for youtube.
See amp-youtube rules in the AMP validator specification.