Marino Faggiana 1 年之前
父節點
當前提交
1c5b47f285

+ 12 - 0
iOSClient/Images.xcassets/speaker0.imageset/Contents.json

@@ -0,0 +1,12 @@
+{
+  "images" : [
+    {
+      "filename" : "speaker0.svg",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 8 - 0
iOSClient/Images.xcassets/speaker0.imageset/speaker0.svg

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg viewBox="0,0,256,256" width="50px" height="50px" fill-rule="nonzero" xmlns="http://www.w3.org/2000/svg">
+  <g fill="#000000" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal" transform="matrix(1, 0, 0, 1, 16.912527, 1.101919)">
+    <g transform="translate(239.02716,16.80287) rotate(90) scale(5.12,5.12)">
+      <path d="M24.15625,3c-0.30469,0 -0.60547,0.0625 -0.90625,0.15625c-0.60547,0.19141 -1.18359,0.55078 -1.6875,1.0625l-11.75,11.75h-6.8125c-1.66797,0 -3.03125,1.36328 -3.03125,3.03125v12c0,1.66797 1.36328,3.03125 3.03125,3.03125h6.8125l11.71875,11.65625c1.11719,1.12109 2.55078,1.61328 3.71875,1.0625c1.17578,-0.55469 1.75,-1.89062 1.75,-3.4375v-37c0,-1.5 -0.76562,-2.74609 -1.9375,-3.15625c-0.29297,-0.10156 -0.60156,-0.15625 -0.90625,-0.15625zM24.1875,5c0.10156,0 0.17969,0.00781 0.25,0.03125c0.28516,0.09766 0.5625,0.35156 0.5625,1.28125v37c0,1.06641 -0.35156,1.54297 -0.59375,1.65625c-0.24219,0.11328 -0.73047,0.125 -1.5,-0.65625l-12.59375,-12.59375c-0.01953,-0.01172 -0.04297,-0.02344 -0.0625,-0.03125c0.07422,0.06641 -0.25,-0.56641 -0.25,-0.9375v-11.5c0,-0.37109 0.33594,-1.01172 0.25,-0.9375c0.02344,-0.01953 0.04297,-0.03906 0.0625,-0.0625l12.65625,-12.625c0.46875,-0.47266 0.91016,-0.62109 1.21875,-0.625zM3,18.03125h5.1875c-0.12891,0.38281 -0.1875,0.80078 -0.1875,1.21875v11.5c0,0.41797 0.0625,0.83203 0.1875,1.21875h-5.1875c-0.53906,0 -0.96875,-0.42969 -0.96875,-0.96875v-12c0,-0.53906 0.42969,-0.96875 0.96875,-0.96875zM31.90625,18.96875c-0.04297,0.00781 -0.08594,0.01953 -0.125,0.03125c-0.375,0.06641 -0.67578,0.33984 -0.78125,0.70313c-0.10547,0.36719 0.00391,0.75781 0.28125,1.01563l4.28125,4.28125l-4.28125,4.28125c-0.39844,0.39844 -0.39844,1.03906 0,1.4375c0.39844,0.39844 1.03906,0.39844 1.4375,0l4.28125,-4.28125l4.28125,4.28125c0.39844,0.39844 1.03906,0.39844 1.4375,0c0.39844,-0.39844 0.39844,-1.03906 0,-1.4375l-4.28125,-4.28125l4.28125,-4.28125c0.32422,-0.30078 0.41016,-0.77734 0.21484,-1.17187c-0.19141,-0.39844 -0.625,-0.61719 -1.05859,-0.54687c-0.22266,0.02344 -0.43359,0.125 -0.59375,0.28125l-4.28125,4.28125l-4.28125,-4.28125c-0.20703,-0.22266 -0.50781,-0.33594 -0.8125,-0.3125z"/>
+    </g>
+  </g>
+</svg>

+ 12 - 0
iOSClient/Images.xcassets/speaker1.imageset/Contents.json

@@ -0,0 +1,12 @@
+{
+  "images" : [
+    {
+      "filename" : "speaker1.svg",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 8 - 0
iOSClient/Images.xcassets/speaker1.imageset/speaker1.svg

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg viewBox="0,0,256,256" width="50px" height="50px" fill-rule="nonzero" xmlns="http://www.w3.org/2000/svg">
+  <g fill="#000000" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal" transform="matrix(1, 0, 0, 1, 29.158455, 5.359102)">
+    <g transform="translate(226.78124,30.5609) rotate(90) scale(5.12,5.12)">
+      <path d="M24.15625,3c-0.30469,0 -0.60547,0.0625 -0.90625,0.15625c-0.60547,0.19141 -1.18359,0.55078 -1.6875,1.0625l-11.75,11.75h-6.8125c-1.66797,0 -3.03125,1.36328 -3.03125,3.03125v12c0,1.66797 1.36328,3.03125 3.03125,3.03125h6.8125l11.71875,11.65625c1.11719,1.12109 2.55078,1.61328 3.71875,1.0625c1.17578,-0.55469 1.75,-1.89062 1.75,-3.4375v-37c0,-1.5 -0.76562,-2.74609 -1.9375,-3.15625c-0.29297,-0.10156 -0.60156,-0.15625 -0.90625,-0.15625zM24.1875,5c0.10156,0 0.17969,0.00781 0.25,0.03125c0.28516,0.09766 0.5625,0.35156 0.5625,1.28125v37c0,1.06641 -0.35156,1.54297 -0.59375,1.65625c-0.24219,0.11328 -0.73047,0.125 -1.5,-0.65625l-12.59375,-12.59375c-0.01953,-0.01172 -0.04297,-0.02344 -0.0625,-0.03125c0.07422,0.06641 -0.25,-0.56641 -0.25,-0.9375v-11.5c0,-0.37109 0.33594,-1.01172 0.25,-0.9375c0.02344,-0.01953 0.04297,-0.03906 0.0625,-0.0625l12.65625,-12.625c0.46875,-0.47266 0.91016,-0.62109 1.21875,-0.625zM3,18.03125h5.1875c-0.12891,0.38281 -0.1875,0.80078 -0.1875,1.21875v11.5c0,0.41797 0.0625,0.83203 0.1875,1.21875h-5.1875c-0.53906,0 -0.96875,-0.42969 -0.96875,-0.96875v-12c0,-0.53906 0.42969,-0.96875 0.96875,-0.96875zM30.53125,18.40625c-0.48437,0.05859 -0.85156,0.45703 -0.875,0.94531c-0.02344,0.48438 0.30469,0.91797 0.78125,1.02344c2.04688,0.53516 3.5625,2.40234 3.5625,4.625c0,2.22266 -1.51562,4.08984 -3.5625,4.625c-0.53516,0.13672 -0.85547,0.68359 -0.71875,1.21875c0.13672,0.53516 0.68359,0.85547 1.21875,0.71875c2.91016,-0.76172 5.0625,-3.42578 5.0625,-6.5625c0,-3.13672 -2.15234,-5.80078 -5.0625,-6.5625c-0.13281,-0.03906 -0.26953,-0.04687 -0.40625,-0.03125z"/>
+    </g>
+  </g>
+</svg>

+ 12 - 0
iOSClient/Images.xcassets/speaker2.imageset/Contents.json

@@ -0,0 +1,12 @@
+{
+  "images" : [
+    {
+      "filename" : "speaker2.svg",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

文件差異過大導致無法顯示
+ 4 - 0
iOSClient/Images.xcassets/speaker2.imageset/speaker2.svg


+ 12 - 0
iOSClient/Images.xcassets/speaker3.imageset/Contents.json

@@ -0,0 +1,12 @@
+{
+  "images" : [
+    {
+      "filename" : "speaker3.svg",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

文件差異過大導致無法顯示
+ 4 - 0
iOSClient/Images.xcassets/speaker3.imageset/speaker3.svg


+ 3 - 3
iOSClient/Utility/NCUtility.swift

@@ -420,16 +420,16 @@ class NCUtility: NSObject {
         return ""
     }
 
-    func loadImage(named imageName: String, color: UIColor = UIColor.systemGray, size: CGFloat = 50, symbolConfiguration: Any? = nil) -> UIImage {
+    func loadImage(named imageName: String, color: UIColor = UIColor.systemGray, size: CGFloat = 50, symbolConfiguration: Any? = nil, renderingMode: UIImage.RenderingMode = .alwaysOriginal) -> UIImage {
 
         var image: UIImage?
 
         // see https://stackoverflow.com/questions/71764255
         let sfSymbolName = imageName.replacingOccurrences(of: "_", with: ".")
         if let symbolConfiguration = symbolConfiguration {
-            image = UIImage(systemName: sfSymbolName, withConfiguration: symbolConfiguration as? UIImage.Configuration)?.withTintColor(color, renderingMode: .alwaysOriginal)
+            image = UIImage(systemName: sfSymbolName, withConfiguration: symbolConfiguration as? UIImage.Configuration)?.withTintColor(color, renderingMode: renderingMode)
         } else {
-            image = UIImage(systemName: sfSymbolName)?.withTintColor(color, renderingMode: .alwaysOriginal)
+            image = UIImage(systemName: sfSymbolName)?.withTintColor(color, renderingMode: renderingMode)
         }
         if image == nil {
             image = UIImage(named: imageName)?.image(color: color, size: size)

+ 26 - 1
iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift

@@ -107,11 +107,13 @@ class NCPlayerToolBar: UIView {
         volumeSlider.value = AVAudioSession.sharedInstance().outputVolume
         volumeSlider.tintColor = .white
         volumeSlider.setThumbImage(UIImage(), for: .normal)
-        volumeSlider.maximumValueImage = NCUtility.shared.loadImage(named: "speaker.wave.3", color: .white).rotate(radians: .pi / 2)
+        volumeSlider.maximumValueImage = getSpeakerImage()
 
         // Normally hide
         self.alpha = 0
         self.isHidden = true
+
+        NotificationCenter.default.addObserver(self, selector: #selector(systemVolumeDidChange), name: Notification.Name("SystemVolumeDidChange"), object: nil)
     }
 
     required init?(coder aDecoder: NSCoder) {
@@ -178,6 +180,23 @@ class NCPlayerToolBar: UIView {
 
     // MARK: -
 
+    func getSpeakerImage() -> UIImage {
+
+        let volume = AVAudioSession.sharedInstance().outputVolume
+
+        if volume == 0 {
+            return NCUtility.shared.loadImage(named: "speaker0", color: .white, size: 20, renderingMode: .automatic)
+        } else if volume > 0 && volume <= 0.5 {
+            return NCUtility.shared.loadImage(named: "speaker1", color: .white, size: 20, renderingMode: .automatic)
+        } else if volume > 0.5 && volume < 1 {
+            return NCUtility.shared.loadImage(named: "speaker2", color: .white, size: 20, renderingMode: .automatic)
+        } else {
+            return NCUtility.shared.loadImage(named: "speaker3", color: .white, size: 20, renderingMode: .automatic)
+        }
+    }
+
+    // MARK: -
+
     public func show() {
 
         UIView.animate(withDuration: 0.3, animations: {
@@ -236,6 +255,12 @@ class NCPlayerToolBar: UIView {
         }
     }
 
+    @objc func systemVolumeDidChange(notification: NSNotification) {
+
+        volumeSlider.value = AVAudioSession.sharedInstance().outputVolume
+        volumeSlider.maximumValueImage = getSpeakerImage()
+    }
+
     // MARK: - Action
 
     @objc func tapTopToolBarWith(gestureRecognizer: UITapGestureRecognizer) { }

部分文件因文件數量過多而無法顯示