1.6.2版本
我发现在CCAudio.js文件里 有个play方法,里面有个不知道干什么用的东西
touchBinded
他会绑定我的touch事件,然后我点击屏幕的时候,时间就重置了
完全不懂这部分代码是干什么用的
望大神帮忙解答
谢谢
代码如下:
proto.play = function () {
if (!this._element) return;
this._bindEnded();
this._element.play();
this.emit('play');
this._state = Audio.State.PLAYING;
if (this._audioType === Audio.Type.DOM && this._element.paused) {
touchPlayList.push({ instance: this, offset: 0, audio: this._element });
}
if (touchBinded) return;
touchBinded = true;
// Listen to the touchstart body event and play the audio when necessary.
cc.game.canvas.addEventListener('touchstart', function () {
var item;
while (item = touchPlayList.pop()) {
item.audio.play(item.offset);
}
});
};