feat: Implement video play count tracking, refactor user update API, add missing CMS delete functions, and update database transaction handling.

This commit is contained in:
2026-01-16 13:43:58 -03:00
parent 2dffbd8b71
commit 42976236b3
11 changed files with 138 additions and 39 deletions
@@ -11,11 +11,13 @@ interface MediaPlayerProps {
config?: {
maxPlays?: number;
};
initialPlayCount?: number;
onTimeUpdate?: (time: number) => void;
onPlay?: () => void;
}
export default function MediaPlayer({ id, title, url, media_type, config, onTimeUpdate }: MediaPlayerProps) {
const [playCount, setPlayCount] = useState(0);
export default function MediaPlayer({ id, title, url, media_type, config, initialPlayCount, onTimeUpdate, onPlay }: MediaPlayerProps) {
const [playCount, setPlayCount] = useState(initialPlayCount || 0);
const [hasStarted, setHasStarted] = useState(false);
const [locked, setLocked] = useState(false);
@@ -44,6 +46,7 @@ export default function MediaPlayer({ id, title, url, media_type, config, onTime
if (!hasStarted) {
setPlayCount(prev => prev + 1);
setHasStarted(true);
if (onPlay) onPlay();
}
};