marinofaggiana 3 years ago
parent
commit
6d50d25d02

+ 3 - 1
iOSClient/Viewer/NCViewerImage/NCViewerImage.swift

@@ -598,7 +598,9 @@ extension NCViewerImage: NCViewerImageZoomDelegate {
         
         // PLAY VIDEO/AUDIO
         if (currentMetadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue || currentMetadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue) {
-            NCViewerVideo.shared.videoPlay(view: viewerImageZoom.imageView, viewerVideoToolBar: viewerImageZoom.videoToolBar, metadata: metadata)
+            DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
+                NCViewerVideo.shared.videoPlay(view: viewerImageZoom.imageView, viewerVideoToolBar: viewerImageZoom.videoToolBar, metadata: metadata)
+            }
         }
             
         if !NCOperationQueue.shared.downloadExists(metadata: metadata) {

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

@@ -78,7 +78,7 @@ class NCViewerVideo: NSObject {
                     if metadata.livePhoto {
                         NCManageDatabase.shared.deleteVideoTime(metadata: metadata)
                     }
-                    self.viewerVideoToolBar?.showToolBar(metadata: metadata)
+                    self.viewerVideoToolBar?.showToolBar()
                 }
             }
                         

+ 11 - 13
iOSClient/Viewer/NCViewerVideo/NCViewerVideoToolBar.swift

@@ -104,12 +104,23 @@ class NCViewerVideoToolBar: UIView {
         })
         
         setToolBar()
+        
+        // show
+        timerAutoHide?.invalidate()
+        updateOutlet()
+        timerAutoHide = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(autoHideToolBar), userInfo: nil, repeats: true)
+        self.isHidden = false
     }
     
     @objc public func hideToolBar() {
+        updateOutlet()
         self.isHidden = true
     }
     
+    @objc public func showToolBar() {
+        self.isHidden = false
+    }
+    
     @objc public func autoHideToolBar() {
         if playbackSliderEvent == .began || playbackSliderEvent == .moved {
             timerAutoHide?.invalidate()
@@ -121,19 +132,6 @@ class NCViewerVideoToolBar: UIView {
         }
     }
     
-    @objc public func showToolBar(metadata: tableMetadata) {
-
-        timerAutoHide?.invalidate()
-
-        if !metadata.livePhoto && (metadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue || metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue) {
-            updateOutlet()
-            timerAutoHide = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(autoHideToolBar), userInfo: nil, repeats: true)
-            UIView.animate(withDuration: 0.2) {
-                self.isHidden = false
-            }
-        }
-    }
-    
     public func setToolBar() {
 
         if player?.rate == 1 {