Skip to content

Live streams · Modules

2 modules · 8 exports · 1 repository · 0 e2e tests · 0 routes

Who imports who · hover a node
Depends onLive streams modulesUsed byLiveStream6 exportsStreamAccountInput2 exp…Loaders1 fileActions1 fileRoutes3 filesComponents6 filesRoutines2 filesOther9 files

LiveStream

app/features/live-streams/core/LiveStream.ts

No overview comment at the top of the file.

Imports
no other modules
Used by
1 loader1 action3 routes6 components2 routines7 other

Types

interface

StreamerStreams

:46

Live streams of one streamer, most viewed first.

export interface StreamerStreams<T> {
	streams: [T, ...T[]];
	viewerCount: number;
}

Functions & values

function

url

:6

Where the stream can be watched: the live video when its id is known, otherwise the channel.

export function url(stream: StreamAccount & { videoId?: string | null })
Unit tests (1)
function

thumbnailSrc

:18

Thumbnail image of a live stream, sized for a stream card.

export function thumbnailSrc(stream: {
	platform: StreamAccount["platform"];
	thumbnailUrl: string;
	videoId: string | null;
})
Unit tests (1)
function

isSameAccount

:41

Whether both point to the same account on the same platform.

export function isSameAccount(a: StreamAccount, b: StreamAccount)
Unit tests (1)
function

groupByStreamer

:52

Groups the streams of a user live on several platforms together, streams of no user (casts) by their account. Most viewed streamer first.

export function groupByStreamer<
	T extends StreamAccount & { userId: number | null; viewerCount: number },
>(streams: T[]): StreamerStreams<T>[]
Unit tests (3)

StreamAccountInput

app/features/live-streams/core/StreamAccountInput.ts

No overview comment at the top of the file.

Imports
no other modules
Used by
3 other

Types

type

ParsedStreamAccountInput

:2

A stream account as typed by the user, YouTube handles still to be resolved to a channel id.

export type ParsedStreamAccountInput =
	| { platform: "TWITCH"; account: string }
	| { platform: "YOUTUBE"; channelId: string }
	| { platform: "YOUTUBE"; handle: string };

Functions & values

function

parse

:17

Parses a Twitch login or channel URL, a YouTube channel URL (/channel/UC…), a YouTube handle URL or an @handle. Twitch logins are lowercased. null when the input is none of these.

export function parse(input: string): ParsedStreamAccountInput | null
Unit tests (2)