0
-(void)playVideo
{
NSURL *vedioURL;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSArray *filePathsArray = [[NSFileManager defaultManager] subpathsOfDirectoryAtPath:documentsDirectory error:nil];
NSLog(@"files array %@", filePathsArray);
NSString *fullpath;
for (NSString *apath in filePathsArray)
{
fullpath = [documentsDirectory stringByAppendingPathComponent:apath];
vedioURL =[NSURL fileURLWithPath:fullpath];
}
NSLog(@"vurl %@",vedioURL);
moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:vedioURL];
[self.view addSubview:moviePlayer.view];
[moviePlayer.moviePlayer prepareToPlay];
[moviePlayer.view setFrame:self.view.bounds]; // player's frame must match parent's
//moviePlayer.moviePlayer.movieSourceType = MPMovieSourceTypeUnknown;
moviePlayer.moviePlayer.fullscreen = YES;
[moviePlayer.moviePlayer play];
[self.view bringSubviewToFront:btnSkip];
// [[NSNotificationCenter defaultCenter] addObserver:self
// selector:@selector(movieFinishedCallback:)
// name:MPMoviePlayerPlaybackDidFinishNotification
// object:moviePlayer];
}
얻기에게 다음과 같은 오류itemFailedToPlayToEnd 오류 .H 파일에 비디오
_itemFailedToPlayToEnd: { kind = 1; new = 2; old = 0; } error in iOS while playing video
동영상 파일을 가지고 있습니까? 동영상을 재생할 수 없다는 AVPlayerItemStatus가 표시되는 것 같습니다. – Sandeep
예 비디오가 있으며이 NSLog (@ "vurl % @", vedioURL)에서 로컬 경로를 얻고 있습니다. – Seema