From faafab331f531590f6a39725ba020dfd5186ad9b Mon Sep 17 00:00:00 2001 From: raj Date: Fri, 3 Jan 2020 02:07:16 +0530 Subject: [PATCH] changes as per google new policy for autoplay --- js/main.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/js/main.js b/js/main.js index 29689d6..dc89460 100644 --- a/js/main.js +++ b/js/main.js @@ -53,6 +53,13 @@ function doneEncoding( blob ) { } function toggleRecording( e ) { + // Changes as per the google autoplay-policy-changes + // ref: https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#webaudio + if(audioContext.state !== "running"){ + audioContext.resume().then(() => { + console.log('Playback resumed successfully'); + }); + } if (e.classList.contains("recording")) { // stop recording audioRecorder.stop();