|
@@ -50,6 +50,7 @@ async function initDefaultAudio() {
|
|
|
[currentAudio, currentScene],
|
|
|
([val, ns], [_, os]) => {
|
|
|
const oldValue = currentAudioTemp.value;
|
|
|
+ const isSwitch = os && ns.sceneCode !== os.sceneCode;
|
|
|
const newValue = unref(val).url;
|
|
|
const isSame = newValue === oldValue;
|
|
|
console.log("audio-isSame", isSame);
|
|
@@ -64,7 +65,7 @@ async function initDefaultAudio() {
|
|
|
currentAudioTemp.value = newValue;
|
|
|
} else {
|
|
|
//相同URL的再次播放
|
|
|
- const isSwitch = ns.sceneCode !== os.sceneCode;
|
|
|
+
|
|
|
if (unref(currentPlayer).isPlaying) {
|
|
|
console.log("相同URL切换时在播放", isSwitch);
|
|
|
unref(currentPlayer).resume();
|
|
@@ -77,8 +78,13 @@ async function initDefaultAudio() {
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- console.log("为空暂时");
|
|
|
- unref(currentPlayer) && unref(currentPlayer).stop();
|
|
|
+ console.log("为空暂时", isSwitch);
|
|
|
+ if (unref(currentPlayer)) {
|
|
|
+ unref(currentPlayer).stop();
|
|
|
+ }
|
|
|
+ if (isSwitch) {
|
|
|
+ currentPlayer.value = null;
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
{
|