فهرست منبع

playback: update displayed meta data when buffering, so it will also work when switching media list members

Felix Paul Kühne 11 سال پیش
والد
کامیت
2b600629a7
1فایلهای تغییر یافته به همراه18 افزوده شده و 13 حذف شده
  1. 18 13
      Sources/VLCMovieViewController.m

+ 18 - 13
Sources/VLCMovieViewController.m

@@ -377,19 +377,8 @@
         MLFile *item = self.mediaItem;
         media = [VLCMedia mediaWithURL:[NSURL URLWithString:item.url]];
         item.unread = @(NO);
-
-        if (item.isAlbumTrack) {
-            self.artworkImageView.image = [VLCThumbnailsCache thumbnailForMediaFile:item];
-            if (!self.artworkImageView.image) {
-                self.trackNameLabel.text = item.albumTrack.title;
-                self.artistNameLabel.text = item.albumTrack.artist;
-                self.albumNameLabel.text = item.albumTrack.album.name;
-            } else
-                self.artistNameLabel.text = self.albumNameLabel.text = @"";
-        }
     } else if (!self.mediaList)
         media = [VLCMedia mediaWithURL:self.url];
-    self.trackNameLabel.text = [[media url] lastPathComponent];
 
     NSMutableDictionary *mediaDictionary = [[NSMutableDictionary alloc] init];
 
@@ -527,8 +516,6 @@
     self.playbackSpeedSlider.value = [self _playbackSpeed];
     [self _updatePlaybackSpeedIndicator];
 
-    [self performSelectorInBackground:@selector(_updateExportedPlaybackInformation) withObject:nil];
-
     _currentAspectRatioMask = 0;
     _mediaPlayer.videoAspectRatio = NULL;
 
@@ -840,6 +827,24 @@
 - (void)mediaPlayerStateChanged:(NSNotification *)aNotification
 {
     VLCMediaPlayerState currentState = _mediaPlayer.state;
+    if (currentState == VLCMediaPlayerStateBuffering) {
+        /* let's update meta data */
+        MLFile *item = self.mediaItem;
+        if (item) {
+            if (item.isAlbumTrack) {
+                self.artworkImageView.image = [VLCThumbnailsCache thumbnailForMediaFile:item];
+                if (!self.artworkImageView.image) {
+                    self.trackNameLabel.text = item.albumTrack.title;
+                    self.artistNameLabel.text = item.albumTrack.artist;
+                    self.albumNameLabel.text = item.albumTrack.album.name;
+                } else
+                    self.artistNameLabel.text = self.albumNameLabel.text = @"";
+            }
+        }
+
+        self.trackNameLabel.text = [[_mediaPlayer.media url] lastPathComponent];
+        [self performSelectorInBackground:@selector(_updateExportedPlaybackInformation) withObject:nil];
+    }
 
     if (currentState == VLCMediaPlayerStateError) {
         [self.statusLabel showStatusMessage:NSLocalizedString(@"PLAYBACK_FAILED", @"")];