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.
		
		
		
		
		
			
		
			
				
	
	
		
			45 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Dart
		
	
			
		
		
	
	
			45 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Dart
		
	
 | 
						|
import 'dart:convert';
 | 
						|
import 'dart:io' show Platform;
 | 
						|
 | 
						|
import 'package:doctor_app_flutter/config/config.dart';
 | 
						|
import 'package:doctor_app_flutter/models/livecare/session_status_model.dart';
 | 
						|
import 'package:flutter/services.dart';
 | 
						|
 | 
						|
class VideoChannel{
 | 
						|
  /// channel name
 | 
						|
  static const _channel = const MethodChannel("Dr.cloudSolution/videoCall");
 | 
						|
  static  openVideoCallScreen(
 | 
						|
      {kApiKey, kSessionId, kToken, callDuration, warningDuration,int vcId,String tokenID,String generalId,int doctorId, Function() onCallEnd , Function(SessionStatusModel sessionStatusModel) onCallNotRespond ,Function(String error) onFailure}) async {
 | 
						|
    var result;
 | 
						|
    try {
 | 
						|
      result = await _channel.invokeMethod(
 | 
						|
        'openVideoCall',
 | 
						|
        {
 | 
						|
          "kApiKey": kApiKey,
 | 
						|
          "kSessionId": kSessionId,
 | 
						|
          "kToken": kToken,
 | 
						|
          "appLang": "en",
 | 
						|
          "baseUrl": BASE_URL_LIVE_CARE,//TODO change it to live
 | 
						|
          "VC_ID": vcId,
 | 
						|
          "TokenID": tokenID,
 | 
						|
          "generalId": generalId,
 | 
						|
          "DoctorId": doctorId ,
 | 
						|
        },
 | 
						|
      );
 | 
						|
      if(result['callResponse'] == 'CallEnd') {
 | 
						|
        onCallEnd();
 | 
						|
      }
 | 
						|
      else {
 | 
						|
        SessionStatusModel sessionStatusModel = SessionStatusModel.fromJson(Platform.isIOS ?result['sessionStatus'] :json.decode(result['sessionStatus']));
 | 
						|
        onCallNotRespond(sessionStatusModel);
 | 
						|
      }
 | 
						|
 | 
						|
    } catch (e) {
 | 
						|
      onFailure(e.toString());
 | 
						|
    }
 | 
						|
 | 
						|
  }
 | 
						|
 | 
						|
 | 
						|
} |