From radio and podcasts to audiobooks and e-learning courses, audio content is a crucial part of many mobile apps. In many cases, users need to be able to play audio content, and control audio playback while the corresponding app is closed — including when listening on headphones, a bluetooth speaker, or connected car audio system. We developed the Median Native Media Player plugin to meet all of these needs and to elevate how your app users engage with audio.
The plugin plays audio files and live audio streams using iOS and Android built-in audio playback capabilities. Because of this functionality audio playback will be uninterrupted even when the device is locked or your app is running in the background. The plugin will display track information and playback controls on the device lock screen and control center area. When displaying the track information the plugin will by default extract artwork and track metadata from the file or stream itself. Optionally, you may specify these details manually to add or override the embedded data. Users can conveniently control playback through the lock screen and control center, as well as through any externally connected device. By loading a playlist of tracks onto the native media player your users will be able to effortlessly navigate through tracks through Next/Previous buttons without unlocking their device.
We offer two versions of the Native Media Player plugin: the Standard Player, which is a standalone native player, or the Background Player, which includes additional callbacks to seamlessly transition between an HTML-based player when your app is in the foreground and the native player when your app is in the background. The Background Player is often used to play the audio stream of a video file when the device screen is turned off.
Whether you're building a radio app, podcast platform, or e-learning course, the Native Media Player plugin elevates the audio experience to new heights. Integrate it effortlessly with our App Studio and captivate your audience with immersive and seamless audio playback.
Background playback:
Your users will be spending hours listening to the audio content you provide and will appreciate the ability to listen while on the go and without needing your app open.
Intuitive playback controls:
Enhance user experience with intuitive controls that allow convenient playback navigation through tracks, even without unlocking the device or bringing the app to the foreground.
Track metadata display:
Elevate your users’ experience and raise the profile of your app by displaying essential audio information and artwork on the device lock screen.
The Standard Player and Background Player are two versions of the Native Media Player plugin, each serving different purposes. The Standard Player is designed to be the default method for playing audio content in your app. It allows you to launch the player with a single track or a playlist of multiple tracks, from your website using the Median JavaScript Bridge. You can develop a web-based UI to display in your app that allows users to control playback while your app is open in the foreground. Then, when your app is backgrounded, or the device is locked, the audio playback continues and playback can be controlled using the native UI on the lock screen and control center, as well as through any connected device.
The Background Player version is designed for apps that use an HTML-based media player while the app is in the foreground. Typically this is when the media includes video or lyrics that must be synchronized to the audio. The Background Player uses JavaScript callbacks to smoothly transition between the HTML-based media player and the Native Media Player when the app is backgrounded or the device is locked, ensuring uninterrupted audio playback. The JavaScript callbacks use track playback position to manage the seamless transition between the web and native players.
Ultimately, the choice between the Standard Player and Background Player depends on your specific app requirements and the desired audio playback behavior.
The Native Media Player plugin uses device-provided audio playback functionality and is compatible with audio files and streamed content that can be decoded by the device. Refer to the Apple and Android documentation for further details.
Apple documentation has no clear mention of the supported formats. Hence, the below list of supported formats is generated by invoking the audiovisualTypes method of AVURLAsset class in an iPhone 8 with iOS version 16.5.1 (see related Apple documentation here):
mqv, pls, aifc, m4r, wav, 3gp, 3g2, flac, avi, m2a, aac, mpa, xhe, m3u, mov, aiff, ttml, vtt, m4v, amr, caf, m4a, m4b, mp4, mp1, m1a, aax, mp2, w64, aa, mp3, itt, au, eac3, webvtt, ac3, m4p, loas
Note: Some formats might not be supported by lower iOS versions.