Background Audio

Overview

Enabling background audio on iOS allows your app's audio to continue playing even when the app is minimized, backgrounded, or when the device screen is locked. This is especially useful for music apps, podcast players, meditation tools, or any media-rich web application.

📘

Note

These functions are currently applicable to iOS only. Android handles background audio differently and usually does not require explicit service activation for audio persistence.

Implementation Guide

You can programmatically start and stop background audio functionality using the following bridge commands:

Start Background Audio Service

Use this command when you want to allow audio to continue playing after the app is backgrounded. This is typically invoked when initializing media playback.

↔️Median JavaScript Bridge

median.backgroundAudio.start();

Stop Background Audio Service

Use this command to release background audio resources when playback has finished or is no longer needed.

↔️Median JavaScript Bridge

median.backgroundAudio.stop();