我有一个视频保存在应用程序文件目录。我需要做的是找出视频的持续时间。即它有多少分钟和几秒钟。我无法弄清楚的是,一旦我有了电影网址,我需要做些什么来获得它的持续时间?我是否使用ALAssets?但我不知道如何。视频/电影持续时间
这是我的代码到目前为止
NSString *nameSelected = [NSString stringWithFormat:@"Movie-1.mov"];
NSLog(@"nameSelected: %@ ...", nameSelected);
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask ,YES);
NSString* documentsPath = [paths objectAtIndex:0];
NSString* movieFile1 = [documentsPath stringByAppendingPathComponent:nameSelected];
NSURL *firstMovieURL1 = [NSURL fileURLWithPath:movieFile1];
//No sure how I can call this
//NSString *durationStr = [alAsset valueForProperty:ALAssetPropertyDuration];
找到我的答案http://stackoverflow.com/questions/8699105/iphone-how-to-get-duration-of-video-selected-from-图书馆/ 8699866#8699866 – Maulik