fix: clear old subtitle cues when switching to scene without subtitles
Previously when subtitleUrl became null, the old cues array was retained and would replay from the beginning on the next scene.
This commit is contained in:
@@ -17,7 +17,13 @@ const currentText = ref('')
|
||||
const loadedUrl = ref('')
|
||||
|
||||
watch(() => props.subtitleUrl, async (url) => {
|
||||
if (!url || url === loadedUrl.value) return
|
||||
if (!url) {
|
||||
cues.value = []
|
||||
currentText.value = ''
|
||||
loadedUrl.value = ''
|
||||
return
|
||||
}
|
||||
if (url === loadedUrl.value) return
|
||||
loadedUrl.value = url
|
||||
try {
|
||||
const resp = await fetch(url)
|
||||
|
||||
Reference in New Issue
Block a user