//获取本地视频的时间
NSFileManager *fm = [[NSFileManager alloc]init];
NSString *docs = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)lastObject];
NSString *videofolder = [docs stringByAppendingPathComponent:[NSString stringWithFormat:@"VideoFolder/%@",self.foldername]];
NSString *moviepath = [NSString stringWithFormat:@"%@/%@",videofolder,[movieArray objectAtIndex:indexPath.row]];
int minute = 0, second = 0;
if ([fm fileExistsAtPath:moviepath]) {
AVURLAsset *urlAsset = [AVURLAsset URLAssetWithURL:[NSURL fileURLWithPath:moviepath] options:nil];
second = urlAsset.duration.value / urlAsset.duration.timescale; // 获取视频总时长,单位秒
if (second >= 60) {
int index = second / 60;
minute = index;
second = second - index*60;
}
}
[fm release];