How to Know Embed Code YouTube Video with the Volume Muted?

How to Know Embed Code YouTube Video with the Volume Muted?


Most of the videos on Facebook are watched with the volume muted as you scroll through your timeline. Whether it’s from your desktop or the smartphone app. Videos play automatically but the volume doesn’t play unless you tap and open the video. There is no harm in this at all but, it keeps you from bothering other people. If you would like to embed a YouTube video with the sound turned off then you can use a little script written by Amit Agarwal by Labnol that lets you do just that. The Video auto-play but the sound is muted. Users who visit your website and use the video will have to manually turn the volume up. Here’s how it works.

Go to YouTube and embed a video you want, note the “Video’s ID” from the URL/address bar in your browser. It’s a string of text that follows right after “www.youtube.com/watch?v=__________” just as shown in the screenshot below:

How To Embed A YouTube Video With The Volume Muted

Here is a script you need to embed the video. All you have to do is just replace “Your_Video_ID” in the eighth line with the video ID you’ve just copied.

<div id="muteYouTubeVideoPlayer"></div>

<script async src="https://www.youtube.com/iframe_api"></script>
<script>
function onYouTubeIframeAPIReady() {
var player;
player = new YT.Player('muteYouTubeVideoPlayer', {
videoId: 'YOUR_VIDEO_ID', // YouTube Video ID
width: 560, // Player width (in px)
height: 316, // Player height (in px)
playerVars: {
autoplay: 1, // Auto-play the video on load
controls: 1, // Show pause/play buttons in player
showinfo: 0, // Hide the video title
modestbranding: 1, // Hide the Youtube Logo
loop: 1, // Run the video in a loop
fs: 0, // Hide the full screen button
cc_load_policty: 0, // Hide closed captions
iv_load_policy: 3, // Hide the Video Annotations
autohide: 0 // Hide video controls when playing
},
events: {
onReady: function(e) {
e.target.mute();
}
}
});
}
// Written by @labnol
</script>

After using this script I found something like this (Look at the screenshot below):

How To Embed A YouTube Video With The Volume Muted 2

Well if you want something cool on your timeline simply follow the steps correctly and have fun.

Enjoy 🙂


Leave a Comment