Sponsored
Categories: WEB

How To Embed A YouTube Video With The Volume Muted

Sponsored

A huge majority of videos been watched on Facebook are muted. When you scroll through your Facebook timeline, be it from your smartphone app or the desktop app, the videos play automatically but the volume doesn’t come up unless you click and open the video. There is no harm in this though and it keeps you from disturbing other people around you as you watch the fourth cat video in your Facebook timeline. If you want to embed a YouTube video with the volume turned off by default, then you can use the script which was written by Amit Agarwal of Labnol that allows you to achieve that. The video will be played automatically but the sound will be muted. Any user that visits your website and wants to view the video will have to manually enable the volume. Here is how it works.

Visit YouTube and open the video you would want to embed and take note of the video’s ID from the Address or URL bar in your web browser. Take note of the string of text that follows just exactly after “https://www.youtube.com/watch?v=”

Below is the script you need to embed in the video. You only need to replace the “YOUR_VIDEO_ID” in the eighth line with the video ID you 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 embedding this code, the YouTube video will be muted. Below is the screenshot of how it will look.

Please NOTE: this won’t work on videos that cannot be embedded i.e. videos that have restrictions on embedding but it will work on any other video.

Via Labnol

Sponsored
Johnbosco Benedict

JohnboscoTips.com is owned and managed by Johnbosco Benedict, a graduate of computer science and management. I'm a technology enthusiast who loves to experiment with devices. Apart from being keen on tech issues, I'm also a Website Developer, SEO Expert & IT consultant. You can reach me via +233542042843 or drop a line at johnboscobenedict@gmail.com

Share
Published by
Johnbosco Benedict

Recent Posts

Facebook CryptoCurrency coin Almost done

Sometime last year, it was gathered that Facebook was building its own Cryptocurrency coin for…

5 years ago

Meet Energizer Power with 18000mah battery capacity

Hold on guys, will you rock this Energizer smartphone with an inbuilt 18000mAh battery capacity?…

5 years ago

Google Duo Video chat for web is now available for users worldwide

Google has begun the process of rolling out the web version of its Google Duo…

5 years ago

Samsung Galaxy S10 and S10+, 5 Cameras Specifications

Meet the latest Samsung smartphone Galaxy S10 and S10+. The device features a 6.1-inch and 6.4-inch Quad HD+ Curved Dynamic AMOLED Infinity-O…

5 years ago

Samsung Galaxy Fold With 12GB RAM Launched

Samsung Mobile has officially unveiled its foldable smartphone dubbed the Samsung Galaxy Fold. It has…

5 years ago

How to Get Hammer VPN Premium Account For Unlimited Internet Usage

It's been a while and i know some of you must have been enjoying hammer…

5 years ago
Sponsored