ios - getting camera horizontal view angle in Swift -
i want hva , vva (horizontal view angle , vertical view angle) of camera of ios device. (using swift) how do this?
in android can use following functions this:
public double gethva() { return camera.getparameters().gethorizontalviewangle(); } public double getvva() { return camera.getparameters().getverticalviewangle(); }
is there similar swift?
it amazes me there's no solution this. have been able hva programmatically, seems there no way vva (if knows otherwise, please correct me).
here how did it:
let devices = avcapturedevice.devices() var capturedevice : avcapturedevice? device in devices { if (device.hasmediatype(avmediatypevideo)) { if(device.position == avcapturedeviceposition.back) { capturedevice = device as? avcapturedevice } } } if let retrieveddevice = capturedevice { println("hfov \(retrieveddevice.activeformat.videofieldofview)") }
for more reading avcapturedevices, , view code source, click here
Comments
Post a Comment