Listening to events

Both Player and Source events can be subscribed to from PlayerView. Currently not all native events are exposed via our React Native SDK - for a complete list of the events currently available, please check EventProps and events.ts.

To register an event callback, just use the name prefixed with on as a PlayerView property, e.g.:

const onReady = useCallback((event: Event) => {
  console.log("Ready event");
}, []);
...

return (
  <PlayerView
    onReady={onReady}
    onMuted={onMuted}
    onPaused={onPaused}
    onPlayerActive={onPlayerActive}
    onSourceLoaded={onSourceLoaded}
    onPlayerError={onPlayerError}
    onSourceError={onSourceError}
    onPlaybackFinished={onPlaybackFinished}
    ...
  />
);