簡體   English   中英

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

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

我正在通過UIImagePickerController和iPhone 6s / 6s Plus錄制視頻,它在錄制時以16:9(通過裁剪模擬,我想象)顯示但是當視頻返回並布局時,它是4:3左視圖和右視圖以外的視頻顯示部分。

如何讓UIImagePickerController在相機模式下以真正的4:3模式顯示而不是默認的faux-16:9?

我現在稱之為:

// 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")
    }

}

想出這個。 對於任何尋找答案的人,如果您未指定videoQuality ,則默認情況下會執行此videoQuality

一旦您輸入videoQuality枚舉,它就會以正確的方式返回它。 所以我添加了: self.imagePicker.videoQuality = .typeMedium ,它返回了視頻16:9。

有關不同視頻質量類型的Apple文檔

UIImagePickerControllerQualityType

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM