|Description||A replacement for the HTML5
|Examples||Annotated code example for amp-video|
|Supported Layouts||fill, fixed, fixed-height, flex-item, nodisplay, responsive|
amp-video component loads the video resource specified by its
src attribute lazily, at a time determined by the runtime. It can be controlled much the same way as a standard HTML5
amp-video component HTML accepts up to three unique types of HTML nodes as children -
source tags, a placeholder for before the video starts, and a fallback if the browser doesn’t support HTML5 video.
source tag children can be used in the same way as the standard
video tag, to specify different source files to play.
One or zero immediate child nodes can have the
fallback attribute. If present, this node and its children form the content that will be displayed if HTML5 video is not supported on the user’s browser.
<amp-video width=400 height=300 src="https://yourhost.com/videos/myvideo.mp4" poster="myvideo-poster.jpg"> <div fallback> <p>Your browser doesn’t support HTML5 video</p> </div> <source type="video/mp4" src="foo.mp4"> <source type="video/webm" src="foo.webm"> </amp-video>
Required if no
<source> children are present. Must be HTTPS.
The image for the frame to be displayed before video playback has started. By default the first frame is displayed.
If this attribute is present, and the browser supports autoplay:
- the video is automatically muted before autoplay starts
- when the video is scrolled out of view, the video is paused
- when the video is scrolled into view, the video resumes playback
- when the user taps the video, the video is unmuted
- if the user has interacted with the video (e.g., mutes/unmutes, pauses/resumes, etc.), and the video is scrolled in or out of view, the state of the video remains as how the user left it. For example, if the user pauses the video, then scrolls the video out of view and returns to the video, the video is still paused.
Similar to the
controls attribute - if present, the browser offers controls to allow the user to control video playback.
If present, will automatically loop the video back to the start upon reaching the end.
muted attribute is deprecated and no longer has any effect.
autoplay attribute automatically controls the mute behavior.
This element includes common attributes extended to AMP components.
Click-to-play is a common UX feature for video players on the web.
play AMP action, allowing you to implement click-to-play easily.
Please see Click-to-play overlay for amp-video on AmpByExample.com for a sample.
See amp-video rules in the AMP validator specification.