Copy link to clipboard
Copied
Problem Description:
video.attachCamera(null) on frame received event call stack cause hang (crash).
It has been tested with AIR 26, AIR 28.0.0.125, AIR 29.0.0.122, AIR 31.0.0.103, AIR 32.0.0.89, AIR 32.0.0.109 beta with shared and captive runtime, 32-bit and 64-bit runtime, also tested with Flash Player 26 and many others versions.
Tested with multiple devices across many OSes: Windows 8.1, Windows 10, macOS 10.14.3, Android 9, iOS 12.2 etc.
Same problem with all cases.
Related issue (not the same): https://tracker.adobe.com/#/view/FP-4198120
Tracker link: Tracker
Steps to Reproduce:
Launch AIR application with device that has camera. After launch start camera and call video.attachCamera(null) with first frame received event (number of frame doesn't matter).
ActionScript 3.0 code:
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.media.Camera;
import flash.media.Video;
import flash.permissions.PermissionStatus;
import flash.events.PermissionEvent;
public class CameraVideoAttachCameraNullCrash extends Sprite {
private var _video:Video;
public function CameraVideoAttachCameraNullCrash() {
addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event):void {
removeEventListener(Event.ADDED_TO_STAGE, init);
if (Camera.permissionStatus == PermissionStatus.GRANTED){
startCamera();
} else {
var camera:Camera = Camera.getCamera();
camera.addEventListener(PermissionEvent.PERMISSION_STATUS, permissionStatus);
camera.requestPermission()
}
}
private function permissionStatus(e:PermissionEvent):void {
if (e.status == PermissionStatus.GRANTED){
startCamera();
}
}
private function startCamera():void {
var camera:Camera = Camera.getCamera();
camera.addEventListener(Event.VIDEO_FRAME, camera_videoFrame);
camera.setMode(640, 480, 30);
_video = new Video(640, 480);
_video.attachCamera(camera);
}
private function camera_videoFrame(e:Event):void {
_video.attachCamera(null);//This line cause crash
}
}
}
Actual Result:
Application hang (crashes) just after start when first frame from camera will be received:
Expected Result:
Application not crash and disable camera.
Any Workarounds: none (do not use video.attachCamera(null) on frame received event call stack)
I'd like to ask everyone affected by this issue to take a minute and vote for the following bug.
Thanks.
Copy link to clipboard
Copied
Issue fixed with AIR 33.0.1.220 for Android but still exists for other platforms.
Copy link to clipboard
Copied
Fixed with latest AIR 33.1.1.50 for all platforms.