//获取视频 大小
- (NSInteger) getFileSize:(NSString*) path
{
DLog(@"path == %@",path);
NSFileManager * filemanager = [[NSFileManager alloc]init];
if([filemanager fileExistsAtPath:path]){
NSDictionary * attributes = [filemanager attributesOfItemAtPath:path error:nil];
NSNumber *theFileSize;
if ( (theFileSize = [attributes objectForKey:NSFileSize]) )
return [theFileSize intValue]/1024;
else
return -1;
}
else
{
return -1;
}
}
注:入参path 要截取var之后的字符串
如:urlStr为: file:///private/var/mobile/Containers/Data/Application/986B18FA-4688-4B9C-B78D-8FE4C69BF569/tmp/58441287194__67BF3B1A-0659-437B-83E6-DE5E7177D2E0.MOV
传入的path应为:[urlStr substringFromIndex:16]