October 2017
Intermediate to advanced
370 pages
8h 57m
English
The first way to embed video in AMP is to use amp-video. This is an AMP replacement for the HTML5 video tag. You should use this if you want to host the video yourself.
First, as usual, you need to import the component:
<script async custom-element="amp-video" src="https://cdn.ampproject.org/v0/amp-video-0.1.js"></script>
Then you can use it like this:
<amp-video width="640" height="480" src="https://theampbook.com/ch5/video/videoclip.mp4" poster="video-snaphsot.jpg" controls> <div fallback> <p>Your browser doesn't support HTML5 video</p> </div> <source type="video/mp4" src="videoclip.mp4"> <source type="video/webm" src="videoclip.webm"></amp-video>
Read now
Unlock full access