Login
Welcome
Login

2c - Audio Mix Management (iOS only)

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 apps will simply mix with the ad sound.

If you chose to handle the audio session by yourself you'll need to call disableTeadsAudioSessionManagement in adSettings.

let teadsAdSettings = TeadsAdSettings(build: { (settings) in
	settings.disableTeadsAudioSessionManagement()
})

Then you should implement TFASoundDelegate in order to know when we mute/unmute our ads.

Note

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

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

Implement the two methods of the TFASoundDelegate

func adWillStartPlayingAudio(_ ad: TFACustomAdView) {
	//you can chose for example to shut down any other sound in your app
}
func adDidStopPlayingAudio(_ ad: TFACustomAdView) {
	// you can reactivate all sound in your app
}

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.