w3c / media-source

Media Source Extensions
https://w3c.github.io/media-source/
Other
268 stars 57 forks source link

Proposal: Add quality attribute to ManagedMediaSource API #322

Open jyavenard opened 1 year ago

jyavenard commented 1 year ago

This was originally part of the original proposal in #320 ; however due to fingerprinting concerns it has been moved to its own proposal.

Media variant selection

Currently, the player has few tools to determine the possible quality level of the media being played. From measuring the speed at which a segment download was performed, assessing the available dimensions available to render the video or how many frames got dropped when played. The User Agent can access further details beforehand: from the speed of the networking medium, to the user's choice of preferring low data usage. The User Agent may suggest a preferred streaming quality.

WebIDL

enum PreferredQuality {
    "low",
    "medium",
    "high"
}

[Exposed=(Window,DedicatedWorker)]
interface ManagedMediaSource : MediaSource {
    constructor();

    readonly   attribute PreferredQuality quality;
               attribute EventHandler     onqualitychanged;

      readonly attribute boolean          streaming;
               attribute EventHandler     onstartstreaming;
               attribute EventHandler     onendstreaming;

                  static boolean          isTypeSupported (DOMString type);                   
};