// https://w3c.github.io/media-source/#dom-mediasource
enum ReadyState {
    "closed",
    "open",
    "ended",
};

// https://w3c.github.io/media-source/#dom-mediasource
enum EndOfStreamError {
    "network",
    "decode",
};

// https://w3c.github.io/media-source/#dom-mediasource
[Exposed=(Window,DedicatedWorker), Experimental]
interface MediaSource : EventTarget {
    constructor();

    [FIXME, SameObject, Exposed=DedicatedWorker]
    readonly  attribute MediaSourceHandle handle;
    readonly  attribute SourceBufferList sourceBuffers;
    readonly  attribute SourceBufferList activeSourceBuffers;
    readonly  attribute ReadyState readyState;

    attribute unrestricted double duration;
    attribute EventHandler onsourceopen;
    attribute EventHandler onsourceended;
    attribute EventHandler onsourceclose;

    static readonly attribute boolean canConstructInDedicatedWorker;

    SourceBuffer addSourceBuffer(DOMString type);
    [FIXME] undefined removeSourceBuffer(SourceBuffer sourceBuffer);
    undefined endOfStream(optional EndOfStreamError error);
    [FIXME] undefined setLiveSeekableRange(double start, double end);
    [FIXME] undefined clearLiveSeekableRange();
    static boolean isTypeSupported(DOMString type);
};
