Skip to content

Instantly share code, notes, and snippets.

@juliofruta
Created June 12, 2017 21:35
Show Gist options
  • Save juliofruta/741e49f728c47df161ecf9c31b4c4587 to your computer and use it in GitHub Desktop.
Save juliofruta/741e49f728c47df161ecf9c31b4c4587 to your computer and use it in GitHub Desktop.
How to reproduce assets at the same time
AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:url options:nil];
NSArray *keys = [NSArray arrayWithObject:@"playable"];
//Carga los assets
[asset loadValuesAsynchronouslyForKeys:keys completionHandler:^()
{
//Al terminar reproducelos en la cola principal
dispatch_async(dispatch_get_main_queue(), ^
{
AVPlayerItem *playerItem = [[[AVPlayerItem alloc] initWithAsset:asset] autorelease];
[player insertItem:playerItem afterItem:nil];
});
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment