mirror of
https://github.com/linsa-io/linsa.git
synced 2026-01-12 12:20:23 +01:00
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:
@@ -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
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user