lucaspulliese / vue-cool-lightbox

Vue.js lightbox inspired by fancybox.
https://vue-cool-lightbox.lucaspulliese.com
341 stars 55 forks source link

Does not accept a YouTube Playlist #97

Closed thedigicraft closed 3 years ago

thedigicraft commented 3 years ago

When passing an embed url for a YouTube playlist, the result is a broken player. When inspecting the iframe, the playlist id is being removed from the URL. It would appear that, for any src that is from youtube you are trying to grab the video id and rebuilding the URL. I see how this is helpful in that it allows people to use a watch url OR the embed url for a video.

However, since youtube playlist's embed URL is structured differently, this: https://www.youtube.com/embed/videoseries?list=[id here] becomes https://www.youtube.com/embed/videoseries in the iframe src.

Is it possible to add the ability to src a YouTube playlist and/or are there any tricks I could use when configuring the plugin, in order to skip that url parsing and just have it use the url, untouched?

thedigicraft commented 3 years ago

Of course, right after I submitted this issue, I got the bright idea to pass iframe as the mediaType and boom it worked. It would still be nice to be able to have the ability to use a playlist without specifying iframe as the media type, but this does work in the meantime. A note in the docs with this workaround might be useful, though.

So, if anyone has run into this issue, this will fix it:

items: [
  {
    // ... other properties
    src: 'https://www.youtube.com/embed/videoseries?list=[id here]',
    mediaType: 'iframe'
  }
]