NSURL *url = [[NSURL alloc] initWithString:@"http://link.songs.pk/song1.php?songid=8217"];
AVURLAsset *anAssest= [[AVURLAsset alloc]initWithURL:url options:nil];
NSString *tracksKey = @"tracks";
[anAssest loadValuesAsynchronouslyForKeys:[NSArray arrayWithObject:tracksKey] completionHandler:^{
NSError *error = nil;
AVKeyValueStatus status = [anAssest statusOfValueForKey:tracksKey error:&error];
if (status == AVKeyValueStatusLoaded) {
self.playerItem = [AVPlayerItem playerItemWithAsset:anAssest];
self.player = [AVPlayer playerWithPlayerItem:playerItem];
[player play];
}
else
{
NSLog(@"The asset's tracks were not loaded:\n%@", [error localizedDescription]);
}
}];
AVURLAsset *anAssest= [[AVURLAsset alloc]initWithURL:url options:nil];
NSString *tracksKey = @"tracks";
[anAssest loadValuesAsynchronouslyForKeys:[NSArray arrayWithObject:tracksKey] completionHandler:^{
NSError *error = nil;
AVKeyValueStatus status = [anAssest statusOfValueForKey:tracksKey error:&error];
if (status == AVKeyValueStatusLoaded) {
self.playerItem = [AVPlayerItem playerItemWithAsset:anAssest];
self.player = [AVPlayer playerWithPlayerItem:playerItem];
[player play];
}
else
{
NSLog(@"The asset's tracks were not loaded:\n%@", [error localizedDescription]);
}
}];
No comments:
Post a Comment