Uncaught DOMException: Failed to construct 'AudioContext': The number of hardware contexts provided (6)

北城余情 提交于 2019-12-12 06:07:02

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!