Skip to content

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

@Yupeng-li

Description

@Yupeng-li

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();
    }
  };

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions