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

In Safari, Progress bar shows current time as 59:-1 when skip back past start of video #328

Closed
karendolan opened this issue Sep 18, 2023 · 1 comment

Comments

@karendolan
Copy link
Contributor

karendolan commented Sep 18, 2023

In Safari, the video appears to be allowed to seek to a time before the start of the video and to a time after the end of the video.

I suspect that adding protection for mp4 setCurrentTime to set video.currentTime only to a point in 0-duration might help https://github.com/polimediaupv/paella-core/blob/main/src/js/videoFormats/es.upv.paella.mp4VideoFormat.js#L90-L94. I will attempt this locally...

To duplicate

  • Open Safari browser (test on Mac Os X)
  • Go to https://paellaplayer.upv.es/player.html?id=belmar-multiresolution-remote
  • Click play
  • Pause the play
  • click the skip back button a couple times
  • Notice the timeline bar shows something unexpected like "59:-1" or "59:-30"
  • EXPECTED: the lowest current time returned by the video wrapper is 0, the lowest time shown in the timeline bar is 0, the lowest time allowed to seekto is 0, the highest time allowed to seek to is video duration (or a couple seconds before the end of video duration)
SeekBeforeZero-Safari

SeekAfterDuration-Safari

@karendolan
Copy link
Contributor Author

Verified that this patches the issue in mp4VideoFormat in Safari.

async setCurrentTime(t) {
    if (this._videoEnabled) {
      await this.waitForLoaded();
      const dur = this.video.duration;
+     if (t >= dur) {
+        // restrict seek-forward to 2 seconds to the end
+       this.video.currentTime = dur - 2;
+     }
+     else if (t < 0) {
+        // restrict seek-back to 0
+        this.video.currentTime = 0;
 +    }
 +    else {
 +       this.video.currentTime = t;
 +    }
 -    this.video.currentTime = t;
      return t;
    }
    else {
      this._disabledProperties.currentTime = t;
      return t;
    }
  }
  

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