From a0e4d2fdc63d8c568d25e9970d83177cd9697004 Mon Sep 17 00:00:00 2001
From: wxr <wxr@hdlchina.com.cn>
Date: 星期一, 30 九月 2024 10:05:34 +0800
Subject: [PATCH] 可视对讲
---
HDL_ON/UI/UI2/1-HomePage/HomePage.cs | 13 ++++++
HDL_ON/Common/HDLCommon.cs | 47 ++++++++++++++---------
HDL-ON_Android/Other/HDLONUtils.cs | 9 ++++
DLL/Linphone/Android/Shared.Droid.HDLLinphone.dll | 0
4 files changed, 49 insertions(+), 20 deletions(-)
diff --git a/DLL/Linphone/Android/Shared.Droid.HDLLinphone.dll b/DLL/Linphone/Android/Shared.Droid.HDLLinphone.dll
index 7a4e2a1..7db5d71 100644
--- a/DLL/Linphone/Android/Shared.Droid.HDLLinphone.dll
+++ b/DLL/Linphone/Android/Shared.Droid.HDLLinphone.dll
Binary files differ
diff --git a/HDL-ON_Android/Other/HDLONUtils.cs b/HDL-ON_Android/Other/HDLONUtils.cs
index 14cd26a..bfe96fa 100644
--- a/HDL-ON_Android/Other/HDLONUtils.cs
+++ b/HDL-ON_Android/Other/HDLONUtils.cs
@@ -1,6 +1,7 @@
锘縰sing System;
using Android.App;
using Android.Content;
+using Android.Media;
using Android.OS;
using Java.IO;
@@ -71,5 +72,13 @@
return false; // 搴旂敤涓嶅湪鍓嶅彴
}
+
+ public static bool IsSilentMode(Context context)
+ {
+ AudioManager audioManager = (AudioManager)context.GetSystemService(Context.AudioService);
+
+ // 鍒ゆ柇鏄惁澶勪簬闈欓煶妯″紡
+ return audioManager.RingerMode == RingerMode.Silent || audioManager.RingerMode == RingerMode.Vibrate;
+ }
}
}
diff --git a/HDL_ON/Common/HDLCommon.cs b/HDL_ON/Common/HDLCommon.cs
index 8a0a362..8b23ca2 100644
--- a/HDL_ON/Common/HDLCommon.cs
+++ b/HDL_ON/Common/HDLCommon.cs
@@ -359,31 +359,40 @@
}
#if __ANDROID__
- Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.MissedCallsTime = 30;
- Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.SetMediaPlayerLooping(true);
- Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.PlayRingtone();
- new Thread(() =>
+ try
{
- try
+ //瀹夊崜濡傛灉璁剧疆浜嗛潤闊筹紝涓嶈兘鍝嶉搩
+ if (Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.AudioManager.RingerMode.ToString().ToLower() == "normal")
{
- DateTime dateTime = DateTime.Now;
- while (true)
+ Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.MissedCallsTime = 30;
+ Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.SetMediaPlayerLooping(true);
+ Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.PlayRingtone();
+ new Thread(() =>
{
- Thread.Sleep(1000);
- if (!Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.MediaPlayerPlayingStatus || dateTime.AddSeconds(Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.MissedCallsTime) <= DateTime.Now)
+ try
{
- break;
+ DateTime dateTime = DateTime.Now;
+ while (true)
+ {
+ Thread.Sleep(1000);
+ if (!Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.MediaPlayerPlayingStatus || dateTime.AddSeconds(Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.MissedCallsTime) <= DateTime.Now)
+ {
+ break;
+ }
+ }
+ Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.SetMediaPlayerLooping(false);
}
- }
- Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.SetMediaPlayerLooping(false);
+ catch (Exception ex)
+ {
+ MainPage.Log("error", "鑷爺鍙瀵硅閾冨0鎾斁寮傚父:" + ex.Message);
+ }
+ })
+ { IsBackground = true }.Start();
}
- catch (Exception ex)
- {
- MainPage.Log("error", "鑷爺鍙瀵硅閾冨0鎾斁寮傚父:" + ex.Message);
- }
- })
- { IsBackground = true }.Start();
-
+ }catch(Exception ex)
+ {
+ MainPage.Log("Error", $"瀹夊崜鍙瀵硅鍝嶉搩寮傚父:{ex.StackTrace}");
+ }
#elif __IOS__
SoundPlayer.Ins.PlaySound();
new Thread(() => {
diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
index 9c335d4..a4425fb 100644
--- a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
+++ b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
@@ -567,7 +567,18 @@
btnResidenceName.MouseUpEventHandler = (envent, ee) =>
{
#if __ANDROID__
- Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.PlayRingtone();
+ //Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.PlayRingtone();
+ //Android.Media.AudioManager audioManager = (Android.Media.AudioManager)Application.Activity.GetSystemService(Android.Content.Context.AudioService);
+ //Console.WriteLine(audioManager.RingerMode);
+ try
+ {
+ var ddd = Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.AudioManager.RingerMode ;
+ Console.WriteLine(ddd + ";;;;ddd");// ddd Vibrate 闇囧姩 銆併�� ddd Silent 闈欓煶// ddd Normal
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("dddd"+e.StackTrace);
+ }
#elif __IOS__
//if (isPlay)
--
Gitblit v1.8.0