保存我在应用程序中录制的视频
在我的学习之旅中,我成功地理解了如何制作相机应用程序:-)
我唯一遇到的问题是保存我录制的视频。我可以保存照片,但同样不适用于视频。
所以我想在 iBrad Apps 的帮助下我已经差不多了。
得到这个代码:
-(void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
[self dismissModalViewControllerAnimated:YES];
if ([mediaType isEqualToString:(NSString *)kUTTypeImage]) {
UIImage *image = [info
objectForKey:UIImagePickerControllerOriginalImage];
imageView.image = image;
if (newMedia)
UIImageWriteToSavedPhotosAlbum(image,
self,
@selector(image:finishedSavingWithError:contextInfo:),
nil);
}
else{
if ([mediaType isEqualToString:(NSString *)kUTTypeMovie]) {
UIImage *movie = [info
objectForKey:UIImagePickerControllerQualityTypeHigh];
videoRecorder2.image = movie;
if (newMedia)
UISaveVideoAtPathToSavedPhotosAlbum(movie,
self,
@selector(movie:finishedSavingWithError:contextInfo:),
nil);
}}}
我有一个 if 语句,因为该应用程序可以拍摄视频和静态图像。
第一部分是静止的 - 有效,然后第二部分我仍然在跳舞:-)
I am succeeding in understanding how to make a camera app in my learning journey:-)
The only thing I am stuck with is saving a video that I have recorded. I am able to save a photo, but the same does not work for videos.
So I think I have almost got it with the help of iBrad Apps.
got this code:
-(void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
[self dismissModalViewControllerAnimated:YES];
if ([mediaType isEqualToString:(NSString *)kUTTypeImage]) {
UIImage *image = [info
objectForKey:UIImagePickerControllerOriginalImage];
imageView.image = image;
if (newMedia)
UIImageWriteToSavedPhotosAlbum(image,
self,
@selector(image:finishedSavingWithError:contextInfo:),
nil);
}
else{
if ([mediaType isEqualToString:(NSString *)kUTTypeMovie]) {
UIImage *movie = [info
objectForKey:UIImagePickerControllerQualityTypeHigh];
videoRecorder2.image = movie;
if (newMedia)
UISaveVideoAtPathToSavedPhotosAlbum(movie,
self,
@selector(movie:finishedSavingWithError:contextInfo:),
nil);
}}}
I have an if statement because the app can take both video and still images.
The first part is for still - which works and then the second part I am still tutu-ing with:-)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个:
编辑:尝试这个并将您的代码修改为此方法:
Try this:
Edit: Try this and modify your code to this method: