Although it is possible to embed YouTube videos, this does not work with YouTube playlists. I'm not sure why this is so. It'd be nice if:

- I could embed playlists
- the preview playlist was just resized (as with videos) OR the preview from the first video in the playlist is used
- the thumbnail image was the thumbnail image from the first video in the playlist (I don't think playlists have their own thumbnail specified)

Here's some example (bogus) embed code:

Videos:

<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/videoid"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/videoid" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>

Playlists:

<object width="530" height="370"><param name="movie" value="http://www.youtube.com/p/playlistid"></param><embed src="http://www.youtube.com/p/playlistid" type="application/x-shockwave-flash" width="530" height="370"></embed></object>

You can distinguish playlists and videos by their url: playlists start with http://www.youtube.com/p/, whereas videos start with http://www.youtube.com/v/. This might be helpful if a distinction between videos and playlists needs to be made. Also, playlists always have an extra column listing the videos contained in it. This leads to different widths as with videos, so probably there'd have to be a setting that allows specifying height/width for videos and playlists seperately.

CommentFileSizeAuthor
#18 playlist.patch5.17 KBJody Lynn
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

aaron’s picture

Assigned: Unassigned » aaron

thanks for the ideas; i'll see if i can work something like that into it. by next week, i should have another solution in place as well, to import specific videos from playlists (as an add-on module).

thanks,
aaron

Sara Adams’s picture

My current solution is:
Include the embed-code in the body field, and add an image (hidden) that is only displayed where teasers are needed. It gives a similar result to what I need.

It'd still be nice if the Embedded Media Field would support both.
Supporting playlists should be easy:
Right now there's a regex used that needs a v (single video) to be in the link. If that check fails (empty), then check for p instead (playlist). Depending on which was successful (if any) you then use the according embed code.
I'm not sure about supporting thumbnails for playlist.

aaron’s picture

Component: User interface » Embedded Media Import

playlists is a couple of hours away (as soon as i can find that precious time to finish it up). already works for flickr -- embedded media import.

aaron’s picture

Status: Active » Postponed

postponed to d6 release, then backport to d5.

Alex UA’s picture

Status: Postponed » Fixed

I'm marking this as fixed because this is now possible using the combination of emfield, FeedAPI, and the FeedAPI_Mapper. I will update this issue queue in the near future with a link to the handbook page after I create it.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

rcross’s picture

ping. This was marked closed, but I can't seem to find the documentation being referred to. Pointers?

rcross’s picture

Status: Closed (fixed) » Active

marking this as active again until it is resolved further

imclean’s picture

A quick search turns this up: http://drupal.org/node/527320

Which links to this: http://www.drupaltherapy.com/feedapi

It's for Drupal 5 but the concept and most of the modules are the same.

marcvangend’s picture

Version: 5.x-1.x-dev » 6.x-1.x-dev

I think it shouldn't be too hard to get this working properly. Youtube playlists have their own url, formatted like http://www.youtube.com/view_play_list?p=[playlistID]. Nowadays the embed code provided by Youtube looks like this:

<object width="480" height="385">
  <param name="movie" value="http://www.youtube.com/p/[playlistID]&hl=en&fs=1"></param>
  <param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param>
  <embed src="http://www.youtube.com/p/[playlistID]&hl=en&fs=1" type="application/x-shockwave-flash"
    width="480" height="385" allowscriptaccess="always" allowfullscreen="true"></embed>
</object>

I have never written an emfield provider include, but if time permits, I would like to give it a go soon (for the 6.x version). I'm just wondering: what would be the best/proper/easiest way, enhance youtube.inc or create a new youtube_playlist.inc?

Alex UA’s picture

Status: Active » Fixed

This has long been possible using FeedAPI, and will be available shortly via Feeds, so I'm marking this as "fixed"

rcross’s picture

Status: Fixed » Active

@alexUA - can you provide a pointer to some documentation that suggests how that would integrate with this module?

adub’s picture

There's a use case for doing this with the inline filter which wouldn't be doable with feeds creating nodes. Is that a separate feature request?

Alex UA’s picture

Status: Active » Closed (fixed)

@adub, yes, that's a separate request. @rcross- it's linked to on both the main emfield page and in the Drupal documentation page that's linked on the front as well.

Alex UA’s picture

Status: Closed (fixed) » Active

Actually, I'm reopening this, because what's being asked for is not the ability to add each video in a playlist, but rather the ability to embed the playlist itself, rather than a video.

Alex UA’s picture

I'm investigating this for a client and here's what I think we need to do to get this to work with the current YouTube provider. We need to either use regex, as the provider is currently doing, or possibly switch it over to use parse_url(), and determine whether we're being passed a video or a playlist. We can grab the id as normal, but we'll have to save the information to use later so that we can output the correct player. After that, the only difference I can find is that we'll need to use '/p/' rather than '/v/' in the output url, so this should all be relatively straight forward and should definitely be added to the youtube provider file directly.

rcross’s picture

@Alex - yes, embedding the playlist is what I had been looking for. I would personally be ok with having a different field type, so that you don't have to do a lot of crazy detection in order to make it an all encompassing field. This could also be helpful at a theme level, to distinguish if it is a single video or playlist in the display.

Jody Lynn’s picture

Status: Active » Needs review
FileSize
5.17 KB

Here's a patch to allow playlists. Getting the thumbnail from the first video in the playlist was a little complicated, but it's working for me.

Alex UA’s picture

Status: Needs review » Patch (to be ported)

I added this to the 6.1x-dev branch- I'm marking "to be ported" so that it finds its way over to media_youtube at some point.

aaron’s picture

Status: Patch (to be ported) » Needs review

can you commit it to the 6.2x-dev as well? i haven't moved youtube out of there yet...

thanks!

aaron’s picture

Status: Needs review » Patch (to be ported)

oops, changed status...

Alex UA’s picture

Done- I'll leave the status until we move it over to media_youtube.

andtokyo’s picture

#18 Confirmed working...
Thanks Jody.

Alex UA’s picture

Project: Embedded Media Field » Media: YouTube
Component: Embedded Media Import » Code

I'm moving this to the Media: YouTube queue to make sure it gets committed there...

aaron’s picture

Status: Patch (to be ported) » Fixed

ok, I refactored and applied this patch. Thanks, @Jody Lynn!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jjclint’s picture

What about D7 I'm having no luck at all embedding playlist url's such as the following on the latest 7.x dev:

http://www.youtube.com/view_play_list?p=8DC5B92632D5898E
OR
http://www.youtube.com/p/8DC5B92632D5898E

jjclint’s picture

no one...?

foripepe’s picture

Same problem. Is there a way to insert Youtube playlists and/or channels to our sites under Drupal 7?

jjclint’s picture

#foripepe I'm stuck at this for some time now, so far my best option was to use the oembed module, instead of media: youtube (http://drupal.org/project/oembed)
With oembed you can configure the url schemes from the configuration menu for quite a number of providers, so you won't get the can't handle url scheme error message.

At the moment I'm still struggling a bit with it, so let us know if you've managed to get it to work properly.

TravisCarden’s picture