Commit 2ab25788 authored by Carola Nitz's avatar Carola Nitz

VLCPlaybackController: move the listplayer out of the header

parent 4de5572d
Pipeline #232 failed with stage
in 0 seconds
......@@ -68,7 +68,6 @@
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
_localNetworkVC = [[VLCServerListTVViewController alloc] initWithNibName:nil bundle:nil];
// _cloudServicesVC = [[VLCCloudServicesTVViewController alloc] initWithNibName:nil bundle:nil];
_remotePlaybackVC = [[VLCRemotePlaybackViewController alloc] initWithNibName:nil bundle:nil];
_openNetworkVC = [[VLCOpenNetworkStreamTVViewController alloc] initWithNibName:nil bundle:nil];
_settingsVC = [[VLCSettingsViewController alloc] initWithNibName:nil bundle:nil];
......@@ -77,7 +76,6 @@
_mainViewController.tabBar.barTintColor = [UIColor VLCOrangeTintColor];
_mainViewController.viewControllers = @[[[UINavigationController alloc] initWithRootViewController:_localNetworkVC],
// [[UINavigationController alloc] initWithRootViewController:_cloudServicesVC],
[[UINavigationController alloc] initWithRootViewController:_remotePlaybackVC],
[[UINavigationController alloc] initWithRootViewController:_openNetworkVC],
[[UINavigationController alloc] initWithRootViewController:_settingsVC]];
......
......@@ -689,19 +689,13 @@ static const NSInteger VLCJumpInterval = 10000; // 10 seconds
{
NSAssert(self.isSeekable, @"Tried to seek while not media is not seekable.");
VLCPlaybackController *vpc = [VLCPlaybackController sharedInstance];
self.transportBar.scrubbing = YES;
[self updateDimmingView];
if (vpc.isPlaying) {
[vpc playPause];
}
}
- (void)stopScrubbing
{
self.transportBar.scrubbing = NO;
[self updateDimmingView];
VLCPlaybackController *vpc = [VLCPlaybackController sharedInstance];
[vpc playPause];
}
- (void)updateDimmingView
......
......@@ -83,13 +83,11 @@
[self.view addConstraint:xConstraint];
NSArray *classes = @[
// [VLCLocalNetworkServiceBrowserManualConnect class],
[VLCLocalNetworkServiceBrowserHTTP class],
[VLCLocalNetworkServiceBrowserUPnP class],
[VLCLocalNetworkServiceBrowserDSM class],
[VLCLocalNetworkServiceBrowserPlex class],
[VLCLocalNetworkServiceBrowserFTP class],
// [VLCLocalNetworkServiceBrowserBonjour class],
#ifndef NDEBUG
[VLCLocalNetworkServiceBrowserSAP class],
#endif
......
......@@ -144,10 +144,7 @@
- (void)_respondToPlay
{
VLCPlaybackController *vpc = [VLCPlaybackController sharedInstance];
VLCMediaListPlayer *listPlayer = vpc.listPlayer;
if (listPlayer) {
[listPlayer play];
}
[vpc play];
}
- (void)playbackStarted
......@@ -170,10 +167,7 @@
- (void)_respondToPause
{
VLCPlaybackController *vpc = [VLCPlaybackController sharedInstance];
VLCMediaListPlayer *listPlayer = vpc.listPlayer;
if (listPlayer) {
[listPlayer pause];
}
[vpc pause];
}
- (void)playbackPaused
......
......@@ -1227,22 +1227,8 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
- (void)toggleRepeatMode
{
LOCKCHECK;
VLCMediaListPlayer *listPlayer = _vpc.listPlayer;
VLCRepeatMode nextRepeatMode = VLCDoNotRepeat;
switch (listPlayer.repeatMode) {
case VLCDoNotRepeat:
nextRepeatMode = VLCRepeatCurrentItem;
break;
case VLCRepeatCurrentItem:
nextRepeatMode = VLCRepeatAllItems;
break;
default:
nextRepeatMode = VLCDoNotRepeat;
break;
}
listPlayer.repeatMode = nextRepeatMode;
_multiSelectionView.repeatMode = nextRepeatMode;
[[VLCPlaybackController sharedInstance] toggleRepeatMode];
_multiSelectionView.repeatMode = [VLCPlaybackController sharedInstance].repeatMode;
}
- (void)toggleShuffleMode
......@@ -1381,8 +1367,6 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
//Invalidate saved location when the gesture is ended
if (_mediaHasProjection)
_saveLocation = CGPointMake(-1.f, -1.f);
if ([_vpc isPlaying])
[_vpc.listPlayer play];
}
}
......@@ -1423,8 +1407,6 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
}
if (swipeRecognizer.state == UIGestureRecognizerStateEnded) {
if ([_vpc isPlaying])
[_vpc.listPlayer play];
[self.statusLabel showStatusMessage:hudString];
}
......
......@@ -40,8 +40,6 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
@interface VLCPlaybackController : NSObject <VLCEqualizerViewDelegate>
@property (nonatomic, readonly) VLCMediaListPlayer *listPlayer;
@property (nonatomic, strong) UIView *videoOutputView;
@property (nonatomic, strong) NSURL *successCallback;
......@@ -94,11 +92,13 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
- (void)startPlayback;
- (void)stopPlayback;
- (void)playPause;
- (void)play;
- (void)pause;
- (void)next;
- (void)previous;
- (void)jumpForward:(int)interval;
- (void)jumpBackward:(int)interval;
- (void)toggleRepeatMode;
- (void)resetFilters;
- (VLCTime *)remainingTime;
......
......@@ -48,6 +48,7 @@ VLCMediaDelegate, VLCRemoteControlServiceDelegate>
{
VLCRemoteControlService *_remoteControlService;
VLCMediaPlayer *_mediaPlayer;
VLCMediaListPlayer *_listPlayer;
BOOL _playerIsSetup;
BOOL _shouldResumePlaying;
BOOL _sessionWillRestart;
......@@ -573,6 +574,23 @@ VLCMediaDelegate, VLCRemoteControlServiceDelegate>
_mediaPlayer.gamma = 1.;
}
- (void)toggleRepeatMode
{
VLCRepeatMode nextRepeatMode = VLCDoNotRepeat;
switch (_listPlayer.repeatMode) {
case VLCDoNotRepeat:
nextRepeatMode = VLCRepeatCurrentItem;
break;
case VLCRepeatCurrentItem:
nextRepeatMode = VLCRepeatAllItems;
break;
default:
nextRepeatMode = VLCDoNotRepeat;
break;
}
_listPlayer.repeatMode = nextRepeatMode;
}
- (NSInteger)indexOfCurrentAudioTrack
{
return [_mediaPlayer.audioTrackIndexes indexOfObject:@(_mediaPlayer.currentAudioTrackIndex)];
......@@ -742,16 +760,22 @@ VLCMediaDelegate, VLCRemoteControlServiceDelegate>
#pragma mark - playback controls
- (void)playPause
{
if ([_mediaPlayer isPlaying]) {
[_mediaPlayer isPlaying] ? [self pause] : [self play];
}
- (void)play
{
[_listPlayer play];
[[NSNotificationCenter defaultCenter] postNotificationName:VLCPlaybackControllerPlaybackDidResume object:self];
}
- (void)pause
{
[_listPlayer pause];
#if TARGET_OS_IOS
[self _savePlaybackState];
#endif
[[NSNotificationCenter defaultCenter] postNotificationName:VLCPlaybackControllerPlaybackDidPause object:self];
} else {
[_listPlayer play];
[[NSNotificationCenter defaultCenter] postNotificationName:VLCPlaybackControllerPlaybackDidResume object:self];
}
}
- (void)next
......
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