marinofaggiana 4 lat temu
rodzic
commit
7e84d0274f

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

@@ -687,18 +687,17 @@ extension NCViewerImage: UIGestureRecognizerDelegate {
         if currentMetadata.typeFile == k_metadataTypeFile_video || currentMetadata.typeFile == k_metadataTypeFile_audio {
         if currentMetadata.typeFile == k_metadataTypeFile_video || currentMetadata.typeFile == k_metadataTypeFile_audio {
             
             
             if pictureInPictureOcId != currentMetadata.ocId {
             if pictureInPictureOcId != currentMetadata.ocId {
-                
-                videoStop()
-                
+                                
                 // Kill PIP
                 // Kill PIP
                 appDelegate.activeViewerVideo?.player?.replaceCurrentItem(with: nil)
                 appDelegate.activeViewerVideo?.player?.replaceCurrentItem(with: nil)
-                //
+                // --------
                 
                 
                 appDelegate.activeViewerVideo = NCViewerVideo()
                 appDelegate.activeViewerVideo = NCViewerVideo()
                 appDelegate.activeViewerVideo?.metadata = currentMetadata
                 appDelegate.activeViewerVideo?.metadata = currentMetadata
                 appDelegate.activeViewerVideo?.delegateViewerVideo = self
                 appDelegate.activeViewerVideo?.delegateViewerVideo = self
                 if let currentViewerVideo = appDelegate.activeViewerVideo {
                 if let currentViewerVideo = appDelegate.activeViewerVideo {
                     present(currentViewerVideo, animated: false) { }
                     present(currentViewerVideo, animated: false) { }
+                    self.videoStop()
                 }
                 }
             }
             }
             
             

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

@@ -69,6 +69,8 @@ protocol NCViewerVideoDelegate {
     override func viewWillDisappear(_ animated: Bool) {
     override func viewWillDisappear(_ animated: Bool) {
         super.viewWillDisappear(animated)
         super.viewWillDisappear(animated)
         
         
+        NCManageDatabase.sharedInstance.addVideoTime(account: metadata.account, ocId: metadata.ocId, time: player?.currentTime())
+        
         if let player = self.player {
         if let player = self.player {
             CCUtility.setAudioMute(player.isMuted)
             CCUtility.setAudioMute(player.isMuted)
         }
         }
@@ -80,7 +82,6 @@ protocol NCViewerVideoDelegate {
                 player?.removeObserver(self, forKeyPath: "rate")
                 player?.removeObserver(self, forKeyPath: "rate")
                 NotificationCenter.default.removeObserver(self, name: NSNotification.Name.AVPlayerItemDidPlayToEndTime, object: nil)
                 NotificationCenter.default.removeObserver(self, name: NSNotification.Name.AVPlayerItemDidPlayToEndTime, object: nil)
                 NCKTVHTTPCache.shared.stopProxy()
                 NCKTVHTTPCache.shared.stopProxy()
-                NCManageDatabase.sharedInstance.addVideoTime(account: metadata.account, ocId: metadata.ocId, time: player?.currentTime())
                 self.rateObserverToken = nil
                 self.rateObserverToken = nil
             }
             }
         }
         }