video-dev / video-dev/hls.js

Support Media Fragment URIs

Open
#5,445 3 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature proposal
Dominant language
TypeScript
Stars
16.9k
Forks
2.8k
Avg merge
1d 12h
Merged PRs (30d)
27

Description

Is your feature request related to a problem? Please describe.

Support the time dimension of the Media Fragments URI specification

Describe the solution you'd like

When calling loadSource( ), the HLS player should respect the Media Fragments URI if it exists in the source url.

e.g.

const hls = new Hls();
hls.loadSource( "http://my.streamURL.com/playlist.m3u8#t=5,10" );

Would confine the playback of the stream with a start time of 5 seconds, and an end time of 10 seconds. More specifically: the player would automatically seek to the 5 second mark initially, and would automatically pause at the 10 second mark.

Additional context

This has been requested before here and it was closed by @robwalch stating that "...[editing streams] is not a feature HLS players or the HTMLMediaElement..."

A few words on the use case: it's often the case that a video player client wants to control aspects of the stream, without having to actually edit the media, or control aspects of the stream from the server, i.e. a manifest. I believe that is one of the intents of the Media Fragment URI spec.

My experience with HLS.js is that it's often used as a bridge to bring HLS playback parity between Safari and other browsers. Safari seems to support the time dimension of Media Fragment URIs for HLS: you can simply append #t=5,10 to the end of a video element's src attribute (an m3u8 manifest) and it will confine playback to the region specified (start at 5, end at 10.) It's also worth nothing that current versions Safari, Edge, Chrome and Firefox seem to support the time dimension of Media Fragment URIs for non-HLS sources, i.e. you can append the fragment to the source attribute of a non-HLS video asset (e.g. an MP4 file), and it will be respected.

This feature would bring parity so that an application using Media Fragment URIs could use them for HLS and non-HLS assets alike, across major current browsers.

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 at the loadSource() entry point and trace how the source URL reaches HLS playback. Check the earlier discussion in issue #2916 for the unresolved design concerns. Done means a Media Fragments time range in an HLS source starts and stops playback at the requested times without changing the stream.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
audio-video-rtc, frontend, web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.