相关疑难解决方法(0)

获取用户音频时的 Google Chrome Javascript 问题 - 不允许启动 AudioContext

我有这个 Javascript 代码,当用户点击麦克风按钮时,我用它来捕获用户的音频输入。此代码适用于 Mozila Firefox,但当我在 Google Chrome 中使用它时,它不起作用并在控制台中显示此警告/错误 -The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page.

var r = function() {
            var e = {}
              , t = void 0
              , n = getBotConfig()
              , r = new Audio("data:audio/wav;base64,")
              , o = !1;
            if (!n.isIE()) {
                window.AudioContext = window.AudioContext || window.webkitAudioContext;
                var i = new AudioContext;
                e.toggleRecording = function(e, t, n, r, s, a, c) {
                    e.classList.contains("recording") …
Run Code Online (Sandbox Code Playgroud)

javascript google-chrome audiocontext

11
推荐指数
2
解决办法
3万
查看次数

标签 统计

audiocontext ×1

google-chrome ×1

javascript ×1