Skip to content

Latest commit

 

History

History
101 lines (87 loc) · 4.42 KB

amp-youtube.md

File metadata and controls

101 lines (87 loc) · 4.42 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>
Examples everything.amp.html

The following lists validation errors specific to the amp-youtube tag (see also amp-youtube in the AMP validator specification:

Validation Error Description
TAG_REQUIRED_BY_MISSING Error thrown when required amp-youtube extension .js script tag is missing or incorrect.
MANDATORY_ONEOF_ATTR_MISSING Error thrown when neither data-videoid or src is included. One of these attributes is mandatory.
MISSING_URL Error thrown when data-videoid or src is missing it's URL.
INVALID_URL Error thrown when data-videoid or src URL is invalid.
INVALID_URL_PROTOCOL Error thrown data-videoid or src URL is http; https protocol required.
IMPLIED_LAYOUT_INVALID Error thrown when implied layout is set to CONTAINER; this layout type isn't supported.
SPECIFIED_LAYOUT_INVALID Error thrown when specified layout is set to CONTAINER; this layout type isn't supported.
INVALID_PROPERTY_VALUE_IN_ATTR_VALUE Error thrown when invalid value is given for attributes height or width. For example, height=auto triggers this error for all supported layout types, with the exception of NODISPLAY.
DEPRECATED_ATTR The attribute video-id is deprecated - use data-videoid instead

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.