mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #24885 - shnmorimoto:implement_mediasession_set_positon_state, r=ferjm
Implement mediasession set positon state <!-- Please describe your changes on the following line: --> fix #24808 > Bonus points if you want to tweak the existing UI by adding a progress bar, and the info about the current position and total duration. I haven't implemented this yet. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #24808 (GitHub issue number if applicable) <!-- Either: --> - [x] There are tests for these changes OR <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
commit
f31a88d85d
13 changed files with 183 additions and 34 deletions
|
@ -240,6 +240,24 @@ pub enum MediaSessionPlaybackState {
|
|||
Paused,
|
||||
}
|
||||
|
||||
/// https://w3c.github.io/mediasession/#dictdef-mediapositionstate
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct MediaPositionState {
|
||||
pub duration: f64,
|
||||
pub playback_rate: f64,
|
||||
pub position: f64,
|
||||
}
|
||||
|
||||
impl MediaPositionState {
|
||||
pub fn new(duration: f64, playback_rate: f64, position: f64) -> Self {
|
||||
Self {
|
||||
duration,
|
||||
playback_rate,
|
||||
position,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Type of events sent from script to the embedder about the media session.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub enum MediaSessionEvent {
|
||||
|
@ -247,4 +265,6 @@ pub enum MediaSessionEvent {
|
|||
SetMetadata(MediaMetadata),
|
||||
/// Indicates that the playback state has changed.
|
||||
PlaybackStateChange(MediaSessionPlaybackState),
|
||||
/// Indicates that the position state is set.
|
||||
SetPositionState(MediaPositionState),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue