Skip to content
This repository has been archived by the owner on Jul 11, 2019. It is now read-only.

Latest commit

 

History

History
73 lines (54 loc) · 2.63 KB

amp-youtube.md

File metadata and controls

73 lines (54 loc) · 2.63 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 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.

Validation

See amp-youtube rules in the AMP validator specification.