Adobe-Runtime-Support
Adobe-Runtime-Support copied to clipboard
[iOS] Cannot use Camera with resolution more than 1280*720
Problem Description
AIR application cannot use Camera with resolution more than 1280*720 for iOS devices. Not for front not for back (main) cameras.
This issue prevent to getting high quality images from camera with iOS.
It has been tested with multiple AIR versions, even with latests AIR 33.1.1.743, 33.1.1.758 and AIR 33.1.1.795 with multiple different iOS devices (iPads and iPhones) with different OS versions. Same problem in all cases. There is no such problem with Windows, Android and macOS.
Steps to Reproduce
Launch code below with any iOS device which camera support at least FullHD resolution. Grant camera permission usage after sample launched.
Application example with sources attached. camera_fullhd_bug.zip
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.media.Camera;
import flash.media.Video;
import flash.events.PermissionEvent;
import flash.permissions.PermissionManager;
import flash.permissions.PermissionStatus;
public class CameraFullHDBug extends Sprite {
private var video:Video;
public function CameraFullHDBug() {
addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event):void {
removeEventListener(Event.ADDED_TO_STAGE, init);
var cameraPermissionManager:PermissionManager = Camera.permissionManager;
if (cameraPermissionManager.permissionStatus != PermissionStatus.GRANTED){
Camera.permissionManager.addEventListener(PermissionEvent.PERMISSION_STATUS, permissionChanged);
Camera.permissionManager.requestPermission();
} else {
startCamera();
}
}
private function permissionChanged(e:PermissionEvent):void {
trace("permissionChanged", Camera.permissionManager.permissionStatus);
startCamera();
}
private function startCamera():void {
var cameras:Array = Camera.names;
trace(cameras);
var camera:Camera = Camera.getCamera();
camera.setMode(1920, 1080, 60, true);
trace("Camera settings:", camera.width + "x" + camera.height, camera.fps);
video = new Video();
video.attachCamera(camera);
addChild(video);
}
}
}
Actual Result:
HD resolution will be used for camera output.
Camera select 1280*720 resolution. In traces you can see:
Camera settings: 1280x720 60
Expected Result:
FullHD resolution will be used for camera output.
Camera select 1920*1080 resolution. In traces you will see:
Camera settings: 1920x1080 60
Known Workarounds
none May be write own native extension to use camera.
same issue, I created an ANE to get available camera resolutions on Android, iOS, Windows, macOS and Linux.
on iOS, my ANE return a max resolution 4032x3024 but
camera.setMode(4032, 3024, camera.fps);
trace( camera.width, camera.height);
return 960x720
on Android, my ANE return a max resolution 4032x3024 but
camera.setMode(4032, 3024, camera.fps);
trace( camera.width, camera.height);
return 1920x1440
Do you think this could also be a reason why scanning barcodes has been impossible on the Pro model iPhones?
Fixed with latest AIR 50.2.2.3. Now we can use 3840*2160 camera resolution for iOS. Thanks!