When to use headless mode
| Approach | Use when |
|---|---|
| Player settings | Colors, size, widget, highlighting—no code required |
| Style overrides | Small CSS tweaks to the built-in UI |
| Headless mode (this guide) | Fully custom controls and layout |
| Direct API calls | You don’t want any player code (loses analytics, ads, segment playback, and more) |
How it works
- Initialize the player with
showUserInterface: false(or omittargetto mount headlessly at the end of<body>). - The SDK still loads content, manages the media element, and fires events.
- Your code reads player state (
currentTime,playbackState,content, etc.) and renders your own UI. - Your UI writes back to player properties (
playbackState = 'playing',currentTime = 30, etc.).
<video>). With playerStyle: "video" and showUserInterface: false, the video element renders without built-in controls.
Enable headless mode
Option 1—hide the built-in UI:target:
If you don’t pass target, the player mounts at the end of <body> with the UI disabled automatically.
On iOS and Android, set showUserInterface: false in PlayerSettings and build native controls that call the SDK setters. See the iOS and Android example apps.
Build a custom UI
The simplest pattern is event-driven re-rendering—listen for player changes, then read state and update your UI:<any> event type to re-render on every state change. See player events for specific event types and listener cleanup.
For playback control, see programmatic control.
React example
WordPress
The WordPress plugin injects the player script on published posts. Use thebeyondwords_player_script_onload filter to call your custom UI initialization after the player loads:
BeyondWords.Player.instances()[0] to get the player instance.
Plain JavaScript example
Style overrides
If you only need minor tweaks to the built-in player UI—rather than a full custom interface—you can override CSS. Player styles are highly specific, so use the intentional override selector:Segment highlight colors
Override segment detection highlight colors without the.bwp selector:
Direct API calls
You can call the player API directly and build a UI from the JSON response. This works, but you lose built-in features:- BeyondWords analytics and analytics integrations
- Ads (pre/mid/post-roll)
- Segment detection and paragraph playback
- Media Session API support
- Intro/outro and playlist handling
FAQs
Can I use headless mode with native apps?
Can I use headless mode with native apps?
Does headless mode disable analytics?
Does headless mode disable analytics?
No. Analytics events still fire when using the SDK in headless mode, as long as you use the player instance rather than calling the API directly.
How do I show paragraph highlighting with a custom UI?
How do I show paragraph highlighting with a custom UI?
Enable highlighting in Distribution → Player → Settings, then use segment detection markers in your article HTML. Your custom UI can listen for segment events and apply highlight styles, or use the segment CSS overrides with the built-in highlight classes.
Should I use headless mode or Magic Embed?
Should I use headless mode or Magic Embed?
Magic Embed installs the standard player automatically. Use headless mode when you need a bespoke interface that the dashboard player cannot provide.