Skip to main content
After the widget loads, you can control it programmatically: play and pause, seek, change tracks, update properties, and react to state changes. This applies to the JavaScript SDK and to native SDKs, which expose the same underlying API.

Properties

Read and set widget configuration and state.

Events

Listen and respond to widget lifecycle events.

How it works

The new BeyondWords.Player(...) call returns a widget instance, a reactive object whose properties you can read and write. Changes take effect immediately (for example, setting player.theme = "dark" updates the UI). You can also retrieve existing instances if the widget was initialized elsewhere (for example via an embed script added by a CMS plugin).

Get a widget instance

At initialization:
From an existing embed:
BeyondWords.Player.instances() returns an array of all initialized widget 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 widget instance:
The widget is reactive, so the UI updates automatically when you change supported properties.

How overrides work

Settings can come from three places, in this order of precedence for initialization:
  1. Dashboard settings: Your Widget page settings, fetched using your projectId and content identifiers.
  2. Initialization code: Properties passed to new BeyondWords.Player({ ... }) or the embed script onload handler.
  3. Runtime SDK calls: Property changes made after the widget has loaded.
At initialization, embed code properties override API defaults. After load, runtime changes override the current state. If content identifiers change and a new API request is made:
  • Runtime changes (step 3) are reset.
  • Initialization overrides (step 2) persist.
Only include a property in the initializer if you want it to survive content reloads.

Top-level methods

Useful static methods and instance helpers:
Call destroy() or destroyAll() on single-page apps when the widget is no longer needed, e.g., when navigating away or unmounting a component. To keep one widget, and any agent conversation, across routes instead, see page navigation.

Native SDKs

On iOS and Android, the native PlayerView wraps the same JavaScript widget. Use the setter methods on PlayerView (for example setPlayerStyle, setBackgroundColor) or access the underlying widget instance for full control. See the iOS and Android SDK guides.

FAQs

Use BeyondWords.Player.instances()[0] once the page has loaded. If you have multiple widgets, filter by checking each instance’s target or content identifiers.
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 widget initializer.
Register listeners with player.addEventListener(...). See widget events for available event types and cleanup patterns.
No. Programmatic control runs in the browser or native app. Server-side code can configure content and widget settings via the API, but playback control requires the client-side SDK.

Get help

If you encounter issues or have questions, contact support. Include your initialization code and any console errors.