Skip to content

Conversation

@amtins
Copy link

@amtins amtins commented May 16, 2023

Description

This PR fixes the currentTime function to keep consistency with Http-Streaming. The currentTime function when used with live streams has two problems:

  • As a getter, the returned position is expressed in timestamp instead of seconds
  • As a setter, the value taken as a parameter must be expressed in timestamp instead of seconds
Screencast.from.17.05.23.16.20.40.webm

Use Case

A developer wishing to redefine the position will have to use a timestamp instead of a position expressed in seconds.

To reproduce the problem open videojs-contrib-dash and in the developer console copy-paste the code below:

player.options({ liveui: true });

player.loadMedia(
  {
    src: { src: 'https://livesim.dashif.org/livesim/testpic_2s/Manifest.mpd' },
  },
  () => {
    player.one('play', () => {
      setTimeout(() => {
        // should seek to half of the live window
        player.currentTime(player.liveTracker.liveWindow() / 2);
      }, 2_000);
    });
  }
);

Specific Changes proposed

  • Override tech_ currentTime, setCurrentTime and seekable functions to support lives
  • currentTime, returns the position expressed in seconds
  • setCurrentTime, takes as a parameter a position expressed in seconds
  • seekable, returns a range expressed in seconds

Requirements Checklist

  • Feature implemented / Bug fixed
  • If necessary, more likely in a feature request than a bug fix
    • Unit Tests updated or fixed
    • Docs/guides updated
  • Reviewed by Two Core Contributors

@amtins amtins force-pushed the fix/live-dvr branch 3 times, most recently from 9c54491 to 61497c6 Compare May 17, 2023 13:59
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

Successfully merging this pull request may close these issues.

1 participant