mediasession.idl (2616B)
1 // GENERATED CONTENT - DO NOT EDIT 2 // Content was automatically extracted by Reffy into webref 3 // (https://github.com/w3c/webref) 4 // Source: Media Session (https://w3c.github.io/mediasession/) 5 6 [Exposed=Window] 7 partial interface Navigator { 8 [SameObject] readonly attribute MediaSession mediaSession; 9 }; 10 11 enum MediaSessionPlaybackState { 12 "none", 13 "paused", 14 "playing" 15 }; 16 17 enum MediaSessionAction { 18 "play", 19 "pause", 20 "seekbackward", 21 "seekforward", 22 "previoustrack", 23 "nexttrack", 24 "skipad", 25 "stop", 26 "seekto", 27 "togglemicrophone", 28 "togglecamera", 29 "togglescreenshare", 30 "hangup", 31 "previousslide", 32 "nextslide", 33 "enterpictureinpicture", 34 "voiceactivity" 35 }; 36 37 enum MediaSessionEnterPictureInPictureReason { 38 "other", 39 "useraction", 40 "contentoccluded" 41 }; 42 43 callback MediaSessionActionHandler = undefined(MediaSessionActionDetails details); 44 45 [Exposed=Window] 46 interface MediaSession { 47 attribute MediaMetadata? metadata; 48 49 attribute MediaSessionPlaybackState playbackState; 50 51 undefined setActionHandler(MediaSessionAction action, MediaSessionActionHandler? handler); 52 53 undefined setPositionState(optional MediaPositionState state = {}); 54 55 Promise<undefined> setMicrophoneActive(boolean active); 56 57 Promise<undefined> setCameraActive(boolean active); 58 59 Promise<undefined> setScreenshareActive(boolean active); 60 }; 61 62 [Exposed=Window] 63 interface MediaMetadata { 64 constructor(optional MediaMetadataInit init = {}); 65 attribute DOMString title; 66 attribute DOMString artist; 67 attribute DOMString album; 68 attribute FrozenArray<object> artwork; 69 [SameObject] readonly attribute FrozenArray<ChapterInformation> chapterInfo; 70 }; 71 72 dictionary MediaMetadataInit { 73 DOMString title = ""; 74 DOMString artist = ""; 75 DOMString album = ""; 76 sequence<MediaImage> artwork = []; 77 sequence<ChapterInformationInit> chapterInfo = []; 78 }; 79 80 [Exposed=Window] 81 interface ChapterInformation { 82 readonly attribute DOMString title; 83 readonly attribute double startTime; 84 [SameObject] readonly attribute FrozenArray<MediaImage> artwork; 85 }; 86 87 dictionary ChapterInformationInit { 88 DOMString title = ""; 89 double startTime = 0; 90 sequence<MediaImage> artwork = []; 91 }; 92 93 dictionary MediaImage { 94 required USVString src; 95 DOMString sizes = ""; 96 DOMString type = ""; 97 }; 98 99 dictionary MediaPositionState { 100 unrestricted double duration; 101 double playbackRate; 102 double position; 103 }; 104 105 dictionary MediaSessionActionDetails { 106 required MediaSessionAction action; 107 double seekOffset; 108 double seekTime; 109 boolean fastSeek; 110 boolean isActivating; 111 MediaSessionEnterPictureInPictureReason enterPictureInPictureReason; 112 };