Vitor Costa
Vitor Costa

Reputation: 114

Dynamic playlist with autoplay

I'm having trouble embedding a dynamic playlist with autoplay.

What I'm trying to do is, having a dynamic list of video IDs, embed a playlist with those videos. I'm doing this by updating a div with the following HTML:

<iframe src="https://www.youtube.com/embed?playlist=<VIDEO_IDS_COMMA_SEPARATED>&autoplay=1 frameborder="0" allowfullscreen></iframe>

as specified here.

However, the autoplay attribute seems to be ignored, since the initial video doesn't get started.

In other cases, I'm setting the src to embed a single video, with

<iframe src="https://www.youtube.com/embed/<VIDEO_ID>&autoplay=1 frameborder="0" allowfullscreen></iframe>

and this works great.

Does anyone know how can I force an autoplay on a dynamic embedded playlist?

--------------------- EDIT-------------------------

It seems this is working on IE, but not on Firefox nor on Chrome... Does anyone have any idea why?

Upvotes: 1

Views: 2485

Answers (2)

vityapro
vityapro

Reputation: 198

Couldn't find, related answer, but looks like problem can be in Autoplay Policy Changes.

Upvotes: 0

abielita
abielita

Reputation: 13494

Based from this thread, you need to add "&autoplay=1&loop=1" in your YouTube playlist link.

Example:

<iframe src="https://www.youtube.com/embed/<VIDEO_ID>&autoplay=1&loop=1" frameborder="0" allowfullscreen></iframe>

Check this related SO question:

Upvotes: 1

Related Questions