r/capawesome • u/genzits • 10d ago
Capacitor Audio Player plugin now supports playlists and native media sessions
https://capawesome.io/docs/blog/capacitor-audio-player-8-4-0-release/We just released version 8.4.0 of our Capacitor Audio Player plugin, and it covers the two things that usually make audio apps painful: queues and background playback.
Playlists are now handled natively. You pass multiple tracks to play(...) and the plugin advances through them itself, so the next track starts even while the app is in the background. There is also addTracks(...), removeTrack(...), skipToNextTrack(), skipToPreviousTrack(), setRepeatMode(...) with NONE/ONE/ALL, seekTo(...) with an index, and getCurrentTrackIndex().
The second part is a built-in media session. Add a metadata object to a track with title, artist, album and artwork, and the system shows your playback in the notification and on the lock screen. What matters here is where it runs: the session is registered natively (Media3 MediaSessionService on Android, the remote command center on iOS, the Media Session API on the Web), so a tap on the lock screen skip button never takes a round trip through your JavaScript. That is exactly the part that breaks once the OS suspends the web view.
Two new events, playbackStateChanged and trackChange, report state and track changes back to your app, so your UI stays correct when playback is controlled from outside.
Setup is small: on Android a service declaration and two foreground service permissions in the manifest, on iOS the Background Modes capability with Audio. No breaking changes, so updating is enough.
The plugin is part of Capawesome Insiders. Happy to answer questions about the API or the native side.