每次我尝试从我的视频资源生成静止帧时,它都会在0.000秒时生成.我可以从我的日志消息中看到这一点.好消息是我可以在0.000 ..时获得图像,以显示在名为"myImageView"的UIImageView中.我认为问题是没有设置AVURLAssetPreferPreciseDurationAndTimingKey,但即使我想出如何做到这一点,它仍然无法正常工作..
这就是我的......
time,actualTime和generate在Header中声明
NSString *path = [NSHomeDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"Documents/videoTest4.m4v"]];
//UISaveVideoAtPathToSavedPhotosAlbum(path, self, @selector(video:didFinishSavingWithError:contextInfo:), nil);
NSURL *url = [NSURL fileURLWithPath:path];
NSDictionary *options = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:AVURLAssetPreferPreciseDurationAndTimingKey];
AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:url options:options];
Float64 durationSeconds = CMTimeGetSeconds([asset duration]);
generate = [[AVAssetImageGenerator alloc] initWithAsset:asset];
NSError *err = nil;
time = CMTimeMake(600,600.0);
CGImageRef imgRef = [generate copyCGImageAtTime:time actualTime:&actualTime error:&err];
UIImage *currentImg = [[UIImage alloc] initWithCGImage:imgRef];
myImageView.image = currentImg;
NSLog(@"The total Video Duration is %f",durationSeconds);
NSLog(@"The time I want my image is %f",CMTimeGetSeconds(time)); …Run Code Online (Sandbox Code Playgroud) 我正在尝试构建一个视频协作平台.我希望以这样的方式设计它,即有一个API,我的网络应用程序就像一个"第三方"应用程序.
我认为它的工作方式有三个主要组成部分..
我希望能够对"项目"等资源进行经过身份验证的请求
截至目前,我想前端应用程序与Rails应用程序通信以获得经过身份验证的请求,然后前端应用程序使用该经过身份验证的请求来调用API.
我对这个架构有几个问题.
我只是问这些问题,因为OAuth看起来是标准的,我只能通过验证第三方应用来访问另一个应用中的资源.
我想我主要是寻找一些指导,因为我可以构建应用程序,我只是没有安全专家.谢谢大家的帮助.