Pregunta

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];
¿Fue útil?

Solución

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]; 

}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top