From 8f1669e77182af21a0c46e5314f61cc9a83beb27 Mon Sep 17 00:00:00 2001 From: Leon Krause Date: Sun, 20 Jan 2019 14:25:15 +0100 Subject: Deal with Google's HTML5 autoplay policy Resume audio context after mouse, touch or key input. --- platform/javascript/audio_driver_javascript.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'platform/javascript/audio_driver_javascript.cpp') diff --git a/platform/javascript/audio_driver_javascript.cpp b/platform/javascript/audio_driver_javascript.cpp index fcfc75280d..16fdc267f3 100644 --- a/platform/javascript/audio_driver_javascript.cpp +++ b/platform/javascript/audio_driver_javascript.cpp @@ -146,6 +146,15 @@ void AudioDriverJavaScript::start() { /* clang-format on */ } +void AudioDriverJavaScript::resume() { + /* clang-format off */ + EM_ASM({ + if (_audioDriver_audioContext.resume) + _audioDriver_audioContext.resume(); + }); + /* clang-format on */ +} + int AudioDriverJavaScript::get_mix_rate() const { /* clang-format off */ -- cgit v1.2.3