wordpress-mobile / MediaPicker-iOS

WPMediaPicker is an iOS controller that allows capture and picking of media assets.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash with iPhone 4s due to camera configuration

astralbodies opened this issue · comments

The media picker crashes consistently on an iPhone 4s due to the front-facing camera not supporting 1280x720.

Fatal Exception: NSInvalidArgumentException
*** Can't add <AVCaptureDeviceInput: 0x1adf7fe0 [Front Camera]> because the device does not support AVCaptureSessionPreset1280x720. Use -[AVCaptureDevice supportsAVCaptureSessionPreset:].

Prevent the crash by maybe inspecting the device to see capabilities or by using one of the high/medium/low presets rather than a specific resolution.

cc: @SergioEstevao

I did get @kurzee to confirm that setting the value to AVCaptureSessionPresetHigh does avoid the crash. We'd want to test on newer devices as well to make sure we don't run into memory issues with streaming 60fps if high means that for those devices.

@kurzee are you submitting a PR for this? Or should I do it?

@SergioEstevao @kurzee I've got a commit to push and I'll get a PR out soon 😄