我正在写一个iPad亭型应用程序,它允许访问者使用前置摄像头录制视频,并查看摄像机卷中以外部监视器为目标的现有视频。我只是学习XCode,并且在针对iOS 5的Xcode 4.4.1中工作。最近似乎有很多变化,这使得学习变得更加困难,所以我试图让事情尽可能简单,这就是为什么我使用UIImagePicker。UIImagePickerController和外部显示器
一切工作正常,只有一个例外 - 我无法在外部显示器和iPad之间切换。当用户录制视频时,它在iPad上全屏显示。这很好,但是在他们停止录制后,视频立即被发送到外部显示器进行批准,并且占位符图像留在UIPopover中。我更愿意看到/做的是将视频预览全屏保存在iPad上,或将视频定位到UIPopover。
原因是外部显示屏不容易从用户访问iPad的位置查看。因此,他们被要求批准(点击使用)他们不能真正看到的东西。将它保存在iPad上会好得多。下面的代码是我用来允许录制的。
其他一切都很好,我希望用户从库中选择视频并显示在外部监视器上,因为这是默认行为,所以它工作正常。
最接近的答案我能找到到目前为止是这样的:UIImagePickerController in an existing UIPopoverController
有没有一种简单的方法来禁用外接显示器或保持被发送的视频预览?
- (IBAction)useCameraRoll:(id)sender
{
if([self.popoverController isPopoverVisible]) {
[self.popoverController dismissPopoverAnimated:YES];
} else {
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeSavedPhotosAlbum])
{
UIImagePickerController *imagePicker =
[[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
imagePicker.mediaTypes = [NSArray arrayWithObjects:(NSString *) kUTTypeMovie, nil];
imagePicker.allowsEditing = NO;
self.popoverController = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
//self.popoverController = [[UIPopoverController alloc] setContentViewController:animated];
self.popoverController.delegate = self;
[self.popoverController
presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
newMedia = NO;
}
}
}
你有没有找到解决这个问题的方法?我想下面的答案只是详细说明如何设置外部设备。我也有一个绘制到外部显示器的应用程序,但是当用户使用UIImagePickerController时,它会直接在外部设备应该绘制的任何位置绘制预览。 –