marinofaggiana 3 жил өмнө
parent
commit
e843409790

+ 11 - 15
iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift

@@ -45,7 +45,7 @@ class NCPlayerToolBar: UIView {
     private var ncplayer: NCPlayer?
     private var wasInPlay: Bool = false
     private var playbackSliderEvent: sliderEventType = .ended
-    private let seekDuration: Float64 = 15
+    private let timeToAdd: CMTime = CMTimeMakeWithSeconds(15, preferredTimescale: 1)
     private var durationTime: CMTime = .zero
 
     // MARK: - View Life Cycle
@@ -269,27 +269,23 @@ class NCPlayerToolBar: UIView {
         guard let ncplayer = ncplayer else { return }
         guard let player = ncplayer.player else { return }
         
-//        let playerCurrentTime = CMTimeGetSeconds(player.currentTime())
-//        let newTime = playerCurrentTime + seekDuration
+        let currentTime = player.currentTime()
+        let newTime = CMTimeAdd(currentTime, timeToAdd)
         
-//        if newTime < ncplayer.getVideoDurationSeconds() {
-//            let time: CMTime = CMTimeMake(value: Int64(newTime * 1000 as Float64), timescale: 1000)
-//            ncplayer.videoSeek(time: time)
-//        } else if newTime >= ncplayer.getVideoDurationSeconds() {
-//            ncplayer.videoSeek(time: .zero)
-//        }
+        if newTime < durationTime {
+            ncplayer.videoSeek(time: newTime)
+        } else if newTime >= durationTime {
+            ncplayer.videoSeek(time: .zero)
+        }
     }
     
     @IBAction func backButtonSec(_ sender: Any) {
         guard let ncplayer = ncplayer else { return }
         guard let player = ncplayer.player else { return }
         
-//        let playerCurrenTime = CMTimeGetSeconds(player.currentTime())
-//        var newTime = playerCurrenTime - seekDuration
-        
-//        if newTime < 0 { newTime = 0 }
-//        let time: CMTime = CMTimeMake(value: Int64(newTime * 1000 as Float64), timescale: 1000)
+        let currentTime = player.currentTime()
+        let newTime = CMTimeSubtract(currentTime, timeToAdd)
         
-//        ncplayer.videoSeek(time: time)
+        ncplayer.videoSeek(time: newTime)
     }
 }

+ 12 - 12
iOSClient/Viewer/NCViewerMedia/NCViewerMedia.storyboard

@@ -254,10 +254,10 @@
                                                 <rect key="frame" x="18" y="10" width="328" height="31"/>
                                             </slider>
                                             <button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="x3E-b2-obf">
-                                                <rect key="frame" x="162" y="55" width="40" height="40"/>
+                                                <rect key="frame" x="157" y="50" width="50" height="50"/>
                                                 <constraints>
-                                                    <constraint firstAttribute="width" constant="40" id="Cmv-LX-Phg"/>
-                                                    <constraint firstAttribute="height" constant="40" id="djE-Ml-YD0"/>
+                                                    <constraint firstAttribute="width" constant="50" id="Cmv-LX-Phg"/>
+                                                    <constraint firstAttribute="height" constant="50" id="djE-Ml-YD0"/>
                                                 </constraints>
                                                 <color key="tintColor" systemColor="labelColor"/>
                                                 <state key="normal">
@@ -281,10 +281,10 @@
                                                 <nil key="highlightedColor"/>
                                             </label>
                                             <button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="F9L-PP-AbM">
-                                                <rect key="frame" x="226.99999999999994" y="55" width="40" height="40"/>
+                                                <rect key="frame" x="206.99999999999994" y="50" width="50" height="50"/>
                                                 <constraints>
-                                                    <constraint firstAttribute="width" constant="40" id="hlL-XQ-OLa"/>
-                                                    <constraint firstAttribute="height" constant="40" id="vEe-Fb-a9N"/>
+                                                    <constraint firstAttribute="width" constant="50" id="hlL-XQ-OLa"/>
+                                                    <constraint firstAttribute="height" constant="50" id="vEe-Fb-a9N"/>
                                                 </constraints>
                                                 <state key="normal" image="goforward.15" catalog="system"/>
                                                 <connections>
@@ -292,10 +292,10 @@
                                                 </connections>
                                             </button>
                                             <button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Isy-sX-Gji">
