以编程方式启动相机进行视频录制
我有一个快速的问题。我使用以下代码在 iOS 4.x 设备上启动相机并录制视频,效果很好。我想在 iPad 2 设备上使用相同的代码,因为 iPad 2 具有视频录制功能。它会起作用吗?有人可以指导我吗?
if ([types containsObject:(id)kUTTypeMovie])
{
UIImagePickerController *pickerController = [[[UIImagePickerController alloc] init] autorelease];
pickerController.delegate = self;
pickerController.videoQuality = appDelegate.settingsCtrler.quality;
pickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
pickerController.showsCameraControls = YES;
pickerController.mediaTypes = [NSArray arrayWithObject:(id)kUTTypeMovie];
pickerController.videoMaximumDuration = maxDuration;
[appDelegate hideFloatingBar];
[self presentModalViewController:pickerController animated:YES];
}
先感谢您!
I have quick question. I am using the following code to launch camera and record video on iOS 4.x devices, it works great. I want to use the same code on iPad 2 device as iPad 2 has video recording facility. Will it work? Can someone please guide me?
if ([types containsObject:(id)kUTTypeMovie])
{
UIImagePickerController *pickerController = [[[UIImagePickerController alloc] init] autorelease];
pickerController.delegate = self;
pickerController.videoQuality = appDelegate.settingsCtrler.quality;
pickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
pickerController.showsCameraControls = YES;
pickerController.mediaTypes = [NSArray arrayWithObject:(id)kUTTypeMovie];
pickerController.videoMaximumDuration = maxDuration;
[appDelegate hideFloatingBar];
[self presentModalViewController:pickerController animated:YES];
}
Thank you in Advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果它基于 iOS 4.3 构建,你应该没问题 - 尽管我没有 iPad2 来测试它。不过,我会将逻辑包装在测试中:
这样当相机不可用时,它就不会尝试显示相机。
If it builds on iOS 4.3 you should be OK - although I don't have an iPad2 to test it on. I would wrap the logic in a test though:
so that it doesn't try and present a camera when one isn't available.