w3c / w3c/media-source

Model `seekable` range for a MediaSource with finite duration

Open
#369 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

TPAC2025
Dominant language
HTML
Stars
286
Forks
55
PR merge metrics
No merged PRs in 30d

Description

To my understanding the aim of the HTMLMediaElement seekable property is to model the seekability of the current source.

The seekable attribute must return a new static normalized TimeRanges object that represents the ranges of the media resource, if any, that the user agent is able to seek to, at the time the attribute is evaluated.

In the context of MSE, seekable returns a time range from time zero to the MediaSource's duration if the duration is finite. Otherwise, if duration is Infinity, seekable returns the internal live seekable range property. (link: https://w3c.github.io/media-source/#htmlmediaelement-extensions-seekable)

There are cases where a finite duration does not mean time 0 is seekable. Sometimes a livestream is up for so long the start of the stream is no longer available when the stream ends. For example, our event streams (concerts etc.) sometimes overrun the 25H capacity we keep on or CDNs. To seek into that range would trigger a player error. Despite this, the seekable property always starts at 0 if the duration of the stream is finite (Section 10.1, step 3). Calling endOfStream() will result in a finite duration (see step 3 of the end of stream algorithm). Hence, it is not possible to model the availability of the livestream using the seekable property once the stream has ended. This leaves JS media player implementers with two choices:

  1. Ignore HTMLMediaElement's seekable property and implement their own seekability model.
  2. Ignore HTMLMediaElement's ended property and implement their own "ended" model.

All JS media players I've surveyed chose option 1 and implement their own seekability model (e.g., in dash.js).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the MSE HTMLMediaElement seekable extension, especially Section 10.1 step 3, alongside the endOfStream algorithm and the linked HTML media specification. Compare finite-duration seekability with the live seekable range for streams whose earliest media is unavailable; the issue is complete when the specification has an agreed model for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.