Mastering the Media: Complete HTML Course
Sobre a Aula

YouTube + Mute (Autoplay)

If you want your YouTube video to start automatically when visiting a page, you can add parameters to the video URL.

However, it’s important to consider the user experience, as autoplay can be irritating.

5.4.1 Autoplay Parameter Embedding

To enable autoplay, add autoplay=1 at the end of the YouTube URL. This will make the video start playing as soon as the page loads.

5.4.2 Chromium Browsers Warning

It’s essential to note that Chromium-based browsers, such as Google Chrome, often block autoplay by default to enhance the user experience and save data.

In many cases, autoplay is allowed only if it’s muted.

5.4.3 Muted Autoplay

If you want to maintain autoplay but without sound, add mute=1 to the URL. This ensures that the video starts automatically but without audio.

<iframe width="420" height="315"
src="https://www.youtube.com/embed/tgbNymZ7vqY?autoplay=1&mute=1">
</iframe>

These options provide a balance between the desired autoplay and consideration for visitors’ comfort, avoiding unwanted sound interruptions when opening the page.

Entrar na conversa
Rolar para cima