Marino Faggiana 2 years ago
parent
commit
d4128d1060

+ 8 - 5
iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayer.swift

@@ -160,7 +160,7 @@ class NCPlayer: NSObject {
 
     @objc func applicationDidBecomeActive(_ notification: NSNotification) {
 
-        playerToolBar?.updateToolBar()
+        playerToolBar?.update()
     }
 
     // MARK: -
@@ -176,14 +176,14 @@ class NCPlayer: NSObject {
         if let position = NCManageDatabase.shared.getVideoPosition(metadata: self.metadata) {
             player?.position = position
         }
-        playerToolBar?.updateToolBar()
+        playerToolBar?.update()
     }
 
     @objc func playerPause() {
 
         if let position = player?.position {
             player?.pause()
-            playerToolBar?.updateToolBar()
+            playerToolBar?.update()
         }
 
         if let playerToolBar = self.playerToolBar, playerToolBar.isPictureInPictureActive() {
@@ -203,7 +203,7 @@ class NCPlayer: NSObject {
     func videoSeek(position: Float) {
 
         player?.position = position
-        playerToolBar?.updateToolBar()
+        playerToolBar?.update()
     }
 
     func videoStop() {
@@ -331,15 +331,18 @@ extension NCPlayer: VLCMediaPlayerDelegate {
             break
         case .ended:
             print("Played mode: ENDED")
+            playerToolBar?.update()
             break
         case .error:
             print("Played mode: ERROR")
             break
         case .playing:
             print("Played mode: PLAYING")
+            playerToolBar?.update()
             break
         case .paused:
             print("Played mode: PAUSED")
+            playerToolBar?.update()
             break
         default: break
         }
@@ -349,7 +352,7 @@ extension NCPlayer: VLCMediaPlayerDelegate {
 
     func mediaPlayerTimeChanged(_ aNotification: Notification) {
 
-        self.playerToolBar?.updateToolBar()
+        self.playerToolBar?.update()
     }
 
     func mediaPlayerTitleChanged(_ aNotification: Notification) {

+ 5 - 8
iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift

@@ -65,9 +65,6 @@ class NCPlayerToolBar: UIView {
         }
     }
 
-
-// NCUtility.shared.isSimulatorOrTestFlight()
-
     var pictureInPictureController: AVPictureInPictureController?
     weak var viewerMediaPage: NCViewerMediaPage?
 
@@ -152,10 +149,10 @@ class NCPlayerToolBar: UIView {
         labelCurrentTime.text = ncplayer.player?.time.stringValue
         labelLeftTime.text = ncplayer.player?.remainingTime?.stringValue
 
-        updateToolBar()
+        update()
     }
 
-    public func updateToolBar() {
+    public func update() {
 
         guard let ncplayer = self.ncplayer else { return }
 
@@ -238,7 +235,7 @@ class NCPlayerToolBar: UIView {
             self.isHidden = false
         })
 
-        updateToolBar()
+        update()
     }
 
     func isShow() -> Bool {
@@ -285,7 +282,7 @@ class NCPlayerToolBar: UIView {
 
         ncplayer.videoSeek(position: newPosition)
 
-        updateToolBar()
+        update()
         reStartTimerAutoHide()
     }
 
@@ -359,7 +356,7 @@ class NCPlayerToolBar: UIView {
             ncplayer?.player?.audio?.volume = 100
         }
 
-        updateToolBar()
+        update()
         reStartTimerAutoHide()
     }