October 2017
Intermediate to advanced
370 pages
8h 57m
English
Just as amp-video is a replacement for the HTML5 video tag, amp-audio is a replacement for the HTML5 audio tag. Import it with:
<script async custom-element="amp-audio" src="https://cdn.ampproject.org/v0/amp-audio-0.1.js"></script>
You can use it with code like this:
<amp-audio width="640" height="100" src="https://theampbook.com/ch5/audio/audioclip.mp4" autoplay controls muted loop> <div fallback> <p>Your browser doesn't support HTML5 audio</p> </div> <source type="audio/mpeg" src="audioclip.mp3"> <source type="audio/ogg" src="audioclip.ogg"></amp-audio>
Again, note the use of the attribute autoplay, as well as the attributes muted, which sets the audio clip as muted by default, and loop, which ...
Read now
Unlock full access