Commit 0ec56c4b authored by Felix Paul Kühne's avatar Felix Paul Kühne

playback: move sleep timer to vpc and adapt to logic changes (closes #14829)

(cherry picked from commit d473feca)
parent 7140fb75
......@@ -59,7 +59,6 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
UIActionSheet *_audiotrackActionSheet;
NSTimer *_idleTimer;
NSTimer *_sleepTimer;
BOOL _viewAppeared;
BOOL _displayRemainingTime;
......@@ -1008,11 +1007,8 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
- (IBAction)sleepTimerAction:(id)sender
{
if (_sleepTimer) {
[_sleepTimer invalidate];
_sleepTimer = nil;
}
_sleepTimer = [NSTimer scheduledTimerWithTimeInterval:_sleepTimeDatePicker.countDownDuration target:self selector:@selector(closePlayback:) userInfo:nil repeats:NO];
VLCPlaybackController *vpc = [VLCPlaybackController sharedInstance];
[vpc scheduleSleepTimerWithInterval:_sleepTimeDatePicker.countDownDuration];
}
- (void)moreActions:(id)sender
......
......@@ -89,6 +89,6 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
- (void)recoverPlaybackState;
- (void)setNeedsMetadataUpdate;
- (void)scheduleSleepTimerWithInterval:(NSTimeInterval)timeInterval;
@end
......@@ -37,6 +37,7 @@ NSString *const VLCPlaybackControllerPlaybackDidFail = @"VLCPlaybackControllerPl
BOOL _playerIsSetup;
BOOL _playbackFailed;
BOOL _shouldResumePlaying;
NSTimer *_sleepTimer;
NSArray *_aspectRatios;
NSUInteger _currentAspectRatioMask;
......@@ -931,6 +932,15 @@ setstuff:
forPlaybackController:self];
}
- (void)scheduleSleepTimerWithInterval:(NSTimeInterval)timeInterval
{
if (_sleepTimer) {
[_sleepTimer invalidate];
_sleepTimer = nil;
}
_sleepTimer = [NSTimer scheduledTimerWithTimeInterval:timeInterval target:self selector:@selector(stopPlayback) userInfo:nil repeats:NO];
}
#pragma mark - remote events
static inline NSArray * RemoteCommandCenterCommandsToHandle(MPRemoteCommandCenter *cc)
......
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