Question

How to play the video file from assets library? I have the URL of file like

"assets-library://asset/asset.MOV?id=1000000023&ext=MOV"

But I am unable to play this file in media player using the following code:

NSString *urlAddress = @"assets-library://asset/asset.mov?id=1000000023&ext=mov"; 
NSURL *theURL = [NSURL URLWithString:urlAddress]; 
MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:theURL];
Was it helpful?

Solution

I was also getting problem, and got the solution. I used the following code and it worked for me. The urlAddress is the url for the video by ALAssetsLibrary.

-(void)playVideo:(NSString *)urlAddress{

NSString *newUrl = [[NSString alloc] initWithFormat:@"%@",urlAddress];

NSURL *theURL = [NSURL URLWithString:newUrl];

//player = [[MPMoviePlayerController alloc] init];

[player setContentURL:theURL];
[player prepareToPlay];
[player play]; 

}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top