proposals icon indicating copy to clipboard operation
proposals copied to clipboard

range attribute in video tag

Open tiuvi opened this issue 5 months ago • 4 comments

What problem are you trying to solve? Currently the video tag can request any range, even a range that includes the entire video. This functionality should limit the megabits per second that the video will use.

What solutions exist today? Currently this does not have a standard solution for all browsers.

How would you solve it? one or two attributes that will limit the video ranges in quantity and time

I'm currently using a hack in the service worker to delay video requests, since it loads more than 25% of the video. The adjustment should basically be the bandwidth requested and the time in milliseconds with which the ranges are requested. With that, the video should request the ranges with the specified bandwidth and at the speed requested.

tiuvi avatar Sep 12 '25 08:09 tiuvi

Are you aware of Media Fragments URI? Here's an example that deeplinks into seconds 10–15 of a video. The browser should then do what you describe (be smart about buffering)

tomayac avatar Sep 12 '25 09:09 tomayac

Image

The problem is limiting the ranges in bandwidth and time on the client, the closest thing is to use mediasource, but it would not hurt if the video tag had those attributes, especially with 4k video

You can see that it asks for the full ranges of the video even though you specify 15 seconds, and it starts playing and stops after 15 seconds.

tiuvi avatar Sep 12 '25 09:09 tiuvi

Image

The browser is smart. It requests Range: bytes=0- for video metadata in the first request and then quickly realizes it actually needs Range: bytes=589824- for the second. It never downloads the full video.

tomayac avatar Sep 12 '25 09:09 tomayac

If what you're referring to is searching for metadata, if the metadata is at the end, make a small request to the metadata in the part where it is. The range 0 request means give me the entire range of the video. On my server, for example, I give 1MB, and the browser makes requests according to the range. Listing the problems that would be needed would be:

  • An attribute that tells the video the bandwidth it can request. That's simple; the video would have to request the 0-bandwidth ranges.
  • Request video ranges only when the video is playing or while it's playing.
  • A timeout attribute that tells the time it can request the ranges. This attribute is used so that it requests those ranges while the video is playing, but if the user changes the seek, then the ranges must be requested automatically. This has a very high programming cost with MediaSource that not everyone can afford, which is why I think it should be standard or even a new video element with this configuration due to problems with legacy configurations.

tiuvi avatar Sep 12 '25 19:09 tiuvi