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/.
6 * The origin of this IDL file is
7 * https://w3c.github.io/mediasession/#idl-index
10 enum MediaSessionPlaybackState {
16 enum MediaSessionAction {
28 callback MediaSessionActionHandler = undefined(MediaSessionActionDetails details);
31 interface MediaSession {
32 attribute MediaMetadata? metadata;
34 attribute MediaSessionPlaybackState playbackState;
36 undefined setActionHandler(MediaSessionAction action, MediaSessionActionHandler? handler);
39 undefined setPositionState(optional MediaPositionState state = {});
41 // Fire the action handler. It's test-only for now.
43 undefined notifyHandler(MediaSessionActionDetails details);
47 interface MediaMetadata {
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 {
62 DOMString artist = "";
64 sequence<MediaImage> artwork = [];
67 dictionary MediaImage {
68 required USVString src;
73 // Spec issue https://github.com/w3c/mediasession/issues/254
74 dictionary MediaSessionActionDetails {
75 required MediaSessionAction action;
81 dictionary MediaPositionState {