解决方法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
function playsound(sound:egret.Sound,loop:boolean= false){
if(sound == null){
console.log('sound err')
return;
}
var times = loop?0:1;
if(typeof WeixinJSBridge != 'undefined'){
WeixinJSBridge.invoke('getNetworkType', {}, function (e) {
return sound.play(0,times);
});
}else{
return sound.play(0,times);
}
}

方法原理

因为IOS有个先交互再播放声音的要求,而微信上借助WeixinJSBridge 可以做很多事情,通过他播放声音即可