feat: Working VoIP calling implementation (Flutter + Android)
Working video and audio calls, as well as android integration
This commit is contained in:
commit
96a7e211a0
60 changed files with 2445 additions and 0 deletions
87
lib/liblinphone_flutter_method_channel.dart
Normal file
87
lib/liblinphone_flutter_method_channel.dart
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'liblinphone_flutter_platform_interface.dart';
|
||||
import 'models/call_type.dart';
|
||||
|
||||
/// An implementation of [LiblinphoneFlutterPlatform] that uses method channels.
|
||||
class MethodChannelLiblinphoneFlutter extends LiblinphoneFlutterPlatform {
|
||||
/// The method channel used to interact with the native platform.
|
||||
@visibleForTesting
|
||||
final methodChannel = const MethodChannel('liblinphone_flutter');
|
||||
|
||||
@override
|
||||
Future<bool> checkPermissions() async {
|
||||
return (await methodChannel.invokeMethod<bool>('checkPermissions'))!;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> initialize() async {
|
||||
return (await methodChannel.invokeMethod<bool>('initialize'))!;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> register(
|
||||
String username,
|
||||
String password,
|
||||
String serverIp,
|
||||
int serverPort,
|
||||
) async {
|
||||
return (await methodChannel
|
||||
.invokeMethod<bool>('register', <String, dynamic>{
|
||||
'username': username,
|
||||
'password': password,
|
||||
'serverIp': serverIp,
|
||||
'serverPort': serverPort,
|
||||
}))!;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> unregister() async {
|
||||
return (await methodChannel.invokeMethod<bool>('unregister'))!;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> makeCall(String callTo, bool isVideoEnabled) async {
|
||||
return (await methodChannel.invokeMethod<bool>(
|
||||
'makeCall',
|
||||
<String, dynamic>{'callTo': callTo, 'isVideoEnabled': isVideoEnabled},
|
||||
))!;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> answerCall() async {
|
||||
return (await methodChannel.invokeMethod<bool>('answerCall'))!;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> hangupCall() async {
|
||||
return (await methodChannel.invokeMethod<bool>('hangupCall'))!;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> inCall() async {
|
||||
return (await methodChannel.invokeMethod<bool>('inCall'))!;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<CallType> callType() async {
|
||||
final callTypeOrdinal = await methodChannel.invokeMethod<int>('callType');
|
||||
return CallType.fromOrdinal(callTypeOrdinal!);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> toggleVideo() async {
|
||||
return (await methodChannel.invokeMethod<bool>('toggleVideo'))!;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> toggleMicrophone() async {
|
||||
return (await methodChannel.invokeMethod<bool>('toggleMicrophone'))!;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> stop() async {
|
||||
return (await methodChannel.invokeMethod<bool>('stop'))!;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue