wei
2021-07-16 65d30e65eb0ee4168871e891984ea565b144c7f4
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);
        }
@@ -185,6 +189,84 @@
        }
        /// <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>
        public void SnapShot(string path)
        {
            try
            {
                int code = mPlayWindow.SnapShot(path);
                if (code == 0)
                {
                    //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;
            }
            //运行到这,photoFile已经存在,这里需要获得这个文件的uri
            //* 分两种情况,android7.0以上和以下
            // 先存入临时目录,然后再移动到相册目录中
            //File photoFile = new File(path);
            //Android.Net.Uri photoUri;
            //if (Build.VERSION.SdkInt >= 24)
            //if (Build.VERSION.PreviewSdkInt >= 24)
            //{
            //    /**
            //     * FileProvider.getUriForFile(),这个方法中需要填写三个参数,
            //     * 第一个Context,
            //     * 第二个S
            //     * tring 任意
            //     * 第三个File
            //     */
            //    photoUri = FileProvider.GetUriForFile(this, "HDL Video SnapShot", photoFile);
            //}
            //else
            //{
            //    photoUri = Android.Net.Uri.FromFile(photoFile);
            //}
        }
        private ContentResolver getContentResolver()
        {
            throw new NotImplementedException();
        }
        /// <summary>
        /// 设置顶部状态栏背景透明
        /// </summary>
        private void SetStatusBarColor()