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

[Windows] StageWebView autoplay with audio doesn't work #2852

Open
itlancer opened this issue Sep 26, 2023 · 1 comment
Open

[Windows] StageWebView autoplay with audio doesn't work #2852

itlancer opened this issue Sep 26, 2023 · 1 comment
Labels

Comments

@itlancer
Copy link

Problem Description

StageWebView autoplay with audio content doesn't work for Windows devices. In all cases mediaPlaybackRequiresUserAction is false as a second StageWebView constructor parameter.
It happens if web page trying to use video with sound or just audio playback.

Tested with latest AIR 50.2.3.5 with different AIR applications and different Windows 10/11 devices with different Edge WebView2 versions and different web pages.
Same problem in all cases.
There is no such issue with Android.

May be StageWebView should be able to request/grant some permissions https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/winrt/microsoft_web_webview2_core/corewebview2permissionkind
Manual registry changes didn't help https://admx.help/?Category=EdgeChromium&Policy=Microsoft.Policies.Edge::AutoplayAllowed

Related issues:
#2832
#1494

Steps to Reproduce

Launch application with code below with any Windows device with Edge WebView2 installed. It just try to start YouTube embedded video using StageWebView with autoplay.

Application example with sources attached.
windows_stagewebview_mediaplaybackrequiresuseraction_bug.zip

package {
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.media.StageWebView;
	import flash.geom.Rectangle;
	
	public class WindowsStageWebViewMediaPlaybackRequiresUserActionBug extends Sprite {
		
		public function WindowsStageWebViewMediaPlaybackRequiresUserActionBug() {
			addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event):void {
			removeEventListener(Event.ADDED_TO_STAGE, init);
			
			var stageWebView:StageWebView = new StageWebView(true, false);
			stageWebView.stage = stage;
            stageWebView.viewPort = new Rectangle(0, 0, 640, 480);
			stageWebView.loadURL("https://www.youtube.com/embed/K_sgIDVPfiY?autoplay=1");
		}
		
	}
}

Actual Result:
Video with sound not started automatically. You need to click manually to launch it.

Expected Result:
Video with sound started automatically. You don't need to make any actions.

Known Workarounds

none
May be don't use audio (if it suitable for you). In example above you can use such link: https://www.youtube.com/embed/K_sgIDVPfiY?autoplay=1&mute=1
May be write native extension with own webview implementation.

@itlancer itlancer added the Bug label Sep 26, 2023
@itlancer
Copy link
Author

Issue still exists with latest AIR 51.0.1.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant