|
@@ -34,42 +34,64 @@ const isShowCover = computed(
|
|
|
() => metadata.value.coverInfo?.isShowCover || false
|
|
|
);
|
|
|
|
|
|
-const setExplanation = () => {
|
|
|
+const setExplanation = (from) => {
|
|
|
if (
|
|
|
"explanation" in currentScene.value &&
|
|
|
"audioUrl" in currentScene.value.explanation
|
|
|
) {
|
|
|
+ console.log("设置解说", from);
|
|
|
let { audioUrl, openByDefault, repeat } = currentScene.value.explanation;
|
|
|
+ // showCommentaryPlaying.value = false;
|
|
|
store.commit("functions/setCommentaryUrl", {
|
|
|
src: audioUrl,
|
|
|
loop: repeat,
|
|
|
openByDefault: openByDefault,
|
|
|
});
|
|
|
-
|
|
|
useSoundPlayer.player.isLock = false;
|
|
|
useSoundPlayer.player.watchPlay();
|
|
|
}
|
|
|
};
|
|
|
-const resetExplanation = () => {
|
|
|
+const stopExplanation = (from) => {
|
|
|
+ console.log("stop解说", from);
|
|
|
+ useSoundPlayer.player.isLock = true;
|
|
|
+ soundPlayer.paused();
|
|
|
+ setTimeout(() => soundPlayer.paused(), 100);
|
|
|
+};
|
|
|
+const resumeExplanation = () => {
|
|
|
+ console.log("resume解说");
|
|
|
+ useSoundPlayer.player.isLock = false;
|
|
|
+ useSoundPlayer.player.watchPlay();
|
|
|
+};
|
|
|
+const resetExplanation = (from) => {
|
|
|
+ console.log("清空解说", from);
|
|
|
store.commit("functions/setCommentaryUrl", "");
|
|
|
useSoundPlayer.player.isLock = true;
|
|
|
- soundPlayer.pause();
|
|
|
+ soundPlayer.paused();
|
|
|
};
|
|
|
watch([isShowCover, isDoneforCover], (val) => {
|
|
|
if (val[0] && val[1]) {
|
|
|
- setExplanation();
|
|
|
+ resumeExplanation(2);
|
|
|
+ }
|
|
|
+ if (val[0] && !val[1]) {
|
|
|
+ stopExplanation(2);
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
watchEffect(() => {
|
|
|
if (currentScene.value.explanation) {
|
|
|
let { audioUrl } = currentScene.value.explanation;
|
|
|
- if (audioUrl && !unref(isShowCover)) {
|
|
|
- setExplanation();
|
|
|
+
|
|
|
+ if (audioUrl) {
|
|
|
+ //解说有变,初始化按钮状态
|
|
|
+ setExplanation(1);
|
|
|
+ if (unref(isShowCover)) {
|
|
|
+ stopExplanation(1);
|
|
|
+ }
|
|
|
} else {
|
|
|
- resetExplanation();
|
|
|
+ resetExplanation(1);
|
|
|
}
|
|
|
} else {
|
|
|
- resetExplanation();
|
|
|
+ resetExplanation(2);
|
|
|
}
|
|
|
});
|
|
|
</script>
|