AudioContext
How an Audio interacts with the device and with other audio.
Applies on Android and iOS. Other platforms ignore it.
Note
On iOS, it applies to the whole app rather than to one
Audio, so the one that applied it last decides for all
others.
Properties
focus- How the audio shares with other audio.respect_silence- Whether the audio follows the device's silent mode.
Properties
focusclass-attributeinstance-attribute
focus: AudioFocus | None = NoneHow the audio shares with other audio.
If None, AudioFocus.DUCK_OTHERS applies on Android, so
every Audio of an app plays together, and
AudioFocus.GAIN applies on iOS.
respect_silenceclass-attributeinstance-attribute
respect_silence: bool = FalseWhether the audio follows the device's silent mode.
On Android, this plays the audio as a ringtone, so it also follows the ringer volume instead of the media volume.
Warning
On iOS, can't be combined with focus set to
AudioFocus.DUCK_OTHERS or
AudioFocus.MIX_WITH_OTHERS.