HTML Iframes - YouTube Video Parameter for Mute
When a YouTube video is embedded into an HTML page using an iframe, it is embedded using the default parameters.
Mute is one such parameter, which can be used to mute the audio.
By default, embedded YouTube video is not going to play without mute, and the user has to click the mute option to mute the audio.
<iframe src="https://www.youtube.com/embed/5UMde7utfCI" title="YouTube Video" width="800" height="450"></iframe>
However, we can make a mute option enabled on the embedded video to make it play with mute by setting the below parameter to the source URL.
- mute=1 (enables mute)
- mute=0 (default, disables mute)
<iframe src="https://www.youtube.com/embed/5UMde7utfCI?mute=1" title="YouTube Video" width="800" height="450"></iframe>
Example
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<h1>HTML Iframes YouTube Video Parameter for Mute</h1>
<h2>Default Parameters (without mute)</h2>
<iframe src="https://www.youtube.com/embed/5UMde7utfCI" title="YouTube Video" width="800" height="450"></iframe>
<h2>Mute Parameter (Enabled)</h2>
<iframe src="https://www.youtube.com/embed/5UMde7utfCI?mute=1" title="YouTube Video" width="800" height="450"></iframe>
<h2>Mute Parameter (Disabled)</h2>
<iframe src="https://www.youtube.com/embed/5UMde7utfCI?mute=0" title="YouTube Video" width="800" height="450"></iframe>
</body>
</html>
Overall
We now know how to embed a YouTube video into an HTML page and make it audio mute upon page load.