您好我使用相机拍摄视频
url = "file:///private/var/mobile/Containers/Data/Application/F5A89447-0720-4956-BD83-EEB541EE69AC/tmp/capture-T0x146e04ad0.tmp.TnQgmW/capturedvideo.MOV"
而且我无法使用dataWithContentsOfFile
它总是给我零。
_videourl = [info objectForKey:UIImagePickerControllerMediaURL];
NSString *mediaType = [info objectForKey: UIImagePickerControllerMediaType];
[picker dismissViewControllerAnimated:YES completion:NULL];
if (CFStringCompare ((__bridge_retained CFStringRef)mediaType, kUTTypeMovie, 0) == kCFCompareEqualTo) {
NSString *str=[[NSBundle mainBundle] pathForResource:@"capturedvideo" ofType:@"MOV"];
NSData *fileData = [NSData dataWithContentsOfFile:str];
NSData *videoData = [NSData dataWithContentsOfFile:[_videourl absoluteString]];
NSData *videoData2 = [NSData dataWithContentsOfURL:_videourl];
FileData
和VideoData
都为空,videoData2
只有一个有值
我的问题是如何使用dataWithContentsOfURL
来自相机而不是来自相册的临时网址?
答案 0 :(得分:1)
将视频文件转换为NSData
NSData *videoData = [NSData dataWithContentsOfFile:videopath];
或来自网址的视频
NSData *videoData = [NSData dataWithContentsOfURL:VideoUrl];
答案 1 :(得分:-1)
你需要做的就是用这个代替你的代码,它会正常工作
'1234' > '456' => false