itubego iTubeGo

How to Make YouTube Embed Autoplay in iFrame URL HTML Code

Amanda
September 13, 2021
YouTube
Content

    Embedding YouTube videos on PPT or your blog can attract visitors and make the text less boring. YouTube videos use iframe embedding with customizable player parameters. Let’s see how to automatically play embedded YouTube videos and playlists and other parameters.

    How to Autoplay Embed YouTube Video?

    Getting YouTube to embed autoplay is a very simple process, if you know a little HTML code. we’ll show you how you can do that in a few simple steps.

    1. Navigate to the YouTube Video you want to embed on your website.
    2. Go to the sharing options of the video and opt for the embed option.
    3. Copy the HTML code of the video from the embed option.
    4. Paste the copied code on your blog. The code like this:

    <iframe width=”560″ height=”315″ src=”https://www.youtube.com/embed/6HMaEAYa3t4″ frameborder=”0″ allow=”accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture” allowfullscreen></iframe>

    5. Or You can add a command “?autoplay=1” after the video ID. The code like this:

    <iframe width=”560″ height=”315″ src=”https://www.youtube.com/embed/6HMaEAYa3t4?autoplay=1″ frameborder=”0″ allowfullscreen></iframe>

    Save changes and refresh your website page for the changes to take effect.

    How to AutoPlay Embed YouTube Playlist?

    Here are the steps that can make a YouTube playlist autoplay.

    1. Open a YouTube playlist on a web browser.
    2. Locate the YouTube playlist URL and copy the playlist ID from it.

    Example: https://www.youtube.com/playlist?list=OLAK5uy_m7qW1ksIxQE3L6i2t-Q29tn5CVcToY6WI

    You can find the playlist ID after “list=”.

    3. Now you’ll need to get the embed code and replace the playlist ID like this:

    <iframe width=”560″ height=”315″ src=”https://www.youtube.com/embed/videoseries?list=PLx0sYbCqOb8TBPRdmBHs5Iftvv9TPboYG” frameborder=”0″ allow=”autoplay; encrypted-media” allowfullscreen></iframe>

    YouTube Embedded Players Parameters

    There are several YouTube embedded players parameters that you need to be aware of. When you embed videos on a website that comes with a lot of control. You can alter a number of aspects of the video to make it appear on your website the exact way you want  it to. Here are some of the most commonly customized and the most important parameters of YouTube embedded videos and the method of doing it.

    <iframe>

    The <iframe> tag specifies an inline frame which is used to embed YouTube video within the current HTML document. You can use the width and height attributes to define the size of the player, or you can add any other parameters.

    Example:
    <iframe width=”420″ height=”315″
    src=”https://www.youtube.com/embed/tgbNymZ7vqY”>
    </iframe>

    AutoPlay

    This makes the video play automatically when the webpage opens. The method for doing this is detailed above.

    Mute

    If you want the video to play mute in the default settings, you can add mute parameter to the iframe.

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

    Loop

    If you want the video to be played in loop, that can be done by adding loop parameter to the embed code. Here’s an example of that:

    <iframe width=”420″ height=”315″
    src=”https://www.youtube.com/embed/tgbNymZ7vqY?playlist=tgbNymZ7vqY&loop=1″></iframe>

    Controls

    You can show the video playback controls on your embedded YouTube video by add “controls=0”.

    <iframe width=”420″ height=”315″
    src=”https://www.youtube.com/embed/tgbNymZ7vqY?controls=0″>
    </iframe>

    More parameter about YouTube player, please check here.

    To Conclude

    That’s all about YouTube embed autoplay and how you can adjust various parameters of an embedded YouTube video on a webpage or a blog. Anything that involves writing/editing lines of code might appear to be a very difficult task but that is not always the case. You just need to add the exact commands in the embed of the code and it will perform the desired function on the video that’s embedded on your blog.

    Home > YouTube > How to Make YouTube Embed Autoplay in iFrame URL HTML Code
    She is engaged in the Internet industry and is a professional in audio/video downloading and conversion topics. She has published articles on some blogs and media to help many people solve audio and video problems. She usually watches YouTube and occasionally shares some video tutorials on YouTube. She is a humble and serious person, hoping to write technology and life in her own language.

    Leave a Reply to iTubego Cancel reply

    Your email address will not be published. Required fields are marked *

    Comments