gpt4 book ai didi

html5-audio - Web Audio API 和

转载 作者:行者123 更新时间:2023-12-05 06:44:23 28 4
gpt4 key购买 nike

我在让 html5 标签与 Web Audio API .createMediaElementSource() 方法配合使用时遇到问题。请参阅下面的 jsFiddle/代码。任何想法这里出了什么问题将不胜感激。

我读了here这是 FireFox 中的一个问题,但是 a) 我在 Chrome 中工作,b) 如果 .mp3 与 .html 位于同一文件夹中,则它不起作用。

如果有人有任何建议,这里的最终目标是使用创建一个网站来过滤来自 SoundCloud API 的轨道。

http://jsfiddle.net/6v9jkcn1/

js:

$(function(){
//create audio context
var context = new AudioContext();

//set variable pointing at the audiotag
var audio = document.getElementById('player');

//declare source that will become the media element source, create gain and filter, and connect them
var source;
var gain = context.createGain();
var filter = context.createBiquadFilter();

//routing
gain.connect(filter);
filter.connect(context.destination);
filter.frequency.value = 220;

//when the audio has sufficiently loaded, create media element source and connect it to the gain
audio.oncanplaythrough = function(){

source = context.createMediaElementSource(audio);

source.connect(gain);
};
});

HTML:

<audio id='player' src='http://develiot.com/eqsoundcloud/EttaAnything.mp3' controls></audio>

最佳答案

Chrome 也遵循同源策略,除非您在服务器上启用了 CORS。

关于html5-audio - Web Audio API 和 <audio> 标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29310125/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com