From e172a0f48fdd01733e04bda2370846b9f36b840f Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期五, 15 十月 2021 14:44:03 +0800
Subject: [PATCH] 2021-10-15 1.修改乐橙推送字段,psk参数取值不能取cname和deviceName

---
 HDL-ON_Android/LeChengVideoActivity.cs |  117 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 116 insertions(+), 1 deletions(-)

diff --git a/HDL-ON_Android/LeChengVideoActivity.cs b/HDL-ON_Android/LeChengVideoActivity.cs
index 9020958..94cae4b 100644
--- a/HDL-ON_Android/LeChengVideoActivity.cs
+++ b/HDL-ON_Android/LeChengVideoActivity.cs
@@ -21,6 +21,7 @@
 using Com.Lechange.Opensdk.Media;
 using HDL_ON.DAL.Server;
 using HDL_ON_Android.LeChengView.Form;
+using Java.IO;
 using Java.Lang;
 
 namespace HDL_ON_Android
@@ -37,6 +38,8 @@
         public string PlayToken = "";//鎾斁playToken
         public string CallId = "";//鍛煎彨Id
         private int Type = 0;//0鐩戞帶锛�1瀵硅
+        private string DeviceName = "";// 澶囨敞
+
         /// <summary>
         /// 0:鍥藉唴锛�1娴峰
         /// </summary>
@@ -65,6 +68,7 @@
             Type = Intent.GetIntExtra("Type", 0);//0鐩戞帶锛�1瀵硅//1
             Location = Intent.GetIntExtra("Location", 0);//1
             CallId = Intent.GetStringExtra("callId");//1384766990812426242
+            DeviceName = Intent.GetStringExtra("DeviceName");
 
             InitLCSDK();
 
@@ -95,7 +99,7 @@
             ivBack = (ImageView)FindViewById(Resource.Id.videoBackImg);
             tvName = (TextView)FindViewById(Resource.Id.nameText);
 
-            tvName.SetText("DeviceName", null);
+            tvName.SetText(DeviceName, null);
             ivBack.SetOnClickListener(this);
 
         }
@@ -129,6 +133,8 @@
             try
             {
                 LCOpenSDK_ParamReal paramReal = new LCOpenSDK_ParamReal(AccessToken, DeviceId, 0, Psk, PlayToken, 1, false, true);
+                //PlayEventListener listener = new PlayEventListener();//瀹炵幇鎾斁浜嬩欢鐩戝惉鍥炶皟 2021-10-15 鐩墠涓嶈兘鐩戝惉锛岀洃鍚簡浼氱┖寮傚父
+                //mPlayWindow.WindowListener = listener;//瀹炵幇鎾斁浜嬩欢鐩戝惉鍥炶皟
                 mPlayWindow.PlayRtspReal(paramReal);
             }
             catch (System.Exception e)
@@ -143,6 +149,7 @@
         public void Stop()
         {
             mPlayWindow.StopRtspReal(true);//鍏抽棴瑙嗛
+            //mPlayWindow.WindowListener = null;
         }
 
         /// <summary>
