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 whether to show controls.
Keys and values will be URI encoded. Keys will be camel cased.
data-param-controls=1
becomes&controls=1
See Youtube Embedded Player Parameters for more parameter options for youtube.
Because of limitations in mobile browsers, the autoplay
param is currently not supported. Follow this issue for updates on autoplay support in AMP.
See amp-youtube rules in the AMP validator specification.