Webrtc Calling
parent
acbafd8d84
commit
304f77b9bb
@ -0,0 +1,64 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||||
|
import 'package:flutter_callkit_incoming/entities/entities.dart';
|
||||||
|
import 'package:flutter_callkit_incoming/flutter_callkit_incoming.dart';
|
||||||
|
import 'package:mohem_flutter_app/main.dart';
|
||||||
|
import 'package:mohem_flutter_app/models/chat/get_single_user_chat_list_model.dart';
|
||||||
|
|
||||||
|
class ChatVoipCall {
|
||||||
|
static final ChatVoipCall _instance = ChatVoipCall._internal();
|
||||||
|
|
||||||
|
ChatVoipCall._internal();
|
||||||
|
|
||||||
|
factory ChatVoipCall() => _instance;
|
||||||
|
|
||||||
|
Future<void> showCallkitIncoming({required String uuid, required RemoteMessage data}) async {
|
||||||
|
logger.d(data.data["user_chat_history_response"]);
|
||||||
|
|
||||||
|
SingleUserChatModel callerData = SingleUserChatModel.fromJson(jsonDecode(data.data["user_chat_history_response"]));
|
||||||
|
var params = CallKitParams(
|
||||||
|
id: uuid,
|
||||||
|
nameCaller: callerData.currentUserName,
|
||||||
|
appName: 'Mohemm',
|
||||||
|
avatar: 'https://i.pravatar.cc/100',
|
||||||
|
handle: '0123456789',
|
||||||
|
type: 0,
|
||||||
|
duration: 30000,
|
||||||
|
textAccept: 'Accept',
|
||||||
|
textDecline: 'Decline',
|
||||||
|
textMissedCall: 'Missed call',
|
||||||
|
textCallback: 'Call back',
|
||||||
|
extra: <String, dynamic>{'userId': '1a2b3c4d'},
|
||||||
|
headers: <String, dynamic>{'apiKey': 'Abc@123!', 'platform': 'flutter'},
|
||||||
|
android: const AndroidParams(
|
||||||
|
isCustomNotification: true,
|
||||||
|
isShowLogo: false,
|
||||||
|
isShowCallback: false,
|
||||||
|
isShowMissedCallNotification: true,
|
||||||
|
ringtonePath: 'system_ringtone_default',
|
||||||
|
backgroundColor: '#0955fa',
|
||||||
|
backgroundUrl: 'assets/test.png',
|
||||||
|
actionColor: '#4CAF50',
|
||||||
|
),
|
||||||
|
ios: IOSParams(
|
||||||
|
iconName: 'CallKitLogo',
|
||||||
|
handleType: '',
|
||||||
|
supportsVideo: true,
|
||||||
|
maximumCallGroups: 2,
|
||||||
|
maximumCallsPerCallGroup: 1,
|
||||||
|
audioSessionMode: 'default',
|
||||||
|
audioSessionActive: true,
|
||||||
|
audioSessionPreferredSampleRate: 44100.0,
|
||||||
|
audioSessionPreferredIOBufferDuration: 0.005,
|
||||||
|
supportsDTMF: true,
|
||||||
|
supportsHolding: true,
|
||||||
|
supportsGrouping: false,
|
||||||
|
supportsUngrouping: false,
|
||||||
|
ringtonePath: 'system_ringtone_default',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
logger.d(callerData.targetUserId);
|
||||||
|
await FlutterCallkitIncoming.showCallkitIncoming(params);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue