(Web Audio API) Oscillator node error: cannot call start more than once

前端 未结 3 688
故里飘歌
故里飘歌 2020-12-15 17:16

When I start my oscillator, stop it, and then start it again; I get the following error:

Uncaught InvalidStateError: Failed to execute \'start\' on \'Oscillat         


        
3条回答
  •  再見小時候
    2020-12-15 17:51

    The best solution I've found so far is to keep the SAME audioContext while recreating the oscillator every time you need to use it.

    http://jsfiddle.net/xbqbzgt2/3/

    FYI You can only create 6 audioContext objects per browser page lifespan (or at least per my hardware):

    Uncaught NotSupportedError: Failed to construct 'AudioContext': The number of hardware contexts provided (6) is greater than or equal to the maximum bound (6).
    

提交回复
热议问题