JavaScript speechSynthesis.speak() without user activation is no longer allowed since M71

后端 未结 6 1074
失恋的感觉
失恋的感觉 2021-01-11 11:15

I used speechSynthesis API in this way:

speechSynthesis.speak(new SpeechSynthesisUtterance(\"hello world\"));

But right now I get error aft

6条回答
  •  清酒与你
    2021-01-11 11:32

    I resorted to swal("Click OK to speak").then(() => speakButton.click()); (with https://sweetalert.js.org) -- https://patarapolw.github.io/tts-api/?q=你好&lang=zh-CN&rate=0.8

    Note that if (confirm("Click OK to speak")) speakButton.click() doesn't work.

提交回复
热议问题