1// Copyright 2017 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5module media_router.mojom;
6
7import "chrome/common/media_router/mojom/media_status.mojom";
8import "mojo/public/mojom/base/time.mojom";
9
10// Interface for a controller to change the current state of a media content.
11// This interface should be kept free of details specific to Media Router, so
12// that it can be moved to the media namespace and be reused for other features
13// in the future.
14interface MediaController {
15  // Starts playing the media if it is paused. Is a no-op if not supported by
16  // the media or the media is already playing.
17  Play();
18
19  // Pauses the media if it is playing. Is a no-op if not supported by the media
20  // or the media is already paused.
21  Pause();
22
23  // Mutes the media if |mute| is true, and unmutes it if false. Is a no-op if
24  // not supported by the media.
25  SetMute(bool mute);
26
27  // Changes the current volume of the media, with 1 being the highest and 0
28  // being the lowest/no sound. Does not change the (un)muted state of the
29  // media. Is a no-op if not supported by the media.
30  SetVolume(float volume);
31
32  // Sets the current playback position. |time| must be less than or equal to
33  // the duration of the media. Is a no-op if the media doesn't support seeking.
34  Seek(mojo_base.mojom.TimeDelta time);
35
36  // Skips to the next media track, e.g. the next song in a playlist. It is a
37  // no-op if there is no next track.
38  NextTrack();
39
40  // Skips to the previous media track, e.g. the previous song in a playlist. It
41  // is a no-op if there is no previous track.
42  PreviousTrack();
43};
44