Web Audio API没有声音播放 [英] Web Audio API no sound playing
问题描述
我试图进入Web Audio API,因为我正在根据正在播放的音乐制作一些可视化。然而,我发现的所有例子,就像音频被静音。它播放的文件,但没有声音。
例如:codepen.io/noeldelgado/pen/jqibm
即使在此之后 - https://www.youtube.com/watch?v=IBHpSkGZtNM产生相同的结果。
我在Mac上使用最新版本的Chrome(42.0.2311.90),也在最新的Firefox上尝试过,它也是同样的问题。
这是createMediaElementSource中的一个跨源访问问题,它存在于Chrome 42中。您需要为ogg设置适当的标头文件并设置crossOrigin属性。否则,你根本没有音频输出。
I'm trying to get into the Web Audio API as I'm looking to make some visualizations based on the music that's playing. However all examples I have found, it's like the audio is muted. It plays the file but there's no sound.
For example: codepen.io/noeldelgado/pen/jqibm
Even following this - https://www.youtube.com/watch?v=IBHpSkGZtNM yields same result.
I'm on mac, using the latest version of Chrome (42.0.2311.90), have also tried on latest Firefox and it's the same problem.
It's a cross-origin access issue in createMediaElementSource that landed in Chrome 42. You need to setup the appropriate headers for the ogg files and set the crossOrigin attribute. Otherwise you get no audio output at all.
这篇关于Web Audio API没有声音播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!