marinofaggiana 3 years ago
parent
commit
cb575f6cbf

+ 2 - 1
iOSClient/Viewer/NCViewerVideo/NCViewerVideo.swift

@@ -77,13 +77,14 @@ class NCViewerVideo: NSObject {
                 self.videoLayer!.videoGravity = AVLayerVideoGravity.resizeAspectFill
                 view.layer.addSublayer(self.videoLayer!)
                 
-                // At end go back to start
+                // At end go back to start & show toolbar
                 NotificationCenter.default.addObserver(forName: .AVPlayerItemDidPlayToEndTime, object: self.player?.currentItem, queue: .main) { (notification) in
                     if let item = notification.object as? AVPlayerItem, let currentItem = self.player?.currentItem, item == currentItem {
                         self.player?.seek(to: .zero)
                         if metadata.livePhoto {
                             NCManageDatabase.shared.deleteVideoTime(metadata: metadata)
                         }
+                        self.viewerVideoToolBar?.showToolBar()
                     }
                 }
                             

+ 9 - 3
iOSClient/Viewer/NCViewerVideo/NCViewerVideoToolBar.swift

@@ -106,20 +106,26 @@ class NCViewerVideoToolBar: UIView {
     }
     
     @objc public func hideToolBar() {
+        self.isHidden = true
+    }
+    
+    @objc public func autoHideToolBar() {
         if playbackSliderEvent == .began || playbackSliderEvent == .moved {
             timerAutoHide?.invalidate()
-            timerAutoHide = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(hideToolBar), userInfo: nil, repeats: true)
+            timerAutoHide = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(autoHideToolBar), userInfo: nil, repeats: true)
 
             return
         }
-        self.isHidden = true
+        if self.player?.rate == 1 {
+            self.isHidden = true
+        }
     }
     
     @objc public func showToolBar() {
         updateOutlet()
         self.isHidden = false
         timerAutoHide?.invalidate()
-        timerAutoHide = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(hideToolBar), userInfo: nil, repeats: true)
+        timerAutoHide = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(autoHideToolBar), userInfo: nil, repeats: true)
     }
     
     public func setToolBar() {