HTML Iframes - YouTube Playlist Parameters

When a YouTube playlist is embedded into an HTML page using an iframe, it is embedded using the default controls.

However, we can provide some playlist controls along with the embed URL to overwrite the default behavior.

Here is a list of parameters that can be passed along with a playlist.

  • loop

Loop Parameter

By default, the embedded YouTube playlist does not loop to repeat itself.

However, we can enable or disable the loop with an additional parameter along with the source URL.

  • loop=0 (default, doesn't loop and plays only once)
  • loop=1 (loops itself forever until the web page is closed)
<iframe src="https://www.youtube.com/embed/videoseries?list=PLqUX34SwGksSwYW4yAt-EP4weN-Npgt_k&loop=1" width="600" height="300"></iframe>

Example

<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
    <h1>HTML Iframes YouTube Playlist Parameters</h1>
    <h2>Default Parameters (without loop)</h2>
    <iframe src="https://www.youtube.com/embed/videoseries?list=PLqUX34SwGksSwYW4yAt-EP4weN-Npgt_k" width="600" height="300"></iframe>
    <h2>Loop Parameter (loop=1, will loop the playlist videos)</h2>
    <iframe src="https://www.youtube.com/embed/videoseries?list=PLqUX34SwGksSwYW4yAt-EP4weN-Npgt_k&loop=1" width="600" height="300"></iframe>
    <h2>Loop Parameter (loop=0, will not loop the playlist videos)</h2>
    <iframe src="https://www.youtube.com/embed/videoseries?list=PLqUX34SwGksSwYW4yAt-EP4weN-Npgt_k&loop=0" width="600" height="300"></iframe>
</body>
</html>

Overall

We now know how to embed a YouTube playlist into an HTML document and manage different parameters available on the source URL.