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

Callbacks for click, hover, keydown #167

Closed
oyeanuj opened this issue Mar 9, 2017 · 3 comments
Closed

Callbacks for click, hover, keydown #167

oyeanuj opened this issue Mar 9, 2017 · 3 comments

Comments

@oyeanuj
Copy link

oyeanuj commented Mar 9, 2017

Hey @cookpete! So far, things have been going great while integrating with react-player but ran into a small roadblock. I was trying to implement -

  1. Play/Pause onClick
  2. Show/hide controls onMouseOver/onMouseOut
  3. Keyboard manipulations onKeyDown

But it seems none of these events are exposed at the moment. My current workaround is to have a div around ReactPlayer and tying all the callbacks to that div but it isn't the nicest solution.

Thoughts? Do you think these can be exposed?

Thank you!

@cookpete
Copy link
Owner

Yeah an object of props to attach to the wrapper div makes sense. What name would make sense though? events?

<ReactPlayer
  url='file.mp3'
  events={{
    onClick: () => {},
    onMouseOver: () => {}
  }}
/>

Maybe events doesn't make sense as it could hold any attribute to attach to the wrapper. Maybe wrapperProps or wrapperAttributes? Is there an established term for "other props to blindly attach to a component"?

@oyeanuj
Copy link
Author

oyeanuj commented Mar 11, 2017

In my experience, I think most components just pass through any other props with just the spread syntax after slicing off the props they needed.

So, I feel like we might not even need a wrapper unless you feel it is cleaner.

@cookpete
Copy link
Owner

There is already a wrapper div here that we can attach stuff to. The problem is that using the spread syntax would require something like

const { url, playing, volume, blah, blah, blah, ...extra } = this.props

which would be huge and impractical considering the amount of props we have. That's why I'm thinking something like wrapperProps or maybe just attributes so that we can simply do

<div style={...} className={...} {...attributes} />

for the wrapper.

david-hub024 pushed a commit to david-hub024/React_VideoPlayer that referenced this issue Dec 23, 2018
david-hub024 pushed a commit to david-hub024/React_VideoPlayer that referenced this issue May 23, 2020
albanqoku added a commit to albanqoku/react-player that referenced this issue Feb 24, 2021
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
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