Skip to content

Commit 1314700

Browse files
authored
Fix: preserve audio category options when forcing speaker output (#1015)
forceSpeakerOutput replaced all category options with only defaultToSpeaker, losing allowBluetooth/allowBluetoothA2DP/allowAirPlay. Now adds defaultToSpeaker to the existing options instead.
1 parent 48709c1 commit 1314700

3 files changed

Lines changed: 3 additions & 0 deletions

File tree

.changes/fix-speaker-toggle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
patch type="fixed" "Preserve Bluetooth and AirPlay options when forcing speaker output on iOS"

lib/src/hardware/hardware.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ class Hardware {
152152
if (_preferSpeakerOutput && _forceSpeakerOutput) {
153153
config = config.copyWith(
154154
appleAudioCategoryOptions: {
155+
...?config.appleAudioCategoryOptions,
155156
AppleAudioCategoryOption.defaultToSpeaker,
156157
},
157158
);

lib/src/track/audio_management.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ Future<void> _onAudioTrackCountDidChange() async {
116116
if (Hardware.instance.forceSpeakerOutput) {
117117
config = config.copyWith(
118118
appleAudioCategoryOptions: {
119+
...?config.appleAudioCategoryOptions,
119120
AppleAudioCategoryOption.defaultToSpeaker,
120121
},
121122
);

0 commit comments

Comments
 (0)