amp-video
You can now use this component outside valid AMP documents using the Bento version of this component. Learn more in the Bento guide.
Description
Replaces the HTML5 video tag.
Required Scripts
<script async custom-element="amp-video" src="https://cdn.ampproject.org/v0/amp-video-0.1.js"></script>
Supported Layouts
Примеры
Usage
A replacement for the HTML5 video tag; only to be used for direct HTML5 video file embeds.
The amp-video component loads the video resource specified by its src attribute lazily, at a time determined by the runtime. You can control an amp-video component much the same way as a standard HTML5 <video> tag.
The amp-video component accepts up to four unique types of HTML nodes as children:
sourcetags: Just like in the HTML<video>tag, you can add<source>tag children to specify different source media files to play.tracktags to enable subtitles in the video. If the track is hosted on a different origin than the document, you must add thecrossoriginattribute to the<amp-video>tag. Whenever the video has narration or important audio information, make sure to include subtitles/captions for users who may not be able to hear it or have their sound turned off.- a placeholder for before the video starts
- a fallback if the browser doesn’t support HTML5 video: One or zero immediate child nodes can have the
fallbackattribute. If present, this node and its children form the content that displays if HTML5 video is not supported on the user’s browser.