Skip to content

Commit

Permalink
release: 1.4.1. (#330)
Browse files Browse the repository at this point in the history
* release: 1.4.1.

* Correctly save speakerOn state and restore state in AudioManagement.

* Update CHANGELOG.md
  • Loading branch information
cloudwebrtc authored Aug 7, 2023
1 parent 8197a05 commit e172da2
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# CHANGELOG

## 1.4.1

* Fix: fix Android earpiece not being replaced after wired headset is disconnected.
* Fix: SpeakerPhone switch for Android.
* Feat: expose Android audio modes.
* Fix: Correctly save speakerOn state and restore in AudioManagement.

## 1.4.0

* Upgrade flutter-webrtc to 0.9.36 (libwebrtc m114).
Expand Down
4 changes: 4 additions & 0 deletions example/lib/pages/room.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ class _RoomPageState extends State<RoomPage> {
_askPublish();
}
});

if (lkPlatformIsMobile()) {
Hardware.instance.setSpeakerphoneOn(true);
}
}

@override
Expand Down
1 change: 1 addition & 0 deletions example/lib/widgets/controls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class _ControlsWidgetState extends State<ControlsWidget> {
_loadDevices(devices);
});
Hardware.instance.enumerateDevices().then(_loadDevices);
_speakerphoneOn = Hardware.instance.speakerOn ?? false;
}

@override
Expand Down
2 changes: 1 addition & 1 deletion lib/src/hardware/hardware.dart
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ class Hardware {

Future<void> setSpeakerphoneOn(bool enable) async {
if (lkPlatformIsMobile()) {
speakerOn = enable;
if (canSwitchSpeakerphone) {
speakerOn = enable;
await rtc.Helper.setSpeakerphoneOn(enable);
} else {
logger.warning('Can\'t switch speaker/earpiece');
Expand Down
8 changes: 8 additions & 0 deletions lib/src/track/audio_management.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import 'package:flutter_webrtc/flutter_webrtc.dart' as rtc;
import 'package:synchronized/synchronized.dart' as sync;

import '../hardware/hardware.dart';
Expand Down Expand Up @@ -123,6 +124,13 @@ Future<void> _onAudioTrackCountDidChange() async {
logger.warning('failed to configure ${error}');
}
}

if (lkPlatformIsMobile()) {
if (Hardware.instance.speakerOn != null &&
Hardware.instance.canSwitchSpeakerphone) {
await rtc.Helper.setSpeakerphoneOn(Hardware.instance.speakerOn!);
}
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
name: livekit_client
description: Flutter Client SDK for LiveKit.
Build real-time video and audio into your apps. Supports iOS, Android, and Web.
version: 1.4.0
version: 1.4.1
homepage: https://livekit.io

environment:
Expand All @@ -38,7 +38,7 @@ dependencies:
uuid: ^3.0.6
synchronized: ^3.0.0+3
protobuf: ^3.0.0
flutter_webrtc: 0.9.36
flutter_webrtc: 0.9.37
flutter_window_close: ^0.2.2
device_info_plus: ^9.0.0
webrtc_interface: 1.1.0
Expand Down

0 comments on commit e172da2

Please sign in to comment.