How it works
Thenew BeyondWords.Player(...) call returns a player instance—a reactive object whose properties you can read and write. Changes take effect immediately (for example, setting player.backgroundColor = "red" updates the UI).
You can also retrieve existing instances if the player was initialized elsewhere (for example via an embed script added by a CMS plugin).
Get a player instance
At initialization:BeyondWords.Player.instances() returns an array of all initialized player instances on the page. BeyondWords is available on the global window object when using the embed script.
Control playback and state
Read and write properties on the player instance:How overrides work
Settings can come from three places, in this order of precedence for initialization:- Player API—defaults fetched using your
projectIdand content identifiers - Initialization code—properties passed to
new BeyondWords.Player({ ... })or the embed scriptonloadhandler - Runtime SDK calls—property changes made after the player has loaded
- Runtime changes (step 3) are reset
- Initialization overrides (step 2) persist
Top-level methods
Useful static methods and instance helpers:destroy() or destroyAll() on single-page apps when the player is no longer needed—for example when navigating away or unmounting a component.
Native SDKs
On iOS and Android, the nativePlayerView wraps the same JavaScript player. Use the setter methods on PlayerView (for example setPlayerStyle, setBackgroundColor) or access the underlying player instance for full control. See the iOS and Android SDK guides.
FAQs
How do I control a player installed by my CMS plugin?
How do I control a player installed by my CMS plugin?
Use
BeyondWords.Player.instances()[0] once the page has loaded. If you have multiple players, filter by checking each instance’s target or content identifiers.Will my runtime changes persist after content reloads?
Will my runtime changes persist after content reloads?
No—runtime property changes are reset when identifiers change and a new API request is made. To persist overrides across reloads, include them in the player initializer.
How do I listen for playback events?
How do I listen for playback events?
Register listeners with
player.addEventListener(...). See player events for available event types and cleanup patterns.Can I control the player from server-side code?
Can I control the player from server-side code?
No—programmatic control runs in the browser or native app. Server-side code can configure content and player settings via the API, but playback control requires the client-side SDK.