summaryrefslogtreecommitdiff
path: root/platform/javascript/os_javascript.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-01-21 10:57:49 +0100
committerGitHub <noreply@github.com>2019-01-21 10:57:49 +0100
commitbef383985e7be5c8253e32758d96fa7a6e3fd257 (patch)
tree6a5f72f59d602959d0ecaf8aad3e1cee94bd7204 /platform/javascript/os_javascript.cpp
parent38a5a23a12ceaccd09b22a009dc680ec5037e367 (diff)
parent8f1669e77182af21a0c46e5314f61cc9a83beb27 (diff)
Merge pull request #25168 from eska014/html5-autoplay
Deal with Google's HTML5 autoplay policy
Diffstat (limited to 'platform/javascript/os_javascript.cpp')
-rw-r--r--platform/javascript/os_javascript.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index 6824ed1803..b92634c8d6 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -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;
}