Meta Horizon OS provides audio capabilities for Android apps. This guide covers background audio playback, media controls, and Dolby Atmos support.
Background audio
The background audio feature on Meta Horizon OS allows Android apps to continue playing audio while they’re not in the foreground. This makes Meta Horizon OS more versatile for everyday tasks like music streaming, podcasts, and audio books.
Add the required permissions and service declaration to your AndroidManifest.xml. See the Media3 MediaSession Guide for complete service configuration.
Implementation
To implement background audio in your Android app, use the standard Android media APIs:
MediaSession: Enables your app to communicate playback state and metadata to the system for media controls and notifications.
MediaSessionService: Runs as a foreground service to maintain audio playback in the background.
MediaStyle notifications: Provides media controls in the notification area.
For complete implementation details, refer to the official Android documentation:
When a 2D app with audio is in the background on Meta Quest, media playback controls become available, making it possible to multitask while managing your audio. These controls work similarly to keyboard media controls on a PC, allowing you to play, pause, skip tracks, and adjust volume without bringing the app back into focus.
Implementation
Implement media playback controls using the MediaSession API with callbacks for play, pause, skip, and other transport controls. Set appropriate flags to handle media buttons and transport controls, and maintain an active session while your app is playing audio.
For complete implementation details, see the official Android Media3 documentation:
Meta Horizon OS supports Dolby Atmos for Android apps, delivering an immersive audio experience with spatial sound and head tracking. Compatible apps can provide a more realistic and engaging audio environment, where sounds appear to come from specific locations in 3D space and move accordingly as you turn your head.
Detecting Dolby Atmos support
Check if the device supports Dolby Atmos:
import android.media.MediaCodecList
fun checkAtmosSupported(): Boolean {
val codecList = MediaCodecList(MediaCodecList.ALL_CODECS)
for (codecInfo in codecList.codecInfos) {
if (codecInfo.isEncoder) continue
codecInfo.supportedTypes.forEach { type ->
if (type == "audio/eac3" || type == "audio/ac4") {
return true
}
}
}
return false
}
Supported formats
Meta Horizon OS supports these Dolby Atmos audio formats:
Audio Format
MIME Type
Spatial Audio (2D/3D)
2D Playback
Notes
Dolby Digital Plus (E-AC-3)
audio/eac3
✅ Yes
✅ Yes
Recommended for immersive experiences
Dolby AC-4
audio/ac4
⚠️ 2D Only
✅ Yes
Not supported for Spatial SDK 3D audio
Note: AC-4 is supported for 2D media playback but not for Spatial SDK spatial audio features.
Configuration
When Dolby Atmos is supported, ExoPlayer and compatible media players automatically select the best available audio track based on device capabilities. Ensure your media content includes Dolby Atmos audio streams for the best experience.
To verify Dolby Atmos playback, check your media player’s selected audio track format during playback.
For media quality requirements and encoding specifications, see Media requirements.
Audio focus
Use Android’s AudioFocusRequest API to request audio focus before starting playback. Request AUDIOFOCUS_GAIN for exclusive audio playback or AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK for temporary playback that allows other audio to continue at reduced volume.