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 onEnded call it several times when changing videos #594

Closed
Matfork opened this issue Mar 13, 2019 · 0 comments
Closed

Wistia onEnded call it several times when changing videos #594

Matfork opened this issue Mar 13, 2019 · 0 comments

Comments

@Matfork
Copy link

Matfork commented Mar 13, 2019

Hello,

I'm facing a problem, only with wistia, when having multiple videos to be displayed (based on a list) and jumping from one video to another one and calling the onEnded method.

I have a list of videos (like a playlist), when you click in one name the video is loaded (mounted) you can reproduce the video and when the video ends it calls the onEnded method correctly and perform a business logic.
Then if you click another video, the previous react-player is destroyed and a new one is created with the new selected video. And the same logic is applied for all videos.

The problem i found is that when you jump to one video and then jump back to the the destroyed one (now it will be recreated) the onEnded method is called 'n' times based on the number of jumps backs you made (despite the fact the react-player component was previously destroyed)
This problem is happening only with Wistia (I tested wistia, youtube and vimeo).

You can see the problem here:
https://jsfiddle.net/dq0n63po/

Steps to reproduce:

  1. Click on Video 1, the video will be displayed (Vimeo)
  2. Reproduce video 1 and wait for it to be finished or just jump to the end to call the onEnded() method.
  3. Check the onEnded method was only called once for vimeo. (which is correct)
    4.- Change to video 2 (wistia) and reproduce it. Then wait for for onEneded() method to be called
    5.- Check the onEnded method was only called once for wistia. (which is correct)

6.- Now change to video 1 again and do the same process: reproduce it and wait for it be finished.
7.- Check the onEnded method was only called once for vimeo. (which is correct)
8.- Now change to video 2 again and do the same process: reproduce it and wait for it be finished.
9.- You'll se the problem: onEnded method is called twice for video 2 (which is wrong)

10.- If you repeat the same process jumping from video 2 to 1 and then to 2 (n times) you will see onEnded method will be called 'n' for video 2 (Wistia).

I tried also updating the react-player-component url instead of recreating it, but the same problem happens (only with wistia)

.

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