Commit 1c08e734 authored by Robert Gordon's avatar Robert Gordon Committed by Carola Nitz

VideoOptionsControlBar: Implement new ui components and pseudo-functionality for repeat button

Made OptionsControlBar respond to device orientation

Fix not working button actions.

Fixed buttons not triggering respective functions when tapped.
parent 200cd50c
...@@ -370,3 +370,11 @@ ...@@ -370,3 +370,11 @@
"UNKNOWN_ARTIST" = "Unknown Artist"; "UNKNOWN_ARTIST" = "Unknown Artist";
"VARIOUS_ARTIST" = "Various Artists"; "VARIOUS_ARTIST" = "Various Artists";
"UNKNOWN_ALBUM" = "Unknown Album"; "UNKNOWN_ALBUM" = "Unknown Album";
/* New strings */
"INTERFACE_LOCK_BUTTON" = "Lock interface";
"INTERFACE_LOCK_HINT" = "Disable interface controls";
"MORE_OPTIONS_BUTTON" = "More";
"MORE_OPTIONS_HINT" = "View more option controls";
"REPEAT_MODE_HINT" = "Change repeat mode of current item";
"VIDEO_ASPECT_RATIO_HINT" = "Change the aspect ratio of the current video";
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#define DEFAULT_FOV 80.f #define DEFAULT_FOV 80.f
#define MAX_FOV 150.f #define MAX_FOV 150.f
#define MIN_FOV 20.f #define MIN_FOV 20.f
#define NEW_UI 0
typedef NS_ENUM(NSInteger, VLCPanType) { typedef NS_ENUM(NSInteger, VLCPanType) {
VLCPanTypeNone, VLCPanTypeNone,
...@@ -53,7 +54,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) { ...@@ -53,7 +54,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
VLCPanTypeProjection VLCPanTypeProjection
}; };
@interface VLCMovieViewController () <UIGestureRecognizerDelegate, VLCMultiSelectionViewDelegate, VLCEqualizerViewUIDelegate, VLCPlaybackControllerDelegate, VLCDeviceMotionDelegate, VLCRendererDiscovererManagerDelegate, PlaybackSpeedViewDelegate> @interface VLCMovieViewController () <UIGestureRecognizerDelegate, VLCMultiSelectionViewDelegate, VLCEqualizerViewUIDelegate, VLCPlaybackControllerDelegate, VLCDeviceMotionDelegate, VLCRendererDiscovererManagerDelegate, PlaybackSpeedViewDelegate, VLCVideoOptionsControlBarDelegate>
{ {
BOOL _controlsHidden; BOOL _controlsHidden;
BOOL _videoFiltersHidden; BOOL _videoFiltersHidden;
...@@ -96,6 +97,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) { ...@@ -96,6 +97,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
VLCEqualizerView *_equalizerView; VLCEqualizerView *_equalizerView;
VLCMultiSelectionMenuView *_multiSelectionView; VLCMultiSelectionMenuView *_multiSelectionView;
VLCVideoOptionsControlBar *_videoOptionsControlBar;
VLCPlaybackController *_vpc; VLCPlaybackController *_vpc;
...@@ -163,14 +165,13 @@ typedef NS_ENUM(NSInteger, VLCPanType) { ...@@ -163,14 +165,13 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
_saturationSlider.accessibilityLabel = _saturationLabel.text; _saturationSlider.accessibilityLabel = _saturationLabel.text;
_gammaLabel.text = NSLocalizedString(@"VFILTER_GAMMA", nil); _gammaLabel.text = NSLocalizedString(@"VFILTER_GAMMA", nil);
_gammaSlider.accessibilityLabel = _gammaLabel.text; _gammaSlider.accessibilityLabel = _gammaLabel.text;
_resetVideoFilterButton.accessibilityLabel = NSLocalizedString(@"VIDEO_FILTER_RESET_BUTTON", nil); _resetVideoFilterButton.accessibilityLabel = NSLocalizedString(@"VIDEO_FILTER_RESET_BUTTON", nil);
_multiSelectionView = [[VLCMultiSelectionMenuView alloc] init]; #if !NEW_UI
_multiSelectionView.delegate = self; [self setupMultiSelectionView];
_multiSelectionView.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin; #else
_multiSelectionView.hidden = YES; [self setupVideoOptionsControlBar];
[self.view addSubview:_multiSelectionView]; #endif
_scrubHelpLabel.text = NSLocalizedString(@"PLAYBACK_SCRUB_HELP", nil); _scrubHelpLabel.text = NSLocalizedString(@"PLAYBACK_SCRUB_HELP", nil);
...@@ -241,6 +242,26 @@ typedef NS_ENUM(NSInteger, VLCPanType) { ...@@ -241,6 +242,26 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
[self setupRendererDiscovererManager]; [self setupRendererDiscovererManager];
} }
- (void) setupMultiSelectionView
{
_multiSelectionView = [[VLCMultiSelectionMenuView alloc] init];
_multiSelectionView.delegate = self;
_multiSelectionView.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin;
_multiSelectionView.hidden = YES;
_multiSelectionView.repeatMode = _vpc.repeatMode;
[self.view addSubview:_multiSelectionView];
}
- (void)setupVideoOptionsControlBar
{
_videoOptionsControlBar = [[VLCVideoOptionsControlBar alloc] init];
_videoOptionsControlBar.delegate = self;
_videoOptionsControlBar.hidden = YES;
_videoOptionsControlBar.repeatMode = _vpc.repeatMode;
_videoOptionsControlBar.spacing = 32.0f;
[self.view addSubview:_videoOptionsControlBar];
}
- (void)setupGestureRecognizers - (void)setupGestureRecognizers
{ {
_tapOnVideoRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(toggleControlsVisible)]; _tapOnVideoRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(toggleControlsVisible)];
...@@ -347,8 +368,10 @@ typedef NS_ENUM(NSInteger, VLCPanType) { ...@@ -347,8 +368,10 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
[NSLayoutConstraint constraintWithItem:_trackSelectorContainer attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationLessThanOrEqual toItem:self.view attribute:NSLayoutAttributeHeight multiplier:2.0/3.0 constant:0], [NSLayoutConstraint constraintWithItem:_trackSelectorContainer attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationLessThanOrEqual toItem:self.view attribute:NSLayoutAttributeHeight multiplier:2.0/3.0 constant:0],
[_videoFilterView.bottomAnchor constraintEqualToAnchor:_controllerPanel.topAnchor] [_videoFilterView.bottomAnchor constraintEqualToAnchor:_controllerPanel.topAnchor]
]; ];
[NSLayoutConstraint activateConstraints:constraints]; #if NEW_UI
constraints = [constraints arrayByAddingObjectsFromArray:[self getVideoOptionsConstraints]];
#endif
[NSLayoutConstraint activateConstraints: constraints];
} }
- (UIButton *)doneButton - (UIButton *)doneButton
...@@ -450,6 +473,26 @@ typedef NS_ENUM(NSInteger, VLCPanType) { ...@@ -450,6 +473,26 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
} }
} }
- (void)layoutFrameForMultiSelectionView
{
CGRect controllerPanelFrame = _controllerPanel.frame;
CGRect multiSelectionFrame;
BOOL isIphone = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone);
if (!isIphone) {
_multiSelectionView.showsEqualizer = YES;
return;
}
BOOL isLandscape = UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]);
_multiSelectionView.showsEqualizer = isLandscape;
multiSelectionFrame = (CGRect){CGPointMake(0., 0.), [_multiSelectionView proposedDisplaySize]};
multiSelectionFrame.origin.x = controllerPanelFrame.size.width - multiSelectionFrame.size.width;
multiSelectionFrame.origin.y = controllerPanelFrame.origin.y - multiSelectionFrame.size.height;
_multiSelectionView.frame = multiSelectionFrame;
}
- (void)viewDidAppear:(BOOL)animated - (void)viewDidAppear:(BOOL)animated
{ {
[super viewDidAppear:animated]; [super viewDidAppear:animated];
...@@ -459,8 +502,13 @@ typedef NS_ENUM(NSInteger, VLCPanType) { ...@@ -459,8 +502,13 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
[_vpc recoverDisplayedMetadata]; [_vpc recoverDisplayedMetadata];
[self resetVideoFiltersSliders]; [self resetVideoFiltersSliders];
_vpc.videoOutputView = self.movieView; _vpc.videoOutputView = self.movieView;
_multiSelectionView.repeatMode = _vpc.repeatMode;
_multiSelectionView.shuffleMode = _vpc.isShuffleMode; #if !NEW_UI
_multiSelectionView.repeatMode = _vpc.repeatMode;
_multiSelectionView.shuffleMode = _vpc.isShuffleMode;
#else
_videoOptionsControlBar.repeatMode = _vpc.repeatMode;
#endif
//Media is loaded in the media player, checking the projection type and configuring accordingly. //Media is loaded in the media player, checking the projection type and configuring accordingly.
[self setupForMediaProjection]; [self setupForMediaProjection];
...@@ -472,31 +520,10 @@ typedef NS_ENUM(NSInteger, VLCPanType) { ...@@ -472,31 +520,10 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
equalizerRect.origin.x = CGRectGetMidX(self.view.bounds) - CGRectGetWidth(equalizerRect)/2.0; equalizerRect.origin.x = CGRectGetMidX(self.view.bounds) - CGRectGetWidth(equalizerRect)/2.0;
equalizerRect.origin.y = CGRectGetMidY(self.view.bounds) - CGRectGetHeight(equalizerRect)/2.0; equalizerRect.origin.y = CGRectGetMidY(self.view.bounds) - CGRectGetHeight(equalizerRect)/2.0;
_equalizerView.frame = equalizerRect; _equalizerView.frame = equalizerRect;
CGRect multiSelectionFrame; #if !NEW_UI
CGRect controllerPanelFrame = _controllerPanel.frame;; [self layoutFrameForMultiSelectionView];
#endif
if (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPhone) {
multiSelectionFrame = (CGRect){CGPointMake(0., 0.), [_multiSelectionView proposedDisplaySize]};
multiSelectionFrame.origin.x = controllerPanelFrame.size.width - multiSelectionFrame.size.width;
multiSelectionFrame.origin.y = controllerPanelFrame.origin.y - multiSelectionFrame.size.height;
_multiSelectionView.frame = multiSelectionFrame;
_multiSelectionView.showsEqualizer = YES;
return;
}
if (UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation])) {
_multiSelectionView.showsEqualizer = YES;
multiSelectionFrame = (CGRect){CGPointMake(0., 0.), [_multiSelectionView proposedDisplaySize]};
multiSelectionFrame.origin.x = controllerPanelFrame.size.width - multiSelectionFrame.size.width;
multiSelectionFrame.origin.y = controllerPanelFrame.origin.y - multiSelectionFrame.size.height;
} else {
_multiSelectionView.showsEqualizer = NO;
multiSelectionFrame = (CGRect){CGPointMake(0., 0.), [_multiSelectionView proposedDisplaySize]};
multiSelectionFrame.origin.x = controllerPanelFrame.size.width - multiSelectionFrame.size.width;
multiSelectionFrame.origin.y = controllerPanelFrame.origin.y - multiSelectionFrame.size.height;
}
_multiSelectionView.frame = multiSelectionFrame;
self.scrubViewTopConstraint.constant = CGRectGetMaxY(self.navigationController.navigationBar.frame); self.scrubViewTopConstraint.constant = CGRectGetMaxY(self.navigationController.navigationBar.frame);
} }
...@@ -648,26 +675,39 @@ typedef NS_ENUM(NSInteger, VLCPanType) { ...@@ -648,26 +675,39 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
- (NSArray *)itemsForInterfaceLock - (NSArray *)itemsForInterfaceLock
{ {
return @[_pinchRecognizer, NSArray *arr = [NSArray arrayWithObjects:
_panRecognizer, _pinchRecognizer,
_tapRecognizer, _panRecognizer,
_doneButton, _tapRecognizer,
_doubleTapRecognizer, _doneButton,
_timeNavigationTitleView.minimizePlaybackButton, _doubleTapRecognizer,
_timeNavigationTitleView.positionSlider, _timeNavigationTitleView.minimizePlaybackButton,
_timeNavigationTitleView.aspectRatioButton, _timeNavigationTitleView.positionSlider,
_controllerPanel.playbackSpeedButton, _timeNavigationTitleView.aspectRatioButton,
_controllerPanel.trackSwitcherButton, _controllerPanel.playbackSpeedButton,
_controllerPanel.bwdButton, _controllerPanel.trackSwitcherButton,
_controllerPanel.playPauseButton, _controllerPanel.bwdButton,
_controllerPanel.fwdButton, _controllerPanel.playPauseButton,
_controllerPanel.videoFilterButton, _controllerPanel.fwdButton,
_multiSelectionView.equalizerButton, _controllerPanel.videoFilterButton,
_multiSelectionView.chapterSelectorButton, _controllerPanel.volumeView,
_multiSelectionView.repeatButton, _rendererButton,
_multiSelectionView.shuffleButton, nil];
_controllerPanel.volumeView, #if !NEW_UI
_rendererButton]; return [arr arrayByAddingObjectsFromArray:
@[_multiSelectionView.equalizerButton,
_multiSelectionView.chapterSelectorButton,
_multiSelectionView.repeatButton,
_multiSelectionView.shuffleButton,
_controllerPanel.volumeView,
_rendererButton]];
#else
return [arr arrayByAddingObjectsFromArray:
@[_videoOptionsControlBar.toggleFullScreenButton,
_videoOptionsControlBar.selectSubtitleButton,
_videoOptionsControlBar.moreOptionsButton,
_videoOptionsControlBar.repeatButton]];
#endif
} }
- (void)handlePinchGesture:(UIPinchGestureRecognizer *)recognizer - (void)handlePinchGesture:(UIPinchGestureRecognizer *)recognizer
...@@ -724,8 +764,14 @@ typedef NS_ENUM(NSInteger, VLCPanType) { ...@@ -724,8 +764,14 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
_sleepTimerContainer.alpha = 0.0f; _sleepTimerContainer.alpha = 0.0f;
_sleepTimerContainer.hidden = YES; _sleepTimerContainer.hidden = YES;
} }
#if !NEW_UI
_multiSelectionView.alpha = 0.0f; _multiSelectionView.alpha = 0.0f;
_multiSelectionView.hidden = YES; _multiSelectionView.hidden = YES;
#else
_videoOptionsControlBar.alpha = 0.0f;
_videoOptionsControlBar.hidden = YES;
#endif
_artistNameLabel.hidden = NO; _artistNameLabel.hidden = NO;
_albumNameLabel.hidden = NO; _albumNameLabel.hidden = NO;
...@@ -738,8 +784,14 @@ typedef NS_ENUM(NSInteger, VLCPanType) { ...@@ -738,8 +784,14 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
self->_videoFilterView.alpha = alpha; self->_videoFilterView.alpha = alpha;
self->_playbackSpeedView.alpha = alpha; self->_playbackSpeedView.alpha = alpha;
self->_trackSelectorContainer.alpha = alpha; self->_trackSelectorContainer.alpha = alpha;
#if !NEW_UI
self->_multiSelectionView.alpha = alpha;
#else
self->_videoOptionsControlBar.alpha = alpha;
#endif
self->_equalizerView.alpha = alpha; self->_equalizerView.alpha = alpha;
self->_multiSelectionView.alpha = alpha;
if (self->_sleepTimerContainer) if (self->_sleepTimerContainer)
self->_sleepTimerContainer.alpha = alpha; self->_sleepTimerContainer.alpha = alpha;
...@@ -758,7 +810,13 @@ typedef NS_ENUM(NSInteger, VLCPanType) { ...@@ -758,7 +810,13 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
self->_equalizerView.hidden = YES; self->_equalizerView.hidden = YES;
if (self->_sleepTimerContainer) if (self->_sleepTimerContainer)
self->_sleepTimerContainer.hidden = YES; self->_sleepTimerContainer.hidden = YES;
self->_multiSelectionView.hidden = YES;
#if !NEW_UI
self->_multiSelectionView.hidden = YES;
#else
self->_videoOptionsControlBar.hidden = YES;
#endif
self->_artistNameLabel.hidden = self->_audioOnly ? NO : self->_controlsHidden; self->_artistNameLabel.hidden = self->_audioOnly ? NO : self->_controlsHidden;
self->_albumNameLabel.hidden = self->_audioOnly ? NO : self->_controlsHidden; self->_albumNameLabel.hidden = self->_audioOnly ? NO : self->_controlsHidden;
...@@ -1118,8 +1176,10 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom ...@@ -1118,8 +1176,10 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
[self.statusLabel showStatusMessage:NSLocalizedString(@"PLAYBACK_FAILED", nil)]; [self.statusLabel showStatusMessage:NSLocalizedString(@"PLAYBACK_FAILED", nil)];
[_controllerPanel updateButtons]; [_controllerPanel updateButtons];
_multiSelectionView.mediaHasChapters = currentMediaHasChapters; #if !NEW_UI
_multiSelectionView.mediaHasChapters = currentMediaHasChapters;
#endif
} }
- (void)savePlaybackState:(VLCPlaybackController *)controller - (void)savePlaybackState:(VLCPlaybackController *)controller
...@@ -1257,32 +1317,26 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom ...@@ -1257,32 +1317,26 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
[self setControlsHidden:YES animated:YES]; [self setControlsHidden:YES animated:YES];
} }
- (void)moreActions:(UIButton *)sender - (void)toggleMultiSelectionView:(UIButton *)sender {
{
if (_multiSelectionView.hidden == NO) { if (_multiSelectionView.hidden == NO) {
[UIView animateWithDuration:.3 [UIView animateWithDuration:.3
animations:^{ animations:^{
self->_multiSelectionView.hidden = YES; self->_multiSelectionView.hidden = YES;
} }
completion:^(BOOL finished){ completion:nil];
}];
return; return;
} }
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { BOOL isLandscape = UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]);
if (UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation])) { BOOL isIphone = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone);
_multiSelectionView.showsEqualizer = YES; _multiSelectionView.showsEqualizer = (isLandscape && isIphone) || !isIphone;
} else {
_multiSelectionView.showsEqualizer = NO;
}
}
CGRect workFrame = _multiSelectionView.frame; CGRect workFrame = _multiSelectionView.frame;
workFrame.size = [_multiSelectionView proposedDisplaySize]; workFrame.size = [_multiSelectionView proposedDisplaySize];
workFrame.origin.x = CGRectGetMaxX(sender.frame) - workFrame.size.width; workFrame.origin.x = CGRectGetMaxX(sender.frame) - workFrame.size.width;
_multiSelectionView.alpha = 1.0f; _multiSelectionView.alpha = 1.0f;
/* animate */ /* animate */
_multiSelectionView.frame = CGRectMake(workFrame.origin.x, workFrame.origin.y + workFrame.size.height, workFrame.size.width, 0.); _multiSelectionView.frame = CGRectMake(workFrame.origin.x, workFrame.origin.y + workFrame.size.height, workFrame.size.width, 0.);
[UIView animateWithDuration:.3 [UIView animateWithDuration:.3
...@@ -1290,8 +1344,29 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom ...@@ -1290,8 +1344,29 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
self->_multiSelectionView.frame = workFrame; self->_multiSelectionView.frame = workFrame;
self->_multiSelectionView.hidden = NO; self->_multiSelectionView.hidden = NO;
} }
completion:^(BOOL finished){ completion:nil];
}]; }
- (void) toggleVideoOptionsBar
{
CGFloat alpha = _videoOptionsControlBar.hidden ? 1.0f : 0.0f;
BOOL hidden = !_videoOptionsControlBar.hidden;
[UIView animateWithDuration:.3
animations:^{
self->_videoOptionsControlBar.alpha = alpha;
self->_videoOptionsControlBar.hidden = hidden;
}
completion:nil];
}
- (void)moreActions:(UIButton *)sender
{
#if !NEW_UI
[self toggleMultiSelectionView:sender];
#else
[self toggleVideoOptionsBar];
#endif
[self _resetIdleTimer]; [self _resetIdleTimer];
} }
...@@ -1322,7 +1397,10 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom ...@@ -1322,7 +1397,10 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
NSAssert(NO, @"class not handled"); NSAssert(NO, @"class not handled");
} }
} }
_multiSelectionView.displayLock = _interfaceIsLocked;
#if !NEW_UI
_multiSelectionView.displayLock = _interfaceIsLocked;
#endif
} }
- (void)toggleEqualizer - (void)toggleEqualizer
...@@ -1379,20 +1457,30 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom ...@@ -1379,20 +1457,30 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
- (void)toggleRepeatMode - (void)toggleRepeatMode
{ {
[[VLCPlaybackController sharedInstance] toggleRepeatMode]; [[VLCPlaybackController sharedInstance] toggleRepeatMode];
_multiSelectionView.repeatMode = [VLCPlaybackController sharedInstance].repeatMode; #if !NEW_UI
_multiSelectionView.repeatMode = [VLCPlaybackController sharedInstance].repeatMode;
#else
_videoOptionsControlBar.repeatMode = [VLCPlaybackController sharedInstance].repeatMode;
#endif
} }
- (void)toggleShuffleMode - (void)toggleShuffleMode
{ {
_vpc.shuffleMode = !_vpc.isShuffleMode; _vpc.shuffleMode = !_vpc.isShuffleMode;
_multiSelectionView.shuffleMode = _vpc.isShuffleMode; #if !NEW_UI
_multiSelectionView.shuffleMode = _vpc.isShuffleMode;
#endif
} }
- (void)hideMenu - (void)hideMenu
{ {
[UIView animateWithDuration:.2 [UIView animateWithDuration:.2
animations:^{ animations:^{
#if !NEW_UI
self->_multiSelectionView.hidden = YES; self->_multiSelectionView.hidden = YES;
#else
self->_videoOptionsControlBar.hidden = YES;
#endif
} }
completion:^(BOOL finished){ completion:^(BOOL finished){
}]; }];
...@@ -1691,12 +1779,10 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom ...@@ -1691,12 +1779,10 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{ {
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) { [coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
if (self.artworkImageView.image) if (self.artworkImageView.image)
self.trackNameLabel.hidden = YES; self.trackNameLabel.hidden = YES;
if (!self->_equalizerView.hidden) if (!self->_equalizerView.hidden)
self->_equalizerView.hidden = YES; self->_equalizerView.hidden = YES;
...@@ -1710,6 +1796,14 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom ...@@ -1710,6 +1796,14 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
[self setControlsHidden:NO animated:YES]; [self setControlsHidden:NO animated:YES];
} }
- (NSArray *)getVideoOptionsConstraints
{
return @[
[_videoOptionsControlBar.centerXAnchor constraintEqualToAnchor:self.view.centerXAnchor],
[_videoOptionsControlBar.bottomAnchor constraintEqualToAnchor:_controllerPanel.topAnchor constant:-50],
];
}
#pragma mark - External Display #pragma mark - External Display
- (void)showOnDisplay:(UIView *)view - (void)showOnDisplay:(UIView *)view
...@@ -1775,4 +1869,26 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom ...@@ -1775,4 +1869,26 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
[self showSleepTimer]; [self showSleepTimer];
} }
#pragma mark - VLCVideoOptionsControlBarDelegate
- (void)didSelectMoreOptions:(VLCVideoOptionsControlBar * _Nonnull)optionsBar {
[self moreActions:optionsBar.moreOptionsButton];
}
- (void)didSelectSubtitle:(VLCVideoOptionsControlBar * _Nonnull)optionsBar {
NSLog(@"subtitles Selected");
}
- (void)didToggleFullScreen:(VLCVideoOptionsControlBar * _Nonnull)optionsBar {
[_vpc toggleFullScreen];
}
- (void)didToggleInterfaceLock:(VLCVideoOptionsControlBar * _Nonnull)optionsBar {
[self toggleUILock];
}
- (void)didToggleRepeat:(VLCVideoOptionsControlBar * _Nonnull)optionsBar {
[self toggleRepeatMode];
}
@end @end
...@@ -9,13 +9,13 @@ ...@@ -9,13 +9,13 @@
* Refer to the COPYING file of the official project for license. * Refer to the COPYING file of the official project for license.
*****************************************************************************/ *****************************************************************************/
@objc (VideoOptionsControlBarDelegate) @objc (VLCVideoOptionsControlBarDelegate)
protocol VideoOptionsControlBarDelegate: class { protocol VideoOptionsControlBarDelegate: class {
func didToggleFullScreen(_ optionsBar: VideoOptionsControlBar) func didToggleFullScreen(_ optionsBar: VideoOptionsControlBar)
func didToggleRepeat(_ optionsBar: VideoOptionsControlBar) func didToggleRepeat(_ optionsBar: VideoOptionsControlBar)
func didSelectSubtitle(_ optionsBar: VideoOptionsControlBar) func didSelectSubtitle(_ optionsBar: VideoOptionsControlBar)
func didSelectMoreOptions(_ optionsBar: VideoOptionsControlBar) func didSelectMoreOptions(_ optionsBar: VideoOptionsControlBar)
func didToggleOrientationLock(_ optionsBar: VideoOptionsControlBar) func didToggleInterfaceLock(_ optionsBar: VideoOptionsControlBar)
} }
@objc (VLCVideoOptionsControlBar) @objc (VLCVideoOptionsControlBar)
...@@ -24,63 +24,86 @@ protocol VideoOptionsControlBarDelegate: class { ...@@ -24,63 +24,86 @@ protocol VideoOptionsControlBarDelegate: class {
// MARK: Instance variables // MARK: Instance variables
weak var delegate: VideoOptionsControlBarDelegate? weak var delegate: VideoOptionsControlBarDelegate?
var repeatMode: VLCRepeatMode {
didSet {
switch repeatMode {
case .repeatCurrentItem:
repeatButton.setImage(UIImage(named: "repeatOne-new"), for: .normal)
case .repeatAllItems:
repeatButton.setImage(UIImage(named: "repeat-new"), for: .normal)
case .doNotRepeat:
repeatButton.setImage(UIImage(named: "no-repeat-new"), for: .normal)
default:
assertionFailure("unhandled repeatmode")
}
}
}
lazy var toggleFullScreenButton: UIButton = { lazy var toggleFullScreenButton: UIButton = {