Something went wrong. Try again.
experiments of a tiny cytube-like player with yt-dlp
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182/// Shared types matching the backend's serialized state.
export interface TrackState { id: string; hash: string; title: string; url: string; duration: string; thumbnail: string | null; started_at: number;}
export interface QueueSummary { id: string; hash: string; title: string; url: string; duration: string; thumbnail: string | null; pending?: boolean;}
export interface HistoryEntry { id: string; hash: string; title: string; url: string; duration: string; thumbnail: string | null; played_at: string;}
export interface PlaylistEntry { id: string; url: string; title: string; duration: string; thumbnail: string | null; source: string; added_by: string | null; added_at: string; pending: boolean; /** None = ok, Some(reason) = download failed for this URL. */ failed: string | null;}
export interface RoomState { room_name: string; current_track: TrackState | null; queue: QueueSummary[]; history: HistoryEntry[]; playlist: PlaylistEntry[]; /// When true, idle rooms draw from the playlist. autoplay_enabled: boolean; /// Vote-skip threshold as an integer 0..=100 percent. skip_threshold: number; /// Number of clients that have cast a skip vote on the current track. skip_votes: number; clients: number;}
export interface ChatMessage { id: string; user_name: string; content: string; msg_type: string; created_at: string;}
/// Client → server WebSocket message types.export type ClientMessage = | { type: "chat"; content: string } | { type: "skip" } | { type: "track_ended"; item_id: string } | { type: "set_autoplay"; enabled: boolean } | { type: "set_skip_threshold"; percent: number } | { type: "vote_skip" } | { type: "ping" } | { type: "move_queue_item"; from: number; to: number } | { type: "shuffle_queue" } | { type: "remove_queue_item"; item_id: string };