MyBacklink86 - In this post my backlink will share how to make Youtube AMP video on AMP blog.
If you have a video on Youtube and you want to display it on your blog then you can make a Youtube video and save embed youtube video playlist on your blog.
If you are using AMP blog, you can also display Youtube AMP video by using Youtube AMP code.
Please follow how to make youtube AMP video below.
1. Please put this code just below <head> code.
<script async custom-element="amp-youtube" src="https://cdn.ampproject.org/v0/amp-youtube-0.1.js"></script>
Example
<head>
<script async custom-element="amp-youtube" src="https://cdn.ampproject.org/v0/amp-youtube-0.1.js"></script>
.......
.......
</head>
</body>
2. Show Youtube AMP video singles on your AMP blog please use the code below.
No Autoplay
Embed YouTube videos via the video id. The id is found in every Youtube video page URL.
<amp-youtube width="480" height="270" layout="responsive" data-videoid="VIDEO ID HERE">
</amp-youtube>
Replace VIDEO ID HERE with your Video Youtube ID (data-videoid = "VIDEO ID HERE")
Autoplay
Setting autoplay will automatically play/pause the YouTube video as it is scrolled into/out of view on supported browsers.
The YouTube video is automatically muted before autoplay starts, when the user taps the video, the video is unmuted.
If the user has interacted with the YouTube 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.
<amp-youtube width="480" height="270" layout="responsive" data-videoid="VIDEO ID HERE" autoplay></amp-youtube>
Replace VIDEO ID HERE with your Video Youtube ID (data-videoid = "VIDEO ID HERE")
This code can be stored in your blog widget or in your blog post.
Make it easy to implement Youtube AMP code in Blog.
Hope this article useful to you.
Good luck