juliusjs icon indicating copy to clipboard operation
juliusjs copied to clipboard

The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page.

Open TrRavi opened this issue 7 years ago • 2 comments

During the page loading , in chrome console it is showing

julius.js:22 The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu

problem is here

var initializeAudio = function(audio) { audio.context = new (window.AudioContext || window.webkitAudioContext)(); audio.processor = audio.context.createScriptProcessor(4096, 1, 1); };

Please somebody tell me how to solve this..

TrRavi avatar Mar 25 '19 07:03 TrRavi

as described here update your dist/julius.js as follows:

//      initializeAudio(this.audio);
//      bootstrap.call(this, pathToDfa, pathToDict, options);
document.querySelector('button').addEventListener('click', function() { 
      initializeAudio(that.audio);
      bootstrap.call(that, pathToDfa, pathToDict, options);
});

kendmaclean avatar Jun 18 '19 14:06 kendmaclean

and shown here, add a button to the HTML page that calls Julius, e.g.:

<button type="button">Click Me!</button>

kendmaclean avatar Jun 18 '19 14:06 kendmaclean