React
A thin React component over <pb-play>, loaded through the same loader as the snippet.
Use it
import { PbPlay, type TPbPlayElement } from '@pb-play/react';
import { useRef } from 'react';
export function Episode() {
const player = useRef<TPbPlayElement | null>(null);
return (
<>
<PbPlay
licenceKey="pbp_live_…"
loader="https://<your delivery host>/sdk/web/index"
onReady={() => console.log('ready')}
onTimeupdate={({ currentTime }) => console.log(currentTime)}
playlist="ply_…"
ref={player}
style={{ aspectRatio: '16 / 9' }}
/>
<button onClick={() => void player.current?.play()}>Play</button>
</>
);
}The component adds the loader's script tag to a container it owns and hands you the element the loader mounts. The player itself is never bundled into your app: licensing, version rollout and the fallback that keeps video playing when our services are unreachable all arrive through the loader, exactly as with the plain snippet.
Props, events and the ref
Props: loader (required — your delivery host's /sdk/web/index), licenceKey, playlist, media, player and start. Changing any of them mounts a fresh player.
Events: on followed by the event's name — onReady, onPlay, onTimeupdate, onError — each with the payload the element's own event carries. A new callback does not reload the video.
The ref is the <pb-play> element itself, with every method on the API reference, or null until the loader has mounted it.
Server rendering
Safe in Next.js and any other server renderer: nothing touches window at import, the server renders an empty container, and the player loads after hydration.