浏览代码

playback: show album art if we don't have video but art. otherwise, fallback to meta data text

Felix Paul Kühne 11 年之前
父节点
当前提交
657c09230c

+ 8 - 3
Resources/VLCMovieViewController~ipad.xib

@@ -1,15 +1,16 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="3.0" toolsVersion="4514" systemVersion="13A603" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="3.0" toolsVersion="5037" systemVersion="12F45" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none">
     <dependencies>
         <deployment defaultVersion="1552" identifier="iOS"/>
         <development version="5000" identifier="xcode"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3747"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
     </dependencies>
     <objects>
         <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="VLCMovieViewController">
             <connections>
                 <outlet property="albumNameLabel" destination="305" id="308"/>
                 <outlet property="artistNameLabel" destination="303" id="306"/>
+                <outlet property="artworkImageView" destination="g3j-bZ-K3S" id="fPn-6f-Kez"/>
                 <outlet property="aspectRatioButton" destination="198" id="229"/>
                 <outlet property="audioSwitcherButton" destination="277" id="292"/>
                 <outlet property="audioSwitcherContainer" destination="k3r-6B-CmK" id="sr9-Hq-Iqu"/>
@@ -118,6 +119,10 @@
             <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"/>
                     <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
@@ -524,4 +529,4 @@
         <image name="subtitleIcon.png" width="19" height="19"/>
         <image name="videoEffectsIcon.png" width="21" height="21"/>
     </resources>
-</document>
+</document>

+ 8 - 3
Resources/VLCMovieViewController~iphone.xib

@@ -1,15 +1,16 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="4514" systemVersion="13A603" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="5037" systemVersion="12F45" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
     <dependencies>
         <deployment defaultVersion="1552" identifier="iOS"/>
         <development version="5000" identifier="xcode"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3747"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
     </dependencies>
     <objects>
         <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="VLCMovieViewController">
             <connections>
                 <outlet property="albumNameLabel" destination="280" id="285"/>
                 <outlet property="artistNameLabel" destination="279" id="283"/>
+                <outlet property="artworkImageView" destination="yK6-Ph-SVE" id="Cm9-7F-iYZ"/>
                 <outlet property="aspectRatioButton" destination="202" id="222"/>
                 <outlet property="audioSwitcherButton" destination="78" id="98"/>
                 <outlet property="audioSwitcherContainer" destination="mKM-iB-gtC" id="jf3-eu-m9Z"/>
@@ -118,6 +119,10 @@
             <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"/>
                     <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
@@ -534,4 +539,4 @@
         <image name="subtitleIcon.png" width="19" height="19"/>
         <image name="videoEffectsIcon.png" width="21" height="21"/>
     </resources>
-</document>
+</document>

+ 1 - 0
Sources/VLCMovieViewController.h

@@ -71,6 +71,7 @@
 @property (nonatomic, strong) IBOutlet UILabel *artistNameLabel;
 @property (nonatomic, strong) IBOutlet UILabel *albumNameLabel;
 @property (nonatomic, strong) IBOutlet UILabel *trackNameLabel;
+@property (nonatomic, strong) IBOutlet UIImageView *artworkImageView;
 
 @property (nonatomic, strong) MLFile *mediaItem;
 @property (nonatomic, strong) NSURL *url;

+ 8 - 3
Sources/VLCMovieViewController.m

@@ -21,6 +21,7 @@
 #import <CommonCrypto/CommonDigest.h>
 #import "UIDevice+SpeedCategory.h"
 #import "VLCBugreporter.h"
+#import "VLCThumbnailsCache.h"
 
 #import "OBSlider.h"
 #import "VLCStatusLabel.h"
@@ -354,9 +355,13 @@
         item.unread = @(NO);
 
         if (item.isAlbumTrack) {
-            self.trackNameLabel.text = item.albumTrack.title;
-            self.artistNameLabel.text = item.albumTrack.artist;
-            self.albumNameLabel.text = 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.trackNameLabel.text = self.artistNameLabel.text = self.albumNameLabel.text = @"";
         }
     } else {
         media = [VLCMedia mediaWithURL:self.url];