mirror of
https://github.com/NoCrypt/migu.git
synced 2026-03-11 17:45:32 +00:00
Fix external player anilist completion
This commit is contained in:
parent
95e0274384
commit
1d21f493c3
1 changed files with 4 additions and 1 deletions
|
|
@ -71,6 +71,7 @@
|
|||
let ended = false
|
||||
let volume = Number(localStorage.getItem('volume')) || 1
|
||||
let playbackRate = 1
|
||||
let externalPlayerReady = false
|
||||
$: localStorage.setItem('volume', (volume || 0).toString())
|
||||
$: safeduration = (isFinite(duration) ? duration : currentTime) || 0
|
||||
|
||||
|
|
@ -185,6 +186,7 @@
|
|||
const duration = current.media?.media?.duration
|
||||
client.removeEventListener('externalWatched', watchedListener)
|
||||
watchedListener = ({ detail }) => {
|
||||
externalPlayerReady = true
|
||||
checkCompletionByTime(detail, duration)
|
||||
}
|
||||
client.on('externalWatched', watchedListener)
|
||||
|
|
@ -959,10 +961,11 @@
|
|||
|
||||
function checkCompletionByTime (currentTime, safeduration) {
|
||||
const fromend = Math.max(180, safeduration / 10)
|
||||
if (safeduration && currentTime && video?.readyState && safeduration - fromend < currentTime) {
|
||||
if (safeduration && currentTime && (video?.readyState || externalPlayerReady) && safeduration - fromend < currentTime) {
|
||||
if (media?.media?.episodes || media?.media?.nextAiringEpisode?.episode) {
|
||||
if (media.media.episodes || media.media.nextAiringEpisode?.episode > media.episode) {
|
||||
completed = true
|
||||
externalPlayerReady = false
|
||||
anilistClient.alEntry(media)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue