Skip to content

Custom Media Time Range that hides unseekable part of the seekbar during Live DVR #746

Answered by luwes
ralfcarneborn asked this question in Q&A
Discussion options

You must be logged in to vote

It's a bit hacky but it gets the job done I think: https://codesandbox.io/s/media-chrome-offset-live-7nr2zf

      Object.defineProperty(timerange, "mediaSeekable", {
        get() {
          let desc = Object.getOwnPropertyDescriptor(
            Object.getPrototypeOf(timerange),
            "mediaSeekable"
          );
          return desc.get.call(this);
        },
        set(range) {
          if (range == null) {
            this.removeAttribute("mediaseekable");
            return;
          }

          let [, end] = range;
          // clamp to 20s from the end
          range[0] = Math.max(0, end - 20);

          console.log(range);
          this.setAttribute("mediaseekable", r…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@ralfcarneborn
Comment options

Comment options

You must be logged in to vote
1 reply
@ralfcarneborn
Comment options

Answer selected by ralfcarneborn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants