Commit 6792d8be authored by Vibhoothi's avatar Vibhoothi

libraryView: Make video Playable

This adds a new approach by calling addPlaylistItems method
A new NSDictionary object with key "ITEM_URL" as it is required,which is added to a NSArray
Console Output:
(
        {
        "ITEM_URL" = "file:///Users/vibhoothiiaanand/Desktop/dummyVideos/Video5.3gp";
    }
)
2018-08-24 23:26:33.241 vlc-osx-static[72846:2136112] -[NSURL length]: unrecognized selector
sent to instance 0x7f9b93784980
GUI output:
Freezes and need to force close
To Do
Fix  passing of the NSArray proper which is broken as of now
parent d6343816
......@@ -28,5 +28,6 @@
@property (strong) NSString *year;
@property (strong) NSString *length;
@property (strong) NSImage *thumbnail;
@property (strong) NSURL *videoURL;
@end
......@@ -86,6 +86,7 @@
}
}
#pragma mark - popOver Initialisation of the indexed files
- (BOOL)buttonIsPressed
......
......@@ -54,6 +54,10 @@
NSSet<NSIndexPath *> * VLCLibraryViewItem;
CGFloat lastCollectionViewHeight;
NSRect frameBeforePlayback;
NSFileManager *fileManager;
NSString *rootPath;
NSArray *paths ;
VLCLibraryItem *libraryItem;
}
@end
......@@ -284,10 +288,10 @@ static const float f_min_window_height = 307.;
*/
- (void)prepareData {
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *rootPath = @"/Users/vibhoothiiaanand/Desktop/dummyVideos";
NSError *error = nil;
NSArray *paths = [fileManager contentsOfDirectoryAtPath:rootPath error:&error];
fileManager = [NSFileManager defaultManager];
rootPath = @"/Users/vibhoothiiaanand/Desktop/dummyVideos";
NSError *error = nil;
paths = [fileManager contentsOfDirectoryAtPath:rootPath error:&error];
for(NSString *path in paths){
NSString *videoPath = [rootPath stringByAppendingFormat:@"/%@",path];
NSLog(@"Video Path:%@",videoPath);
......@@ -306,6 +310,7 @@ static const float f_min_window_height = 307.;
self.dataModel.videoTitle= path;
self.dataModel.year = @"2012";
self.dataModel.length = @"40.4 MB";
self.dataModel.videoURL=url;
[self.dummyData addObject:self.dataModel] ;
}
......@@ -323,10 +328,29 @@ static const float f_min_window_height = 307.;
{
NSLog(@"Video at:%@ is Selected",VLCLibraryViewItem);
//Hide the CollectionView in favour of playing video when user clicks
[self performSelector:@selector(makeCollectionViewHidden) withObject:self afterDelay:2.0 ];
// [self performSelector:@selector(makeCollectionViewHidden) withObject:self afterDelay:2.0 ];
/*
Insert code for playing Video using libVLCCore
[[[VLCMain sharedInstance] open] openFileWithAction:^(NSArray *files) {
[[[VLCMain sharedInstance] playlist] addPlaylistItems:files];
}];
if (items.count == 0)
return NO;
NSString *o_urlString = [self directParameter];
if ([o_command isEqualToString:@"GetURL"] || [o_command isEqualToString:@"OpenURL"]) {
if (o_urlString) {
NSDictionary *o_dic = [NSDictionary dictionaryWithObject:o_urlString forKey:@"ITEM_URL"];
NSArray* item = [NSArray arrayWithObject:o_dic];
[[[VLCMain sharedInstance] playlist] addPlaylistItems:item tryAsSubtitle:YES];
*/
NSDictionary *dic = [NSDictionary dictionaryWithObject:libraryItem.videoURL forKey:@"ITEM_URL"];
NSArray *test = [NSArray arrayWithObject:dic];
NSLog(@"Test %@",test);
[[[VLCMain sharedInstance] playlist] addPlaylistItems:test];
}
- (NSInteger)collectionView:(NSCollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
......@@ -340,7 +364,7 @@ static const float f_min_window_height = 307.;
and return updated view
*/
VLCLibraryView *item = [collectionView makeItemWithIdentifier:@"dummyViews" forIndexPath:indexPath];
VLCLibraryItem *libraryItem = [self.dummyData objectAtIndex:indexPath.item];
libraryItem = [self.dummyData objectAtIndex:indexPath.item];
[item assignValueForDataModel:libraryItem];
return item;
}
......@@ -401,7 +425,7 @@ static const float f_min_window_height = 307.;
else
[self makeCollectionViewVisible];
} else {
[_collectionView setHidden: NO];
[self.collectionView setHidden: NO];
[self.videoView setHidden: YES];
[self showControlsBar];
}
......
......@@ -596,10 +596,12 @@
BOOL b_autoplay = var_InheritBool(getIntf(), "macosx-autoplay");
[self addPlaylistItems:array withParentItemId:i_plItemId atPos:-1 startPlayback:b_autoplay];
NSLog(@"addPlaylistItems %@",array);
}
- (void)addPlaylistItems:(NSArray*)array tryAsSubtitle:(BOOL)isSubtitle
{
input_thread_t *p_input = pl_CurrentInput(getIntf());
if (isSubtitle && array.count == 1 && p_input) {
int i_result = input_AddSlave(p_input, SLAVE_TYPE_SPU,
......@@ -615,8 +617,11 @@
vlc_object_release(p_input);
[self addPlaylistItems:array];
}
- (void)addPlaylistItems:(NSArray*)array withParentItemId:(int)i_plItemId atPos:(int)i_position startPlayback:(BOOL)b_start
{
playlist_t * p_playlist = pl_Get(getIntf());
......
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