Marino Faggiana 1 éve
szülő
commit
ce4f178bd3

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

@@ -24,7 +24,6 @@
 import Foundation
 import NextcloudKit
 import UIKit
-import MediaPlayer
 import MobileVLCKit
 
 class NCPlayer: NSObject {
@@ -296,12 +295,12 @@ extension NCPlayer: VLCMediaThumbnailerDelegate {
         do {
             image = UIImage(cgImage: thumbnail)
             // Update Playing Info Center
-            let mediaItemPropertyTitle = MPNowPlayingInfoCenter.default().nowPlayingInfo?[MPMediaItemPropertyTitle] as? String
-            if let image = image, mediaItemPropertyTitle == metadata.fileNameView {
-                MPNowPlayingInfoCenter.default().nowPlayingInfo?[MPMediaItemPropertyArtwork] = MPMediaItemArtwork(boundsSize: image.size) { _ in
-                    return image
-                }
-            }
+            // let mediaItemPropertyTitle = MPNowPlayingInfoCenter.default().nowPlayingInfo?[MPMediaItemPropertyTitle] as? String
+            // if let image = image, mediaItemPropertyTitle == metadata.fileNameView {
+            //    MPNowPlayingInfoCenter.default().nowPlayingInfo?[MPMediaItemPropertyArtwork] = MPMediaItemArtwork(boundsSize: image.size) { _ in
+            //        return image
+            //    }
+            // }
             // Preview
             if let data = image?.jpegData(compressionQuality: 0.5) {
                 try data.write(to: URL(fileURLWithPath: fileNamePreviewLocalPath), options: .atomic)

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

@@ -151,6 +151,7 @@ class NCPlayerToolBar: UIView {
               let length = ncplayer.player?.media?.length.intValue,
               let position = position
         else { return }
+        let positionInSecond = position * Float(length / 1000)
 
         // SAVE POSITION
         if position > 0 {
@@ -173,6 +174,8 @@ class NCPlayerToolBar: UIView {
         playbackSlider.isEnabled = true
         labelCurrentTime.text = ncplayer.player?.time.stringValue
         labelLeftTime.text = ncplayer.player?.remainingTime?.stringValue
+        MPNowPlayingInfoCenter.default().nowPlayingInfo?[MPMediaItemPropertyPlaybackDuration] = length / 1000
+        MPNowPlayingInfoCenter.default().nowPlayingInfo?[MPNowPlayingInfoPropertyElapsedPlaybackTime] = positionInSecond
 
         // BACK FORWARD
         if length > 0 {

+ 0 - 1
iOSClient/Viewer/NCViewerMedia/NCViewerMediaPage.swift

@@ -415,7 +415,6 @@ class NCViewerMediaPage: UIViewController {
         }
 
         nowPlayingInfo[MPMediaItemPropertyTitle] = metadata.fileNameView
-        nowPlayingInfo[MPMediaItemPropertyPlaybackDuration] = 0 // ncplayer.durationTime.seconds
         if let image = currentViewController.image {
             nowPlayingInfo[MPMediaItemPropertyArtwork] = MPMediaItemArtwork(boundsSize: image.size) { _ in
                 return image