| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 module media_router.mojom; | 5 module media_router.mojom; |
| 6 | 6 |
| 7 import "mojo/common/time.mojom"; | 7 import "mojo/common/time.mojom"; |
| 8 | 8 |
| 9 // Represents the current state of a media content. This struct should be kept | 9 // Represents the current state of a media content. This struct should be kept |
| 10 // free of details specific to Media Router, so that it can be moved to the | 10 // free of details specific to Media Router, so that it can be moved to the |
| 11 // media namespace and be reused for other features in the future. | 11 // media namespace and be reused for other features in the future. |
| 12 struct MediaStatus { | 12 struct MediaStatus { |
| 13 enum PlayState { |
| 14 PLAYING, |
| 15 PAUSED, |
| 16 BUFFERING |
| 17 }; |
| 18 |
| 13 // The main title of the media. For example, in a MediaStatus representing | 19 // The main title of the media. For example, in a MediaStatus representing |
| 14 // a YouTube Cast session, this could be the title of the video. | 20 // a YouTube Cast session, this could be the title of the video. |
| 15 string title; | 21 string title; |
| 16 | 22 |
| 17 // Text describing the media, or a secondary title. For example, in a | 23 // Text describing the media, or a secondary title. For example, in a |
| 18 // MediaStatus representing a YouTube Cast session, this could be "YouTube". | 24 // MediaStatus representing a YouTube Cast session, this could be "YouTube". |
| 19 string description; | 25 string description; |
| 20 | 26 |
| 21 // If this is true, the media can be played and paused through its | 27 // If this is true, the media can be played and paused through its |
| 22 // MediaController. | 28 // MediaController. |
| 23 bool can_play_pause; | 29 bool can_play_pause; |
| 24 | 30 |
| 25 // If this is true, the media can be muted and unmuted through its | 31 // If this is true, the media can be muted and unmuted through its |
| 26 // MediaController. | 32 // MediaController. |
| 27 bool can_mute; | 33 bool can_mute; |
| 28 | 34 |
| 29 // If this is true, the media's volume can be changed through its | 35 // If this is true, the media's volume can be changed through its |
| 30 // MediaController. | 36 // MediaController. |
| 31 bool can_set_volume; | 37 bool can_set_volume; |
| 32 | 38 |
| 33 // If this is true, the media's current playback position can be changed | 39 // If this is true, the media's current playback position can be changed |
| 34 // through its MediaController. | 40 // through its MediaController. |
| 35 bool can_seek; | 41 bool can_seek; |
| 36 | 42 |
| 37 bool is_paused; | 43 // Whether the media is playing, paused, or buffering. |
| 44 PlayState play_state; |
| 38 | 45 |
| 39 bool is_muted; | 46 bool is_muted; |
| 40 | 47 |
| 41 // Current volume of the media, with 1 being the highest and 0 being the | 48 // Current volume of the media, with 1 being the highest and 0 being the |
| 42 // lowest/no sound. When |is_muted| is true, there should be no sound | 49 // lowest/no sound. When |is_muted| is true, there should be no sound |
| 43 // regardless of |volume|. | 50 // regardless of |volume|. |
| 44 float volume; | 51 float volume; |
| 45 | 52 |
| 46 // The length of the media. A value of 0 indicates that this is a media with | 53 // The length of the media. A value of 0 indicates that this is a media with |
| 47 // no set duration (e.g. a live stream). | 54 // no set duration (e.g. a live stream). |
| 48 mojo.common.mojom.TimeDelta duration; | 55 mojo.common.mojom.TimeDelta duration; |
| 49 | 56 |
| 50 // Current playback position. Must be less than or equal to |duration|. | 57 // Current playback position. Must be less than or equal to |duration|. |
| 51 mojo.common.mojom.TimeDelta current_time; | 58 mojo.common.mojom.TimeDelta current_time; |
| 52 }; | 59 }; |
| 53 | 60 |
| 54 // Interface for being notified whenever the MediaStatus of a media changes. | 61 // Interface for being notified whenever the MediaStatus of a media changes. |
| 55 // This interface should be kept free of details specific to Media Router, so | 62 // This interface should be kept free of details specific to Media Router, so |
| 56 // that it can be moved to the media namespace and be reused for other features | 63 // that it can be moved to the media namespace and be reused for other features |
| 57 // in the future. | 64 // in the future. |
| 58 interface MediaStatusObserver { | 65 interface MediaStatusObserver { |
| 59 OnMediaStatusUpdated(MediaStatus status); | 66 OnMediaStatusUpdated(MediaStatus status); |
| 60 }; | 67 }; |
| OLD | NEW |