JavaScript Bridge
Background Audio and Notification Controls
Keep configured web audio playing in the background and expose native play/pause and stop notification actions.
Before you start
- Background Audio or Audio Notification Controls enabled
- HTML audio or video elements in the page
- Notification permission on Android 13+ when controls are used
Configure and verify
Enable media settings
In App Settings, enable background audio and/or notification controls and choose autoplay behavior.
Build and grant permission
Create a new APK and grant notification permission on Android 13+ when prompted.
Use standard media elements
The injected WebToAppAudio helper discovers existing and dynamically inserted audio and video elements, then watches play, pause, ended, and removed-source events.
Test native actions
Play media, background the app, then use notification play/pause and stop. Verify the website element responds.
Manual state update
webtoapp.audioStateChanged("playing", document.title);Current control scope
Native actions call WebToAppAudio.toggle() and WebToAppAudio.stop() inside the active WebView. Pages with custom players should expose compatible audio/video elements or integrate their state explicitly.
Test before release
- Background playback follows policy
- Notification appears only while relevant
- Play/pause and stop work
- Notification permission denial is handled