Commit c4861164 authored by Felix Paul Kühne's avatar Felix Paul Kühne
Browse files

Media View: fix remembering the last playback position

parent 3a8e81a1
......@@ -68,6 +68,7 @@
name:UIScreenDidConnectNotification object:nil];
[center addObserver:self selector:@selector(handleExternalScreenDidDisconnect:)
name:UIScreenDidDisconnectNotification object:nil];
[center addObserver:self selector:@selector(appWillResign:) name:UIApplicationWillResignActiveNotification object:nil];
if ([self hasExternalDisplay]) {
[self showOnExternalDisplay];
......@@ -90,9 +91,9 @@
self.title = [self.mediaItem title];
[_mediaPlayer setMedia:[VLCMedia mediaWithURL:[NSURL URLWithString:self.mediaItem.url]]];
[_mediaPlayer play];
if (self.mediaItem.lastPosition && [self.mediaItem.lastPosition floatValue] < 0.99)
[_mediaPlayer setPosition:[self.mediaItem.lastPosition floatValue]];
[_mediaPlayer play];
}
}
......@@ -100,9 +101,9 @@
{
[self.navigationController setNavigationBarHidden:NO animated:YES];
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackOpaque;
[_mediaPlayer pause];
[super viewWillDisappear:animated];
self.mediaItem.lastPosition = [NSNumber numberWithFloat:[_mediaPlayer position]];
}
- (void)didReceiveMemoryWarning
......@@ -264,6 +265,11 @@
self.masterPopoverController = nil;
}
- (void)appWillResign:(NSNotification *)aNotification
{
self.mediaItem.lastPosition = [NSNumber numberWithFloat:[_mediaPlayer position]];
}
#pragma mark - External Display
- (BOOL)hasExternalDisplay
......
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