问题
i am trying to implement microsoft bing speech api and its working fine for the first 5 times after that when i record my voice i getting exception in console . Exception : Uncaught DOMException: Failed to construct 'AudioContext': The number of hardware contexts provided (6) is greater than or equal to the maximum bound (6).
when i try to close with AudioContext.close() it shows another error like "Uncaught (in promise) DOMException: Cannot close a context that is being closed or has already been closed." Anybody know whats the error is this . i am using speech 1.0.0 js sdk of microsoft bing speech .
回答1:
I have a solution to resolve this problem, i just closed the audio context when the recording stops and its working fine for me :)
here is the edited speech.js stop method :`
Speech.prototype.stop = function () {
if (this._currentSource) {
// context will be closed here
this.context.close(); // new added code for the continues context creation (To avoid DoM exception)
};`
来源:https://stackoverflow.com/questions/43511096/uncaught-domexception-failed-to-construct-audiocontext-the-number-of-hardwar