| // Copyright 2020 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| module media.mojom; |
| |
| import "mojo/public/mojom/base/time.mojom"; |
| import "services/media_session/public/mojom/media_session.mojom"; |
| import "ui/gfx/geometry/mojom/geometry.mojom"; |
| |
| // Implemented by HTMLMediaElement in the renderer process. |
| interface MediaPlayer { |
| // Sends |observer| to the renderer process so that it can be established a |
| // communication channel with the implementor of MediaPlayerObserver. |
| // TODO(crbug.com/1039252): Make this an AddMediaPlayerObserver method as soon |
| // as there is a HeapMojoRemoteSet class available for its use in Blink. |
| SetMediaPlayerObserver(pending_remote<MediaPlayerObserver> observer); |
| |
| // Requests the media player to start or resume media playback. |
| RequestPlay(); |
| |
| // Requests the media player to pause media playback. |
| RequestPause(bool triggered_by_user); |
| |
| // Requests the media player to move forward the media playback position. |
| RequestSeekForward(mojo_base.mojom.TimeDelta seek_time); |
| |
| // Requests the media player to move backward the media playback position. |
| RequestSeekBackward(mojo_base.mojom.TimeDelta seek_time); |
| |
| // Requests the media player to enter the Picture-in-Picture mode. |
| RequestEnterPictureInPicture(); |
| |
| // Requests the media player to exit the Picture-in-Picture mode. |
| RequestExitPictureInPicture(); |
| }; |
| |
| // Implemented by MediaWebContentsObserver::MediaPlayerObserverHostImpl in the |
| // browser process. |
| interface MediaPlayerObserver { |
| // Notifies that the muted status of the media player has changed. |
| OnMutedStatusChanged(bool muted); |
| |
| // Notifies the browser process that the media playback position has changed, |
| // and reports the new current position via |media_position|. |
| OnMediaPositionStateChanged(media_session.mojom.MediaPosition media_position); |
| |
| // Notifies that the size of the media player has changed. |
| OnMediaSizeChanged(gfx.mojom.Size size); |
| |
| // Notifies the browser process of PictureinPicture playback's availability. |
| OnPictureInPictureAvailabilityChanged(bool available); |
| |
| // Notifies the browser process that the ability to switch audio output |
| // devices for the associated media player has been disabled. |
| OnAudioOutputSinkChangingDisabled(); |
| |
| // Notifies that a buffer underflow event happened for the media player. |
| OnBufferUnderflow(); |
| |
| // Notifies that a playback seek event happened for the media player. |
| OnSeek(); |
| }; |
| |
| // Implemented by MediaWebContentsObserver::MediaPlayerHostImpl in the browser |
| // process. |
| interface MediaPlayerHost { |
| // Sends a message to the browser notifying the render frame associated to the |
| // document owning the HTMLMediaElement that a new MediaPlayer is available, |
| // passing a pending remote (i.e. |player_remote|) that will be used in the |
| // browser process to establish a channel with the HTMLMediaElement. |
| OnMediaPlayerAdded(pending_remote<MediaPlayer> player_remote, |
| int32 player_id); |
| }; |