From e71c57108e6dd407c2c6f0361f68150f2ff9aed5 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期三, 15 十二月 2021 13:41:16 +0800
Subject: [PATCH] 版本备份
---
HDL-ON_Android/LeChengVideoActivity.cs | 142 +++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 136 insertions(+), 6 deletions(-)
diff --git a/HDL-ON_Android/LeChengVideoActivity.cs b/HDL-ON_Android/LeChengVideoActivity.cs
index 71cb5b4..1d26881 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
@@ -30,13 +31,17 @@
{
private static LeChengVideoActivity CurtActivity;
//
- private string URL = "openapi.easy4ip.com:443";
+ private string URL = "openapi.easy4ip.com:443"; //娴峰锛堟寮忥級
+ private static string URL_LC_CHINA = "openapi.lechange.cn:443"; //涓浗澶ч檰(姝e紡)
+ private static string URL_LC_Overseas = "openapi.easy4ip.com:443"; //涓浗澶ч檰(姝e紡)
public string AccessToken = "";
public string DeviceId = "";
public string Psk = "";
public string PlayToken = "";//鎾斁playToken
public string CallId = "";//鍛煎彨Id
private int Type = 0;//0鐩戞帶锛�1瀵硅
+ private string DeviceName = "";// 澶囨敞
+
/// <summary>
/// 0:鍥藉唴锛�1娴峰
/// </summary>
@@ -65,6 +70,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 +101,7 @@
ivBack = (ImageView)FindViewById(Resource.Id.videoBackImg);
tvName = (TextView)FindViewById(Resource.Id.nameText);
- tvName.SetText("DeviceName", null);
+ tvName.SetText(DeviceName, null);
ivBack.SetOnClickListener(this);
}
@@ -108,8 +114,7 @@
mPlayWindow = new LCOpenSDK_PlayWindow();
mPlayWindow.InitPlayWindow(this, flWindowContent, 0, true);
- //if (Location == 1)
- URL = "openapi.easy4ip.com:443";
+
}
/// <summary>
@@ -117,6 +122,14 @@
/// </summary>
private void InitLCSDK()
{
+
+ if (Location == 1)
+ {
+ URL = URL_LC_Overseas;
+ }else {
+ URL = URL_LC_CHINA;
+ }
+
InitParams initParams = new InitParams(this, URL, AccessToken);
LCOpenSDK_Api.InitOpenApi(initParams);
}
@@ -129,6 +142,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 +158,7 @@
public void Stop()
{
mPlayWindow.StopRtspReal(true);//鍏抽棴瑙嗛
+ //mPlayWindow.WindowListener = null;
}
/// <summary>
@@ -152,8 +168,14 @@
{
CloseAudio();// 鍏抽棴Audio
LCOpenSDK_Talk.Listener = new AudioTalkerListener();//璁剧疆瀵硅鐩戝惉
+ //2021-10-29 瀵硅璇锋眰绫诲瀷锛宑all鍛煎彨锛屽鏋滀笉浼狅紝榛樿涓簍alk
+ string talkType = "talk";
+ if (Type == 1)//0鐩戞帶锛�1瀵硅
+ {
+ talkType = "call";
+ }
// 瀵硅鍙傛暟
- LCOpenSDK_ParamTalk paramTalk = new LCOpenSDK_ParamTalk(AccessToken, DeviceId, -1, Psk, PlayToken, true);
+ LCOpenSDK_ParamTalk paramTalk = new LCOpenSDK_ParamTalk(AccessToken, DeviceId, -1, Psk, PlayToken, true, talkType);
LCOpenSDK_Talk.PlayTalk(paramTalk);
}
@@ -182,6 +204,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 +366,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"))
{
@@ -267,7 +383,7 @@
CurtActivity.StopTalk();
CurtActivity.RunOnUiThread(() =>
{
- Toast.MakeText(CurtActivity, "鎵撳紑瀵硅澶辫触", ToastLength.Short).Show();
+ Toast.MakeText(CurtActivity, Resource.String.talk_open_failed, ToastLength.Short).Show();
});
}
else
@@ -300,5 +416,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