Chromeless Player
Dynamic import of the THEO chromeless bundle keeps SSR safe; the hook mounts one player instance per container and swaps sources without tearing down the SDK.
This workspace ships both Shaka Player and THEOplayer (Chromeless) hooks from @/shared. Use useTheoPlayer when you need THEO’s unified pipeline (HLS/DASH/DRM), network interceptors, optional THEOlive / cast / analytics integrations via playerConfiguration, and commercial SDK features — alongside the same LiveBarn URL + token model as the Shaka path.
Pushes a fresh access token + user id into the running AuthService. Persisted to localStorage so it survives page refresh. Not for production end-users — XSS-exposed; use a server-side cookie + the bundled API proxy instead.
Dynamic import of the THEO chromeless bundle keeps SSR safe; the hook mounts one player instance per container and swaps sources without tearing down the SDK.
Video renditions (target quality), audio languages/roles, and text tracks surface the same UI model as Shaka — representation changes feed bitrate analytics.
buildTheoContentProtection maps license URLs (and FairPlay certificate) onto THEO’s DRMConfiguration for each TypedSource.
Bearer or Akamai tokens attach via addRequestInterceptor — aligned with LiveBarn’s X-LB-* header requirements.
DynamicConfigService tuning maps onto THEO abr.targetBuffer and buffer lookback; BufferManagementService still reacts to rebuffers.
Pass playerConfiguration for vendor integrations (cast, THEOlive, retry policies) without forking the hook.
Mount an empty container ref; THEO injects the <video>. Pass license / library location via props or NEXT_PUBLIC_* env vars.
const containerRef = useRef<HTMLDivElement>(null);
const {
isReady, error, qualities,
selectQuality, audioTracks, textTracks,
selectAudioTrack, selectTextTrack,
} = useTheoPlayer({
containerRef,
source: streamSource,
telemetry,
playerConfiguration: {
// THEOlive, retry, cast, …
},
});
return <div ref={containerRef} className="aspect-video w-full" />;Map the same StreamSource.drm shape to THEO contentProtection; merge auth headers on every manifest/segment request through player.network.
import {
buildTheoContentProtection,
useTheoPlayer,
} from "@/shared";
// Source uses LiveBarn URL + optional drm / requestHeaders.
// Buffer tuning follows DynamicConfigService like useShakaPlayer.THEO requires a valid commercial license and worker assets for HLS (libraryLocation, often /theoplayer/ under public/). Pair with the same LiveBarn bearer flow as the rest of this app.
NEXT_PUBLIC_THEO_LICENSE or NEXT_PUBLIC_THEO_LICENSE_URL, optional NEXT_PUBLIC_THEO_LIBRARY_LOCATIONuseTheoPlayer exposes the same quality / audio / text track state shape as useShakaPlayer for shared controls.