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

Wistia player leaks onXxxx handlers if they are not stable #805

Closed
davidmfoley opened this issue Feb 14, 2020 · 0 comments
Closed

Wistia player leaks onXxxx handlers if they are not stable #805

davidmfoley opened this issue Feb 14, 2020 · 0 comments

Comments

@davidmfoley
Copy link

Current Behavior

The behavior we have seen in our application that uses react-player to play videos from wistia is that our onEnded handler is invoked multiple times when it should only be invoked once.

What I think is happening

I'm not super familiar with this code, so this analysis may be incorrect:

b03365a <-- this unbinds the current onXxxx handlers in this.props. If the onXxx handlers passed into the player as props are not memoized, as is common in a functional component with recent react versions, the old handlers remain bound (because they are different instances on each rerender) and are rebound each time the video is loaded. This results in multiple invocations of old versions of these handlers.

The FilePlayer handles this by binding to stable functions on the component: https://github.com/CookPete/react-player/blob/master/src/players/FilePlayer.js (cf af6ed75)

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

1 participant