(url: string)
| 52 | /** The cast's own duration: timestamp of its last event (the file is local |
| 53 | * and line-delimited, cheaper and more deterministic than player events). */ |
| 54 | const fetchCastDuration = async (url: string): Promise<number> => { |
| 55 | const text = await fetch(url).then((r) => r.text()); |
| 56 | const last = text.trimEnd().split("\n").at(-1); |
| 57 | if (!last || last.startsWith("{")) return 0; |
| 58 | return (JSON.parse(last) as [number])[0] ?? 0; |
| 59 | }; |
| 60 | |
| 61 | export const SessionPlayer = ({ |
| 62 | castUrl, |
no test coverage detected