Skip to content

Commit

Permalink
fix restore view progress of next chap
Browse files Browse the repository at this point in the history
  • Loading branch information
tachibana-shin committed Oct 15, 2022
1 parent 88ad6fa commit 62dda26
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/components/BrtPlayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -803,10 +803,12 @@ const setArtCurrentTime = (currentTime: number) => {
video.value.currentTime = currentTime
artCurrentTime.value = currentTime
}
let disableBackupProgressViewing = false
watch(
() => props.currentChap,
async (currentChap) => {
if (currentChap) {
disableBackupProgressViewing = true
setArtCurrentTime(0)
if (!authStore.user_data) return
Expand All @@ -824,6 +826,7 @@ watch(
setArtCurrentTime(cur)
addNotice(`Đã khôi phục phiên xem trước ${parseTime(cur)}`)
}
disableBackupProgressViewing = false
}
},
{ immediate: true }
Expand Down Expand Up @@ -976,6 +979,8 @@ const emit = defineEmits<{
}>()
const saveCurTimeToPer = throttle(async () => {
if (!seasonRefCache) return
if (disableBackupProgressViewing) return
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const chapRef = doc(seasonRefCache, "chaps", props.currentChap!)
Expand Down

0 comments on commit 62dda26

Please sign in to comment.