| | |
| | | using HDL_ON.Entity; |
| | | |
| | | #if __IOS__ |
| | | using Shared.IOS.ESVideoOnSDK; |
| | | using Shared.IOS.LCVideoOnSDK; |
| | | using UIKit; |
| | | using Foundation; |
| | | #else |
| | |
| | | int.TryParse(mESVideoInfo.roomno, out roomID); |
| | | |
| | | #if __IOS__ |
| | | if (interphoneType == InterphoneType.IMOUVISIAL.ToString()) |
| | | { |
| | | //乐橙可视对讲 |
| | | //1.初始化LCOpenSDK_Api(Shared.IOS.LCVideoOnSDK) |
| | | LCApiKit.SharedInstance().IsChinaMainland = GetIsChinaMainland(); |
| | | LCApiKit.SharedInstance().InitSDKOpenApi(mESVideoInfo.Lc_AccessToken); |
| | | LCApiKit.SharedInstance().CurrentDevicePlayToken = mESVideoInfo.Lc_PlayToken; |
| | | LCApiKit.SharedInstance().CurrentDeviceId = mESVideoInfo.Lc_DeviceId; |
| | | LCApiKit.SharedInstance().CurrentDeviceName = mESVideoInfo.DeviceName; |
| | | LCApiKit.SharedInstance().CurrentPsk = mESVideoInfo.Lc_Psk; |
| | | //2.调整监视页面 |
| | | LCOnMonitorViewController vc = new LCOnMonitorViewController(); |
| | | mOnLCCallDelegate = new OnLCCallDelegate(this); |
| | | vc.MLCCallDelegate = mOnLCCallDelegate; |
| | | //vc.MLCCallDelegate = new OnLCCallDelegate(this); |
| | | Shared.Application.currentVC.NavigationController.PushViewController(vc, true); |
| | | } |
| | | else if(interphoneType == InterphoneType.FLVI.ToString()) |
| | | { |
| | | //Shared.IOS.ESVideoOnSDK |
| | | ESOnMonitorViewController vc = new ESOnMonitorViewController(); |
| | | vc.MESVideoID = mESVideoInfo.ESVideoUUID; |
| | | vc.MESRoomID = roomID; |
| | | vc.DeviceName = mESVideoInfo.DeviceName; |
| | | Shared.Application.currentVC.NavigationController.PushViewController(vc, true); |
| | | } |
| | | else if (interphoneType == InterphoneType.HDL.ToString()) |
| | | if (interphoneType == InterphoneType.HDL.ToString()) |
| | | { |
| | | //HDLLinphone 狄耐克 |
| | | HDLLinphone.Current.ShowESVideoMonitor(mESVideoInfo, interphoneType); |
| | | } else if (interphoneType == InterphoneType.FREEVIEW.ToString()) |
| | | { |
| | | //全视通监视 |
| | | //NSDictionary deviceInfo = new NSDictionary("deviceCode",mESVideoInfo.deviceCode, "deviceName", mESVideoInfo.DeviceName); |
| | | //Shared.IOS.HDLFVSDK.Video.Monitor(deviceInfo); |
| | | } |
| | | else |
| | | { |
| | |
| | | int roomID = 0; |
| | | int.TryParse(mESVideoInfo.roomno, out roomID); |
| | | #if __IOS__ |
| | | if (interphoneType == InterphoneType.IMOUVISIAL.ToString()) |
| | | { |
| | | //乐橙可视对讲 |
| | | //1.初始化LCOpenSDK_Api(Shared.IOS.LCVideoOnSDK) |
| | | LCApiKit.SharedInstance().IsChinaMainland = GetIsChinaMainland(); |
| | | LCApiKit.SharedInstance().InitSDKOpenApi(mESVideoInfo.Lc_AccessToken); |
| | | //2021-05-18 目前推送的PlayToken;有问题会导致SDK崩溃,暂时不传 |
| | | //LCApiKit.SharedInstance().CurrentDevicePlayToken = mESVideoInfo.Lc_PlayToken; |
| | | LCApiKit.SharedInstance().CurrentDeviceId = mESVideoInfo.Lc_DeviceId; |
| | | LCApiKit.SharedInstance().CurrentDeviceName = mESVideoInfo.DeviceName; |
| | | LCApiKit.SharedInstance().CurrentPsk = mESVideoInfo.Lc_Psk; |
| | | //2.跳转乐橙呼叫页面 |
| | | LCOnIntercomViewController vc = new LCOnIntercomViewController(); |
| | | mOnLCCallDelegate = new OnLCCallDelegate(this); |
| | | vc.MLCCallDelegate = mOnLCCallDelegate; |
| | | //vc.MLCCallDelegate = new OnLCCallDelegate(this); |
| | | Shared.Application.currentVC.NavigationController.PushViewController(vc, true); |
| | | } |
| | | else if (interphoneType == InterphoneType.EZVIZ.ToString()) |
| | | { |
| | | //萤石猫眼呼叫 |
| | | //初始化萤石云SDK,中文国内key、英文海外key 开发者账号使用应用包名申请的APPKEY,不同包名应用需配置不同的APPKEY |
| | | EZSDK.IOS.EZSDK.SharedInstance().InitLibWithAppKey("1aa98a90489b4838b966b57018b4b04b", "1aa98a90489b4838b966b57018b4b04b"); |
| | | //1.设置所需河东的AccessToken和RefreshToken、域名地址 |
| | | EZSDK.IOS.EZSDK.SharedInstance().SetHDlAccessToken(UserInfo.Current.LoginTokenString, UserInfo.Current.RefreshToken); |
| | | |
| | | EZSDK.IOS.EZSDK.SharedInstance().SetRequestHttpsHostAndPlatform(OnAppConfig.Instance.RequestHttpsHost, 1, mESVideoInfo.HomeId); |
| | | //2.设置萤石子账号的AccessToken到SDK |
| | | EZSDK.IOS.EZSDK.SharedInstance().SetEZAccessToken(mESVideoInfo.Lc_AccessToken); |
| | | //3.打开视频播放页面 |
| | | string currentTimeStr = Utlis.GetTimestamp(); // 当前时间 |
| | | |
| | | if (string.IsNullOrEmpty(mESVideoInfo.currentTime) && string.IsNullOrEmpty(currentTimeStr) && (long.Parse(currentTimeStr) - long.Parse(mESVideoInfo.currentTime)) > 30000) { // 超时30s |
| | | EZSDK.IOS.EZSDK.SharedInstance().PlayWithDeviceSerial(mESVideoInfo.DeviceSerial); |
| | | } |
| | | else { |
| | | EZSDK.IOS.EZSDK.SharedInstance().PlayWithDeviceSerial(mESVideoInfo.DeviceSerial, mESVideoInfo.msgId); |
| | | } |
| | | } |
| | | else if (interphoneType == InterphoneType.HDL.ToString()) |
| | | if (interphoneType == InterphoneType.HDL.ToString()) |
| | | { |
| | | //HDL Linphone 狄耐克 |
| | | |
| | | |
| | | } |
| | | else if (interphoneType == InterphoneType.FLVI.ToString()) |
| | | { |
| | | //Shared.IOS.ESVideoOnSDK |
| | | ESOnIntercomViewController vc = new ESOnIntercomViewController(); |
| | | vc.MESVideoID = mESVideoInfo.ESVideoUUID; |
| | | vc.MESRoomID = roomID; |
| | | vc.DeviceName = mESVideoInfo.DeviceName; |
| | | //vc.RoomName = mESVideoInfo.RoomName; |
| | | //vc.MESCallDelegate = new OnESCallDelegate(this); |
| | | mOnESCallDelegate = new OnESCallDelegate(this); |
| | | vc.MESCallDelegate = mOnESCallDelegate; |
| | | Shared.Application.currentVC.NavigationController.PushViewController(vc, true); |
| | | } |
| | | else{ |
| | | HDLUtils.WriteLine("未支持的可视对讲类型"); |
| | |
| | | |
| | | #if __IOS__ |
| | | #region OnESCallDelegate |
| | | /////// <summary> |
| | | /////// OnESCallDelegate 继承响应事件(Shared.IOS.ESVideoOnSDK) |
| | | /////// </summary> |
| | | OnESCallDelegate mOnESCallDelegate; |
| | | |
| | | /// <summary> |
| | | /// iOS原生委托事件 |
| | | /// </summary> |
| | | public class OnESCallDelegate : ESCallDelegate |
| | | { |
| | | /// <summary> |
| | | /// ESOnVideo |
| | | /// </summary> |
| | | [Weak] ESOnVideo _ESOnVideo; |
| | | |
| | | /// <summary> |
| | | /// 初始化 |
| | | /// </summary> |
| | | /// <param name="mESOnVideo">呼叫相关的参数</param> |
| | | public OnESCallDelegate(ESOnVideo mESOnVideo) |
| | | { |
| | | _ESOnVideo = mESOnVideo; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 接听 |
| | | /// </summary> |
| | | public override void OnAnswerAction() |
| | | { |
| | | _ESOnVideo.AnswerAction(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 挂断 |
| | | /// </summary> |
| | | /// <param name="callDuration"></param> |
| | | public override void OnHangUpAction(int callDuration) |
| | | { |
| | | _ESOnVideo.HangUpAction(callDuration); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 拒接 |
| | | /// </summary> |
| | | public override void OnRejectCallAction() |
| | | { |
| | | _ESOnVideo.RejectCallAction(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 截图成功 |
| | | /// </summary> |
| | | /// <param name="image"></param> |
| | | public override void OnScreenshotSuccessfulAction(UIImage image) |
| | | { |
| | | //NSData imageData = UIImagePNGRepresentation(image); UIImage |
| | | NSData imageData = image.AsPNG(); |
| | | byte[] dataBytes = new byte[imageData.Length]; |
| | | System.Runtime.InteropServices.Marshal.Copy(imageData.Bytes, dataBytes, 0, Convert.ToInt32(imageData.Length)); |
| | | //image.g |
| | | _ESOnVideo.ScreenshotSuccessfulAction(dataBytes); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 开锁成功 |
| | | /// </summary> |
| | | public override void OnUnlockAction() |
| | | { |
| | | _ESOnVideo.UnlockAction(); |
| | | } |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region OnLCCallDelegate |
| | | /////// <summary> |
| | | /////// OnLCCallDelegate 继承响应事件(Shared.IOS.LCVideoOnSDK) |
| | | /////// </summary> |
| | | OnLCCallDelegate mOnLCCallDelegate; |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public class OnLCCallDelegate : LCCallDelegate |
| | | { |
| | | |
| | | [Weak] ESOnVideo _ESOnVideo; |
| | | |
| | | public OnLCCallDelegate(ESOnVideo mESOnVideo) |
| | | { |
| | | _ESOnVideo = mESOnVideo; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 接听 |
| | | /// </summary> |
| | | public override void OnAnswerAction() |
| | | { |
| | | _ESOnVideo.HDLUpdateCallStatus(CallStatusType.RECEIVED, InterphoneType.IMOUVISIAL); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 挂断 |
| | | /// </summary> |
| | | /// <param name="callDuration"></param> |
| | | public override void OnHangUpAction(int callDuration) |
| | | { |
| | | _ESOnVideo.HDLUpdateCallStatus(CallStatusType.RECEIVED, InterphoneType.IMOUVISIAL, callDuration); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 拒接 |
| | | /// </summary> |
| | | public override void OnRejectCallAction() |
| | | { |
| | | _ESOnVideo.HDLUpdateCallStatus(CallStatusType.REJECT, InterphoneType.IMOUVISIAL); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 截图成功 |
| | | /// </summary> |
| | | /// <param name="image"></param> |
| | | public override void OnScreenshotSuccessfulAction(UIImage image) |
| | | { |
| | | ////NSData imageData = UIImagePNGRepresentation(image); UIImage |
| | | //NSData imageData = image.AsPNG(); |
| | | //byte[] dataBytes = new byte[imageData.Length]; |
| | | //System.Runtime.InteropServices.Marshal.Copy(imageData.Bytes, dataBytes, 0, Convert.ToInt32(imageData.Length)); |
| | | ////image.g |
| | | ////_ESOnVideo.ScreenshotSuccessfulAction(dataBytes); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 开锁成功 |
| | | /// </summary> |
| | | public override void OnUnlockAction() |
| | | { |
| | | _ESOnVideo.HDLUnlockAction(); |
| | | } |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | |