Skip to content

Commit

Permalink
Revert "Merge pull request #122 from kjpolaszek/master"
Browse files Browse the repository at this point in the history
This reverts commit 662e7d4, reversing
changes made to 4945c26.
  • Loading branch information
saiday committed Dec 4, 2016
1 parent 915ee25 commit 5a9bc4b
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions HysteriaPlayer/HysteriaPlayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -305,28 +305,19 @@ - (void)getSourceURLAtIndex:(NSInteger)index preBuffer:(BOOL)preBuffer

- (void)setupPlayerItemWithUrl:(NSURL *)url index:(NSInteger)index
{
AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:url options:nil];
NSArray *keys = @[@"playable"];

AVPlayerItem *item = [AVPlayerItem playerItemWithAsset:asset];
AVPlayerItem *item = [AVPlayerItem playerItemWithURL:url];
if (!item)
return;

[asset loadValuesAsynchronouslyForKeys:keys completionHandler:^() {

dispatch_async(dispatch_get_main_queue(), ^{

[self setHysteriaIndex:item key:[NSNumber numberWithInteger:index]];

if (self.isMemoryCached) {
NSMutableArray *playerItems = [NSMutableArray arrayWithArray:self.playerItems];
[playerItems addObject:item];
self.playerItems = playerItems;
}

if ([self getLastItemIndex] == index) {
[self insertPlayerItem:item];
}
});
}];
dispatch_async(dispatch_get_main_queue(), ^{
[self setHysteriaIndex:item key:[NSNumber numberWithInteger:index]];
if (self.isMemoryCached) {
NSMutableArray *playerItems = [NSMutableArray arrayWithArray:self.playerItems];
[playerItems addObject:item];
self.playerItems = playerItems;
}
[self insertPlayerItem:item];
});
}


Expand Down

0 comments on commit 5a9bc4b

Please sign in to comment.