From c26c06ef4a22d6fb9e59dc734abca92fa8a23c47 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期五, 05 六月 2020 17:41:00 +0800
Subject: [PATCH] 2020-06-05-02
---
Shared.IOS/Volume.cs | 152 +++++++++++++++++++++++++-------------------------
1 files changed, 76 insertions(+), 76 deletions(-)
diff --git a/Shared.IOS/Volume.cs b/Shared.IOS/Volume.cs
old mode 100755
new mode 100644
index 5022927..a38d5e7
--- a/Shared.IOS/Volume.cs
+++ b/Shared.IOS/Volume.cs
@@ -1,77 +1,77 @@
-锘縰sing System;
-using AVFoundation;
-using Foundation;
-using MediaPlayer;
-using Shared;
-using UIKit;
+锘�//using System;
+//using AVFoundation;
+//using Foundation;
+//using MediaPlayer;
+//using Shared;
+//using UIKit;
-namespace com.hdl.on
-{
- public static class Volume
- {
- /// <summary>
- /// 澹伴煶鍙樺寲浜嬩欢
- /// </summary>
- public static Action<int> VolumeChange;
- /// <summary>
- /// 璁剧疆褰撳墠闊抽噺
- /// </summary>
- /// <param name="volume">Volume.</param>
- public static int MusicVolume
- {
- set
- {
- if ((DateTime.Now - dateTime).TotalMilliseconds < 2000)
- {
- return;
- }
- foreach (var view in BaseViewController.MPVolumeView.Subviews)
- {
- if (view.GetType().Name == "UISlider")
- {
- (view as UISlider).SetValue((float)Math.Round(value / 100.0f, 2, MidpointRounding.AwayFromZero), false);
- beforeVolume = (view as UISlider).Value;
- //System.Console.WriteLine("鎺ユ敹鍒版洿鏂伴煶閲忥細" + (float)Math.Round(value / 100.0f, 2, MidpointRounding.AwayFromZero) + " " + beforeVolume);
- break;
- }
- }
- }
- }
- static System.DateTime dateTime = DateTime.MinValue;
- /// <summary>
- /// 涔嬪墠鐨勯煶閲�
- /// </summary>
- static float beforeVolume;
- public static void Init()
- {
- NSNotificationCenter.DefaultCenter.AddObserver(new NSString("AVSystemController_SystemVolumeDidChangeNotification"),
- (obj) =>
- {
- //濡傛灉搴旂敤杩涘叆鍚庡彴锛屼笉鎵ц闊抽噺鍙樺寲
- if (UIApplication.SharedApplication.ApplicationState != UIApplicationState.Active || "Audio/Video" != obj.UserInfo.ObjectForKey(new NSString("AVSystemController_AudioCategoryNotificationParameter")).ToString())
- {
- return;
- }
- //System.Console.WriteLine("鎺ユ敹鍒伴煶閲忓彉鍖栦簨浠�");
- dateTime = DateTime.Now;
- var tempValue = obj.UserInfo.ObjectForKey(new NSString("AVSystemController_AudioVolumeNotificationParameter"));
- if (tempValue == null)
- {
- return;
- }
- try
- {
- //鏈夋椂杞崲澶辫触锛屽彲鑳芥湁鏃跺�兼湁闂
- var volume = 100 * float.Parse(tempValue.ToString());
- volume = (float)Math.Round(volume, 2, MidpointRounding.AwayFromZero);
- //System.Console.WriteLine("闊抽噺鍙樺寲浜嬩欢锛�" + volume + " " + beforeVolume * 100);
- if (VolumeChange != null && beforeVolume * 100 != volume)
- {
- VolumeChange((int)volume);
- }
- }
- catch { }
- });
- }
- }
-}
+//namespace com.hdl.on
+//{
+// public static class Volume
+// {
+// /// <summary>
+// /// 澹伴煶鍙樺寲浜嬩欢
+// /// </summary>
+// public static Action<int> VolumeChange;
+// /// <summary>
+// /// 璁剧疆褰撳墠闊抽噺
+// /// </summary>
+// /// <param name="volume">Volume.</param>
+// public static int MusicVolume
+// {
+// set
+// {
+// if ((DateTime.Now - dateTime).TotalMilliseconds < 2000)
+// {
+// return;
+// }
+// foreach (var view in BaseViewController.MPVolumeView.Subviews)
+// {
+// if (view.GetType().Name == "UISlider")
+// {
+// (view as UISlider).SetValue((float)Math.Round(value / 100.0f, 2, MidpointRounding.AwayFromZero), false);
+// beforeVolume = (view as UISlider).Value;
+// //System.Console.WriteLine("鎺ユ敹鍒版洿鏂伴煶閲忥細" + (float)Math.Round(value / 100.0f, 2, MidpointRounding.AwayFromZero) + " " + beforeVolume);
+// break;
+// }
+// }
+// }
+// }
+// static System.DateTime dateTime = DateTime.MinValue;
+// /// <summary>
+// /// 涔嬪墠鐨勯煶閲�
+// /// </summary>
+// static float beforeVolume;
+// public static void Init()
+// {
+// NSNotificationCenter.DefaultCenter.AddObserver(new NSString("AVSystemController_SystemVolumeDidChangeNotification"),
+// (obj) =>
+// {
+// //濡傛灉搴旂敤杩涘叆鍚庡彴锛屼笉鎵ц闊抽噺鍙樺寲
+// if (UIApplication.SharedApplication.ApplicationState != UIApplicationState.Active || "Audio/Video" != obj.UserInfo.ObjectForKey(new NSString("AVSystemController_AudioCategoryNotificationParameter")).ToString())
+// {
+// return;
+// }
+// //System.Console.WriteLine("鎺ユ敹鍒伴煶閲忓彉鍖栦簨浠�");
+// dateTime = DateTime.Now;
+// var tempValue = obj.UserInfo.ObjectForKey(new NSString("AVSystemController_AudioVolumeNotificationParameter"));
+// if (tempValue == null)
+// {
+// return;
+// }
+// try
+// {
+// //鏈夋椂杞崲澶辫触锛屽彲鑳芥湁鏃跺�兼湁闂
+// var volume = 100 * float.Parse(tempValue.ToString());
+// volume = (float)Math.Round(volume, 2, MidpointRounding.AwayFromZero);
+// //System.Console.WriteLine("闊抽噺鍙樺寲浜嬩欢锛�" + volume + " " + beforeVolume * 100);
+// if (VolumeChange != null && beforeVolume * 100 != volume)
+// {
+// VolumeChange((int)volume);
+// }
+// }
+// catch { }
+// });
+// }
+// }
+//}
--
Gitblit v1.8.0