Browse Source

Fix

Signed-off-by: marinofaggiana <marino@marinofaggiana.com>
marinofaggiana 3 years ago
parent
commit
575dadc4df

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

@@ -168,7 +168,7 @@ class NCPlayer: NSObject {
         
         // Evey 1 second update toolbar
         observerAVPlayertTime = player?.addPeriodicTimeObserver(forInterval: CMTimeMakeWithSeconds(1, preferredTimescale: 1), queue: .main, using: { (CMTime) in
-            if self.player?.currentItem?.status == .readyToPlay {
+            if self.player?.currentItem?.status == .readyToPlay, let playerToolBar = self.playerToolBar, playerToolBar.isShow() {
                 self.playerToolBar?.updateToolBar()
             }
         })

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

@@ -415,6 +415,8 @@ class NCPlayerToolBar: UIView {
             self.isHidden = false
             self.playerTopToolBarView.isHidden = false
         })
+        
+        updateToolBar()
     }
     
     func isShow() -> Bool {

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

@@ -393,11 +393,14 @@ extension NCViewerMedia: UIPageViewControllerDelegate, UIPageViewControllerDataS
         if metadatas.count == 0 { return false }
         
         var direction: UIPageViewController.NavigationDirection = .forward
+        
         if currentIndex == metadatas.count {
             currentIndex -= 1
             direction = .reverse
         }
         
+        currentViewController.ncplayer?.deactivateObserver(livePhoto: currentViewController.metadata.livePhoto)
+        
         let viewerMediaZoom = getViewerMediaZoom(index: currentIndex, image: getImageMetadata(metadatas[currentIndex]), metadata: metadatas[currentIndex], direction: direction)
         pageViewController.setViewControllers([viewerMediaZoom], direction: direction, animated: true, completion: nil)
         
@@ -408,6 +411,8 @@ extension NCViewerMedia: UIPageViewControllerDelegate, UIPageViewControllerDataS
         
         currentIndex = index
         
+        currentViewController.ncplayer?.deactivateObserver(livePhoto: currentViewController.metadata.livePhoto)
+
         let viewerMediaZoom = getViewerMediaZoom(index: currentIndex, image: getImageMetadata(metadatas[currentIndex]), metadata: metadatas[currentIndex], direction: direction)
         viewerMediaZoom.autoPlay = autoPlay
         pageViewController.setViewControllers([viewerMediaZoom], direction: direction, animated: true, completion: nil)