marinofaggiana 3 年之前
父节点
当前提交
00f7dd6ae5

+ 0 - 0
iOSClient/Images.xcassets/play.imageset/Contents.json → iOSClient/Images.xcassets/mediaPlay.imageset/Contents.json


+ 0 - 0
iOSClient/Images.xcassets/play.imageset/play.png → iOSClient/Images.xcassets/mediaPlay.imageset/play.png


+ 15 - 0
iOSClient/Images.xcassets/pause.fill.imageset/Contents.json

@@ -0,0 +1,15 @@
+{
+  "images" : [
+    {
+      "filename" : "pause.svg",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  },
+  "properties" : {
+    "preserves-vector-representation" : true
+  }
+}

+ 1 - 0
iOSClient/Images.xcassets/pause.fill.imageset/pause.svg

@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M14,19H18V5H14M6,19H10V5H6V19Z" /></svg>

+ 15 - 0
iOSClient/Images.xcassets/play.fill.imageset/Contents.json

@@ -0,0 +1,15 @@
+{
+  "images" : [
+    {
+      "filename" : "play.svg",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  },
+  "properties" : {
+    "preserves-vector-representation" : true
+  }
+}

+ 1 - 0
iOSClient/Images.xcassets/play.fill.imageset/play.svg

@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M8,5.14V19.14L19,12.14L8,5.14Z" /></svg>

+ 1 - 1
iOSClient/Media/NCMedia.swift

@@ -108,7 +108,7 @@ class NCMedia: UIViewController, NCEmptyDataSetDelegate, NCSelectDelegate {
         collectionView.prefetchDataSource = self
         collectionView.prefetchDataSource = self
         
         
         cacheImages.cellLivePhotoImage = NCUtility.shared.loadImage(named: "livephoto", color: .white)
         cacheImages.cellLivePhotoImage = NCUtility.shared.loadImage(named: "livephoto", color: .white)
-        cacheImages.cellPlayImage = UIImage.init(named: "play")!.image(color: .white, size: 50)
+        cacheImages.cellPlayImage = UIImage.init(named: "mediaPlay")!.image(color: .white, size: 50)
     }
     }
     
     
     override func viewWillAppear(_ animated: Bool) {
     override func viewWillAppear(_ animated: Bool) {

+ 49 - 14
iOSClient/Viewer/NCViewerImage/NCViewerImage.storyboard

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="ne8-hS-cp3">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="ne8-hS-cp3">
     <device id="retina6_1" orientation="portrait" appearance="light"/>
     <device id="retina6_1" orientation="portrait" appearance="light"/>
     <dependencies>
     <dependencies>
         <deployment identifier="iOS"/>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="System colors in document resources" minToolsVersion="11.0"/>
         <capability name="System colors in document resources" minToolsVersion="11.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -33,36 +33,67 @@
                                     <constraint firstAttribute="height" constant="1" id="F4E-lI-3jZ"/>
                                     <constraint firstAttribute="height" constant="1" id="F4E-lI-3jZ"/>
                                 </constraints>
                                 </constraints>
                             </progressView>
                             </progressView>
-                            <toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" translucent="NO" translatesAutoresizingMaskIntoConstraints="NO" id="NSc-sb-T8L">
-                                <rect key="frame" x="0.0" y="813" width="414" height="49"/>
-                                <items>
-                                    <barButtonItem systemItem="play" id="hHF-Q3-tyB"/>
-                                    <barButtonItem style="plain" systemItem="flexibleSpace" id="tYH-bL-I0G"/>
-                                    <barButtonItem image="audioOn" id="6mg-K7-nwa"/>
-                                </items>
-                            </toolbar>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="JKq-ki-dtz">
+                                <rect key="frame" x="0.0" y="812" width="414" height="50"/>
+                                <subviews>
+                                    <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vaQ-iz-6jn">
+                                        <rect key="frame" x="10" y="10" width="30" height="30"/>
+                                        <constraints>
+                                            <constraint firstAttribute="width" constant="30" id="CcA-ic-g60"/>
+                                            <constraint firstAttribute="height" constant="30" id="WW1-B9-it4"/>
+                                        </constraints>
+                                        <color key="tintColor" systemColor="labelColor"/>
+                                        <state key="normal" image="play.fill" catalog="system"/>
+                                        <connections>
+                                            <action selector="playerPause:" destination="ne8-hS-cp3" eventType="touchUpInside" id="DPP-bu-HdY"/>
+                                        </connections>
+                                    </button>
+                                    <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="EEV-Aj-0lu">
+                                        <rect key="frame" x="374" y="10" width="30" height="30"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="30" id="SgR-jP-cE2"/>
+                                            <constraint firstAttribute="width" constant="30" id="i2T-5f-Vp2"/>
+                                        </constraints>
+                                        <color key="tintColor" systemColor="labelColor"/>
+                                        <state key="normal" title="Button" image="audioOn"/>
+                                        <connections>
+                                            <action selector="setMute:" destination="ne8-hS-cp3" eventType="touchUpInside" id="gc7-ym-5Dg"/>
+                                        </connections>
+                                    </button>
+                                </subviews>
+                                <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+                                <constraints>
+                                    <constraint firstAttribute="trailing" secondItem="EEV-Aj-0lu" secondAttribute="trailing" constant="10" id="9zh-GS-bDP"/>
+                                    <constraint firstItem="vaQ-iz-6jn" firstAttribute="centerY" secondItem="JKq-ki-dtz" secondAttribute="centerY" id="Gyx-Hx-jxv"/>
+                                    <constraint firstItem="EEV-Aj-0lu" firstAttribute="centerY" secondItem="JKq-ki-dtz" secondAttribute="centerY" id="Jmg-uL-7Kx"/>
+                                    <constraint firstItem="vaQ-iz-6jn" firstAttribute="leading" secondItem="JKq-ki-dtz" secondAttribute="leading" constant="10" id="SpM-Ue-jtI"/>
+                                    <constraint firstAttribute="height" constant="50" id="i5H-Nn-hox"/>
+                                </constraints>
+                            </view>
                         </subviews>
                         </subviews>
                         <viewLayoutGuide key="safeArea" id="Ozy-9S-dMl"/>
                         <viewLayoutGuide key="safeArea" id="Ozy-9S-dMl"/>
                         <color key="backgroundColor" systemColor="systemBackgroundColor"/>
                         <color key="backgroundColor" systemColor="systemBackgroundColor"/>
                         <constraints>
                         <constraints>
                             <constraint firstAttribute="bottom" secondItem="fpt-Rz-5fT" secondAttribute="bottom" id="4Xy-Dl-e47"/>
                             <constraint firstAttribute="bottom" secondItem="fpt-Rz-5fT" secondAttribute="bottom" id="4Xy-Dl-e47"/>
                             <constraint firstItem="sD9-1i-ZdY" firstAttribute="leading" secondItem="Ozy-9S-dMl" secondAttribute="leading" id="8Dv-gf-lFy"/>
                             <constraint firstItem="sD9-1i-ZdY" firstAttribute="leading" secondItem="Ozy-9S-dMl" secondAttribute="leading" id="8Dv-gf-lFy"/>
+                            <constraint firstItem="Ozy-9S-dMl" firstAttribute="bottom" secondItem="JKq-ki-dtz" secondAttribute="bottom" id="AOj-43-nbC"/>
                             <constraint firstItem="fpt-Rz-5fT" firstAttribute="leading" secondItem="Ozy-9S-dMl" secondAttribute="leading" id="J6h-qF-6dx"/>
                             <constraint firstItem="fpt-Rz-5fT" firstAttribute="leading" secondItem="Ozy-9S-dMl" secondAttribute="leading" id="J6h-qF-6dx"/>
                             <constraint firstItem="sD9-1i-ZdY" firstAttribute="top" secondItem="Ozy-9S-dMl" secondAttribute="top" id="JUh-my-qNG"/>
                             <constraint firstItem="sD9-1i-ZdY" firstAttribute="top" secondItem="Ozy-9S-dMl" secondAttribute="top" id="JUh-my-qNG"/>
                             <constraint firstItem="Ozy-9S-dMl" firstAttribute="trailing" secondItem="sD9-1i-ZdY" secondAttribute="trailing" id="KQa-Ni-1TC"/>
                             <constraint firstItem="Ozy-9S-dMl" firstAttribute="trailing" secondItem="sD9-1i-ZdY" secondAttribute="trailing" id="KQa-Ni-1TC"/>
                             <constraint firstItem="fpt-Rz-5fT" firstAttribute="leading" secondItem="wvY-tB-6ZK" secondAttribute="leading" id="Kzi-Hg-Ocf"/>
                             <constraint firstItem="fpt-Rz-5fT" firstAttribute="leading" secondItem="wvY-tB-6ZK" secondAttribute="leading" id="Kzi-Hg-Ocf"/>
                             <constraint firstItem="fpt-Rz-5fT" firstAttribute="top" secondItem="wvY-tB-6ZK" secondAttribute="top" id="NnL-9A-ht1"/>
                             <constraint firstItem="fpt-Rz-5fT" firstAttribute="top" secondItem="wvY-tB-6ZK" secondAttribute="top" id="NnL-9A-ht1"/>
-                            <constraint firstItem="Ozy-9S-dMl" firstAttribute="bottom" secondItem="NSc-sb-T8L" secondAttribute="bottom" id="OeM-QW-eVv"/>
-                            <constraint firstItem="Ozy-9S-dMl" firstAttribute="trailing" secondItem="NSc-sb-T8L" secondAttribute="trailing" id="eQ1-te-slQ"/>
-                            <constraint firstItem="NSc-sb-T8L" firstAttribute="leading" secondItem="Ozy-9S-dMl" secondAttribute="leading" id="psi-dc-yia"/>
+                            <constraint firstItem="JKq-ki-dtz" firstAttribute="leading" secondItem="Ozy-9S-dMl" secondAttribute="leading" id="evZ-9h-ioB"/>
+                            <constraint firstItem="Ozy-9S-dMl" firstAttribute="trailing" secondItem="JKq-ki-dtz" secondAttribute="trailing" id="jVT-Ul-L36"/>
                             <constraint firstAttribute="trailing" secondItem="fpt-Rz-5fT" secondAttribute="trailing" id="xh9-IP-ti7"/>
                             <constraint firstAttribute="trailing" secondItem="fpt-Rz-5fT" secondAttribute="trailing" id="xh9-IP-ti7"/>
                         </constraints>
                         </constraints>
                     </view>
                     </view>
                     <navigationItem key="navigationItem" id="azh-DM-TLz"/>
                     <navigationItem key="navigationItem" id="azh-DM-TLz"/>
                     <nil key="simulatedBottomBarMetrics"/>
                     <nil key="simulatedBottomBarMetrics"/>
                     <connections>
                     <connections>
+                        <outlet property="muteButton" destination="EEV-Aj-0lu" id="Brf-jh-7So"/>
+                        <outlet property="playButton" destination="vaQ-iz-6jn" id="coX-gh-2aN"/>
                         <outlet property="progressView" destination="sD9-1i-ZdY" id="nag-cc-Up3"/>
                         <outlet property="progressView" destination="sD9-1i-ZdY" id="nag-cc-Up3"/>
-                        <outlet property="toolBar" destination="NSc-sb-T8L" id="cKx-kX-JPa"/>
+                        <outlet property="toolBar" destination="JKq-ki-dtz" id="iTS-hJ-3EA"/>
                     </connections>
                     </connections>
                 </viewController>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="qhs-BU-mEq" userLabel="First Responder" sceneMemberID="firstResponder"/>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="qhs-BU-mEq" userLabel="First Responder" sceneMemberID="firstResponder"/>
@@ -301,6 +332,10 @@
     <resources>
     <resources>
         <image name="audioOn" width="28" height="28"/>
         <image name="audioOn" width="28" height="28"/>
         <image name="image" width="128" height="128"/>
         <image name="image" width="128" height="128"/>
+        <image name="play.fill" catalog="system" width="116" height="128"/>
+        <systemColor name="labelColor">
+            <color white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+        </systemColor>
         <systemColor name="systemBackgroundColor">
         <systemColor name="systemBackgroundColor">
             <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
             <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
         </systemColor>
         </systemColor>

+ 19 - 22
iOSClient/Viewer/NCViewerImage/NCViewerImage.swift

@@ -28,7 +28,10 @@ import NCCommunication
 class NCViewerImage: UIViewController {
 class NCViewerImage: UIViewController {
 
 
     @IBOutlet weak var progressView: UIProgressView!
     @IBOutlet weak var progressView: UIProgressView!
-    @IBOutlet weak var toolBar: UIToolbar!
+    
+    @IBOutlet weak var toolBar: UIView!
+    @IBOutlet weak var playButton: UIButton!
+    @IBOutlet weak var muteButton: UIButton!
 
 
     enum ScreenMode {
     enum ScreenMode {
         case full, normal
         case full, normal
@@ -517,35 +520,29 @@ class NCViewerImage: UIViewController {
         
         
         let mute = CCUtility.getAudioMute()
         let mute = CCUtility.getAudioMute()
         
         
-        var itemPlay = toolBar.items![0]
-        let itemFlexibleSpace = toolBar.items![1]
-        var itemMute = toolBar.items![2]
-        
         if player?.rate == 1 {
         if player?.rate == 1 {
-            itemPlay = UIBarButtonItem(barButtonSystemItem: UIBarButtonItem.SystemItem.pause, target: self, action: #selector(playerPause))
+            playButton.setImage(NCUtility.shared.loadImage(named: "pause.fill"), for: .normal)
         } else {
         } else {
-            itemPlay = UIBarButtonItem(barButtonSystemItem: UIBarButtonItem.SystemItem.play, target: self, action: #selector(playerPlay))
+            playButton.setImage(NCUtility.shared.loadImage(named: "play.fill"), for: .normal)
         }
         }
+       
         if mute {
         if mute {
-            itemMute = UIBarButtonItem(image: UIImage(named: "audioOff"), style: UIBarButtonItem.Style.plain, target: self, action: #selector(SetMute))
+            muteButton.setImage(NCUtility.shared.loadImage(named: "audioOff"), for: .normal)
         } else {
         } else {
-            itemMute = UIBarButtonItem(image: UIImage(named: "audioOn"), style: UIBarButtonItem.Style.plain, target: self, action: #selector(SetMute))
+            muteButton.setImage(NCUtility.shared.loadImage(named: "audioOn"), for: .normal)
         }
         }
-        
-        toolBar.setItems([itemPlay, itemFlexibleSpace, itemMute], animated: true)
-        toolBar.tintColor = NCBrandColor.shared.brandElement
-        toolBar.barTintColor = view.backgroundColor
     }
     }
 
 
-    @objc func playerPause() {
-        player?.pause()
-    }
-    
-    @objc func playerPlay() {
-        player?.play()
+    @IBAction func playerPause(_ sender: Any) {
+        
+        if player?.timeControlStatus == .playing {
+            player?.pause()
+        } else if player?.timeControlStatus == .paused {
+            player?.play()
+        }
     }
     }
-    
-    @objc func SetMute() {
+        
+    @IBAction func setMute(_ sender: Any) {
         let mute = CCUtility.getAudioMute()
         let mute = CCUtility.getAudioMute()
         CCUtility.setAudioMute(!mute)
         CCUtility.setAudioMute(!mute)
         player?.isMuted = !mute
         player?.isMuted = !mute
@@ -826,7 +823,7 @@ extension NCViewerImage: NCViewerVideoDelegate {
     func stopPictureInPicture(metadata: tableMetadata, playing: Bool) {
     func stopPictureInPicture(metadata: tableMetadata, playing: Bool) {
         pictureInPictureOcId = ""
         pictureInPictureOcId = ""
         if playing && currentMetadata.ocId == metadata.ocId {
         if playing && currentMetadata.ocId == metadata.ocId {
-            playerPlay()
+            playerPause(self)
         }
         }
     }
     }
 }
 }