cc.audioEngine.stop(audioId);
cc.audioEngine.setFinishCallback(audioId,self.onFinishSound);
测试环境 PC win7 chrome
如果你手动去调用 stop某个音效ID,监听函数onFinishSound 会进来4次 ,传参过来的 event.currentTarget.instanceId 都是一样的。
如果是让音效自己停止,监听函数只会进来一次 是正常的。
onFinishSound = function (event) {
if(event.type == “ended”){
var soundId = event.currentTarget.instanceId;
cc.log(“声音停止”+soundId );
}
};