In this article, you'll learn how to embed a YouTube video with autoplay enabled but mute. The Youtube video will automatically play when the web is loaded, but the sound is set to zero.
It's easy to embed video from YouTube on your website. You can copy the default IFRAME embed code, paste it anywhere in your web page, and you're ready. Youtube also offers a very basic configuration. You can modify the dimensions or hide the brand name Youtube etc but if you wanted more control over the behavior of the embedded player then you can do it through YouTube Player API.
This article explains how you can embed a video from Youtube which will play automatically when the web page loads but with mute audio.
It could be a useful technique for a website that sells various things products, starting for example with short screencasts to highlight the products, playing a 5-10 second video on initial page load, but without sound so as not to disturb the user.
The volume will automatically be set to zero and the user can manually turn the sound on with one click. Similarly, if useste as background video from YouTube, it makes more sense to embed the muting of the continuously running video.
But let's see how you can do that. Go to the YouTube page that contains the video you want and note the ID of the video from the URL. For example, if the video link from YouTube is http://youtube.com/watch?v=xyz-123, the id of the video is XYZ-123 (ie all characters after v = and until the next &) . Once you have copied the id, all you have to do is replace YOUR_VIDEO_ID with your own id in the script below.
Then integrate all of the above script into the code of your webpage and the video will automatically play with the sound muted.
You can further customize the YouTube player by modifying the various variables. For example, if you set loop to 1, the video will play in a loop. If you set fs to 1 then one will appear key full screen(fs=fullscreen) inside the video player.
Good Luck!