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

Using an array for URL breaks the code #906

Closed
lcukerd opened this issue Jun 1, 2020 · 1 comment
Closed

Using an array for URL breaks the code #906

lcukerd opened this issue Jun 1, 2020 · 1 comment

Comments

@lcukerd
Copy link

lcukerd commented Jun 1, 2020

Declaring Urls as described here will break the code and cause Error

Current Behavior

Error occurs. You get

Uncaught TypeError: url.match is not a function
    at YouTube.load (YouTube.js:170)
    at Object.onMount (Player.js:83)

Expected Behavior

Player should load both URL and give option to play either (similar to when loading playlist).

Steps to Reproduce

Create player like
<ReactPlayer playing url={['https://www.youtube.com/watch?v=d46Azg3Pm4c', 'https://www.youtube.com/watch?v=eVsXVzSse8I']} />

Environment

  • Browser: Chrome
  • Operating system: MacOs 10.15.5
@cookpete
Copy link
Owner

cookpete commented Jun 1, 2020

Passing an array to url only applies to file paths, when you want to provide multiple different types for the same video (eg video/webm and video/ogg) to improve cross-browser support.

You can use playerVars to play several Youtube videos as a playlist, although this is not documented and not very obvious:

<ReactPlayer
  url='https://www.youtube.com/watch?v=oUFJJNQGwhk' // First video in playlist
  playing
  controls
  config={{
    playerVars: {              
      listType: 'playlist',
      playlist: 'jNgP6d9HraI,_8UJBrnYBW4' // Second and third videos, comma separated
    }
  }}
/>

I suppose it would be nice if ReactPlayer did this automatically for arrays of youtube URLs…

@lcukerd lcukerd closed this as completed Jun 3, 2020
cookpete added a commit that referenced this issue Jun 7, 2020
Webmaster1116 added a commit to Webmaster1116/video-player that referenced this issue May 20, 2021
webmiraclepro added a commit to webmiraclepro/video-player that referenced this issue Sep 9, 2022
philip-luther added a commit to philip-luther/react-player that referenced this issue Nov 22, 2024
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

2 participants