Handle media session action, no default handling yet

This commit is contained in:
Fernando Jiménez Moreno 2019-10-07 10:51:56 +02:00
parent ec7a4bf32d
commit 31ce7a2b5c
2 changed files with 9 additions and 2 deletions

View file

@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::dom::bindings::callback::ExceptionHandling;
use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::MediaSessionBinding; use crate::dom::bindings::codegen::Bindings::MediaSessionBinding;
use crate::dom::bindings::codegen::Bindings::MediaSessionBinding::MediaSessionAction; use crate::dom::bindings::codegen::Bindings::MediaSessionBinding::MediaSessionAction;
@ -54,7 +55,13 @@ impl MediaSession {
} }
pub fn handle_action(&self, action: MediaSessionActionType) { pub fn handle_action(&self, action: MediaSessionActionType) {
// TODO if let Some(handler) = self.action_handlers.borrow().get(&action) {
if handler.Call__(ExceptionHandling::Report).is_err() {
warn!("Error calling MediaSessionActionHandler callback");
}
return;
}
// TODO default action.
} }
} }

View file

@ -42,7 +42,7 @@ dictionary MediaSessionSeekToActionDetails : MediaSessionActionDetails {
boolean? fastSeek; boolean? fastSeek;
}; };
callback MediaSessionActionHandler = void(MediaSessionActionDetails details); callback MediaSessionActionHandler = void(/*MediaSessionActionDetails details*/);
[Exposed=Window] [Exposed=Window]
interface MediaSession { interface MediaSession {