Ken Ingram
Ken Ingram

Reputation: 1608

What would cause this youtube embed string to stop working?

I save youtube links in a datastore for viewing in batches according to topic. I basically save the videoid with a caption note and the length data.

I used php to construct a custom viewer. I've been using it for at least 10 months exactly the way I want. One breaking change to the format happened during this time and I was able to adjust to that change.

Now, today, it looks like another breaking change has happened and I'm curious to see if it's my code or if it's youtube's embed syntax.

So here's a list of youtube video id's from the Veritasium channel:

2KZb2_vcNTg,Ux33-5k8cjg,vqDbMEdLiCs,myh94hpFmJY,Iuv6hY6zsd0,vWVZ6APXM4w,BD6h-wDj7bw,1Xp_imnO6WE,38gVZgE39K8,XAgXwUwQoPA,rAYW9n8i-C4

I dynamically construct an iframe with this baseline syntax:

<iframe id="myiframe" class="myplaylist" width="720" height="405" src="https://www.youtube.com/embed/videoseries?playlist= <comma separated list of video id's> &amp;controls=1?enablejsapi=1" frameborder="0" allowfullscreen=""></iframe>

So a functional iframe element created from these two pieces looks this:

<iframe id="myiframe" class="myplaylist" width="720" height="405" src="https://www.youtube.com/embed/videoseries?playlist=2KZb2_vcNTg,Ux33-5k8cjg,vqDbMEdLiCs,myh94hpFmJY,Iuv6hY6zsd0,vWVZ6APXM4w,BD6h-wDj7bw,1Xp_imnO6WE,38gVZgE39K8,XAgXwUwQoPA,rAYW9n8i-C4&amp;controls=1?enablejsapi=1" frameborder="0" allowfullscreen=""></iframe>

This won't work as a snippet, but as an html element, it should show a youtube player, and in the upper right show a counter and drop down list of the queued videos as though you were looking at a playlist on the youtube site.

For example (Except this one is demonstrating the new problem): enter image description here

It would help if someone would try this completed tag, and see if the embedded player functions. I can't tell what's gone wrong.

Upvotes: 1

Views: 528

Answers (2)

Melissa
Melissa

Reputation: 26

According to a client whose embedded YouTube videos broke in the same manner today, when he reviewed a playlist in his YouTube account today there is now a new URL provided for embedding it. We replaced the old URL with the new one and the problem is fixed.

New URL is of the format https://www.youtube.com/embed/<new id code>

Old URL is of the format https://www.youtube.com/embed/videoseries?list=<old id code>

Upvotes: 0

Will
Will

Reputation: 491

I think it's YouTube. I don't know whether it is intended or a bug, but something certainly changed on YouTube's end.

If you copy the URL of the video it is https://youtu.be/videoseries - YouTube no longer recognizes /videoseries as a special URL and simply tries loading it as if it were a video slug at the front of the playlist.

It looks like a potential workaround is simply removing videoseries from the embed URL, like this:

<iframe id="myiframe" class="myplaylist" width="720" height="405" src="https://www.youtube.com/embed/?playlist=2KZb2_vcNTg,Ux33-5k8cjg,vqDbMEdLiCs,myh94hpFmJY,Iuv6hY6zsd0,vWVZ6APXM4w,BD6h-wDj7bw,1Xp_imnO6WE,38gVZgE39K8,XAgXwUwQoPA,rAYW9n8i-C4&amp;controls=1?enablejsapi=1" frameborder="0" allowfullscreen=""></iframe>

Upvotes: 1

Related Questions