We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 9371662 + 528043f commit 6418d95Copy full SHA for 6418d95
cocos2d/audio/CCAudio.js
@@ -516,10 +516,16 @@ cc.Audio = cc.Class.extend({
516
return cb(null, loader.cache[url]);
517
518
if(SWA){
519
- var volume = context["createGain"]();
520
- volume["gain"].value = 1;
521
- volume["connect"](context["destination"]);
522
- audio = new cc.Audio(context, volume, realUrl);
+ try{
+ var volume = context["createGain"]();
+ volume["gain"].value = 1;
+ volume["connect"](context["destination"]);
523
+ audio = new cc.Audio(context, volume, realUrl);
524
+ }catch(err){
525
+ SWA = false;
526
+ cc.log("browser don't support webAudio");
527
+ audio = new cc.Audio(null, null, realUrl);
528
+ }
529
}else{
530
audio = new cc.Audio(null, null, realUrl);
531
}
0 commit comments