Add WebRTC playback support: implement WebRTCPlayer component, update schema, database, playback types, and API endpoints to handle webrtc_url field and streaming logic

This commit is contained in:
Nikita
2025-12-21 18:34:06 -08:00
parent b9927d9807
commit 01102c6817
8 changed files with 179 additions and 7 deletions
+1
View File
@@ -14,6 +14,7 @@ export type StreamPageData = {
is_live: boolean
viewer_count: number
hls_url: string | null
webrtc_url: string | null
playback: StreamPlayback | null
thumbnail_url: string | null
started_at: string | null
+7
View File
@@ -5,19 +5,26 @@ export type CloudflareStreamRef = {
export type StreamPlayback =
| { type: "cloudflare"; uid: string; customerCode?: string }
| { type: "webrtc"; url: string }
| { type: "hls"; url: string }
type PlaybackInput = {
hlsUrl?: string | null
webrtcUrl?: string | null
cloudflareUid?: string | null
cloudflareCustomerCode?: string | null
}
export function resolveStreamPlayback({
hlsUrl,
webrtcUrl,
cloudflareUid,
cloudflareCustomerCode,
}: PlaybackInput): StreamPlayback | null {
if (webrtcUrl) {
return { type: "webrtc", url: webrtcUrl }
}
if (cloudflareUid) {
return {
type: "cloudflare",