Seb*_*nne 2 javascript internet-explorer soundmanager2 html5-audio web-audio-api
我是html中的音频新手.我找到了一些小javascript游戏的好例子.我想尝试在Internet Explorer中加载游戏,我得到:"此浏览器不支持Web api音频".
我找到了这个网站:http://caniuse.com/#feat=audio-api ,看起来像Internet Explorer不支持它.
我发现SoundManager 2似乎适用于所有浏览器.
我的问题是,有没有办法检测浏览器是否支持WebApiAudio,如果不支持则提供回退?
我希望能够在所有不同的浏览器上提供相同的功能,但我不知道如何在这一点上做到这一点.
一个不错的功能是能够同时播放多种声音,并具有可调音量(如爆炸).
我想创建一个helloworld,我可以在PC,Mac,Android和Ipad上运行.可能吗 ?
非常感谢我的多个问题.
我查看这个演示:http://www.cocos2d-x.org/wiki/MoonWarriors_-_Cocos2d-JS_Showcase 声音在Firefox中运行良好,但在Internet Explorer中只有音乐,而不是声音效果
我的问题是,有没有办法检测浏览器是否支持WebApiAudio,如果不支持则提供回退?
"use strict"
function audioContextCheck() {
if (typeof AudioContext !== "undefined") {
return new AudioContext();
} else if (typeof webkitAudioContext !== "undefined") {
return new webkitAudioContext();
} else if (typeof mozAudioContext !== "undefined") {
return new mozAudioContext();
} else {
// Do stuff with soundmanager or something else if Web Audio API is not supported
}
}
var audioContext = audioContextCheck();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7673 次 |
| 最近记录: |