New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement mediasession set positon state #24885
Merged
bors-servo
merged 6 commits into
servo:master
from
shnmorimoto:implement_mediasession_set_positon_state
Dec 3, 2019
+183
−34
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
274d4d2
implement MediaSession.setPositionState method
shnmorimoto 3e83b0b
updated tests for mediasession
shnmorimoto 8bdee36
extended MediaSessionEvent with SetPositionState
shnmorimoto e268193
fix typo
shnmorimoto 4d215c9
extended HostTrait with on_media_session_set_position_state
shnmorimoto 41ff93e
extended android jni with onMediaSessionSetPositionState
shnmorimoto File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.
implement MediaSession.setPositionState method
- Loading branch information
commit 274d4d2303fa2986da356dd2d05adcb48d796a2a
| @@ -9,10 +9,13 @@ use crate::dom::bindings::codegen::Bindings::HTMLMediaElementBinding::HTMLMediaE | ||||
| use crate::dom::bindings::codegen::Bindings::MediaMetadataBinding::MediaMetadataInit; | ||||
| use crate::dom::bindings::codegen::Bindings::MediaMetadataBinding::MediaMetadataMethods; | ||||
| use crate::dom::bindings::codegen::Bindings::MediaSessionBinding; | ||||
| use crate::dom::bindings::codegen::Bindings::MediaSessionBinding::MediaPositionState; | ||||
| use crate::dom::bindings::codegen::Bindings::MediaSessionBinding::MediaSessionAction; | ||||
| use crate::dom::bindings::codegen::Bindings::MediaSessionBinding::MediaSessionActionHandler; | ||||
| use crate::dom::bindings::codegen::Bindings::MediaSessionBinding::MediaSessionMethods; | ||||
| use crate::dom::bindings::codegen::Bindings::MediaSessionBinding::MediaSessionPlaybackState; | ||||
| use crate::dom::bindings::error::{Error, Fallible}; | ||||
| use crate::dom::bindings::num::Finite; | ||||
| use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; | ||||
| use crate::dom::bindings::root::{DomRoot, MutNullableDom}; | ||||
| use crate::dom::bindings::str::DOMString; | ||||
| @@ -194,6 +197,62 @@ impl MediaSessionMethods for MediaSession { | ||||
| None => self.action_handlers.borrow_mut().remove(&action.into()), | ||||
| }; | ||||
| } | ||||
|
|
||||
| /// https://w3c.github.io/mediasession/#dom-mediasession-setpositionstate | ||||
| fn SetPositionState(&self, state: &MediaPositionState) -> Fallible<()> { | ||||
| // If the state is an empty dictionary then clear the position state. | ||||
| if state.duration.is_none() && state.position.is_none() && state.playbackRate.is_none() { | ||||
|
This conversation was marked as resolved
by jdm
ferjm
Member
|
||||
| if let Err(e) = player.lock().unwrap().stop() { |
ProTip!
Use n and p to navigate between commits in a pull request.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
https://w3c.github.io/mediasession/#dom-mediasession-setpositionstate
Is the position state the combination of duration and playback_position and playbackRate in media_instance(type is HTMLMediaElement)?
And, Does clear mean to set at 0?