/** Where the media can be sought to, on the session's absolute clock (`now` while the element has * no range yet), or null when the element refuses to say. Its own function, outside PlexPlayer: the * React Compiler cannot lower a conditional inside a try yet, and skipped the whole player for it. */ export function seekableEndOf( video: HTMLVideoElement, sessionStart: number, now: number, ): number | null { try { return video.seekable.length ? sessionStart + video.seekable.end(0) : now; } catch { return null; } }