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/string16.mojom"; | 7 import "mojo/common/string16.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/ | 11 // Spec: https://wicg.github.io/mediasession/ |
12 enum MediaSessionAction { | 12 enum MediaSessionAction { |
13 PLAY, | 13 PLAY, |
14 PAUSE, | 14 PAUSE, |
15 PLAY_PAUSE, | 15 PLAY_PAUSE, |
16 PREVIOUS_TRACK, | 16 PREVIOUS_TRACK, |
17 NEXT_TRACK, | 17 NEXT_TRACK, |
18 SEEK_BACKWARD, | 18 SEEK_BACKWARD, |
19 SEEK_FORWARD, | 19 SEEK_FORWARD, |
20 | 20 |
21 LAST = SEEK_FORWARD, | 21 LAST = SEEK_FORWARD, |
22 }; | 22 }; |
23 | 23 |
24 // Spec: https://wicg.github.io/mediasession/ | |
mlamouri (slow - plz ping)
2016/12/16 15:49:14
I don't think this is needed.
Zhiqiang Zhang (Slow)
2016/12/16 18:26:15
Done.
| |
25 enum MediaSessionPlaybackState { | |
26 NONE, | |
27 PAUSED, | |
28 PLAYING, | |
29 }; | |
30 | |
24 // Album art in MediaMetadata | 31 // Album art in MediaMetadata |
25 // Spec: https://wicg.github.io/mediasession/ | 32 // Spec: https://wicg.github.io/mediasession/ |
26 struct MediaImage { | 33 struct MediaImage { |
27 url.mojom.Url src; | 34 url.mojom.Url src; |
28 mojo.common.mojom.String16 type; | 35 mojo.common.mojom.String16 type; |
29 array<gfx.mojom.Size> sizes; | 36 array<gfx.mojom.Size> sizes; |
30 }; | 37 }; |
31 | 38 |
32 // MediaMetadata | 39 // MediaMetadata |
33 // Spec: https://wicg.github.io/mediasession/ | 40 // Spec: https://wicg.github.io/mediasession/ |
34 struct MediaMetadata { | 41 struct MediaMetadata { |
35 mojo.common.mojom.String16 title; | 42 mojo.common.mojom.String16 title; |
36 mojo.common.mojom.String16 artist; | 43 mojo.common.mojom.String16 artist; |
37 mojo.common.mojom.String16 album; | 44 mojo.common.mojom.String16 album; |
38 array<MediaImage> artwork; | 45 array<MediaImage> artwork; |
39 }; | 46 }; |
40 | 47 |
41 interface MediaSessionClient { | 48 interface MediaSessionClient { |
42 // Notifies the Blink side that a MediaSessionAction has been fired from the | 49 // Notifies the Blink side that a MediaSessionAction has been fired from the |
43 // UI or the platform. | 50 // UI or the platform. |
44 DidReceiveAction(MediaSessionAction action); | 51 DidReceiveAction(MediaSessionAction action); |
45 }; | 52 }; |
46 | 53 |
47 interface MediaSessionService { | 54 interface MediaSessionService { |
48 // MediaSessionClient interface is used to notify Blink MediaSession of | 55 // MediaSessionClient interface is used to notify Blink MediaSession of |
49 // media control actions. | 56 // media control actions. |
50 SetClient(MediaSessionClient client); | 57 SetClient(MediaSessionClient client); |
51 | 58 |
59 // Notifies the browser that the page specified its current playback state. | |
60 SetPlaybackState(MediaSessionPlaybackState state); | |
61 | |
52 // Notifies the browser that the metadata is set, |metadata| will be displayed | 62 // Notifies the browser that the metadata is set, |metadata| will be displayed |
53 // on the UI. | 63 // on the UI. |
54 SetMetadata(MediaMetadata? metadata); | 64 SetMetadata(MediaMetadata? metadata); |
55 | 65 |
56 // Notifies the browser that the event handler for |action| has been set, | 66 // Notifies the browser that the event handler for |action| has been set, |
57 // browser needs to show a media button in the UI or register listeners to the | 67 // browser needs to show a media button in the UI or register listeners to the |
58 // platform. | 68 // platform. |
59 EnableAction(MediaSessionAction action); | 69 EnableAction(MediaSessionAction action); |
60 // Notifies the browser that the event handler for |action| has been set, | 70 // Notifies the browser that the event handler for |action| has been set, |
61 // browser needs to hide the media button in the UI and unregister listeners | 71 // browser needs to hide the media button in the UI and unregister listeners |
62 // from the platform. | 72 // from the platform. |
63 DisableAction(MediaSessionAction action); | 73 DisableAction(MediaSessionAction action); |
64 }; | 74 }; |
OLD | NEW |