Skip to content

Commit

Permalink
fix!: Change the default value of iOS audio context to force speakers (
Browse files Browse the repository at this point in the history
…#1363)

There has been a high number of issues being opened around the fact that on 1.0.0, forceSpeaker on iOS (and android) was set to false by default, requiring most users to explicitly setup the global audio context.

This change the default value of iOS audio context to force speakers to be inline with what users seem to expect.

Follow this thread for details.

Since I only test iOS on emulators, where this setting doesn't make any difference, I hadn't realized this issue.

Note: this changes the default for android as well, which is in line with the unified audio context philosophy.

Migration instructions

If you wanted to have it set to false, you can just set it so:

      final AudioContext audioContext = AudioContext(
        iOS: AudioContextIOS(
          defaultToSpeaker: false,
         // ...
        ),
        // ...
      );
      AudioPlayer.global.setGlobalAudioContext(audioContext);

If not, you can remove all the ad-hoc code you had to set this up.
  • Loading branch information
luanpotter committed Jan 1, 2023
1 parent 6a66d42 commit cb16c12
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -72,7 +72,7 @@ class AudioContextConfig {
final bool stayAwake;

AudioContextConfig({
this.forceSpeaker = false,
this.forceSpeaker = true,
this.duckAudio = false,
this.respectSilence = false,
this.stayAwake = true,
Expand Down

0 comments on commit cb16c12

Please sign in to comment.