mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-03-11 17:45:38 +00:00
fix(player): prevent Up Next fallback from triggering early when outro exists
This commit is contained in:
parent
3a8ec97a7b
commit
f90bbea1bb
1 changed files with 8 additions and 9 deletions
|
|
@ -80,17 +80,16 @@ const UpNextButton: React.FC<UpNextButtonProps> = ({
|
|||
const shouldShow = useMemo(() => {
|
||||
if (!nextEpisode || duration <= 0) return false;
|
||||
|
||||
// 1. Check for Outro-based trigger
|
||||
if (outroSegment) {
|
||||
const timeRemainingAtOutroEnd = duration - outroSegment.endTime;
|
||||
// Only trigger if the outro ends within the last 5 minutes (300s)
|
||||
// This prevents mid-episode "fake" outros from triggering it too early
|
||||
if (timeRemainingAtOutroEnd < 300 && currentTime >= outroSegment.endTime) {
|
||||
return true;
|
||||
}
|
||||
// 1. Determine if we have a valid ending outro (within last 5 mins)
|
||||
const hasValidEndingOutro = outroSegment && (duration - outroSegment.endTime < 300);
|
||||
|
||||
if (hasValidEndingOutro) {
|
||||
// If we have a valid outro, ONLY show after it finishes
|
||||
// This prevents the 60s fallback from "jumping the gun"
|
||||
return currentTime >= outroSegment.endTime;
|
||||
}
|
||||
|
||||
// 2. Standard Fallback (60s remaining)
|
||||
// 2. Standard Fallback (only if no valid ending outro was found)
|
||||
const timeRemaining = duration - currentTime;
|
||||
return timeRemaining < 61 && timeRemaining > 0;
|
||||
}, [nextEpisode, duration, currentTime, outroSegment]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue