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

Adding any events in youtube embedOptions stops the Player onReady event from ever triggering #1016

Closed
mherczeg opened this issue Sep 16, 2020 · 5 comments

Comments

@mherczeg
Copy link

Current Behavior

Youtube embedOptions are completely overwritten with the config value ( src )

causing this handler to never run.

onReady: () => {
  if (loop) {
    this.player.setLoop(true) // Enable playlist looping
  }
  this.props.onReady()
},

the ready handler never running stops a couple things from working, one of them is changing the url (I've ran into this warning, though this particular problem can be circumvented by setting the url to empty first, and then to the new value), and the progress update won't fire either.

Expected Behavior

both the event handlers passed in through the props, and the event handlers added in the Youtube class are classed

@cookpete
Copy link
Owner

What events are you using, out of curiosity? I think most, if not all, are covered by other ReactPlayer props.

@mherczeg
Copy link
Author

onStateChange

@cookpete
Copy link
Owner

What state change are you listening for? The logic here covers every type, I think?

https://github.com/CookPete/react-player/blob/19857af64d1afa55767d808ea5f61c4eecb4d21f/src/players/YouTube.js#L106-L125

@mherczeg
Copy link
Author

fair enough, I guess I can work around using the youtube player events, thanks.

(I would still recommend to either not allow embedOptions.events in the config, or to not overwrite the default ones completely, so people naively trying to use youtube player events won't break the player.)

@cookpete
Copy link
Owner

I'm going to add a console warning when embedOptions.events is set.

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