From 9665512b4ff34b49eee4bd5a43738519a17e9a36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= Date: Tue, 27 Oct 2015 15:02:49 +0100 Subject: [PATCH] VPC: correctly move on to the next item if playback is over --- NEWS | 1 + Sources/VLCPlaybackController.m | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index f9c8ac9b..ec7d238f 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,7 @@ * Added support for SMB file sharing (#8879) * Added support for music albums with more than 1 disk (#14650) * Re-wrote Apple Watch extension for watchOS 2 +* Media stored in folders on remote servers is now played as a list * Reworked networking UI * Added support for system-wide search "CoreSpotlight" * Added improved UI support for Right-to-Left languages diff --git a/Sources/VLCPlaybackController.m b/Sources/VLCPlaybackController.m index 5c624c8e..3781dd51 100644 --- a/Sources/VLCPlaybackController.m +++ b/Sources/VLCPlaybackController.m @@ -567,12 +567,19 @@ NSString *const VLCPlaybackControllerPlaybackDidFail = @"VLCPlaybackControllerPl [_mediaPlayer performSelector:@selector(setTextRendererFontSize:) withObject:[[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingSubtitlesFontSize]]; [_mediaPlayer performSelector:@selector(setTextRendererFontColor:) withObject:[[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingSubtitlesFontColor]]; } else if (currentState == VLCMediaPlayerStateError) { + APLog(@"Playback failed"); _playbackFailed = YES; [self stopPlayback]; } else if ((currentState == VLCMediaPlayerStateEnded || currentState == VLCMediaPlayerStateStopped) && _listPlayer.repeatMode == VLCDoNotRepeat) { - if ([_listPlayer.mediaList indexOfMedia:_mediaPlayer.media] == _listPlayer.mediaList.count - 1) { + [_listPlayer.mediaList lock]; + NSUInteger listCount = _listPlayer.mediaList.count; + if ([_listPlayer.mediaList indexOfMedia:_mediaPlayer.media] == listCount - 1) { + [_listPlayer.mediaList unlock]; [self stopPlayback]; return; + } else if (listCount > 1) { + [_listPlayer.mediaList unlock]; + [_listPlayer next]; } } -- GitLab