feat: add mic gain set and get methods
This commit is contained in:
parent
a740475d56
commit
7608d79d64
8 changed files with 83 additions and 8 deletions
|
|
@ -212,6 +212,21 @@ class LiblinphoneFlutterPlugin : FlutterPlugin, ActivityAware, MethodCallHandler
|
|||
result.success(true)
|
||||
}
|
||||
|
||||
"setMicGain" -> {
|
||||
try {
|
||||
val level = call.argument<Float>("level")!!
|
||||
linphoneBridge.setMicGain(level)
|
||||
result.success(true)
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "setMicGain: ${e.message}")
|
||||
result.error("error", e.message, e)
|
||||
}
|
||||
}
|
||||
|
||||
"getMicGain" -> {
|
||||
result.success(linphoneBridge.getMicGain())
|
||||
}
|
||||
|
||||
else -> {
|
||||
result.notImplemented()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -376,4 +376,12 @@ class LinphoneBridge(
|
|||
currentCall?.sendDtmf(dtmfChar)
|
||||
return true
|
||||
}
|
||||
|
||||
fun setMicGain(level: Float) {
|
||||
core.setMicGainDb(level)
|
||||
}
|
||||
|
||||
fun getMicGain(): Float {
|
||||
return core.getMicGainDb()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ packages:
|
|||
path: ".."
|
||||
relative: true
|
||||
source: path
|
||||
version: "0.0.2"
|
||||
version: "0.0.3"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -141,10 +141,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: matcher
|
||||
sha256: "12956d0ad8390bbcc63ca2e1469c0619946ccb52809807067a7020d57e647aa6"
|
||||
sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.12.18"
|
||||
version: "0.12.19"
|
||||
material_color_utilities:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -157,10 +157,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: meta
|
||||
sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394"
|
||||
sha256: "1741988757a65eb6b36abe716829688cf01910bbf91c34354ff7ec1c3de2b349"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.17.0"
|
||||
version: "1.18.0"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -250,10 +250,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
sha256: "19a78f63e83d3a61f00826d09bc2f60e191bf3504183c001262be6ac75589fb8"
|
||||
sha256: "8161c84903fd860b26bfdefb7963b3f0b68fee7adea0f59ef805ecca346f0c7a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.8"
|
||||
version: "0.7.10"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -279,5 +279,5 @@ packages:
|
|||
source: hosted
|
||||
version: "3.1.0"
|
||||
sdks:
|
||||
dart: ">=3.9.0-333.2.beta <4.0.0"
|
||||
dart: ">=3.10.0-0 <4.0.0"
|
||||
flutter: ">=3.18.0-18.0.pre.54"
|
||||
|
|
|
|||
|
|
@ -227,6 +227,23 @@ public class LiblinphoneFlutterPlugin: NSObject, FlutterPlugin {
|
|||
case "stopCallService":
|
||||
result(true)
|
||||
|
||||
case "setMicGain":
|
||||
guard let args = call.arguments as? [String: Any],
|
||||
let level = args["level"] as? String else {
|
||||
result(FlutterError(
|
||||
code: "INVALID_ARGUMENTS",
|
||||
message: "Missing required arguments",
|
||||
details: nil
|
||||
))
|
||||
return
|
||||
}
|
||||
|
||||
linphoneBridge.setMicGain(level: level)
|
||||
result(success)
|
||||
|
||||
case "getMicGain":
|
||||
result(linphoneBridge.getMicGain())
|
||||
|
||||
default:
|
||||
result(FlutterMethodNotImplemented)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -272,6 +272,14 @@ class LinphoneBridge {
|
|||
onRegistrationStateChanged(registrationState.rawValue)
|
||||
onCallStateChanged(callState.rawValue)
|
||||
}
|
||||
|
||||
func setMicGain(level: Float) {
|
||||
core.micGainDb = level
|
||||
}
|
||||
|
||||
func getMicGain() -> Float {
|
||||
return core.micGainDb
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - CoreDelegate
|
||||
|
|
|
|||
|
|
@ -90,4 +90,10 @@ class LiblinphoneFlutter {
|
|||
|
||||
Future<bool> stopCallService() async =>
|
||||
LiblinphoneFlutterPlatform.instance.stopCallService();
|
||||
|
||||
Future<bool> setMicGain(double level) async =>
|
||||
LiblinphoneFlutterPlatform.instance.setMicGain(level);
|
||||
|
||||
Future<double> getMicGain() async =>
|
||||
LiblinphoneFlutterPlatform.instance.getMicGain();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,4 +117,17 @@ class MethodChannelLiblinphoneFlutter extends LiblinphoneFlutterPlatform {
|
|||
Future<bool> stopCallService() async {
|
||||
return (await methodChannel.invokeMethod<bool>('stopCallService'))!;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> setMicGain(double level) async {
|
||||
return (await methodChannel.invokeMethod<bool>(
|
||||
'setMicGain',
|
||||
<String, dynamic>{'level': level},
|
||||
))!;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<double> getMicGain() async {
|
||||
return (await methodChannel.invokeMethod<double>('getMicGain'))!;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,4 +97,12 @@ abstract class LiblinphoneFlutterPlatform extends PlatformInterface {
|
|||
Future<bool> stopCallService() async {
|
||||
throw UnimplementedError('stopCallService() has not been implemented.');
|
||||
}
|
||||
|
||||
Future<bool> setMicGain(double level) async {
|
||||
throw UnimplementedError('setMicGain() has not been implemented.');
|
||||
}
|
||||
|
||||
Future<double> getMicGain() async {
|
||||
throw UnimplementedError('getMicGain() has not been implemented.');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue