From d7d775ac606ee8f1d71c58fa321bc41b378e465d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Mon, 7 Oct 2019 11:12:25 +0200 Subject: [PATCH] Extend libsimpleservo API with a method to request a media session action --- ports/libsimpleservo/api/src/lib.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ports/libsimpleservo/api/src/lib.rs b/ports/libsimpleservo/api/src/lib.rs index 0b415ac669c..952d85f9d31 100644 --- a/ports/libsimpleservo/api/src/lib.rs +++ b/ports/libsimpleservo/api/src/lib.rs @@ -19,7 +19,7 @@ use servo::embedder_traits::EmbedderMsg; use servo::euclid::{Point2D, Rect, Scale, Size2D, Vector2D}; use servo::keyboard_types::{Key, KeyState, KeyboardEvent}; use servo::msg::constellation_msg::TraversalDirection; -use servo::script_traits::{TouchEventType, TouchId}; +use servo::script_traits::{MediaSessionActionType, TouchEventType, TouchId}; use servo::servo_config::opts; use servo::servo_config::{pref, set_pref}; use servo::servo_url::ServoUrl; @@ -466,6 +466,15 @@ impl ServoGlue { self.process_event(WindowEvent::Keyboard(key_event)) } + pub fn media_session_action( + &mut self, + action: MediaSessionActionType, + ) -> Result<(), &'static str> { + info!("Media session action {:?}", action); + let browser_id = self.get_browser_id()?; + self.process_event(WindowEvent::MediaSessionAction(browser_id, action)) + } + fn process_event(&mut self, event: WindowEvent) -> Result<(), &'static str> { self.events.push(event); if !self.batch_mode {