Skip to content

Platform Setup

wyrindev edited this page Apr 22, 2026 · 2 revisions

πŸ› οΈ Platform Setup

Each platform requires a bit of configuration to ensure the media session works correctly and looks professional.


πŸ€– Android

The plugin uses Media3 to handle background playback and system notifications.

1. Permissions

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" />

2. Service Configuration

The plugin automatically declares the MediaSessionService via manifest merging. No manual <service> tag is required unless you want to override specific behaviors.


🍎 Apple (iOS & macOS)

1. Background Audio (iOS only)

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>

2. Sandbox (macOS only)

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.


🌐 Web

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.

Clone this wiki locally