-                                                <rect key="frame" x="97" y="55" width="40" height="40"/>
+                                                <rect key="frame" x="107" y="50" width="50" height="50"/>
                                                 <constraints>
-                                                    <constraint firstAttribute="width" constant="40" id="COm-r2-ubw"/>
-                                                    <constraint firstAttribute="height" constant="40" id="mbb-ql-zCc"/>
+                                                    <constraint firstAttribute="width" constant="50" id="COm-r2-ubw"/>
+                                                    <constraint firstAttribute="height" constant="50" id="mbb-ql-zCc"/>
                                                 </constraints>
                                                 <state key="normal" image="gobackward.15" catalog="system"/>
                                                 <connections>
@@ -306,12 +306,12 @@
                                         <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                         <constraints>
                                             <constraint firstAttribute="trailing" secondItem="8AB-hx-yqN" secondAttribute="trailing" constant="20" id="4LY-8e-z3y"/>
-                                            <constraint firstAttribute="bottom" secondItem="x3E-b2-obf" secondAttribute="bottom" constant="5" id="7W8-qk-uwn"/>
                                             <constraint firstAttribute="height" constant="100" id="EyI-HW-pHA"/>
                                             <constraint firstItem="Isy-sX-Gji" firstAttribute="centerY" secondItem="x3E-b2-obf" secondAttribute="centerY" id="Hif-Fa-xc2"/>
                                             <constraint firstItem="a0D-B0-eGX" firstAttribute="leading" secondItem="sBp-t2-eFh" secondAttribute="leading" id="OIL-1t-uuh"/>
                                             <constraint firstAttribute="trailing" secondItem="SR4-e8-1hC" secondAttribute="trailing" constant="20" id="Q3r-ex-Cpf"/>
-                                            <constraint firstItem="F9L-PP-AbM" firstAttribute="leading" secondItem="x3E-b2-obf" secondAttribute="trailing" constant="25" id="VPD-ln-2aN"/>
+                                            <constraint firstAttribute="bottom" secondItem="x3E-b2-obf" secondAttribute="bottom" id="QJI-MS-VKR"/>
+                                            <constraint firstItem="F9L-PP-AbM" firstAttribute="leading" secondItem="x3E-b2-obf" secondAttribute="trailing" id="VPD-ln-2aN"/>
                                             <constraint firstItem="SR4-e8-1hC" firstAttribute="leading" secondItem="sBp-t2-eFh" secondAttribute="leading" constant="20" id="Xec-gd-9AB"/>
                                             <constraint firstAttribute="bottom" secondItem="a0D-B0-eGX" secondAttribute="bottom" id="a3T-pV-xrr"/>
                                             <constraint firstItem="F9L-PP-AbM" firstAttribute="centerY" secondItem="x3E-b2-obf" secondAttribute="centerY" id="cIu-i5-mbJ"/>
@@ -320,7 +320,7 @@
                                             <constraint firstItem="kVv-X4-6SK" firstAttribute="top" secondItem="SR4-e8-1hC" secondAttribute="bottom" constant="1" id="l6a-l5-ZvL"/>
                                             <constraint firstAttribute="trailing" secondItem="a0D-B0-eGX" secondAttribute="trailing" id="lbh-DN-SZF"/>
                                             <constraint firstItem="8AB-hx-yqN" firstAttribute="centerY" secondItem="F9L-PP-AbM" secondAttribute="centerY" id="o5E-tm-osC"/>
-                                            <constraint firstItem="x3E-b2-obf" firstAttribute="leading" secondItem="Isy-sX-Gji" secondAttribute="trailing" constant="25" id="sIc-bL-Yjz"/>
+                                            <constraint firstItem="x3E-b2-obf" firstAttribute="leading" secondItem="Isy-sX-Gji" secondAttribute="trailing" id="sIc-bL-Yjz"/>
                                             <constraint firstItem="x3E-b2-obf" firstAttribute="centerX" secondItem="sBp-t2-eFh" secondAttribute="centerX" id="uPa-tM-Vx6"/>
                                             <constraint firstItem="SR4-e8-1hC" firstAttribute="top" secondItem="sBp-t2-eFh" secondAttribute="top" constant="10" id="uu1-ai-wmJ"/>
                                             <constraint firstItem="OUD-HH-cXH" firstAttribute="top" secondItem="SR4-e8-1hC" secondAttribute="bottom" constant="1" id="wwk-tz-5dj"/>