私のアプリケーションでは、私のビデオをドキュメント ディレクトリに保存し、名前を付け'video2.MOV'
て再生したいと考えています。
ここでの問題は、ドキュメント ディレクトリからこのビデオ(名前は'video2.MOV'
)を取得できないことです。
私のコード:
-(void)playVideo:(NSTimer *)theTimer
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"video2.MOV"];
NSLog(@"filePath - %@",filePath);
NSString *content = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:NULL];
NSLog(@"contentPath - %@",content);
MPMoviePlayerViewController *videoPlayerView = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:content]];
[[CCDirector sharedDirector] presentMoviePlayerViewControllerAnimated:videoPlayerView];
[videoPlayerView.moviePlayer play];
}
contentPath
コンソールでは、取得するたびにNULL
が表示されるため、ビデオを再生できない可能性があります。
ここで、私の間違いは何ですか。この問題に関する提案をお願いします。