fix: stop autoplay after final episode

This commit is contained in:
2026-04-18 23:48:33 +02:00
parent ed73400b83
commit e336e2aa40
3 changed files with 8 additions and 0 deletions

View File

@@ -48,6 +48,7 @@ const initPlayer = (): void => {
const streamURL = container.getAttribute('data-stream-url') || '/watch/proxy/stream'
const currentEpisode = container.getAttribute('data-current-episode') || '1'
const malID = Number.parseInt(container.getAttribute('data-mal-id') || '', 10)
const totalEpisodes = Number.parseInt(container.getAttribute('data-total-episodes') || '0', 10)
const startTimeSeconds = Number.parseFloat(container.getAttribute('data-start-time-seconds') || '0')
const modeSources = JSON.parse(container.getAttribute('data-mode-sources') || '{}')
const availableModes = JSON.parse(container.getAttribute('data-available-modes') || '[]')
@@ -603,6 +604,10 @@ const initPlayer = (): void => {
const currentEpisode = Number.parseInt(pathParts[3], 10)
if (Number.isNaN(currentEpisode)) return
if (Number.isInteger(totalEpisodes) && totalEpisodes > 0 && currentEpisode >= totalEpisodes) {
return
}
const nextEpisode = currentEpisode + 1
markEpisodeTransition(nextEpisode)
const nextUrl = `/watch/${animeID}/${nextEpisode}`