1

我正在使用 Swifts 4 SDK 在我的应用程序中拍摄实时照片。

是否可以拍摄不同纵横比的实时照片图像?我想支持 4:3、16:9 和 1:1。我将添加一些关于如何拍摄照片的代码,我不知道如何更改宽高比,而且我知道这可能不是一项简单的任务,因为 LivePhoto 既有视频部分,也有照片部分。

//define the AVCapturePhotoOutput object somewhere in the code
let photoOutput = AVCapturePhotoOutput()
//capture a photo with the settings defined for livePhoto using the helper function that returns the AVCapturePhotoSettings
photoOutput.capturePhoto(with: getCaptureSettings(), delegate: photoCaptureDelegate!)

func getCaptureSettings() -> AVCapturePhotoSettings {
    var settings = AVCapturePhotoSettings()
    settings = AVCapturePhotoSettings()    
    let writeURL = NSURL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("LivePhotoVideo\(settings.uniqueID).mov")
    settings.livePhotoMovieFileURL = writeURL
}

那么有可能做到吗?如果是这样,如何?

4

0 回答 0