When to use headless mode
How it works
- Initialize the widget 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 widget state (
currentTime,playbackState,content, etc.) and renders your own UI. - Your UI writes back to widget 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 widget 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 widget events, then read state and update your UI:<any> event type to re-render on every state change. See widget events for specific event types and listener cleanup.
For playback control, see programmatic control.
React example
WordPress
The WordPress plugin injects the widget script on published posts. Use thebeyondwords_player_script_onload filter to call your custom UI initialization after the widget loads:
BeyondWords.Player.instances()[0] to get the widget instance.
Plain JavaScript example
Style overrides
If you only need minor tweaks to the built-in widget UI, rather than a full custom interface, you can override CSS. Widget 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 playback from paragraphs.
- 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 widget 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 on the Widget page in your project dashboard, 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 widget automatically. Use headless mode when you need a bespoke interface that the dashboard widget can’t provide.