remove "smart" skip detection

It really wasnt smart. Just report the skip time from the APIs
This commit is contained in:
Pas 2026-01-07 15:38:36 -07:00
parent 4024aecd40
commit 445fd373c1
2 changed files with 6 additions and 85 deletions

View file

@ -29,33 +29,8 @@ interface SkipTrackingResult {
}
/**
* Calculate confidence score for automatic skip detection
* Based on skip duration and timing within the video
*/
function calculateSkipConfidence(
skipDuration: number,
startTime: number,
duration: number,
): number {
// Duration confidence: longer skips are more confident
// 20s = 0.4, 40s = 0.6, 60s+ = 0.85
const durationConfidence = Math.min(0.85, 0.4 + (skipDuration - 20) * 0.01);
// Timing confidence: earlier skips are more confident
// Start time as percentage of total duration
const startPercentage = startTime / duration;
// Higher confidence for earlier starts (0% = 1.0, 20% = 0.8)
const timingConfidence = Math.max(0.7, 1.0 - startPercentage * 0.75);
// Combine factors (weighted average)
return durationConfidence * 0.6 + timingConfidence * 0.4;
}
/**
* Hook that tracks rapid skipping sessions where users accumulate 20+ seconds of forward
* movement within a 5-second window. Sessions continue until 8 seconds pass without
* any forward movement, then report the total skip distance. Ignores skips that start
* after 20% of video duration (unlikely to be intro skipping).
* Hook that tracks manual skip events and monitors user behavior patterns for confidence adjustment.
* Only processes skip events added via addSkipEvent (e.g., from skip intro button).
*
* @param minSkipThreshold Minimum total forward movement in 5-second window to start session (default: 20)
* @param maxHistory Maximum number of skip events to keep in history (default: 50)
@ -74,7 +49,6 @@ export function useSkipTracking(
// Get current player state
const progress = usePlayerStore((s) => s.progress);
const meta = usePlayerStore((s) => s.meta);
const duration = progress.duration;
const clearHistory = useCallback(() => {
setSkipHistory([]);
@ -149,60 +123,7 @@ export function useSkipTracking(
);
if (isInSkipSessionRef.current && recentEntries.length === 0) {
// Ignore skips that start after 20% of video duration (likely not intro skipping)
const twentyPercentMark = duration * 0.2;
if (skipSessionStartRef.current > twentyPercentMark) {
// Reset session state without creating event
isInSkipSessionRef.current = false;
skipSessionStartRef.current = 0;
sessionTotalRef.current = 0;
skipWindowRef.current = [];
return;
}
// Only report skips where end time is greater than start time
if (currentTime <= skipSessionStartRef.current) {
// Reset session state without creating event
isInSkipSessionRef.current = false;
skipSessionStartRef.current = 0;
sessionTotalRef.current = 0;
skipWindowRef.current = [];
return;
}
// Create skip event for completed session
const skipEvent: SkipEvent = {
startTime: skipSessionStartRef.current,
endTime: currentTime,
skipDuration: sessionTotalRef.current,
timestamp: now,
confidence: calculateSkipConfidence(
sessionTotalRef.current,
skipSessionStartRef.current,
duration,
),
meta: meta
? {
title:
meta.type === "show" && meta.episode
? `${meta.title} - S${meta.season?.number || 0}E${meta.episode.number || 0}`
: meta.title,
type: meta.type === "movie" ? "Movie" : "TV Show",
tmdbId: meta.tmdbId,
seasonNumber: meta.season?.number,
episodeNumber: meta.episode?.number,
}
: undefined,
};
setSkipHistory((prev) => {
const newHistory = [...prev, skipEvent];
return newHistory.length > maxHistory
? newHistory.slice(newHistory.length - maxHistory)
: newHistory;
});
// Reset session state
// Session ended - reset state but DON'T create skip event
isInSkipSessionRef.current = false;
skipSessionStartRef.current = 0;
sessionTotalRef.current = 0;
@ -210,7 +131,7 @@ export function useSkipTracking(
}
previousTimeRef.current = currentTime;
}, [progress.time, duration, meta, minSkipThreshold, maxHistory]);
}, [progress.time, minSkipThreshold]);
useEffect(() => {
// Monitor time changes every 100ms to catch rapid skipping

View file

@ -82,13 +82,13 @@ export function SkipTracker() {
return {
skip,
originalConfidence: skip.confidence,
startTime: progress.time,
startTime: skip.startTime,
endTime: skip.endTime,
hasBackwardMovement: false,
timer,
};
},
[progress.time, sendSkipAnalytics],
[sendSkipAnalytics],
);
useEffect(() => {