浏览代码

Change behavior of the transport bar to match the newer style in AVPlayerViewController Embed hint icons for transport bar instead of loading them from AVKit.

Signed-off-by: Felix Paul Kühne <fkuehne@videolan.org>
Vincent L. Cone 8 年之前
父节点
当前提交
415044925a

+ 6 - 0
Apple-TV/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json

@@ -13,6 +13,12 @@
       "role" : "primary-app-icon"
       "role" : "primary-app-icon"
     },
     },
     {
     {
+      "size" : "2320x720",
+      "idiom" : "tv",
+      "filename" : "Top Shelf Image Wide-1.imageset",
+      "role" : "top-shelf-image-wide"
+    },
+    {
       "size" : "1920x720",
       "size" : "1920x720",
       "idiom" : "tv",
       "idiom" : "tv",
       "filename" : "Top Shelf Image.imageset",
       "filename" : "Top Shelf Image.imageset",

+ 6 - 0
Apple-TV/Assets.xcassets/TransportBar/Contents.json

@@ -0,0 +1,6 @@
+{
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

+ 13 - 0
Apple-TV/Assets.xcassets/TransportBar/NowPlayingFastForward.imageset/Contents.json

@@ -0,0 +1,13 @@
+{
+  "images" : [
+    {
+      "idiom" : "tv",
+      "filename" : "NowPlayingFastForward.png",
+      "scale" : "1x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

二进制
Apple-TV/Assets.xcassets/TransportBar/NowPlayingFastForward.imageset/NowPlayingFastForward.png


+ 13 - 0
Apple-TV/Assets.xcassets/TransportBar/NowPlayingSkip10Backward.imageset/Contents.json

@@ -0,0 +1,13 @@
+{
+  "images" : [
+    {
+      "idiom" : "tv",
+      "filename" : "NowPlayingSkip10Backward.png",
+      "scale" : "1x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

二进制
Apple-TV/Assets.xcassets/TransportBar/NowPlayingSkip10Backward.imageset/NowPlayingSkip10Backward.png


+ 13 - 0
Apple-TV/Assets.xcassets/TransportBar/NowPlayingSkip10Forward.imageset/Contents.json

@@ -0,0 +1,13 @@
+{
+  "images" : [
+    {
+      "idiom" : "tv",
+      "filename" : "NowPlayingSkip10Forward.png",
+      "scale" : "1x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

二进制
Apple-TV/Assets.xcassets/TransportBar/NowPlayingSkip10Forward.imageset/NowPlayingSkip10Forward.png


+ 32 - 12
Apple-TV/Playback/VLCFullscreenMovieTVViewController.m

@@ -218,6 +218,10 @@ typedef NS_ENUM(NSInteger, VLCPlayerScanState)
         }
         }
     }
     }
 
 
+    if (!self.canScrub) {
+        return;
+    }
+
     switch (panGestureRecognizer.state) {
     switch (panGestureRecognizer.state) {
         case UIGestureRecognizerStateCancelled:
         case UIGestureRecognizerStateCancelled:
         case UIGestureRecognizerStateFailed:
         case UIGestureRecognizerStateFailed:
@@ -469,16 +473,20 @@ typedef NS_ENUM(NSInteger, VLCPlayerScanState)
                     return;
                     return;
                 }
                 }
             } else {
             } else {
-                switch (recognizer.touchLocation) {
-                    case VLCSiriRemoteTouchLocationLeft:
-                        hint = VLCTransportBarHintJumpBackward10;
-                        break;
-                    case VLCSiriRemoteTouchLocationRight:
-                        hint = VLCTransportBarHintJumpForward10;
-                        break;
-                    default:
-                        hint = VLCTransportBarHintNone;
-                        break;
+                if (self.canJump) {
+                    switch (recognizer.touchLocation) {
+                        case VLCSiriRemoteTouchLocationLeft:
+                            hint = VLCTransportBarHintJumpBackward10;
+                            break;
+                        case VLCSiriRemoteTouchLocationRight:
+                            hint = VLCTransportBarHintJumpForward10;
+                            break;
+                        default:
+                            hint = VLCTransportBarHintNone;
+                            break;
+                    }
+                } else {
+                    hint = VLCTransportBarHintNone;
                 }
                 }
             }
             }
             break;
             break;
@@ -500,14 +508,15 @@ typedef NS_ENUM(NSInteger, VLCPlayerScanState)
 
 
 - (void)handleSiriPressUpAtLocation:(VLCSiriRemoteTouchLocation)location
 - (void)handleSiriPressUpAtLocation:(VLCSiriRemoteTouchLocation)location
 {
 {
+    BOOL canJump = [self canJump];
     switch (location) {
     switch (location) {
         case VLCSiriRemoteTouchLocationLeft:
         case VLCSiriRemoteTouchLocationLeft:
-            if (self.isSeekable) {
+            if (canJump && self.isSeekable) {
                 [self jumpBackward];
                 [self jumpBackward];
             }
             }
             break;
             break;
         case VLCSiriRemoteTouchLocationRight:
         case VLCSiriRemoteTouchLocationRight:
-            if (self.isSeekable) {
+            if (canJump && self.isSeekable) {
                 [self jumpForward];
                 [self jumpForward];
             }
             }
             break;
             break;
@@ -662,6 +671,17 @@ static const NSInteger VLCJumpInterval = 10000; // 10 seconds
     return [VLCPlaybackController sharedInstance].mediaPlayer.isSeekable;
     return [VLCPlaybackController sharedInstance].mediaPlayer.isSeekable;
 }
 }
 
 
+- (BOOL)canJump
+{
+    // to match the AVPlayerViewController behavior only allow jumping when playing.
+    return [VLCPlaybackController sharedInstance].isPlaying;
+}
+- (BOOL)canScrub
+{
+    // to match the AVPlayerViewController behavior only allow scrubbing when paused.
+    return ![VLCPlaybackController sharedInstance].isPlaying;
+}
+
 #pragma mark -
 #pragma mark -
 
 
 - (void)updateTimeLabelsForScrubbingFraction:(CGFloat)scrubbingFraction
 - (void)updateTimeLabelsForScrubbingFraction:(CGFloat)scrubbingFraction

+ 1 - 3
Apple-TV/Playback/VLCTransportBar.m

@@ -139,9 +139,7 @@ static inline void sharedSetup(VLCTransportBar *self) {
 			break;
 			break;
 	}
 	}
     if (imageName) {
     if (imageName) {
-        // FIXME: TODO: don't use the images from AVKit
-        NSBundle *bundle = [NSBundle bundleWithPath:@"/System/Library/Frameworks/AVKit.framework"];
-        return [UIImage imageNamed:imageName inBundle:bundle compatibleWithTraitCollection:nil];
+        return [UIImage imageNamed:imageName];
     }
     }
     return nil;
     return nil;
 }
 }