本次测试上传视频的时候,发下从相册调用视频路径:assets-library://asset/asset.m4v?id=D7C196AE-7754-4153-A75A-41523A623F33&ext=m4v是这种格式的,于是乎各种查询资料,
现解决办法: 首先定义路径 沙盒路径:Libary下的目录[[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:@"polidSaid"]
ALAssetRepresentation *rep = [asset defaultRepresentation];
Byte *buffer = (Byte*)malloc((unsigned long)rep.size);
//流大小
NSUInteger buffered = [rep getBytes:buffer fromOffset:0.0 length:(unsigned long)rep.size error:nil];
//清空视频缓存
NSFileManager* fileManager=[NSFileManager defaultManager];
NSString *createPath = KVideoUrlPath;
//判断文件是否存在
BOOL blHave=[[NSFileManager defaultManager] fileExistsAtPath:createPath];
if (blHave) {
BOOL blDele= [fileManager removeItemAtPath:createPath error:nil];
if (!blDele) {
[fileManager removeItemAtPath:createPath error:nil];
}
[fileManager removeItemAtPath:createPath error:nil];
}
NSString *namLong= [NSString stringWithFormat:@"%ld.mp4",(unsigned long)buffered];
[self videoWithUrl:urlFile withFileName:namLong];
self.VideoPathUrl = [NSString stringWithFormat:@"%@/%@",KVideoUrlPath,namLong];
thepath:打印输出的就是:/var/mobile/Containers/Data/Application/xxxxx/路径格式/xxx.mp4。
有更好解决assets-library://asset/asset.m4v?id=D7C196AE-7754-4153-A75A-41523A623F33&ext=m4v
这种路径问题办法的可以相互交流