wxr
2024-09-30 a0e4d2fdc63d8c568d25e9970d83177cd9697004
可视对讲

1.更新安卓在响铃模式下才能响铃
4个文件已修改
69 ■■■■ 已修改文件
DLL/Linphone/Android/Shared.Droid.HDLLinphone.dll 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Other/HDLONUtils.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/HDLCommon.cs 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/1-HomePage/HomePage.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DLL/Linphone/Android/Shared.Droid.HDLLinphone.dll
Binary files differ
HDL-ON_Android/Other/HDLONUtils.cs
@@ -1,6 +1,7 @@
using 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;
        }
    }
}
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", "自研可视对讲铃声播放异常:" + ex.Message);
                                        }
                                    })
                                    { IsBackground = true }.Start();
                                }
                                catch (Exception ex)
                                {
                                    MainPage.Log("error", "自研可视对讲铃声播放异常:" + ex.Message);
                                }
                            })
                            { IsBackground = true }.Start();
                            }catch(Exception ex)
                            {
                                MainPage.Log("Error", $"安卓可视对讲响铃异常:{ex.StackTrace}");
                            }
#elif __IOS__
                            SoundPlayer.Ins.PlaySound();
                            new Thread(() => {
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)