Commit 44cd3745 authored by Felix Paul Kühne's avatar Felix Paul Kühne
Browse files

library: when trying to play an item from an album, build a media list and...

library: when trying to play an item from an album, build a media list and play that one instead, so we can listen to the other tracks without going to back to the library
parent c2b493be
......@@ -31,6 +31,7 @@
- (void)openMediaFromManagedObject:(NSManagedObject *)file;
- (void)openMovieFromURL:(NSURL *)url;
- (void)openMediaList:(VLCMediaList*)list atIndex:(NSUInteger)index;
@property (nonatomic, readonly) VLCPlaylistViewController *playlistViewController;
@property (nonatomic, readonly) VLCDropboxTableViewController *dropboxTableViewController;
......@@ -334,4 +334,18 @@
[self.window.rootViewController presentViewController:navCon animated:YES completion:nil];
- (void)openMediaList:(VLCMediaList*)list atIndex:(NSUInteger)index
if (!_movieViewController)
_movieViewController = [[VLCMovieViewController alloc] initWithNibName:nil bundle:nil];
_movieViewController.mediaList = list;
_movieViewController.itemInMediaListToBePlayedFirst = index;
UINavigationController *navCon = [[UINavigationController alloc] initWithRootViewController:_movieViewController];
navCon.modalPresentationStyle = UIModalPresentationFullScreen;
[self.window.rootViewController presentViewController:navCon animated:YES completion:nil];
......@@ -430,7 +430,21 @@ static NSString *kDisplayedFirstSteps = @"Did we display the first steps tutoria
[tableView deselectRowAtIndexPath:indexPath animated:YES];
NSManagedObject *selectedObject = _foundMedia[indexPath.row];
[self openMediaObject:selectedObject];
if ([selectedObject isKindOfClass:[MLAlbumTrack class]]) {
VLCMediaList *list;
NSArray *tracks = [[(MLAlbumTrack*)selectedObject album] sortedTracks];
NSUInteger count = tracks.count;
list = [[VLCMediaList alloc] init];
MLFile *file;
for (NSUInteger x = 0; x < count; x++) {
file = [(MLAlbumTrack*)tracks[x] files].anyObject;
[list addMedia:[VLCMedia mediaWithURL: [NSURL URLWithString:file.url]]];
[(VLCAppDelegate*)[UIApplication sharedApplication].delegate openMediaList:list atIndex:[tracks indexOfObject:selectedObject]];
} else
[self openMediaObject:selectedObject];
#pragma mark - table view gestures
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