Commit 5fa6b857 authored by Carola Nitz's avatar Carola Nitz

playback: pause playback when headphones get unplugged

parent 2185a37f
......@@ -218,6 +218,8 @@
name:UIApplicationDidBecomeActiveNotification object:nil];
[center addObserver:self selector:@selector(applicationDidEnterBackground:)
name:UIApplicationDidEnterBackgroundNotification object:nil];
[center addObserver:self selector:@selector(audioSessionRouteChange:)
name:AVAudioSessionRouteChangeNotification object:nil];
_playingExternallyTitle.text = NSLocalizedString(@"PLAYING_EXTERNALLY_TITLE", @"");
_playingExternallyDescription.text = NSLocalizedString(@"PLAYING_EXTERNALLY_DESC", @"");
......@@ -1377,6 +1379,15 @@
}
}
- (void)audioSessionRouteChange:(NSNotification *)notification
{
NSArray *outputs = [[AVAudioSession sharedInstance] currentRoute].outputs;
NSString *portName = [[outputs objectAtIndex:0] portName];
if (![portName isEqualToString:@"Headphones"])
[_listPlayer pause];
}
- (void)mediaDidFinishParsing:(VLCMedia *)aMedia
{
[self _updateDisplayedMetadata];
......
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