Adobe-Runtime-Support icon indicating copy to clipboard operation
Adobe-Runtime-Support copied to clipboard

[macOS] Camera.names returns empty array after one from two cameras unplugged for some cameras

Open itlancer opened this issue 2 years ago • 0 comments

Problem Description

Camera.names returns empty array after one from two cameras unplugged for some cameras with macOS. scanHardware() didn't help. So there is no way to use remain camera in such cases. It returns correct data only after application restart.

Tested with multiple AIR versions, even with latest AIR 33.1.1.889 with multiple different macOS devices with different OS versions with different architechtures (Intel-based and M1-based) and different cameras. Problem with some cameras with some macOS devices. Issue always reproducible with C-EP28WD400 camera. Issue sometimes reproducible with Apple M1-based devices with Logitech C270 camera. No issues with Genius 1000X camera. May be problem only with cameras without embedded microphone. There is no such issue with Windows devices.

Steps to Reproduce

  1. Launch code below with any macOS device with two connected cameras (for example, one embedded and another one USB). Better to use USB camera without embedded microphone to reproduce this issue.
  2. Click anywhere on stage, in Scout you will see trace with two cameras: cameras EP28WD,HD-camera FaceTime
  3. Unplug USB camera.
  4. Click anywhere on stage one more time.

Application example with sources attached. macos_camera_names_unplug_bug.zip

package {
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.media.Camera;
	import flash.events.MouseEvent;
	import flash.media.scanHardware;
	
	public class MacOSCameraNamesUnplugBug extends Sprite {
		
		public function MacOSCameraNamesUnplugBug() {
			addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event):void {
			removeEventListener(Event.ADDED_TO_STAGE, init);
			
			stage.addEventListener(MouseEvent.CLICK, click);
		}
	
		private function click(e:MouseEvent):void {
			scanHardware();
			
			trace("cameras", Camera.names);
		}
	}
}

Actual Result: In Scout you will see trace without cameras at all: cameras

Expected Result: In Scout you will see trace with one remain camera: cameras HD-camera FaceTime

Known Workarounds

none May be write own native extension for camera usage.

itlancer avatar Jun 27 '22 16:06 itlancer