Bug 261512

Summary: Changing the currentTime at loadedmetadata breaks the player
Product: WebKit Reporter: André M. <amtins.dev>
Component: MediaAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Major CC: eric.carlson, jer.noble, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 15   
Hardware: iPhone / iPad   
OS: All   

Description André M. 2023-09-13 07:59:51 PDT
When a value is assigned to the currentTime property during loadedmetadata, this has the following consequences:

- Playback starts at position 0
- It is no longer possible to change the playback position either via the user interface or via javascript.
- timeupdate events are no longer emitted correctly.

This problem has been observed on iOS 17, 16, 15, 14, 13.

Code sample:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      html,
      body {
        height: 100vh;
        margin: 0;
        padding: 0;
      }
      .player {
        width: 100%;
        height: 50vh;
        height: 50dvh;
      }
    </style>
  </head>
  <body>
    <video
      class="player"
      controls
      playsinline
    ></video>
    <script>
      const player = document.querySelector('.player');

      player.addEventListener('loadstart', () => {
        console.log('loadstart');
      });
      player.addEventListener('loadedmetadata', () => {
        console.log('loadedmetadata', player.duration);
        player.currentTime = 600;
      });
      player.addEventListener('loadeddata', () => {
        console.log('loadeddata');
      });
      player.addEventListener('timeupdate', () => {
        console.log('timeupdate', player.currentTime);
      });

      player.src = 'https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8';
    </script>
  </body>
</html>
Comment 1 Radar WebKit Bug Importer 2023-09-20 08:00:13 PDT
<rdar://problem/115784490>