You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
HMG_Patient_App/lib/pages/webRTC/call_page.dart

165 lines
5.6 KiB
Dart

// import 'dart:io';
//
// import 'package:diplomaticquarterapp/models/LiveCare/IncomingCallData.dart';
// import 'package:diplomaticquarterapp/pages/livecare/incoming_call.dart';
// import 'package:diplomaticquarterapp/pages/webRTC/signaling.dart';
// import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
// import 'package:firebase_messaging/firebase_messaging.dart';
// import 'package:flutter/material.dart';
// import 'package:flutter_webrtc/flutter_webrtc.dart';
//
// class CallPage extends StatefulWidget {
// @override
// _CallPageState createState() => _CallPageState();
// }
//
// class _CallPageState extends State<CallPage> {
// Signaling signaling = Signaling();
// RTCVideoRenderer _localRenderer = RTCVideoRenderer();
// RTCVideoRenderer _remoteRenderer = RTCVideoRenderer();
// String roomId;
// TextEditingController textEditingController = TextEditingController(text: '');
//
// @override
// void initState() {
// _localRenderer.initialize();
// _remoteRenderer.initialize();
//
// // signaling.onRemoteStream = ((stream) {
// // _remoteRenderer.srcObject = stream;
// // setState(() {});
// // });
//
// fcmConfigure();
//
// super.initState();
// }
//
// @override
// void dispose() {
// _localRenderer.dispose();
// _remoteRenderer.dispose();
// super.dispose();
// }
//
// @override
// Widget build(BuildContext context) {
// FirebaseMessaging.instance.getToken().then((value) {
// print('FCM_TOKEN: $value');
// });
//
// return AppScaffold(
// isShowAppBar: true,
// showNewAppBar: true,
// showNewAppBarTitle: true,
// isShowDecPage: false,
// appBarTitle: "WebRTC Calling",
// body: Column(
// children: [
// SizedBox(height: 8),
// Wrap(
// children: [
// SizedBox(
// width: 8,
// ),
// ElevatedButton(
// onPressed: () {
// dummyCall();
// },
// child: Text("Call"),
// ),
// SizedBox(
// width: 8,
// ),
// ElevatedButton(
// onPressed: () {
// signaling.hangUp(_localRenderer);
// },
// child: Text("Hangup"),
// )
// ],
// ),
// SizedBox(height: 8),
// Expanded(
// child: Padding(
// padding: const EdgeInsets.all(0.0),
// child: Stack(
// children: [
// Positioned(top: 0.0, right: 0.0, left: 0.0, bottom: 0.0, child: RTCVideoView(_remoteRenderer)),
// Positioned(
// top: 20.0,
// right: 100.0,
// left: 20.0,
// bottom: 300.0,
// child: RTCVideoView(_localRenderer, mirror: true),
// ),
// ],
// ),
// ),
// ),
// Padding(
// padding: const EdgeInsets.all(8.0),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Text("Join the following Room: "),
// Flexible(
// child: TextFormField(
// controller: textEditingController,
// ),
// )
// ],
// ),
// ),
// SizedBox(height: 8)
// ],
// ),
// );
// }
//
// dummyCall() async {
// final json = {
// "callerID": "9920",
// "receiverID": "2001273",
// "msgID": "123",
// "notfID": "123",
// "notification_foreground": "true",
// "count": "1",
// "message": "Doctor is calling ",
// "AppointmentNo": "123",
// "title": "Rayyan Hospital",
// "ProjectID": "123",
// "NotificationType": "10",
// "background": "1",
// "doctorname": "Dr Sulaiman Al Habib",
// "clinicname": "ENT Clinic",
// "speciality": "Speciality",
// "appointmentdate": "Sun, 15th Dec, 2019",
// "appointmenttime": "09:00",
// "type": "video",
// "session_id":
// "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImN0eSI6InR3aWxpby1mcGE7dj0xIn0.eyJqdGkiOiJTS2I2NjYyOWMzN2ZhOTM3YjFjNDI2Zjg1MTgyNWFmN2M0LTE1OTg3NzQ1MDYiLCJpc3MiOiJTS2I2NjYyOWMzN2ZhOTM3YjFjNDI2Zjg1MTgyNWFmN2M0Iiwic3ViIjoiQUNhYWQ1YTNmOGM2NGZhNjczNTY3NTYxNTc0N2YyNmMyYiIsImV4cCI6MTU5ODc3ODEwNiwiZ3JhbnRzIjp7ImlkZW50aXR5IjoiSGFyb29uMSIsInZpZGVvIjp7InJvb20iOiJTbWFsbERhaWx5U3RhbmR1cCJ9fX0.7XUS5uMQQJfkrBZu9EjQ6STL6R7iXkso6BtO1HmrQKk",
// "identity": "Haroon1",
// "name": "SmallDailyStandup",
// "videoUrl": "video",
// "picture": "video",
// "is_call": "true"
// };
//
// IncomingCallData incomingCallData = IncomingCallData.fromJson(json);
// final result = await Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: incomingCallData)));
// }
//
// fcmConfigure() {
// FirebaseMessaging.onMessage.listen((RemoteMessage message) async {
// print(message.toString());
//
// IncomingCallData incomingCallData;
// if (Platform.isAndroid)
// incomingCallData = IncomingCallData.fromJson(message.data['data']);
// else if (Platform.isIOS) incomingCallData = IncomingCallData.fromJson(message.data);
// if (incomingCallData != null) final result = await Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: incomingCallData)));
// });
// }
// }