Backed out 2 changesets (bug 1908320) for causing wr failures on align-items-baseline...
[gecko.git] / dom / webidl / MediaSession.webidl
blob8a19998e05bd40176f682a47d96092245f5743ef
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4  * You can obtain one at http://mozilla.org/MPL/2.0/.
5  *
6  * The origin of this IDL file is
7  * https://w3c.github.io/mediasession/#idl-index
8  */
10 enum MediaSessionPlaybackState {
11   "none",
12   "paused",
13   "playing"
16 enum MediaSessionAction {
17   "play",
18   "pause",
19   "seekbackward",
20   "seekforward",
21   "previoustrack",
22   "nexttrack",
23   "skipad",
24   "seekto",
25   "stop",
28 callback MediaSessionActionHandler = undefined(MediaSessionActionDetails details);
30 [Exposed=Window]
31 interface MediaSession {
32   attribute MediaMetadata? metadata;
34   attribute MediaSessionPlaybackState playbackState;
36   undefined setActionHandler(MediaSessionAction action, MediaSessionActionHandler? handler);
38   [Throws]
39   undefined setPositionState(optional MediaPositionState state = {});
41   // Fire the action handler. It's test-only for now.
42   [ChromeOnly]
43   undefined notifyHandler(MediaSessionActionDetails details);
46 [Exposed=Window]
47 interface MediaMetadata {
48   [Throws]
49   constructor(optional MediaMetadataInit init = {});
51   attribute DOMString title;
52   attribute DOMString artist;
53   attribute DOMString album;
54   // https://github.com/w3c/mediasession/issues/237
55   // Take and return `MediaImage` on setter and getter.
56   [Frozen, Cached, Pure, Throws]
57   attribute sequence<object> artwork;
60 dictionary MediaMetadataInit {
61   DOMString title = "";
62   DOMString artist = "";
63   DOMString album = "";
64   sequence<MediaImage> artwork = [];
67 dictionary MediaImage {
68   required USVString src;
69   DOMString sizes = "";
70   DOMString type = "";
73 // Spec issue https://github.com/w3c/mediasession/issues/254
74 dictionary MediaSessionActionDetails {
75   required MediaSessionAction action;
76   double seekOffset;
77   double seekTime;
78   boolean fastSeek;
81 dictionary MediaPositionState {
82   double duration;
83   double playbackRate;
84   double position;