Browse Source

vpc: add native support for media lists

Felix Paul Kühne 10 years ago
parent
commit
5b742eda0c
2 changed files with 17 additions and 0 deletions
  1. 2 0
      Sources/VLCPlaybackController.h
  2. 15 0
      Sources/VLCPlaybackController.m

+ 2 - 0
Sources/VLCPlaybackController.h

@@ -91,4 +91,6 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
 - (void)setNeedsMetadataUpdate;
 - (void)scheduleSleepTimerWithInterval:(NSTimeInterval)timeInterval;
 
+- (void)playMediaList:(VLCMediaList *)mediaList firstIndex:(int)index;
+
 @end

+ 15 - 0
Sources/VLCPlaybackController.m

@@ -145,6 +145,21 @@ NSString *const VLCPlaybackControllerPlaybackDidFail = @"VLCPlaybackControllerPl
     return YES;
 }
 
+- (void)playMediaList:(VLCMediaList *)mediaList firstIndex:(int)index
+{
+    self.mediaList = mediaList;
+    self.itemInMediaListToBePlayedFirst = index;
+    self.pathToExternalSubtitlesFile = nil;
+
+    if (self.activePlaybackSession) {
+        self.sessionWillRestart = YES;
+        [self stopPlayback];
+    } else {
+        self.sessionWillRestart = NO;
+        [self startPlayback];
+    }
+}
+
 - (void)startPlayback
 {
     if (_playerIsSetup)