When i passin link to youtube that has playlist on, it does not working=(
https://www.youtube.com/watch?v=4l8Wkrb5JNw&list=PLSmhG8yDCXaFj04Rag9btia4G3nN3hFRn for example- nothing happens...
Great work! I was going to ask about playlist support as well. @CookPete - Is this something you plan to support?
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/
Amazing, thanks for the info.
I suppose it would be handy to parse list= in the url prop and set the playerVars automatically. I'll look into it.
@CookPete The below code doesn't work
<ReactPlayer
url='https://www.youtube.com/embed?'
config={{ youtube: {
playerVars: {
listType:'search',
list: 'likey'
}
}}}
controls
/>
@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.