Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable Media AutoPlay in Microsoft WebView2?

I am using a WinForms application and within that I created a WebView2 instance to play media content using HTML5. I have been looking into documentation to find some way by which I can Enable AutoPlay in WebView2 such that my desktop application will play videos without user's interaction.

Things that I have tried.

  • I changed the Registry following this Documentation without success
  • I also enabled the AutoPlay from within Microsoft Edge but it did not have any effect.

Thank you!

like image 535
Imran Faruqi Avatar asked Sep 05 '25 16:09

Imran Faruqi


1 Answers

It can be so. It helped me

public MainWindow()
    {
        Environment.SetEnvironmentVariable("WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS", "--autoplay-policy=no-user-gesture-required");
        InitializeComponent();
    }
like image 119
FAR747 Avatar answered Sep 07 '25 17:09

FAR747