Skip to content

Latest commit

 

History

History
75 lines (55 loc) · 2.84 KB

amp-youtube.md

File metadata and controls

75 lines (55 loc) · 2.84 KB

amp-youtube

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

Example

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>

Attributes

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.

Validation

See amp-youtube rules in the AMP validator specification.