Kaynağa Gözat

playback: fix album art display for non-MLFile playback, re-arrange elements in the UI a bit

Felix Paul Kühne 11 yıl önce
ebeveyn
işleme
21ab40cfdc

+ 7 - 7
Resources/VLCMovieViewController~ipad.xib

@@ -119,12 +119,8 @@
             <rect key="frame" x="0.0" y="0.0" width="768" height="1024"/>
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <subviews>
-                <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" id="g3j-bZ-K3S">
-                    <rect key="frame" x="84" y="212" width="600" height="600"/>
-                    <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
-                </imageView>
                 <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" text="Artist Name" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="12" adjustsLetterSpacingToFitWidth="YES" id="303">
-                    <rect key="frame" x="255" y="356" width="257" height="28"/>
+                    <rect key="frame" x="255" y="400" width="257" height="28"/>
                     <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
                     <fontDescription key="fontDescription" type="system" pointSize="23"/>
                     <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
@@ -132,7 +128,7 @@
                     <color key="shadowColor" cocoaTouchSystemColor="darkTextColor"/>
                 </label>
                 <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" text="Track Name" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="12" adjustsLetterSpacingToFitWidth="YES" id="304">
-                    <rect key="frame" x="255" y="465" width="257" height="28"/>
+                    <rect key="frame" x="84" y="850" width="600" height="28"/>
                     <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
                     <fontDescription key="fontDescription" type="system" pointSize="23"/>
                     <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
@@ -140,13 +136,17 @@
                     <color key="shadowColor" cocoaTouchSystemColor="darkTextColor"/>
                 </label>
                 <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Album Name" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" adjustsLetterSpacingToFitWidth="YES" id="305">
-                    <rect key="frame" x="255" y="412" width="258" height="28"/>
+                    <rect key="frame" x="255" y="600" width="258" height="28"/>
                     <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
                     <fontDescription key="fontDescription" type="system" pointSize="14"/>
                     <color key="textColor" white="0.71999999999999997" alpha="1" colorSpace="calibratedWhite"/>
                     <nil key="highlightedColor"/>
                     <color key="shadowColor" cocoaTouchSystemColor="darkTextColor"/>
                 </label>
+                <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" id="g3j-bZ-K3S">
+                    <rect key="frame" x="84" y="212" width="600" height="600"/>
+                    <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
+                </imageView>
                 <view contentMode="scaleToFill" id="121" userLabel="Movie view">
                     <rect key="frame" x="0.0" y="0.0" width="768" height="1024"/>
                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>

+ 7 - 7
Resources/VLCMovieViewController~iphone.xib

@@ -119,12 +119,8 @@
             <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <subviews>
-                <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" id="yK6-Ph-SVE">
-                    <rect key="frame" x="40" y="164" width="240" height="240"/>
-                    <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
-                </imageView>
                 <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" text="Artist Name" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="12" adjustsLetterSpacingToFitWidth="YES" id="279">
-                    <rect key="frame" x="31" y="137" width="257" height="28"/>
+                    <rect key="frame" x="31" y="267" width="257" height="28"/>
                     <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
                     <fontDescription key="fontDescription" type="system" pointSize="23"/>
                     <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
@@ -132,7 +128,7 @@
                     <color key="shadowColor" cocoaTouchSystemColor="darkTextColor"/>
                 </label>
                 <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" text="Track Name" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="12" adjustsLetterSpacingToFitWidth="YES" id="282">
-                    <rect key="frame" x="31" y="204" width="257" height="28"/>
+                    <rect key="frame" x="31" y="410" width="257" height="28"/>
                     <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
                     <fontDescription key="fontDescription" type="system" pointSize="23"/>
                     <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
@@ -140,13 +136,17 @@
                     <color key="shadowColor" cocoaTouchSystemColor="darkTextColor"/>
                 </label>
                 <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Album Name" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" adjustsLetterSpacingToFitWidth="YES" id="280">
-                    <rect key="frame" x="31" y="171" width="258" height="28"/>
+                    <rect key="frame" x="31" y="336" width="258" height="28"/>
                     <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
                     <fontDescription key="fontDescription" type="system" pointSize="14"/>
                     <color key="textColor" white="0.71999999999999997" alpha="1" colorSpace="calibratedWhite"/>
                     <nil key="highlightedColor"/>
                     <color key="shadowColor" cocoaTouchSystemColor="darkTextColor"/>
                 </label>
+                <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" id="yK6-Ph-SVE">
+                    <rect key="frame" x="40" y="164" width="240" height="240"/>
+                    <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
+                </imageView>
                 <view contentMode="scaleToFill" id="91" userLabel="Movie view">
                     <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>

+ 23 - 7
Sources/VLCMovieViewController.m

@@ -830,19 +830,35 @@
     if (currentState == VLCMediaPlayerStateBuffering) {
         /* let's update meta data */
         MLFile *item = self.mediaItem;
+        NSString *title;
+        NSString *artist;
+        NSString *albumName;
+
         if (item) {
             if (item.isAlbumTrack) {
+                title = item.albumTrack.title;
+                artist = item.albumTrack.artist;
+                albumName = item.albumTrack.album.name;
                 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 {
+            NSDictionary * metaDict = _mediaPlayer.media.metaDictionary;
+            if (metaDict) {
+                title = metaDict[VLCMetaInformationTitle];
+                artist = metaDict[VLCMetaInformationArtist];
+                albumName = metaDict[VLCMetaInformationAlbum];
+                self.artworkImageView.image = [VLCThumbnailsCache thumbnailForMediaItemWithTitle:title Artist:artist andAlbumName:albumName];
             }
         }
+        if (!self.artworkImageView.image) {
+            self.trackNameLabel.text = title;
+            self.artistNameLabel.text = artist;
+            self.albumNameLabel.text = albumName;
+        } else
+            self.trackNameLabel.text = [NSString stringWithFormat:@"%@ – %@ — %@", title, artist, albumName];
 
-        self.trackNameLabel.text = [[_mediaPlayer.media url] lastPathComponent];
+        if (self.trackNameLabel.text.length < 1)
+            self.trackNameLabel.text = [[_mediaPlayer.media url] lastPathComponent];
         [self performSelectorInBackground:@selector(_updateExportedPlaybackInformation) withObject:nil];
     }