Get an Video from Library (PHAsset)

How to get an video file knowing its name from the library to play, without using a selector.


Thanks

Accepted Reply

This thread has been deleted

Sorry, IOS (objective C)


I have the name of archive, nameOfArchive.mov and I want to play.


This is the code:


[PHPhotoLibrary requestAuthorization:^( PHAuthorizationStatus status ) {

if ( status == PHAuthorizationStatusAuthorized ) {

// The URL is not the same in diferent devices, how do I get it?

_nameVideo = @"file:///var/mobile/Media/DCIM/.../F2743B76-748C-4290-A982-8EFB64B02148.mov";// ... Change

NSURL *theurl=[NSURL fileURLWithPath:_nameVideo];


AVPlayer *player = [AVPlayer playerWithURL:theurl];

AVPlayerViewController *playerViewController = [AVPlayerViewController new];

playerViewController.player = player;

[playerViewController.player play];

[self presentViewController:playerViewController animated:YES completion:nil];

}

else {

NSLog(@"THERE IS NO AUTHORIZATION TO READ IN THE LIBRARY");

}

}];


Thanks

Replies

What platform, OS?


Using url path? If so, show that code, thanks.