@@ -182,6 +189,99 @@
         public bool CloseAudio()
         {
             return mPlayWindow.StopAudio() == 0;
+        }
+
+        /// <summary>
+        /// 寮�閿�
+        /// </summary>
+        public void Unlock()
+        {
+            //
+            Dictionary<string, object> dic = new Dictionary<string, object>();
+            dic.Add("deviceId", this.DeviceId);
+            dic.Add("callId", this.CallId);
+
+            var requestJson = HttpUtil.GetSignRequestJson(dic);
+            var revertObj = HttpUtil.RequestHttpsPostFroHome("/home-wisdom/platform/imou/openDoorbell", requestJson);
+            if (revertObj.Code == StateCode.SUCCESS)
+            {
+                Toast.MakeText(this, Resources.GetString(Resource.String.unlock_success), ToastLength.Short).Show();
+            }
+            else
+            {
+                Toast.MakeText(this, Resources.GetString(Resource.String.unlock_fail), ToastLength.Short).Show();
+            }
+        }
+
+        ///// <summary>
+        ///// 鍙戦�佸箍鎾紝閫氱煡鍒锋柊鍥惧簱鐨勬樉绀�
+        ///// </summary>
+        ///// <param name="path"></param>
+        //void SendBroadcastScanFile(Context context, string path)
+        //{
+        //    // 鍙戦�佸箍鎾紝閫氱煡鍒锋柊鍥惧簱鐨勬樉绀�
+        //    Intent scanIntent = new Intent(Intent.ActionMediaScannerScanFile);
+        //    scanIntent.SetData(Android.Net.Uri.FromFile(new File(path)));
+        //    context.SendBroadcast(scanIntent);
+        //}
+
+        /// <summary>
+        /// 鎴浘
+        /// </summary>
+        /// <param name="path"></param>
+        public void SnapShot(string path)
+        {
+            try
+            {
+                int code = mPlayWindow.SnapShot(path);
+                if (code == 0)
+                {
+                    //2021-09-01 澧炲姞鍙戦�佸箍鎾紝閫氱煡鍒锋柊鍥惧簱鐨勬樉绀�
+                    HDLONUtils.SendBroadcastScanFile(this, path);
+
+                    //Android.Provider.MediaStore.Images.Media.InsertImage(this.getContentResolver(), path, "ss", "ss");
+                    Toast.MakeText(this, Resources.GetString(Resource.String.screenshot_success), ToastLength.Short).Show();
+                }
+                else
+                {
+                    Toast.MakeText(this, Resources.GetString(Resource.String.screenshot_fail), ToastLength.Short).Show();
+                }
+            }
+            catch (System.Exception e)
+            {
+                string error = e.Message;
+            }
+            
+            //杩愯鍒拌繖锛宲hotoFile宸茬粡瀛樺湪锛岃繖閲岄渶瑕佽幏寰楄繖涓枃浠剁殑uri
+            //* 鍒嗕袱绉嶆儏鍐碉紝android7.0浠ヤ笂鍜屼互涓�
+            // 鍏堝瓨鍏ヤ复鏃剁洰褰曪紝鐒跺悗鍐嶇Щ鍔ㄥ埌鐩稿唽鐩綍涓�
+            //File photoFile = new File(path);
+            //Android.Net.Uri photoUri;
+
+            //if (Build.VERSION.SdkInt >= 24)
+            //if (Build.VERSION.PreviewSdkInt >= 24)
+            //{
+
+            //    /**
+            //     * FileProvider.getUriForFile(),杩欎釜鏂规硶涓渶瑕佸~鍐欎笁涓弬鏁帮紝
+            //     * 绗竴涓狢ontext锛�
+            //     * 绗簩涓猄
+            //     * tring 浠绘剰
+            //     * 绗笁涓狥ile
+            //     */
+            //    photoUri = FileProvider.GetUriForFile(this, "HDL Video SnapShot", photoFile);
+
+            //}
+            //else
+            //{
+            //    photoUri = Android.Net.Uri.FromFile(photoFile);
+            //}
+    
+        }
+
+        private ContentResolver getContentResolver()
+        {
+            throw new NotImplementedException();
         }
 
         /// <summary>
@@ -251,6 +351,7 @@
 
                 try
                 {
+                    System.Console.WriteLine("LC OnTalkResult error锛�" + error + "  type:" + type);
                     bool talkResult = false;
                     if (type == 99 || error.Equals("-1000") || error.Equals("0") || error.Equals("1") || error.Equals("3"))
                     {
@@ -300,5 +401,19 @@
             }
         }
 
+        /// <summary>
+        /// 鎾斁銆侀瑙堢粨鏋滃洖璋�
+        /// resultSource:  0--RTSP  1--HLS  5--DHHTTP  99--OPENAPI
+        /// </summary>
+        class PlayEventListener : LCOpenSDK_EventListener
+        {
+            public override void OnPlayerResult(int index, string code, int resultSource)
+            {
+                base.OnPlayerResult(index, code, resultSource);
+                System.Console.WriteLine("LC OnPlayerResult index锛�" + index + "  code:" + code + "  resultSource:"+ resultSource);
+            }
+
+           
+        }
     }
 }

--
Gitblit v1.8.0