Closed liaokaime closed 3 years ago
当我使用如下代码,5秒钟后,a的播放会停止,a与b属于两个不同的实例,但它们之间却会互相干扰,如何使得它们互相不干扰?
let a = new Sound(this.url,Sound.MAIN_BUNDLE,(e)=>{ a.play(); }); let b = new Sound(this.url,Sound.MAIN_BUNDLE,(e)=>{ setTimeout(()=>{b.pause()},5000); });
我的试过另一种写法,它们不会互相干扰,为什么?
let a = new Sound(this.url,Sound.MAIN_BUNDLE,(e)=>{
a.play();
let b = new Sound(this.url,Sound.MAIN_BUNDLE,(e)=>{
setTimeout(()=>{b.play()},5000);
});
});
Anybody know why?
如果您需要帮助,请用英文写
When I use the following code, after 5 seconds, the play of a will stop, a and b belong to two different instances, but they will interfere with each other, how to make them do not interfere with each other?
let a = new Sound(this.url,Sound.MAIN_BUNDLE,(e)=>{
a.play();
});
let b = new Sound(this.url,Sound.MAIN_BUNDLE,(e)=>{
setTimeout(()=>{b.pause()},5000);
});
Thank you for your reminding. I used English to describe the problem.
当我使用如下代码,5秒钟后,a的播放会停止,a与b属于两个不同的实例,但它们之间却会互相干扰,如何使得它们互相不干扰?