mirror of
https://github.com/godotengine/godot.git
synced 2025-10-23 09:53:25 +00:00
Deal with Google's HTML5 autoplay policy
Resume audio context after mouse, touch or key input.
This commit is contained in:
parent
09e4d7e9eb
commit
8f1669e771
3 changed files with 16 additions and 0 deletions
|
@ -245,6 +245,8 @@ EM_BOOL OS_JavaScript::keydown_callback(int p_event_type, const EmscriptenKeyboa
|
|||
return false;
|
||||
}
|
||||
os->input->parse_input_event(ev);
|
||||
// Resume audio context after input in case autoplay was denied.
|
||||
os->audio_driver_javascript.resume();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -335,6 +337,8 @@ EM_BOOL OS_JavaScript::mouse_button_callback(int p_event_type, const EmscriptenM
|
|||
ev->set_button_mask(mask);
|
||||
|
||||
os->input->parse_input_event(ev);
|
||||
// Resume audio context after input in case autoplay was denied.
|
||||
os->audio_driver_javascript.resume();
|
||||
// Prevent multi-click text selection and wheel-click scrolling anchor.
|
||||
// Context menu is prevented through contextmenu event.
|
||||
return true;
|
||||
|
@ -663,6 +667,8 @@ EM_BOOL OS_JavaScript::touch_press_callback(int p_event_type, const EmscriptenTo
|
|||
|
||||
os->input->parse_input_event(ev);
|
||||
}
|
||||
// Resume audio context after input in case autoplay was denied.
|
||||
os->audio_driver_javascript.resume();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue