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

前端 未结 3 686
故里飘歌
故里飘歌 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 18:11

    From what I know, an oscillator can only be played once, for reasons having to do with precision, and never well explained by anyone yet. Whoever decided on this "play only once" model probably would consider it good practice to use a zero-volume setting to insert silence in the middle of a sequence. After all, it really is the only alternative to the disconnect-and-recreate method.

提交回复
热议问题