OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 blink.mojom; | 5 module blink.mojom; |
6 | 6 |
7 import "mojo/common/common_custom_types.mojom"; | 7 import "mojo/common/common_custom_types.mojom"; |
8 import "ui/gfx/geometry/mojo/geometry.mojom"; | 8 import "ui/gfx/geometry/mojo/geometry.mojom"; |
9 import "url/mojo/url.mojom"; | 9 import "url/mojo/url.mojom"; |
10 | 10 |
| 11 // Spec: https://wicg.github.io/mediasession/ |
| 12 enum MediaSessionAction { |
| 13 PLAY, |
| 14 PAUSE, |
| 15 PLAY_PAUSE, |
| 16 PREVIOUS_TRACK, |
| 17 NEXT_TRACK, |
| 18 SEEK_FORWARD, |
| 19 SEEK_BACKWARD, |
| 20 }; |
| 21 |
11 // Album art in MediaMetadata | 22 // Album art in MediaMetadata |
12 // Spec: https://wicg.github.io/mediasession/ | 23 // Spec: https://wicg.github.io/mediasession/ |
13 struct MediaImage { | 24 struct MediaImage { |
14 url.mojom.Url src; | 25 url.mojom.Url src; |
15 mojo.common.mojom.String16 type; | 26 mojo.common.mojom.String16 type; |
16 array<gfx.mojom.Size> sizes; | 27 array<gfx.mojom.Size> sizes; |
17 }; | 28 }; |
18 | 29 |
19 // MediaMetadata | 30 // MediaMetadata |
20 // Spec: https://wicg.github.io/mediasession/ | 31 // Spec: https://wicg.github.io/mediasession/ |
21 struct MediaMetadata { | 32 struct MediaMetadata { |
22 mojo.common.mojom.String16 title; | 33 mojo.common.mojom.String16 title; |
23 mojo.common.mojom.String16 artist; | 34 mojo.common.mojom.String16 artist; |
24 mojo.common.mojom.String16 album; | 35 mojo.common.mojom.String16 album; |
25 array<MediaImage> artwork; | 36 array<MediaImage> artwork; |
26 }; | 37 }; |
27 | 38 |
| 39 interface MediaSessionClient { |
| 40 // Notifies the Blink side that a MediaSessionAction has been fired from the |
| 41 // UI or the platform. |
| 42 DidReceiveAction(MediaSessionAction action); |
| 43 }; |
| 44 |
28 interface MediaSessionService { | 45 interface MediaSessionService { |
| 46 // MediaSessionClient interface is used to notify Blink MediaSession of |
| 47 // media control actions. |
| 48 SetClient(MediaSessionClient client); |
| 49 |
| 50 // Notifies the browser that the metadata is set, |metadata| will be displayed |
| 51 // on the UI. |
29 SetMetadata(MediaMetadata? metadata); | 52 SetMetadata(MediaMetadata? metadata); |
| 53 |
| 54 // Notifies the browser that the event handler for |action| has been set, |
| 55 // browser needs to show a media button in the UI or register listeners to the |
| 56 // platform. |
| 57 EnableAction(MediaSessionAction action); |
| 58 // Notifies the browser that the event handler for |action| has been set, |
| 59 // browser needs to hide the media button in the UI and unregister listeners |
| 60 // from the platform. |
| 61 DisableAction(MediaSessionAction action); |
30 }; | 62 }; |
OLD | NEW |