문제

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];
도움이 되었습니까?

해결책

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

}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top