Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When i passin link to youtube that has playlist on, it does not working=( #318

Closed
againksy opened this issue Feb 5, 2018 · 6 comments
Closed

Comments

@againksy
Copy link

againksy commented Feb 5, 2018

https://www.youtube.com/watch?v=4l8Wkrb5JNw&list=PLSmhG8yDCXaFj04Rag9btia4G3nN3hFRn
for example- nothing happens...

@iladarsda
Copy link

Great work! I was going to ask about playlist support as well. @cookpete - Is this something you plan to support?

@cookpete
Copy link
Owner

cookpete commented Feb 6, 2018

You can do this using the config prop to set certain playerVars:

<ReactPlayer
  url='https://www.youtube.com/watch?v=4l8Wkrb5JNw'
  config={{ youtube: { 
    playerVars: {
      listType:'playlist',
      list: 'PLSmhG8yDCXaFj04Rag9btia4G3nN3hFRn'
    }
  }}}
/>

https://jsfiddle.net/hLjjhyog/

@cookpete cookpete closed this as completed Feb 6, 2018
@iladarsda
Copy link

iladarsda commented Feb 6, 2018

Amazing, thanks for the info.

@cookpete
Copy link
Owner

cookpete commented Feb 6, 2018

I suppose it would be handy to parse list= in the url prop and set the playerVars automatically. I'll look into it.

@edwinharly
Copy link

edwinharly commented Jul 19, 2018

@cookpete The below code doesn't work

<ReactPlayer
          url='https://www.youtube.com/embed?'
          config={{ youtube: { 
            playerVars: {
              listType:'search',
              list: 'likey'
            }
          }}}
          controls
        />

@cookpete
Copy link
Owner

cookpete commented Dec 5, 2018

@edwinharly Yeah that kind of sucks. With how things work, you have to pass in a valid Youtube URL for the Youtube player to kick in, but obviously when you want to search, you don't know what you want to play first...

A very hacky workaround would be to set the URL as a very short blank video, which will play and finish quickly, then play the search results, eg:

<ReactPlayer
  url='https://www.youtube.com/watch?v=jhFDyDgMVUI'
  config={{ youtube: { 
    playerVars: {
      listType:'search',
      list: 'likey'
    }
  }}}
  controls
/>

This is not ideal though, so I will look for a better fix.

cookpete added a commit that referenced this issue Dec 5, 2018
Properly fixes #318
Instead of having to use `playerVars` to play playlists, you can now just pass
in URLs, such as https://www.youtube.com/watch?v=4l8Wkrb5JNw&list=PLSmhG8yDCXaFj04Rag9btia4G3nN3hFRn
david-hub024 pushed a commit to david-hub024/React_VideoPlayer that referenced this issue Dec 23, 2018
Properly fixes cookpete/react-player#318
Instead of having to use `playerVars` to play playlists, you can now just pass
in URLs, such as https://www.youtube.com/watch?v=4l8Wkrb5JNw&list=PLSmhG8yDCXaFj04Rag9btia4G3nN3hFRn
david-hub024 pushed a commit to david-hub024/React_VideoPlayer that referenced this issue May 23, 2020
Properly fixes cookpete/react-player#318
Instead of having to use `playerVars` to play playlists, you can now just pass
in URLs, such as https://www.youtube.com/watch?v=4l8Wkrb5JNw&list=PLSmhG8yDCXaFj04Rag9btia4G3nN3hFRn
albanqoku added a commit to albanqoku/react-player that referenced this issue Feb 24, 2021
Properly fixes cookpete/react-player#318
Instead of having to use `playerVars` to play playlists, you can now just pass
in URLs, such as https://www.youtube.com/watch?v=4l8Wkrb5JNw&list=PLSmhG8yDCXaFj04Rag9btia4G3nN3hFRn
Webmaster1116 added a commit to Webmaster1116/video-player that referenced this issue May 20, 2021
Properly fixes cookpete/react-player#318
Instead of having to use `playerVars` to play playlists, you can now just pass
in URLs, such as https://www.youtube.com/watch?v=4l8Wkrb5JNw&list=PLSmhG8yDCXaFj04Rag9btia4G3nN3hFRn
webmiraclepro added a commit to webmiraclepro/video-player that referenced this issue Sep 9, 2022
Properly fixes cookpete/react-player#318
Instead of having to use `playerVars` to play playlists, you can now just pass
in URLs, such as https://www.youtube.com/watch?v=4l8Wkrb5JNw&list=PLSmhG8yDCXaFj04Rag9btia4G3nN3hFRn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants