Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

video.attachCamera(null) on frame received event cause hang (crash) #54

Open
itlancer opened this issue May 21, 2019 · 3 comments

Comments

@itlancer
Copy link

commented May 21, 2019

Problem Description

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: https://tracker.adobe.com/#/view/AIR-4198846

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).

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.

Known Workarounds

none (do not use video.attachCamera(null) on frame received event call stack)

@itlancer

This comment has been minimized.

Copy link
Author

commented Aug 6, 2019

Issue still exists with AIR 32.0.0.144 beta and AIR 33.0.0.212.

@ajwfrost

This comment has been minimized.

Copy link
Collaborator

commented Aug 7, 2019

Reproduced here: looks like there's something hanging when AIR is closing down the camera activity. We'll investigate further...
thanks

@itlancer

This comment has been minimized.

Copy link
Author

commented Aug 11, 2019

Issue fixed with AIR 33.0.1.220 for Android but still exists for other platforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.