Skip to main content

Audio Management

warning

Legacy Limitation: Audio management configuration is currently only available when using legacy inRead or inFeed native placements or Mediation settings. For other placement types, management is still unavailable. See Settings Configuration for more details.

Audio Behavior by Placement Type

Media Placements

Device unmuted: Sound is OFF by default. Switched ON with a tap on the unmute button.

Device muted: Sound is OFF by default. Switched ON by switching the physical mute button (iOS) or increasing the Media Volume (Android).

Interstitial and Rewarded Placements

Device unmuted: Sound is ON by default. Switched OFF by a tap on the mute button.

Device muted: Sound is OFF by default. Switched ON by switching the physical mute button (iOS) or increasing the Media Volume (Android).

Audio Session Management

By default, the Teads inApp SDK handles the audio session by setting its category to ambient. This means that all the audio played by other applications will simply mix with the ad sound.

Custom Audio Session Management

If you choose to handle the audio session yourself, you'll need to call disableTeadsAudioSessionManagement in your ad settings:

let teadsAdPlacementSettings = TeadsAdPlacementSettings { settings in
settings.disableTeadsAudioSessionManagement()
}

Playback Delegate Implementation

When using custom audio session management, register for the playbackDelegate on didReceiveAd:

func didReceiveAd(ad: TeadsInReadAd, adRatio: TeadsAdRatio) {
// ...
ad.playbackDelegate = self // register to playbackDelegate
}

Then implement TeadsPlaybackDelegate to know when ads are muted/unmuted:

func adStartPlayingAudio(_ ad: TeadsAd) {
// You can choose to shut down any other sound in your app
}

func adStopPlayingAudio(_ ad: TeadsAd) {
// You can reactivate all sound in your app
}
warning

Important: If you are using an audio session with a category that is non-mixable, all sound from other applications (e.g., Spotify) would be stopped when an ad starts playing (even an ad without sound). This is due to Apple's default behavior with a video player.

To prevent this and preserve optimal user experience, please make sure that your audio session category is mixable. You can add mixWithOthers from AVAudioSession.CategoryOptions in some categories (like .playback).