mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Send MediaSessionAction from Android
This commit is contained in:
parent
b494acbf19
commit
08f9f17ed3
10 changed files with 64 additions and 15 deletions
|
@ -19,7 +19,7 @@ use servo::embedder_traits::{EmbedderMsg, MediaSessionEvent};
|
|||
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::{MediaSessionActionType, TouchEventType, TouchId};
|
||||
use servo::script_traits::{TouchEventType, TouchId};
|
||||
use servo::servo_config::opts;
|
||||
use servo::servo_config::{pref, set_pref};
|
||||
use servo::servo_url::ServoUrl;
|
||||
|
@ -470,13 +470,10 @@ impl ServoGlue {
|
|||
self.process_event(WindowEvent::Keyboard(key_event))
|
||||
}
|
||||
|
||||
pub fn media_session_action(
|
||||
&mut self,
|
||||
action: MediaSessionActionType,
|
||||
) -> Result<(), &'static str> {
|
||||
pub fn media_session_action(&mut self, action: i32) -> Result<(), &'static str> {
|
||||
info!("Media session action {:?}", action);
|
||||
let browser_id = self.get_browser_id()?;
|
||||
self.process_event(WindowEvent::MediaSessionAction(browser_id, action))
|
||||
self.process_event(WindowEvent::MediaSessionAction(browser_id, action.into()))
|
||||
}
|
||||
|
||||
fn process_event(&mut self, event: WindowEvent) -> Result<(), &'static str> {
|
||||
|
|
|
@ -333,6 +333,16 @@ pub fn Java_org_mozilla_servoview_JNIServo_click(env: JNIEnv, _: JClass, x: jint
|
|||
call(&env, |s| s.click(x as f32, y as f32));
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub fn Java_org_mozilla_servoview_JNIServo_mediaSessionAction(
|
||||
env: JNIEnv,
|
||||
_: JClass,
|
||||
action: jint,
|
||||
) {
|
||||
debug!("mediaSessionAction");
|
||||
call(&env, |s| s.media_session_action(action as i32));
|
||||
}
|
||||
|
||||
pub struct WakeupCallback {
|
||||
callback: GlobalRef,
|
||||
jvm: Arc<JavaVM>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue