Skip to main content

Audio Management

Default mixing

The SDK mixes ad audio with other apps by default. Disable that if you manage the audio session yourself.

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
)

Note: TeadsAdPlacementMediaConfig is a Swift struct and Teads.createPlacement<T>(with:delegate:) is generic — neither bridges to Objective-C, so no Objective-C sample can be produced for this snippet.

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
Mixable audio session

A non-mixable session stops other apps (for example Spotify) when an ad starts, even a silent ad. Add mixWithOthers (for example on .playback) so ad audio mixes with other apps.