Quellcode durchsuchen

MediaLibraryService: Fix thumbnailReady callback

Soomin Lee vor 5 Jahren
Ursprung
Commit
50a8a7a249

+ 7 - 1
SharedSources/MediaLibraryModel/VideoModel.swift

@@ -71,7 +71,13 @@ extension VideoModel: MediaLibraryObserver {
 
     // MARK: - Thumbnail
 
-    func medialibrary(_ medialibrary: MediaLibraryService, thumbnailReady media: VLCMLMedia) {
+    func medialibrary(_ medialibrary: MediaLibraryService,
+                      thumbnailReady media: VLCMLMedia,
+                      type: VLCMLThumbnailSizeType, success: Bool) {
+        guard success else {
+            return
+        }
+
         for (index, file) in files.enumerated() where file == media {
             files[index] = media
             break

+ 6 - 3
SharedSources/MediaLibraryService.swift

@@ -40,7 +40,8 @@ extension NSNotification {
 
     // Tumbnail
     @objc optional func medialibrary(_ medialibrary: MediaLibraryService,
-                                     thumbnailReady media: VLCMLMedia)
+                                     thumbnailReady media: VLCMLMedia,
+                                     type: VLCMLThumbnailSizeType, success: Bool)
 
     // Tracks
     @objc optional func medialibrary(_ medialibrary: MediaLibraryService,
@@ -546,9 +547,11 @@ extension MediaLibraryService: VLCMediaLibraryDelegate {
         }
     }
 
-    func medialibrary(_ medialibrary: VLCMediaLibrary, thumbnailReadyFor media: VLCMLMedia, withSuccess success: Bool) {
+    func medialibrary(_ medialibrary: VLCMediaLibrary, thumbnailReadyFor media: VLCMLMedia,
+                      of type: VLCMLThumbnailSizeType, withSuccess success: Bool) {
         for observer in observers {
-            observer.value.observer?.medialibrary?(self, thumbnailReady: media)
+            observer.value.observer?.medialibrary?(self, thumbnailReady: media,
+                                                   type: type, success: success)
         }
     }
 }