简体   繁体   English

以4:3而不是16:9(Xcode)(Swift)调用UIImagePickerController

[英]Calling UIImagePickerController in 4:3 instead of 16:9 (Xcode) (Swift)

I am recording a video through UIImagePickerController and on an iPhone 6s / 6s Plus, it is displayed in 16:9 (simulated by cropping, I imagine) when recording but when the video returns and is laid out, it is 4:3 with the left and right beyond-the-viewfinder parts of the video showing. 我正在通过UIImagePickerController和iPhone 6s / 6s Plus录制视频,它在录制时以16:9(通过裁剪模拟,我想象)显示但是当视频返回并布局时,它是4:3左视图和右视图以外的视频显示部分。

How do I have UIImagePickerController in camera mode display in its true 4:3 mode and not in the default faux-16:9? 如何让UIImagePickerController在相机模式下以真正的4:3模式显示而不是默认的faux-16:9?

I am currently calling it as so: 我现在称之为:

// IB: Record Button Control
@IBAction func recordVideo(_ sender: UIButton) {

    if (UIImagePickerController.isSourceTypeAvailable(.camera)) {

        self.selectedButton = sender

        self.imagePicker.sourceType = .camera
        self.imagePicker.mediaTypes = [kUTTypeMovie as String]
        self.imagePicker.allowsEditing = false
        self.imagePicker.videoMaximumDuration = 30.0
        self.imagePicker.delegate = self

        self.present(self.imagePicker, animated: true, completion: {})

    } else {
        CreateAlert(controller: self, title: "No Camera", message: "Camera is not accessible")
    }

}

Figured this one out. 想出这个。 For any of you looking for an answer, ends up that it does this by default if you do not specify a videoQuality . 对于任何寻找答案的人,如果您未指定videoQuality ,则默认情况下会执行此videoQuality

As soon as you enter in an videoQuality enum, it returns it the proper way. 一旦您输入videoQuality枚举,它就会以正确的方式返回它。 So I added: self.imagePicker.videoQuality = .typeMedium , it returned the video 16:9. 所以我添加了: self.imagePicker.videoQuality = .typeMedium ,它返回了视频16:9。

For Apple documentation on the different video quality types: 有关不同视频质量类型的Apple文档

UIImagePickerControllerQualityType UIImagePickerControllerQualityType

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM