Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions frontend/src/components/video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,16 @@ export default function Video({ URL, startTime, nextItemId, endTime, points, ano
// Prevent playing if current time is at or beyond endTime
if (endTimeSeconds > 0 && currentTime >= endTimeSeconds) {
return;
}else{
player.playVideo();
}
// Block resuming if any proctoring anomalies or gesture prompts are active
if (pauseVid || rewindVid || doGesture) {
console.log("🔒 Play blocked: Anomaly or gesture prompt active");
return;
}
player.playVideo();
setTimeout(() => { playerRef.current?.setPlaybackRate?.(playbackRate); }, 50);
}
}, [playing, endTimeSeconds, currentTime, isSkipping, isStopFailed, isStopping, playbackRate]);
}, [playing, endTimeSeconds, currentTime, isSkipping, isStopFailed, isStopping, playbackRate, pauseVid, rewindVid, doGesture]);

const handleBackward = () => {
const player = playerRef.current;
Expand Down Expand Up @@ -989,6 +993,10 @@ export default function Video({ URL, startTime, nextItemId, endTime, points, ano
if (rawEvent.code === 'Space') {
rawEvent.preventDefault();
rawEvent.stopImmediatePropagation();
if (rawEvent.repeat) {
// Ignore held down spacebar to prevent rapid play/pause bypass
return;
}
handlePlayPause();
return;
}
Expand Down Expand Up @@ -1355,6 +1363,10 @@ export default function Video({ URL, startTime, nextItemId, endTime, points, ano

className='shadow-2xl'

onClick={(e) => e.stopPropagation()}

onMouseDown={(e) => e.stopPropagation()}

style={{

position: 'absolute',
Expand Down Expand Up @@ -2095,6 +2107,8 @@ export function NavigatingOverlay({
return (
<div
className={`absolute z-50 animate-in slide-in-from-right-3 duration-300 ${positionClasses[position]}`}
onClick={(e) => e.stopPropagation()}
onMouseDown={(e) => e.stopPropagation()}
>
<Card className={`shadow-lg backdrop-blur-md ${styles.card}`}>
<CardContent className="flex items-center gap-3 px-4 py-3">
Expand Down Expand Up @@ -2152,6 +2166,8 @@ export function ConfirmOverlay({
return (
<div
className={`absolute z-50 animate-in slide-in-from-right-3 duration-300 ${positionClasses[position]}`}
onClick={(e) => e.stopPropagation()}
onMouseDown={(e) => e.stopPropagation()}
>
<Card className={`border-red-400/40 ${message === "Invalid watch time" ? "bg-yellow-600/95": "bg-red-600/95"} text-red-50 shadow-lg backdrop-blur-md w-80`}>
<CardContent className="flex flex-col gap-3 p-4">
Expand Down
Loading