From e27fe504a9990abc9e459482b1287c7bbb4b9cd5 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Fri, 27 Dec 2019 12:53:30 -0800 Subject: [PATCH] GUACAMOLE-905: Automatically resume AudioContext when recording starts. The AudioContext is paused by default in Google Chrome as a defense against autoplay. It can be explicitly resumed with resume() as long as there has been enough interaction with the page. --- guacamole-common-js/src/main/webapp/modules/AudioRecorder.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/guacamole-common-js/src/main/webapp/modules/AudioRecorder.js b/guacamole-common-js/src/main/webapp/modules/AudioRecorder.js index e54dcca61..7a1df8be8 100644 --- a/guacamole-common-js/src/main/webapp/modules/AudioRecorder.js +++ b/guacamole-common-js/src/main/webapp/modules/AudioRecorder.js @@ -435,6 +435,11 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) { source = context.createMediaStreamSource(stream); source.connect(processor); + // Attempt to explicitly resume AudioContext, as it may be paused + // by default + if (context.state === 'suspended') + context.resume(); + // Save stream for later cleanup mediaStream = stream;