blob: 7d22ef623ba432731755459af2f3c4d1b8149ded [file] [log] [blame]
// Copyright 2018 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_session.mojom;
import "mojo/public/mojom/base/time.mojom";
import "services/media_session/public/mojom/media_session.mojom";
// Controls a MediaSession. This will automatically route commands to the
// correct session if the audio focus changes. If the media session is
// not controllable then the commands will be no-ops.
interface MediaController {
// Suspend the media session.
Suspend();
// Resume the media session.
Resume();
// Stop the media session.
Stop();
// This will either suspend or resume the media session based on the
// playback state.
ToggleSuspendResume();
// Adds an observer that will forward events from the active media session.
// If the active session changes then observers do not need to be readded.
// Adding the observer will update the observer with the latest state.
AddObserver(MediaSessionObserver observer);
// Skip to the previous track. If there is no previous track then this will be
// a no-op.
PreviousTrack();
// Skip to the next track. If there is no next track then this will be a
// no-op.
NextTrack();
// Seek the media session. If the media cannot seek then this will be a
// no-op. The |seek_time| is the time delta that the media will seek by and
// supports both positive and negative values. This value cannot be zero.
// The |kDefaultSeekTimeSeconds| provides a default value for seeking by a
// few seconds.
Seek(mojo_base.mojom.TimeDelta seek_time);
};