iPhone 3gs でビデオを録画する場合、ビデオは一時ディレクトリに保存されることはわかっています。パスを取得して、mpmovieplayer を使用してビデオを再生するにはどうすればよいですか?
2430 次
2 に答える
1
- (void)video:(NSString *)videoPath didFinishSavingWithError:(NSError *)error contextInfo:(NSString *)contextInfo{
NSString *originalPathOfVideo=videoPath;//this will give the path of ur storing video,use this as a url and assign this url to ur mpmovieplayer
}
于 2011-11-03T08:57:34.240 に答える
1
- (void)video:(NSString *)videoPath didFinishSavingWithError:(NSError *)error contextInfo:(NSString *)contextInfo{
NSLog(@"didFinishSavingWithError--videoPath in temp directory:%@",contextInfo);
NSString *file,*latestFile;
NSDate *latestDate = [NSDate distantPast];
NSDirectoryEnumerator *dirEnum = [[NSFileManager defaultManager] enumeratorAtPath:[[contextInfo stringByDeletingLastPathComponent]stringByDeletingLastPathComponent]];
// Enumerate all files in the ~/tmp directory
while (file = [dirEnum nextObject]) {
// Only check files with MOV extension.
if ([[file pathExtension] isEqualToString: @"MOV"]) {
NSLog(@"latestDate:%@",latestDate);
NSLog(@"file name:%@",file);
NSLog(@"NSFileSize:%@", [[dirEnum fileAttributes] valueForKey:@"NSFileSize"]);
NSLog(@"NSFileModificationDate:%@", [[dirEnum fileAttributes] valueForKey:@"NSFileModificationDate"]);
// Check if current jpg file is the latest one.
if ([(NSDate *)[[dirEnum fileAttributes] valueForKey:@"NSFileModificationDate"] compare:latestDate] == NSOrderedDescending){
latestDate = [[dirEnum fileAttributes] valueForKey:@"NSFileModificationDate"];
latestFile = file;
NSLog(@"***latestFile changed:%@",latestFile);
}
}
}
// The Video path.
latestFile = [NSTemporaryDirectory() stringByAppendingPathComponent:latestFile];
NSLog(@"This Is The Recent Video:%@",latestFile);
}
次に、コンソールを開いて結果を表示します:-)これが役に立てば幸いです
于 2009-10-30T01:58:57.143 に答える