-
Creator 版本:2.4.6
-
目标平台:vivo小游戏
-
重现方式:下方demo构建vivo小游戏,首次安装后连续点击屏幕,声音重叠。
-
首个报错:无
-
之前哪个版本是正常的:
-
手机型号:
-
手机浏览器:
-
编辑器 操作系统:macOS 12.1
-
重现概率:
vivo-audio-demo.zip (1.1 MB)
代码片段:
private _clipList = ['1020101003', '1020101006', '1020101008', '1020101010'];
private _playIdx = 0;
private _playing?;
private _playingname?;
onScreenClicked() {
if (this._playing) {
this._playing.stop();
}
const clipName = this._clipList[this._playIdx];
this._playingname = clipName;
this.playAudio(clipName);
this._playIdx++;
if (this._playIdx >= this._clipList.length) {
this._playIdx = 0;
}
}
playAudio(name:string) {
cc.resources.load(name, cc.AudioClip, (err, clip) => {
if (err) {
console.error(err);
return;
}
if (this._playingname != name) {
return;
}
this._playing = qg.createInnerAudioContext();
this._playing.src = clip._nativeAsset.src;
this._playing.loop = false;
this._playing.volume = 1;
this._playing.play();
});
}




