Skip to content

<videojs-video> breaks when play() is called directly after ended event #184

@sbrandtb

Description

@sbrandtb

When play() is called directly in the ended handler or very shortly after, the video is not rewound and played again.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Videojs-Video-Element</title>
<script type="module" src="https://cdn.jsdelivr.net/npm/videojs-video-element@1.0/+esm"></script>
</head>
<body>
  <videojs-video id="video" controls width="320" height="240">
    <source src="https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4" type="video/mp4" />
  </videojs-video>

  <script>
    const player = document.getElementById('video');

    player.addEventListener('ended', () => {
      player.play();
    });
  </script>
</body>
</html>

Error message in console:

Uncaught (in promise) DOMException: The fetching process for the media resource was aborted by the user agent at the user's request.

It does not seem to happen when play is called e.g. via an interval handler after 1000ms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions