Autoplay-policy not being respected in Win 10 App

Having problems with building or using the CefSharp .NET binding? Ask your CEF-related questions here. Please ask general usage questions on StackOverflow.

Moderator: amaitland

Autoplay-policy not being respected in Win 10 App

Postby diveecco63 » Thu Jun 10, 2021 12:02 pm

We are experiencing an issue with auto-play on windows 10 machines.

We are initializing Cef as follows:we create a OverrideSettings object of type CefSettingsOverrideCefSettings = new CefSettings();

Then we add accepted langugue list settings and a variety of command line args:

OverrideCefSettings.AcceptLanguageList =$"{CultureInfo.CurrentCulture.Name}, {CultureInfo.CurrentCulture.Name.Substring(0, 2)}";OverrideCefSettings.CefCommandLineArgs["autoplay-policy"] = "no-user-gesture-required";OverrideCefSettings.CefCommandLineArgs.Add("enable-media-stream");OverrideCefSettings.CefCommandLineArgs.Add("disable-gpu");OverrideCefSettings.CefCommandLineArgs.Add("no-proxy-server");OverrideCefSettings.CefCommandLineArgs.Add("enable-experimental-web-platform-features");OverrideCefSettings.CefCommandLineArgs.Add("enable-p2papi");OverrideCefSettings.CefCommandLineArgs.Add("allow-running-insecure-content");OverrideCefSettings.CefCommandLineArgs.Add("enable-usermedia-screen-capturing");OverrideCefSettings.CefCommandLineArgs.Add("enable-speech-input");OverrideCefSettings.CefCommandLineArgs.Add("allow-file-access-from-files");OverrideCefSettings.CefCommandLineArgs.Add("allow-http-screen-capture");OverrideCefSettings.CefCommandLineArgs.Add("auto-select-desktop-capture-source");OverrideCefSettings.CefCommandLineArgs.Add("use-fake-ui-for-media-stream");OverrideCefSettings.CefCommandLineArgs.Add("use-mock-keychain");OverrideCefSettings.CefCommandLineArgs.Add("force-renderer-accessibility");The issue is the first one, the autoplay-policy does not seem to be respected on windows machines. This is a WPF app, and we are initializing cef in app.xaml.cs on Application_startup

Cef.Initialize(OverrideCefSettings);Are we missing something else? This is only an issue on windows - MacOs seems to handle this fine.
Posts: 7
Joined: Thu Jun 10, 2021 11:47 am

Re: Autoplay-policy not being respected in Win 10 App

Postby amaitland » Thu Jun 10, 2021 2:12 pm

What version are you using?

Try remove all your other command line args and just set autoplay-policy as a test.

Load chrome://version in the browser and confirm the command line arg is listed.
Maintainer of the CefSharp project.
Posts: 969
Joined: Wed Jan 14, 2015 2:35 am

Re: Autoplay-policy not being respected in Win 10 App

Postby ValentinNikin » Fri Jul 30, 2021 1:25 pm

Hello, diveecco63.

I also develop application for Windows 10, and this option works fine for me.
Maybe you have some trouble with video codec. I came across the fact that proprietary codecs doesn't supported on Cef default configuration. You can see my question viewtopic.php?f=18&t=18540

Also, maybe you should try to change CefSettings console flags initialization

My code it looks like this
Code: Select all
var cefSettings = new CefSettings
                RootCachePath = cache,
                CachePath = cache,
                CefCommandLineArgs = { ["disable-gpu-shader-disk-cache"] = "1", ["autoplay-policy"] = "no-user-gesture-required" },
                CommandLineArgsDisabled = true,
                WindowlessRenderingEnabled = true
Posts: 25
Joined: Fri Jun 18, 2021 1:37 am

Return to CefSharp Forum

Who is online

Users browsing this forum: No registered users and 1 guest