Problem/Motivation
Providing a Youtube playlist URL (for example https://www.youtube.com/playlist?list=PLbpi6ZahtOH6PVhBTPhS6iDUkFGJBeH9g) does not work. The error "Could not find a video provider to handle the given URL" is thrown.
The source of the problem is the regex in \Drupal\video_embed_field\Plugin\video_embed_field\Provider\YouTubePlaylist::getUrlComponent. The regex searches for "/watch?" but not "/playlist?". Both are valid. The difference is that "/watch?" will autoplay.
Additionally but unrelated, there are a couple incorrect implementations of Ignore this. Did not realize there is a custom module built on top of video_embed_field.\Drupal\video_embed_field\ProviderPluginInterface::renderEmbedCode that are missing arguments which throw errors such as: "Fatal error: Declaration of Drupal\video_embed_echo360\Plugin\video_embed_field\Provider\Echo360::renderEmbedCode($width, $height, $autoplay) must be compatible with Drupal\video_embed_field\ProviderPluginInterface::renderEmbedCode($width, $height, $autoplay, $title_format = null, $use_title_fallback = true) in /app/docroot/modules/custom/video_embed_echo360/src/Plugin/video_embed_field/Provider/Echo360.php on line 20".
These are fatal errors that cause the page to not load.
Steps to reproduce
Enter "https://www.youtube.com/playlist?list=PLbpi6ZahtOH6PVhBTPhS6iDUkFGJBeH9g" in a video embed field.
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork video_embed_field-3513506
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
maskedjellybeanComment #4
maskedjellybeanCreated a merge request with correct regex. Both "/watch?" and "/playlist?" should work.
I'm not sure that we actually need this part of the regex:
(?=.*v=(?<video_id>[0-9A-Za-z_-]*)), so I made it optional. It seems like this would only be relevant for a URL to a single video.Comment #5
mably commentedHere is what Claude gives me:
Playlist URLs:
https://youtube.com/playlist?list=PLAYLIST_IDhttps://youtube.com/watch?v=VIDEO_ID&list=PLAYLIST_ID(specific video in playlist)https://www.youtube.com/watch?v=VIDEO_ID&list=PLAYLIST_ID&index=3(specific position in playlist)Comment #6
maskedjellybeanOk, updated the MR.
We can support index I think. Might as well add support for all the currently unsupported URL patterns in this issue. Also we were regexing for v (VIDEO_ID) and doing nothing with it, so I tried to address that.
From what I've seen, URLs in those 3 patterns now work, however I see no change in the first video played no matter what. My assumption is that in
\Drupal\video_embed_field\Plugin\video_embed_field\Provider\YouTubePlaylist::renderEmbedCodewe should set$embed_code['#query']['v']and$embed_code['#query']['index']. At the very least doing this does not cause any issues loading the playlist.Comment #7
mably commentedThanks for the update but sadly some unit tests seem to be failing now.
Comment #9
mably commentedComment #11
calbasiIt seems there are other regexp that fire an error, for example:
https://www.youtube.com/watch?v=EuY-8fRKOuA&list=RDEuY-8fRKOuA&start_rad...
The merged merge request doesn't address the issue.