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

[macOS] `StageWebView` cannot get camera access

Open itlancer opened this issue 7 months ago • 0 comments

Problem Description

StageWebView cannot get camera access with macOS. So you cannot use webframes with some camera integrations for macOS.

Tested with multiple AIR versions, even with latest AIR 51.1.3.10 with multiple OS versions, devices and architectures with different applications and different web sites. Tested even with signed/notarized applications with proper Entitlements/InfoAdditions. The same issue with in all cases. It works fine with Windows/Android/iOS. Didn't tested with microphone/geolocation.

Related issues: https://github.com/airsdk/Adobe-Runtime-Support/issues/208 https://github.com/airsdk/Adobe-Runtime-Support/issues/995 https://github.com/airsdk/Adobe-Runtime-Support/issues/2852 https://github.com/airsdk/Adobe-Runtime-Support/issues/2832

Steps to Reproduce

Launch StageWebView with any website which trying to use camera:

  1. Launch code below with any macOS device.
  2. Grant permission to camera if it will be requested.

Application example with sources attached. macos_stagewebview_camera_bug.zip

package {
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.PermissionEvent;
	import flash.permissions.PermissionManager;
	import flash.permissions.PermissionStatus;
	import flash.media.StageWebView;
	import flash.geom.Rectangle;
	import flash.media.Camera;
	
	public class MacOSStageWebViewCameraBug extends Sprite {
		
		public function MacOSStageWebViewCameraBug() {
			addEventListener(Event.ADDED_TO_STAGE, addedToStage);
		}
		
		private function addedToStage(e:Event):void {
			removeEventListener(Event.ADDED_TO_STAGE, addedToStage);
			
			var cameraPermissionManager:PermissionManager = Camera.permissionManager;
			if (cameraPermissionManager.permissionStatus != PermissionStatus.GRANTED){
				Camera.permissionManager.addEventListener(PermissionEvent.PERMISSION_STATUS, permissionChanged);
				Camera.permissionManager.requestPermission();
			} else {
				startApp();
			}
		}
	
		private function permissionChanged(e:PermissionEvent):void {
			trace("permissionChanged", Camera.permissionManager.permissionStatus);
			startApp();
		}
	
		private function startApp():void {
			var stageWebView:StageWebView = new StageWebView({mediaPlaybackRequiresUserAction:false});
			stageWebView.stage = stage;
			stageWebView.viewPort = new Rectangle(0, 0, 640, 480);
			stageWebView.loadURL("https://webcamtests.com/");
		}
		
	}
}

Actual Result: Website cannot get camera access. You can see error like: "Your browser does not support features for accessing media devices. Please upgrade your browser or install another one."

Expected Result: Camera permission will be granted to website automatically by it request (cause AIR application have camera permission) and camera will be displayed at website.

Known Workarounds

none *write your own native extension with webview implementation.

itlancer avatar Apr 15 '25 19:04 itlancer