1

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?

Vitor Costa
  • 114
  • 1
  • 2
  • 12
  • does this question have any relevance to this one? - http://stackoverflow.com/questions/27498032/autoplay-1-not-working-for-iframe-in-playing-video-in-mobile-devices and this http://stackoverflow.com/questions/18676660/autoplay-with-iframe-you-tube-video-autoplay-1-not-working – ruslan May 27 '16 at 20:57
  • @ruslan I'm afraid not... The first link is regarding an iframe not autoplaying on an iPhone, which, accordingly to the answer, is Apple's policy. I'm testing this on a Windows machine, with various browsers. It seems however to be working on IE, but not on Firefox nor or Chrome. The second link is regarding a mistyped attribute, which is not the case... – Vitor Costa Jun 06 '16 at 10:57

2 Answers2

1

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:

Community
  • 1
  • 1
abielita
  • 12,126
  • 2
  • 15
  • 52
  • thanks for your answer. I've tried this already, but the loop attribute only sets the loop feature for the playlist, which I don't want it to be set. Even with `loop=1` attribute, the autoplay still doesn't work – Vitor Costa Jun 06 '16 at 10:59
0

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

vityapro
  • 170
  • 1
  • 11