Commit 47a9020c authored by wildfirecode13's avatar wildfirecode13

1

parent fe96b89d
......@@ -22,6 +22,7 @@ class AudioModel {
}
};
const createAudio = opts => {
console.log('createAudio')
const audioInstance = new AudioModel(opts)
return audioInstance;
};
......@@ -30,8 +31,9 @@ let bgs = {
export const playBgMusic = (isOn, src) => {//待测试
for (let k in bgs) {
if (bgs[k].isOn) {
bgs[k].pause();
if (bgs[k] && bgs[k].isOn) {
bgs[k].destroy();
bgs[k]=null;
}
// bgs[k].isOn = false; /// TODO 自己记一个开关,因为淘宝的玩意stop之后虽然听不到,但还是在播放,会触发loop播放和onEnded事件
}
......@@ -78,7 +80,8 @@ export const playBgMusic = (isOn, src) => {//待测试
} else {
if (bgs[key]) {
// bgs[key].pause(); /// pause ,不能用
bgs[key].pause();
bgs[key].destroy();
bgs[k]=null;
// bgs[key].isOn = false; /// TODO 自己记一个开关,因为淘宝的玩意stop之后虽然听不到,但还是在播放,会触发loop播放和onEnded事件
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment