chromium/third_party/blink/renderer/modules/mediasession/media_session.idl

// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// https://w3c.github.io/mediasession/#enumdef-mediasessionplaybackstate

enum MediaSessionPlaybackState {
    "none",
    "paused",
    "playing"
};

// https://w3c.github.io/mediasession/#the-mediasession-interface

enum MediaSessionAction {
  "play",
  "pause",
  "previoustrack",
  "nexttrack",
  "seekbackward",
  "seekforward",
  "skipad",
  "stop",
  "seekto",
  "togglemicrophone",
  "togglecamera",
  "hangup",
  "previousslide",
  "nextslide",
  "enterpictureinpicture"
};

callback MediaSessionActionHandler = void (MediaSessionActionDetails details);

[
    Exposed=Window,
    RuntimeEnabled=MediaSession
] interface MediaSession {
    [Measure] attribute MediaMetadata? metadata;
    [Measure] attribute MediaSessionPlaybackState playbackState;

    [Measure, RaisesException] void setActionHandler(MediaSessionAction action,
                                    MediaSessionActionHandler? handler);

    [Measure, RaisesException]
    void setPositionState(optional MediaPositionState state = {});

    [Measure]
    void setMicrophoneActive(boolean active);

    [Measure]
    void setCameraActive(boolean active);
};