diff options
author | Fernando Jiménez Moreno <ferjmoreno@gmail.com> | 2019-10-08 10:18:13 +0200 |
---|---|---|
committer | Fernando Jiménez Moreno <ferjmoreno@gmail.com> | 2019-11-20 13:33:14 +0100 |
commit | 4d147d2c56465405e7c3281073ef57fe1bd1c062 (patch) | |
tree | 7098eaa3bcccf06c44696023352eec78736b7027 /components/script_traits/lib.rs | |
parent | 9c329a79354cb8b6c1000aa7c78364a5541de421 (diff) | |
download | servo-4d147d2c56465405e7c3281073ef57fe1bd1c062.tar.gz servo-4d147d2c56465405e7c3281073ef57fe1bd1c062.zip |
Register media instance with session and prepare communication with embedder
Diffstat (limited to 'components/script_traits/lib.rs')
-rw-r--r-- | components/script_traits/lib.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index b4b85889ea0..f5006f1df6f 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -1087,3 +1087,34 @@ pub enum MediaSessionActionType { /// The action intent is to move the playback time to a specific time. SeekTo, } + +/// https://w3c.github.io/mediasession/#mediametadata +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct MediaMetadata { + /// Title + pub title: String, + /// Artist + pub artist: Option<String>, + /// Album + pub album: Option<String>, +} + +/// https://w3c.github.io/mediasession/#enumdef-mediasessionplaybackstate +#[derive(Clone, Debug, Deserialize, Serialize)] +pub enum MediaSessionPlaybackState { + /// The browsing context does not specify whether it’s playing or paused. + None_, + /// The browsing context has paused media and it can be resumed. + Playing, + /// The browsing context is currently playing media and it can be paused. + Paused, +} + +/// Type of events sent from script to the constellation about the media session. +#[derive(Clone, Debug, Deserialize, Serialize)] +pub enum MediaSessionEvent { + /// Indicates that the media metadata is available. + SetMetadata(MediaMetadata), + /// Indicates that the playback state has changed. + PlaybackStateChange(MediaSessionPlaybackState), +} |