angular - 使用 AudioContext 未在 Firebox 中播放音频声音
问题描述
使用 WebAudio API AudioContext。它在 chrome 和播放声音中工作正常。但它没有在Firefox中播放声音,在播放音频栏中显示图标。
// console.log("this.audioContext.state", this.audioContext.state);
//create buffer source node which is used to play a sound one time
const bufferSourceNode = this.audioContext.createBufferSource();
// bufferSourceNode.channelCount = 1;
// bufferSourceNode.channelCountMode
console.log('Created buffer source node');
//set buffer to one of the loaded sounds;
bufferSourceNode.buffer = sound;
//connect to output
bufferSourceNode.connect(this.audioContext.destination);
//play the sound
bufferSourceNode.start();
//stop the sound
// bufferSourceNode.stop(this.audioContext.currentTime + 0.5);
//end the sound
bufferSourceNode.onended = () => {
console.log("onended");
}
解决方案
推荐阅读
- discord - 如何在 discord.js 的 v12 中修复我的成员数
- sql - 经典 Asp - ADO 子例程未正确调用
- swift - 使用更改项目数更新 ForEach 的问题 - .count 似乎返回错误值
- javascript - 像谷歌地图一样缩放时如何将标记保持在屏幕底部?
- node.js - Hyperledger node.js 无法解析 null
- ios - ReplayKit 广播上传扩展 - 找不到服务
- c - shmat() - 无效参数
- javascript - 使用链式布尔值或三元运算符重新分配变量
- angular - 类型'可观察的
>' 不可分配给类型 'Observable '。输入“承诺” ' 不见了 - html - 网格列开始和结束而不指定开始或结束