Commit 41504492 authored by Vincent L. Cone's avatar Vincent L. Cone Committed by Felix Paul Kühne

Change behavior of the transport bar to match the newer style in...

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's avatarFelix Paul Kühne <fkuehne@videolan.org>
parent cf998d67
...@@ -12,6 +12,12 @@ ...@@ -12,6 +12,12 @@
"filename" : "App Icon - Small.imagestack", "filename" : "App Icon - Small.imagestack",
"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",
......
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "tv",
"filename" : "NowPlayingFastForward.png",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "tv",
"filename" : "NowPlayingSkip10Backward.png",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "tv",
"filename" : "NowPlayingSkip10Forward.png",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
...@@ -218,6 +218,10 @@ typedef NS_ENUM(NSInteger, VLCPlayerScanState) ...@@ -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) ...@@ -469,16 +473,20 @@ typedef NS_ENUM(NSInteger, VLCPlayerScanState)
return; return;
} }
} else { } else {
switch (recognizer.touchLocation) { if (self.canJump) {
case VLCSiriRemoteTouchLocationLeft: switch (recognizer.touchLocation) {
hint = VLCTransportBarHintJumpBackward10; case VLCSiriRemoteTouchLocationLeft:
break; hint = VLCTransportBarHintJumpBackward10;
case VLCSiriRemoteTouchLocationRight: break;
hint = VLCTransportBarHintJumpForward10; case VLCSiriRemoteTouchLocationRight:
break; hint = VLCTransportBarHintJumpForward10;
default: break;
hint = VLCTransportBarHintNone; default:
break; hint = VLCTransportBarHintNone;
break;
}
} else {
hint = VLCTransportBarHintNone;
} }
} }
break; break;
...@@ -500,14 +508,15 @@ typedef NS_ENUM(NSInteger, VLCPlayerScanState) ...@@ -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 ...@@ -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
......
...@@ -139,9 +139,7 @@ static inline void sharedSetup(VLCTransportBar *self) { ...@@ -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 return [UIImage imageNamed:imageName];
NSBundle *bundle = [NSBundle bundleWithPath:@"/System/Library/Frameworks/AVKit.framework"];
return [UIImage imageNamed:imageName inBundle:bundle compatibleWithTraitCollection:nil];
} }
return nil; return nil;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment