From 385ae8b3b12c71b2043c0104a3ca8132e2082ae1 Mon Sep 17 00:00:00 2001 From: CloudWebRTC Date: Mon, 21 Oct 2024 11:54:40 +0800 Subject: [PATCH] feat: support bypass voice processing. (#595) * feat: support bypass voice processing. * update. * update pubspec.yaml. --- example/lib/pages/connect.dart | 4 ++++ ios/livekit_client.podspec | 2 +- lib/src/livekit.dart | 11 +++++++++++ macos/livekit_client.podspec | 2 +- pubspec.yaml | 5 ++++- 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/example/lib/pages/connect.dart b/example/lib/pages/connect.dart index d88f6cfc1..5961c82ef 100644 --- a/example/lib/pages/connect.dart +++ b/example/lib/pages/connect.dart @@ -47,6 +47,10 @@ class _ConnectPageState extends State { if (lkPlatformIs(PlatformType.android)) { _checkPermissions(); } + + if (lkPlatformIsMobile()) { + LiveKitClient.initialize(bypassVoiceProcessing: true); + } } @override diff --git a/ios/livekit_client.podspec b/ios/livekit_client.podspec index aaadc7068..e17340ac0 100644 --- a/ios/livekit_client.podspec +++ b/ios/livekit_client.podspec @@ -16,5 +16,5 @@ Pod::Spec.new do |s| s.static_framework = true s.dependency 'Flutter' - s.dependency 'WebRTC-SDK', '125.6422.04' + s.dependency 'WebRTC-SDK', '125.6422.05' end diff --git a/lib/src/livekit.dart b/lib/src/livekit.dart index 01b04d683..6e9ba56fe 100644 --- a/lib/src/livekit.dart +++ b/lib/src/livekit.dart @@ -12,8 +12,19 @@ // See the License for the specific language governing permissions and // limitations under the License. +import 'package:flutter_webrtc/flutter_webrtc.dart' as rtc; + /// Main entry point to connect to a room. /// {@category Room} class LiveKitClient { static const version = '2.2.6'; + + /// Initialize the WebRTC plugin. If this is not manually called, will be + /// initialized with default settings. + /// This method must be called before calling any LiveKit SDK API. + static Future initialize({bool bypassVoiceProcessing = false}) async { + await rtc.WebRTC.initialize(options: { + if (bypassVoiceProcessing) 'bypassVoiceProcessing': bypassVoiceProcessing, + }); + } } diff --git a/macos/livekit_client.podspec b/macos/livekit_client.podspec index 388d85714..7b986da5e 100644 --- a/macos/livekit_client.podspec +++ b/macos/livekit_client.podspec @@ -16,5 +16,5 @@ Pod::Spec.new do |s| s.static_framework = true s.dependency 'FlutterMacOS' - s.dependency 'WebRTC-SDK', '125.6422.04' + s.dependency 'WebRTC-SDK', '125.6422.05' end diff --git a/pubspec.yaml b/pubspec.yaml index 8905972ad..b2062dd13 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -37,7 +37,10 @@ dependencies: uuid: '>=3.0.6' synchronized: ^3.0.0+3 protobuf: ^3.0.0 - flutter_webrtc: ^0.11.7 + flutter_webrtc: + git: + url: https://github.com/flutter-webrtc/flutter-webrtc.git + ref: feat/support-unprocessed-audio device_info_plus: '>=8.0.0' js: '>=0.6.4' platform_detect: ^2.0.7