Marino Faggiana 1 жил өмнө
parent
commit
daafe15867

+ 12 - 10
iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift

@@ -34,15 +34,17 @@ class NCPlayerToolBar: UIView {
 
     @IBOutlet weak var playerTopToolBarView: UIStackView!
     @IBOutlet weak var playerToolBarView: UIView!
-    @IBOutlet weak var muteButton: UIButton!
     @IBOutlet weak var playButton: UIButton!
     @IBOutlet weak var subtitleButton: UIButton!
     @IBOutlet weak var audioButton: UIButton!
     @IBOutlet weak var forwardButton: UIButton!
     @IBOutlet weak var backButton: UIButton!
     @IBOutlet weak var playbackSlider: UISlider!
+    @IBOutlet weak var volumeSlider: UISlider!
     @IBOutlet weak var labelLeftTime: UILabel!
     @IBOutlet weak var labelCurrentTime: UILabel!
+    @IBOutlet weak var volumeSliderConstraintWidth: NSLayoutConstraint!
+    @IBOutlet weak var volumeSliderConstraintTrailing: NSLayoutConstraint!
 
     enum sliderEventType {
         case began
@@ -81,16 +83,11 @@ class NCPlayerToolBar: UIView {
         playerToolBarView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(tapToolBarWith(gestureRecognizer:))))
 
         playbackSlider.value = 0
-        playbackSlider.minimumValue = 0
-        playbackSlider.maximumValue = 1
-        playbackSlider.isContinuous = true
         playbackSlider.tintColor = .lightGray
 
         labelCurrentTime.textColor = .white
         labelLeftTime.textColor = .white
 
-        muteButton.setImage(NCUtility.shared.loadImage(named: "audioOn", color: .white), for: .normal)
-
         playButton.setImage(NCUtility.shared.loadImage(named: "play.fill", color: .white, symbolConfiguration: UIImage.SymbolConfiguration(pointSize: 30)), for: .normal)
 
         subtitleButton.setImage(NCUtility.shared.loadImage(named: "captions.bubble", color: .white), for: .normal)
@@ -103,6 +100,13 @@ class NCPlayerToolBar: UIView {
 
         forwardButton.setImage(NCUtility.shared.loadImage(named: "goforward.10", color: .white), for: .normal)
 
+        volumeSliderConstraintWidth.constant = self.frame.size.width / 2
+        volumeSliderConstraintTrailing.constant = -(volumeSliderConstraintWidth.constant / 2) + 15
+        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)
+
         // Normally hide
         self.alpha = 0
         self.isHidden = true
@@ -135,10 +139,8 @@ class NCPlayerToolBar: UIView {
 
         if CCUtility.getAudioVolume() == 0 {
             ncplayer.setVolumeAudio(0)
-            muteButton.setImage(NCUtility.shared.loadImage(named: "audioOff", color: .white), for: .normal)
         } else {
             ncplayer.setVolumeAudio(100)
-            muteButton.setImage(NCUtility.shared.loadImage(named: "audioOn", color: .white), for: .normal)
         }
 
         if viewerMediaScreenMode == .normal {
@@ -252,19 +254,19 @@ class NCPlayerToolBar: UIView {
 
     @IBAction func tapMute(_ sender: Any) {
 
+        /*
         guard let ncplayer = ncplayer else { return }
 
         if CCUtility.getAudioVolume() > 0 {
             CCUtility.setAudioVolume(0)
             ncplayer.setVolumeAudio(0)
-            muteButton.setImage(NCUtility.shared.loadImage(named: "audioOff", color: .white), for: .normal)
         } else {
             CCUtility.setAudioVolume(100)
             ncplayer.setVolumeAudio(100)
-            muteButton.setImage(NCUtility.shared.loadImage(named: "audioOn", color: .white), for: .normal)
         }
 
         self.viewerMediaPage?.startTimerAutoHide()
+        */
     }
 
     @IBAction func tapSubTitle(_ sender: Any) {

+ 16 - 16
iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.xib

@@ -16,7 +16,7 @@
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <subviews>
                 <stackView opaque="NO" contentMode="scaleToFill" spacing="15" translatesAutoresizingMaskIntoConstraints="NO" id="XfW-XC-eMf" userLabel="Player Top Tool Bar">
-                    <rect key="frame" x="289" y="58" width="115" height="35"/>
+                    <rect key="frame" x="329" y="58" width="75" height="35"/>
                     <subviews>
                         <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="qqZ-QN-TsW">
                             <rect key="frame" x="5" y="5" width="25" height="25"/>
@@ -42,21 +42,18 @@
                                 <action selector="tapAudio:" destination="iN0-l3-epB" eventType="touchUpInside" id="EVU-fE-n5T"/>
                             </connections>
                         </button>
-                        <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Fml-c2-FMY">
-                            <rect key="frame" x="85" y="5" width="25" height="25"/>
-                            <constraints>
-                                <constraint firstAttribute="width" constant="25" id="S8g-UR-4zh"/>
-                                <constraint firstAttribute="height" constant="25" id="zjo-O1-SI2"/>
-                            </constraints>
-                            <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
-                            <state key="normal" image="audioOn"/>
-                            <connections>
-                                <action selector="tapMute:" destination="iN0-l3-epB" eventType="touchUpInside" id="FWr-cn-Pgw"/>
-                            </connections>
-                        </button>
                     </subviews>
                     <directionalEdgeInsets key="directionalLayoutMargins" top="5" leading="5" bottom="5" trailing="5"/>
                 </stackView>
+                <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="Jec-GX-2dX">
+                    <rect key="frame" x="362" y="440" width="104" height="31"/>
+                    <constraints>
+                        <constraint firstAttribute="width" constant="100" id="tyN-ZD-51M"/>
+                    </constraints>
+                    <userDefinedRuntimeAttributes>
+                        <userDefinedRuntimeAttribute type="string" keyPath="layer.transform.rotation.z" value="-1.570795"/>
+                    </userDefinedRuntimeAttributes>
+                </slider>
                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="85m-50-8yp">
                     <rect key="frame" x="10" y="794" width="394" height="58"/>
                     <subviews>
@@ -110,7 +107,7 @@
                                 <constraint firstItem="bGn-IC-3V1" firstAttribute="centerX" secondItem="ixi-yR-HDH" secondAttribute="centerX" multiplier="1.6" id="wJP-ph-5c5"/>
                             </constraints>
                         </view>
-                        <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.5" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="MY0-FC-j88">
+                        <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="MY0-FC-j88">
                             <rect key="frame" x="121" y="14" width="265" height="31"/>
                         </slider>
                         <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="--:--" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="svM-TQ-AyQ">
@@ -147,9 +144,11 @@
             <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
             <constraints>
                 <constraint firstItem="85m-50-8yp" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="10" id="5H2-Gg-PEb"/>
+                <constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="Jec-GX-2dX" secondAttribute="trailing" constant="-50" id="5Js-8x-UdK"/>
                 <constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="85m-50-8yp" secondAttribute="trailing" constant="10" id="BXT-Qo-qFl"/>
                 <constraint firstItem="vUN-kp-3ea" firstAttribute="bottom" secondItem="85m-50-8yp" secondAttribute="bottom" constant="10" id="N7Q-PF-7lb"/>
                 <constraint firstItem="XfW-XC-eMf" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" constant="10" id="fq3-6h-kkx"/>
+                <constraint firstItem="Jec-GX-2dX" firstAttribute="centerY" secondItem="vUN-kp-3ea" secondAttribute="centerY" id="sq1-Nj-RAv"/>
                 <constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="XfW-XC-eMf" secondAttribute="trailing" constant="10" id="uYG-Ai-CGv"/>
             </constraints>
             <connections>
@@ -158,18 +157,19 @@
                 <outlet property="forwardButton" destination="bGn-IC-3V1" id="0OZ-f2-eWU"/>
                 <outlet property="labelCurrentTime" destination="OHB-2J-Gqb" id="pFy-CJ-x2A"/>
                 <outlet property="labelLeftTime" destination="svM-TQ-AyQ" id="UDV-Lh-12z"/>
-                <outlet property="muteButton" destination="Fml-c2-FMY" id="Fo1-Ep-ZPz"/>
                 <outlet property="playButton" destination="hx9-d5-yiD" id="Enk-Ge-2Yx"/>
                 <outlet property="playbackSlider" destination="MY0-FC-j88" id="bVe-Kc-80k"/>
                 <outlet property="playerToolBarView" destination="85m-50-8yp" id="eZK-p1-v65"/>
                 <outlet property="playerTopToolBarView" destination="XfW-XC-eMf" id="Qdp-IW-YhT"/>
                 <outlet property="subtitleButton" destination="qqZ-QN-TsW" id="XCP-hb-eZB"/>
+                <outlet property="volumeSlider" destination="Jec-GX-2dX" id="p6t-7N-Cfr"/>
+                <outlet property="volumeSliderConstraintTrailing" destination="5Js-8x-UdK" id="aGL-pZ-LqG"/>
+                <outlet property="volumeSliderConstraintWidth" destination="tyN-ZD-51M" id="Jgs-Kj-QQ7"/>
             </connections>
             <point key="canvasLocation" x="137.68115942028987" y="152.67857142857142"/>
         </view>
     </objects>
     <resources>
-        <image name="audioOn" width="28" height="28"/>
         <image name="captions.bubble" catalog="system" width="128" height="110"/>
         <image name="gobackward.10" catalog="system" width="119" height="128"/>
         <image name="goforward.10" catalog="system" width="119" height="128"/>