Skip to content

Commit e172da2

Browse files
authored
release: 1.4.1. (#330)
* release: 1.4.1. * Correctly save speakerOn state and restore state in AudioManagement. * Update CHANGELOG.md
1 parent 8197a05 commit e172da2

File tree

6 files changed

+23
-3
lines changed

6 files changed

+23
-3
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# CHANGELOG
22

3+
## 1.4.1
4+
5+
* Fix: fix Android earpiece not being replaced after wired headset is disconnected.
6+
* Fix: SpeakerPhone switch for Android.
7+
* Feat: expose Android audio modes.
8+
* Fix: Correctly save speakerOn state and restore in AudioManagement.
9+
310
## 1.4.0
411

512
* Upgrade flutter-webrtc to 0.9.36 (libwebrtc m114).

example/lib/pages/room.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ class _RoomPageState extends State<RoomPage> {
4242
_askPublish();
4343
}
4444
});
45+
46+
if (lkPlatformIsMobile()) {
47+
Hardware.instance.setSpeakerphoneOn(true);
48+
}
4549
}
4650

4751
@override

example/lib/widgets/controls.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class _ControlsWidgetState extends State<ControlsWidget> {
4848
_loadDevices(devices);
4949
});
5050
Hardware.instance.enumerateDevices().then(_loadDevices);
51+
_speakerphoneOn = Hardware.instance.speakerOn ?? false;
5152
}
5253

5354
@override

lib/src/hardware/hardware.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ class Hardware {
152152

153153
Future<void> setSpeakerphoneOn(bool enable) async {
154154
if (lkPlatformIsMobile()) {
155+
speakerOn = enable;
155156
if (canSwitchSpeakerphone) {
156-
speakerOn = enable;
157157
await rtc.Helper.setSpeakerphoneOn(enable);
158158
} else {
159159
logger.warning('Can\'t switch speaker/earpiece');

lib/src/track/audio_management.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
import 'package:flutter_webrtc/flutter_webrtc.dart' as rtc;
1516
import 'package:synchronized/synchronized.dart' as sync;
1617

1718
import '../hardware/hardware.dart';
@@ -123,6 +124,13 @@ Future<void> _onAudioTrackCountDidChange() async {
123124
logger.warning('failed to configure ${error}');
124125
}
125126
}
127+
128+
if (lkPlatformIsMobile()) {
129+
if (Hardware.instance.speakerOn != null &&
130+
Hardware.instance.canSwitchSpeakerphone) {
131+
await rtc.Helper.setSpeakerphoneOn(Hardware.instance.speakerOn!);
132+
}
133+
}
126134
}
127135
}
128136

pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
name: livekit_client
1616
description: Flutter Client SDK for LiveKit.
1717
Build real-time video and audio into your apps. Supports iOS, Android, and Web.
18-
version: 1.4.0
18+
version: 1.4.1
1919
homepage: https://livekit.io
2020

2121
environment:
@@ -38,7 +38,7 @@ dependencies:
3838
uuid: ^3.0.6
3939
synchronized: ^3.0.0+3
4040
protobuf: ^3.0.0
41-
flutter_webrtc: 0.9.36
41+
flutter_webrtc: 0.9.37
4242
flutter_window_close: ^0.2.2
4343
device_info_plus: ^9.0.0
4444
webrtc_interface: 1.1.0

0 commit comments

Comments
 (0)