marinofaggiana 3 yıl önce
ebeveyn
işleme
b6bfe40f50

+ 6 - 2
iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayer.swift

@@ -131,9 +131,13 @@ class NCPlayer: NSObject {
     }
     
     func videoPause() {
-        guard let metadata = self.metadata else { return }
         
         appDelegate.player?.pause()
+    }
+    
+    func saveCurrentTime() {
+        guard let metadata = self.metadata else { return }
+
         NCManageDatabase.shared.addVideoTime(metadata: metadata, time: appDelegate.player?.currentTime(), durationSeconds: nil)
     }
     
@@ -147,7 +151,7 @@ class NCPlayer: NSObject {
     func videoRemoved() {
 
         videoPause()
-                            
+
         self.videoLayer?.removeFromSuperlayer()
     }
     

+ 1 - 0
iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift

@@ -228,6 +228,7 @@ class NCPlayerToolBar: UIView {
         
         if appDelegate.player?.timeControlStatus == .playing {
             ncplayer?.videoPause()
+            ncplayer?.saveCurrentTime()
         } else if appDelegate.player?.timeControlStatus == .paused {
             ncplayer?.videoPlay()
         } else if appDelegate.player?.timeControlStatus == .waitingToPlayAtSpecifiedRate {

+ 3 - 0
iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift

@@ -133,6 +133,7 @@ class NCViewerMedia: UIViewController {
         super.viewWillDisappear(animated)
         
         currentViewerMediaZoom?.ncplayer?.videoPause()
+        currentViewerMediaZoom?.ncplayer?.saveCurrentTime()
 
         NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterDeleteFile), object: nil)
         NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterRenameFile), object: nil)
@@ -378,12 +379,14 @@ extension NCViewerMedia: UIPageViewControllerDelegate, UIPageViewControllerDataS
         return viewerMediaZoom
     }
     
+    // START TRANSITION
     func pageViewController(_ pageViewController: UIPageViewController, willTransitionTo pendingViewControllers: [UIViewController]) {
         
         guard let nextViewController = pendingViewControllers.first as? NCViewerMediaZoom else { return }
         nextIndex = nextViewController.index        
     }
     
+    // END TRANSITION
     func pageViewController(_ pageViewController: UIPageViewController, didFinishAnimating finished: Bool, previousViewControllers: [UIViewController], transitionCompleted completed: Bool) {
         
         if (completed && nextIndex != nil) {