marinofaggiana 4 жил өмнө
parent
commit
7cdf715c2c

+ 1 - 1
iOSClient/CCGlobal.h

@@ -78,7 +78,7 @@
 
 // Database Realm
 #define k_databaseDefault                               @"nextcloud.realm"
-#define k_databaseSchemaVersion                         148
+#define k_databaseSchemaVersion                         149
 
 // Database JSON
 #define k_databaseDefaultJSON                           @"nextcloud.json"

+ 1 - 1
iOSClient/Data/NCDatabase.swift

@@ -439,7 +439,7 @@ class tableVideo: Object {
     
     @objc dynamic var account = ""
     @objc dynamic var ocId = ""
-    @objc dynamic var sec: Int64 = 0
+    @objc dynamic var time: Int64 = 0
     
     override static func primaryKey() -> String {
         return "ocId"

+ 5 - 4
iOSClient/Data/NCManageDatabase.swift

@@ -2690,7 +2690,7 @@ class NCManageDatabase: NSObject {
     //MARK: -
     //MARK: Table Video
     
-    @objc func addVideo(account: String, ocId: String, time: CMTime) {
+    func addVideo(account: String, ocId: String, time: CMTime) {
         
         let realm = try! Realm()
 
@@ -2700,7 +2700,7 @@ class NCManageDatabase: NSObject {
                
                 addObject.account = account
                 addObject.ocId = ocId
-                addObject.sec = Int64(CMTimeGetSeconds(time))
+                addObject.time = Int64(CMTimeGetSeconds(time))
               
                 realm.add(addObject, update: .all)
             }
@@ -2709,7 +2709,7 @@ class NCManageDatabase: NSObject {
         }
     }
     
-    @objc func getVideo(account: String, ocId: String) -> tableVideo? {
+    func getVideoTime(account: String, ocId: String) -> CMTime? {
         
         let realm = try! Realm()
         
@@ -2717,7 +2717,8 @@ class NCManageDatabase: NSObject {
             return nil
         }
         
-        return tableVideo.init(value: result)
+        let time = CMTimeMake(value: result.time, timescale: 1)
+        return time
     }
     
     //MARK: -

+ 1 - 2
iOSClient/Viewer/NCViewerImage/NCViewerImage.swift

@@ -476,8 +476,7 @@ class NCViewerImage: UIViewController {
             setToolBar()
             
             if ((player?.rate) == 1) {
-                if let tableVideo = NCManageDatabase.sharedInstance.getVideo(account: self.currentMetadata.account, ocId: self.currentMetadata.ocId) {
-                    let time = CMTimeMake(value: tableVideo.sec, timescale: 1)
+                if let time = NCManageDatabase.sharedInstance.getVideoTime(account: self.currentMetadata.account, ocId: self.currentMetadata.ocId) {
                     player?.seek(to: time)
                     player?.isMuted = CCUtility.getAudioMute()
                 }

+ 1 - 2
iOSClient/Viewer/NCViewerVideo/NCViewerVideo.swift

@@ -91,8 +91,7 @@ protocol NCViewerVideoDelegate {
             NCKTVHTTPCache.shared.saveCache(metadata: metadata)
             
             if ((player?.rate) == 1) {
-                if let tableVideo = NCManageDatabase.sharedInstance.getVideo(account: self.metadata.account, ocId: self.metadata.ocId) {
-                    let time = CMTimeMake(value: tableVideo.sec, timescale: 1)
+                if let time = NCManageDatabase.sharedInstance.getVideoTime(account: self.metadata.account, ocId: self.metadata.ocId) {
                     player?.seek(to: time)
                     player?.isMuted = CCUtility.getAudioMute()
                 }