Commit 9acd094f authored by Felix Paul Kühne's avatar Felix Paul Kühne

playback: improve pausing when headphones are unplugged

(cherry picked from commit 131898e30af8e44a06f5065903c8b263a037076d)
parent 713ee565
......@@ -727,10 +727,13 @@ NSString *const VLCPlaybackControllerPlaybackDidFail = @"VLCPlaybackControllerPl
- (void)audioSessionRouteChange:(NSNotification *)notification
{
NSArray *outputs = [[AVAudioSession sharedInstance] currentRoute].outputs;
NSString *portName = [[outputs objectAtIndex:0] portName];
NSString *portName = [[outputs firstObject] portName];
if (![portName isEqualToString:@"Headphones"] && [_mediaPlayer isPlaying])
[_listPlayer pause];
if (![portName isEqualToString:@"Headphones"] && [_mediaPlayer isPlaying]) {
[_mediaPlayer pause];
[self _savePlaybackState];
[[NSNotificationCenter defaultCenter] postNotificationName:VLCPlaybackControllerPlaybackDidPause object:self];
}
}
#pragma mark - Managing the media item
......
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