feat: add server-sent events for logging and activity tracking
- Implemented a custom tracing layer (`AppLogLayer`) to capture log events and broadcast them to SSE clients. - Created admin routes for streaming server logs and listing recent activity logs. - Added an activity log repository interface and SQLite implementation for persisting activity events. - Integrated activity logging into user authentication and channel CRUD operations. - Developed frontend components for displaying server logs and activity logs in the admin panel. - Enhanced the video player with a stats overlay for monitoring streaming metrics.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { forwardRef, useEffect, useRef, useState } from "react";
|
||||
import Hls from "hls.js";
|
||||
import { Loader2 } from "lucide-react";
|
||||
import type { CurrentBroadcastResponse } from "@/lib/types";
|
||||
import { StatsPanel } from "./stats-panel";
|
||||
|
||||
export interface SubtitleTrack {
|
||||
id: number;
|
||||
@@ -19,6 +21,10 @@ interface VideoPlayerProps {
|
||||
muted?: boolean;
|
||||
/** Force direct-file mode (skips hls.js even for .m3u8 URLs). */
|
||||
streamingProtocol?: "hls" | "direct_file";
|
||||
/** When true, renders the Stats for Nerds overlay. */
|
||||
showStats?: boolean;
|
||||
/** Current broadcast data passed to the stats panel for slot timing. */
|
||||
broadcast?: CurrentBroadcastResponse | null;
|
||||
onStreamError?: () => void;
|
||||
onSubtitleTracksChange?: (tracks: SubtitleTrack[]) => void;
|
||||
/** Called when the browser blocks autoplay and user interaction is required. */
|
||||
@@ -37,6 +43,8 @@ const VideoPlayer = forwardRef<HTMLVideoElement, VideoPlayerProps>(
|
||||
subtitleTrack = -1,
|
||||
muted = false,
|
||||
streamingProtocol,
|
||||
showStats = false,
|
||||
broadcast,
|
||||
onStreamError,
|
||||
onSubtitleTracksChange,
|
||||
onNeedsInteraction,
|
||||
@@ -162,6 +170,16 @@ const VideoPlayer = forwardRef<HTMLVideoElement, VideoPlayerProps>(
|
||||
<Loader2 className="h-10 w-10 animate-spin text-zinc-500" />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Stats for Nerds overlay */}
|
||||
{showStats && (
|
||||
<StatsPanel
|
||||
videoRef={internalRef}
|
||||
hlsRef={hlsRef}
|
||||
streamingProtocol={streamingProtocol}
|
||||
broadcast={broadcast}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user