Skip to main content

Audio Management

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 with mixWithOthers. 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 can disable the SDK's audio session management.

Unified Placements (TeadsAdPlacementMedia / TeadsAdPlacementMediaNative)

Pass disableAudioSessionManagement: true in your config:

let config = TeadsAdPlacementMediaConfig(
pid: YOUR_PID,
disableAudioSessionManagement: true
)

let placement: TeadsAdPlacementMedia = Teads.createPlacement(
with: config,
delegate: self
)

Then handle playback events through TeadsAdPlacementEventsDelegate:

func adPlacement(
_ placement: TeadsAdPlacementIdentifiable?,
didEmitEvent event: TeadsAdPlacementEventName,
data: [String: Any]?
) {
switch event {
case .startPlayAudio:
// Pause your app's audio
break
case .stopPlayAudio:
// Resume your app's audio
break
default:
break
}
}

Legacy Placements (inRead / inFeed Native)

Call disableTeadsAudioSessionManagement in your placement settings:

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

let placement = Teads.createInReadPlacement(
pid: YOUR_PID,
settings: settings,
delegate: self
)

Then register for playbackDelegate when receiving the ad:

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

And implement TeadsPlaybackDelegate:

func adStartPlayingAudio(_ ad: TeadsAd) {
// Pause your app's audio
}

func adStopPlayingAudio(_ ad: TeadsAd) {
// Resume your app's audio
}

Available Playback Events

EventDescription
.startPlayAudioAd started playing audio
.stopPlayAudioAd stopped playing audio
.playAd video started or resumed
.pauseAd video paused
.completeAd video completed
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).