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

showOnEnd didn't work and the video restarted even when repeat set to false #125

Open
Yupeng-li opened this issue Oct 28, 2024 · 0 comments

Comments

@Yupeng-li
Copy link

We set repeat to false and showOnEnd to true. We expect the video to stop when it finishes playing, but the video loops forever.

I believe the issue is in this function. The logic to pause the video and show controls shouldn't be inside the if statement. When video ends, from what I observed, the currentTime is always greater than or equal to the duration.

 const _onEnd = () => {
    if (currentTime < duration) { // <----- this is always false. 
      setCurrentTime(duration);
      setPaused(!props.repeat);

      if (showOnEnd) {
        setShowControls(!props.repeat);
      }
    }

    if (typeof onEnd === 'function') {
      onEnd();
    }
  };
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