Commit 8ac9f4b8 authored by Gleb Pinigin's avatar Gleb Pinigin Committed by Felix Paul Kühne

VLCKit: pause playback when application resigns active (fixes #8139)

Signed-off-by: Felix Paul Kühne's avatarFelix Paul Kühne <fkuehne@videolan.org>
parent caaf33ab
......@@ -206,6 +206,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
[self unregisterObservers];
[[VLCEventManager sharedManager] cancelCallToObject:self];
[[NSNotificationCenter defaultCenter] removeObserver:self];
// Always get rid of the delegate first so we can stop sending messages to it
// TODO: Should we tell the delegate that we're shutting down?
......@@ -727,6 +728,8 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
instance = libvlc_media_player_new([VLCLibrary sharedInstance]);
[self registerObservers];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillResignActive:)
name:UIApplicationWillResignActiveNotification object:nil];
[self setDrawable:aDrawable];
}
......@@ -765,6 +768,11 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
libvlc_event_detach(p_em, libvlc_MediaPlayerMediaChanged, HandleMediaPlayerMediaChanged, self);
}
- (void)applicationWillResignActive:(NSNotification *)notification
{
[self pause];
}
- (void)mediaPlayerTimeChanged:(NSNumber *)newTime
{
[self willChangeValueForKey:@"time"];
......
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