Răsfoiți Sursa

Remote Command Center

Signed-off-by: marinofaggiana <marino@marinofaggiana.com>
marinofaggiana 3 ani în urmă
părinte
comite
2d41493d32

+ 3 - 2
iOSClient/AppDelegate.swift

@@ -67,8 +67,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
     var player: AVPlayer?
     var commandCenterPlayCommand: Any?
     var commandCenterPauseCommand: Any?
-    var commandCenterPreviousCommand: Any?
-    var commandCenterNextCommand: Any?
+    var commandCenterskipForwardCommand: Any?
+    var commandCenterSkipBackwardCommand: Any?
+    var commandCenterChangePlaybackPositionCommand: Any?
 
     func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
         

+ 0 - 0
iOSClient/Images.xcassets/gobackward.15.imageset/Contents.json → iOSClient/Images.xcassets/gobackward.10.imageset/Contents.json


+ 0 - 0
iOSClient/Images.xcassets/gobackward.15.imageset/gobackward.15.svg → iOSClient/Images.xcassets/gobackward.10.imageset/gobackward.15.svg


+ 0 - 0
iOSClient/Images.xcassets/goforward.15.imageset/Contents.json → iOSClient/Images.xcassets/goforward.10.imageset/Contents.json


+ 0 - 0
iOSClient/Images.xcassets/goforward.15.imageset/goforward.15.svg → iOSClient/Images.xcassets/goforward.10.imageset/goforward.15.svg


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

@@ -118,7 +118,7 @@ class NCPlayer: NSObject {
                                 }
                             }
                             // PiP
-                            if let playerLayer = self.videoLayer {
+                            if let playerLayer = self.videoLayer, CCUtility.fileProviderStorageExists(metadata.ocId, fileNameView: metadata.fileNameView) {
                                 self.pictureInPictureController = AVPictureInPictureController(playerLayer: playerLayer)
                                 self.pictureInPictureController?.delegate = self
                             }
@@ -206,11 +206,11 @@ class NCPlayer: NSObject {
         if let pauseCommand = appDelegate.commandCenterPauseCommand {
             MPRemoteCommandCenter.shared().pauseCommand.removeTarget(pauseCommand)
         }
-        if let previousCommand = appDelegate.commandCenterPreviousCommand {
-            MPRemoteCommandCenter.shared().previousTrackCommand.removeTarget(previousCommand)
+        if let commandCenterSkipBackwardCommand = appDelegate.commandCenterSkipBackwardCommand {
+            MPRemoteCommandCenter.shared().previousTrackCommand.removeTarget(commandCenterSkipBackwardCommand)
         }
-        if let nextCommand = appDelegate.commandCenterNextCommand {
-            MPRemoteCommandCenter.shared().nextTrackCommand.removeTarget(nextCommand)
+        if let commandCenterskipForwardCommand = appDelegate.commandCenterskipForwardCommand {
+            MPRemoteCommandCenter.shared().nextTrackCommand.removeTarget(commandCenterskipForwardCommand)
         }
     }
     

+ 14 - 16
iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift

@@ -49,7 +49,7 @@ class NCPlayerToolBar: UIView {
     private var ncplayer: NCPlayer?
     private var wasInPlay: Bool = false
     private var playbackSliderEvent: sliderEventType = .ended
-    private let timeToAdd: CMTime = CMTimeMakeWithSeconds(15, preferredTimescale: 1)
+    private let timeToAdd: CMTime = CMTimeMakeWithSeconds(10, preferredTimescale: 1)
     private var durationTime: CMTime = .zero
     private var timeObserver: Any?
     private var timerAutoHide: Timer?
@@ -103,13 +103,13 @@ class NCPlayerToolBar: UIView {
         labelOverallDuration.text = NCUtility.shared.stringFromTime(.zero)
         labelOverallDuration.textColor = .lightGray
         
-        backButton.setImage(NCUtility.shared.loadImage(named: "gobackward.15", color: .lightGray), for: .normal)
+        backButton.setImage(NCUtility.shared.loadImage(named: "gobackward.10", color: .lightGray), for: .normal)
         backButton.isEnabled = false
         
         playButton.setImage(NCUtility.shared.loadImage(named: "play.fill", color: .lightGray), for: .normal)
         playButton.isEnabled = false
         
-        forwardButton.setImage(NCUtility.shared.loadImage(named: "goforward.15", color: .lightGray), for: .normal)
+        forwardButton.setImage(NCUtility.shared.loadImage(named: "goforward.10", color: .lightGray), for: .normal)
         forwardButton.isEnabled = false
         
         NotificationCenter.default.addObserver(self, selector: #selector(handleInterruption), name: AVAudioSession.interruptionNotification, object: nil)
@@ -230,22 +230,20 @@ class NCPlayerToolBar: UIView {
                 return .commandFailed
             }
             
-            // Add handler for Previous Command
-            appDelegate.commandCenterPreviousCommand = commandCenter.previousTrackCommand.addTarget { event in
+            // Add handler for Backward Command
+            appDelegate.commandCenterSkipBackwardCommand = commandCenter.skipBackwardCommand.addTarget { event in
                 
-                ncplayer.videoSeek(time: .zero)
-                self.updateToolBar(timeSeek: .zero)
+                self.forwardButtonSec(self)
                 return.success
             }
                 
-            // Add handler for Next Command
-            appDelegate.commandCenterNextCommand = commandCenter.nextTrackCommand.addTarget { event in
+            // Add handler for Forward Command
+            appDelegate.commandCenterskipForwardCommand = commandCenter.skipForwardCommand.addTarget { event in
                 
-                ncplayer.videoSeek(time: .zero)
-                self.updateToolBar(timeSeek: .zero)
+                self.backButtonSec(self)
                 return.success
             }
-                  
+            
             nowPlayingInfo[MPMediaItemPropertyTitle] = metadata.fileNameView
             nowPlayingInfo[MPMediaItemPropertyPlaybackDuration] = appDelegate.player?.currentItem?.asset.duration.seconds
             if let image = self.image {
@@ -359,9 +357,9 @@ class NCPlayerToolBar: UIView {
         playbackSlider.isEnabled = true
         
         if #available(iOS 13.0, *) {
-            backButton.setImage(NCUtility.shared.loadImage(named: "gobackward.15", color: .white), for: .normal)
+            backButton.setImage(NCUtility.shared.loadImage(named: "gobackward.10", color: .white), for: .normal)
         } else {
-            backButton.setImage(NCUtility.shared.loadImage(named: "gobackward.15", color: .white, size: 30), for: .normal)
+            backButton.setImage(NCUtility.shared.loadImage(named: "gobackward.10", color: .white, size: 30), for: .normal)
         }
         backButton.isEnabled = true
         
@@ -380,9 +378,9 @@ class NCPlayerToolBar: UIView {
         playButton.isEnabled = true
         
         if #available(iOS 13.0, *) {
-            forwardButton.setImage(NCUtility.shared.loadImage(named: "goforward.15", color: .white), for: .normal)
+            forwardButton.setImage(NCUtility.shared.loadImage(named: "goforward.10", color: .white), for: .normal)
         } else {
-            forwardButton.setImage(NCUtility.shared.loadImage(named: "goforward.15", color: .white, size: 30), for: .normal)
+            forwardButton.setImage(NCUtility.shared.loadImage(named: "goforward.10", color: .white, size: 30), for: .normal)
         }
         forwardButton.isEnabled = true