-
Notifications
You must be signed in to change notification settings - Fork 4
Platform Setup
Each platform requires a bit of configuration to ensure the media session works correctly and looks professional.
The plugin uses Media3 to handle background playback and system notifications.
Add these to your android/app/src/main/AndroidManifest.xml:
<!-- Required to run a foreground service -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<!-- Required for media playback services on Android 14 (API 34) -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />The plugin automatically declares the MediaSessionService via manifest merging. No manual <service> tag is required unless you want to override specific behaviors.
To keep the media session active when the app is in the background, you must enable the background audio mode in your Info.plist:
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>If your macOS app is sandboxed, ensure you have enabled the Audio Input and Hardware permissions in your .entitlements files if you plan to use audio. For just controlling media session metadata, standard entitlements are usually sufficient.
The Web implementation uses the Media Session API.
- Artwork: Ensure your artwork URLs are CORS-compliant so the browser can fetch them for the media hub.
- Interaction: Most browsers require a user interaction (like a click) before the media session can be fully activated.
- Android
- Windows
- Others