WordPress.org

Make WordPress Core

Opened 21 months ago

Last modified 12 months ago

#42074 new defect (bug)

YouTube Auto-Embed Does Not Work with Video+Playlist Links

Reported by: MicroBerto Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Embeds Keywords: needs-patch
Focuses: Cc:

Description

Hi,

When we past a video URL into the editor, it works fine:
https://www.youtube.com/watch?v=0yGrCbYDUvQ

But when embedding the playlist-based URL, WordPress always shows the first video in the playlist, despite the v=0yGrCbYDUvQ being set (see below what I am pasting). This is even if I don't have their index parameter set (indexes can move around):

https://www.youtube.com/watch?v=0yGrCbYDUvQ&list=PLpxGtvV4Cq_IacCuIMunwiFx3c4G5h0mE

To make it work, I always have to use YouTube's physical embed code, but then I don't get the benefits of WordPress auto-sizing it.

Any chance to get this parsed out a bit better?

Thanks!

Change History (3)

#1 @swissspidy
21 months ago

  • Component changed from Editor to Embeds
  • Focuses administration removed
  • Keywords needs-patch added
  • Version 4.8.2 deleted

#2 @ocean90
19 months ago

@swissspidy Looking at the result of the endpoint and it actually confirms what @MicroBerto is reporting. The endpoint only returns the embed code for the playlist, ignoring the current video ID. I'd expect https://www.youtube.com/embed/0yGrCbYDUvQ?list=PLpxGtvV4Cq_IacCuIMunwiFx3c4G5h0mE for the iframe source.

#3 @jukkarau
12 months ago

I sent feedback to YouTube for this, I think the API should return the correct embed code with the request @MicroBerto described.

If they are not willing to fix this, maybe we could first convert the request URL to normal video embed and then add the list parameter for the returned code (src would be like @ocean90 linked), but that seems a bit hacky.

Note: See TracTickets for help on using tickets.