Skip to content

Latest commit

 

History

History
78 lines (57 loc) · 2.75 KB

amp-youtube.md

File metadata and controls

78 lines (57 loc) · 2.75 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 Annotated code example for amp-youtube

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

autoplay

If present, the video will automatically start playback once rendered (if autoplay is supported by the browser). Autoplay, when supported, will automatically mute the video before auto playing.

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.

Validation

See amp-youtube rules in the AMP validator specification.