Skip to main content

Installation

Usage

Wrap your UI in PlayerProvider, then read player state with the hooks.

Video

To use a video player, add video: true to the player args.

API

  • PlayerProvider: creates a BeyondWords.Player and provides it via context. args is forwarded to the player constructor.
  • usePlayer(): returns the player instance. Throws if used outside a provider.
  • usePlayerSelector(selector, deps?, options?): subscribes to player events and returns the selected slice of state. It re-renders only when that slice changes (customizable via options.equalityFn).