AudioContextConfig class
This class contains flags to control several secondary, platform-specific aspects of audio playback, like how this audio interact with other audios, how is it played by the device and what happens when the app is backgrounded. However, note that each platform has its nuances on how to configure audio. This class is a generic abstraction of some parameters that can be useful across the board. Its flags are simple abstractions that are then translated to an AudioContext containing platform specific configurations: AudioContextAndroid and AudioContextIOS. If these simplified flags cannot fully reflect your goals, you must create an AudioContext configuring each platform separately.
Constructors
- AudioContextConfig({bool forceSpeaker = true, bool duckAudio = false, bool respectSilence = false, bool stayAwake = true})
Properties
- duckAudio → bool
-
This flag determines how your audio interacts with other audio playing on
the device.
If your audio is playing, and another audio plays on top (like an alarm,
gps, etc), this determines what happens with your audio.
final
- forceSpeaker → bool
-
Normally, audio played will respect the devices configured preferences.
However, if you want to bypass that and flag the system to use the
built-in speakers, you can set this flag.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- respectSilence → bool
-
Whether the "silent" mode of the device should be respect.
By default (false), if the device is on silent mode, the audio will not be
played.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stayAwake → bool
-
By default, when the screen is locked, all the app's processing stops,
including audio playback.
You can set this flag to keep your audio playing even when locked.
final
Methods
-
build(
) → AudioContext -
buildAndroid(
) → AudioContextAndroid -
buildIOS(
) → AudioContextIOS -
copy(
{bool? forceSpeaker, bool? duckAudio, bool? respectSilence, bool? stayAwake}) → AudioContextConfig -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
validateIOS(
) → void
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited