Explorar el Código

VPC: correctly move on to the next item if playback is over

Felix Paul Kühne hace 9 años
padre
commit
9665512b4f
Se han modificado 2 ficheros con 9 adiciones y 1 borrados
  1. 1 0
      NEWS
  2. 8 1
      Sources/VLCPlaybackController.m

+ 1 - 0
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

+ 8 - 1
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];
         }
     }