I cant seem to find all over the internet on how to loop a local MP4 file in webview2
I can loop it but I have to right click then click it on the menu.
is there anyway to enable loop via code in C#/vbnet? It is unchecked when you initialize the winform:
Tried searching WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS for any options for it but to no avail
Imports System.Speech.Synthesis
Imports Microsoft.Web.WebView2.Core
Imports MySql.Data.MySqlClient
Private Sub QDashboard_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.StartPosition = FormStartPosition.Manual
Me.Location = Screen.AllScreens(1).Bounds.Location
Environment.SetEnvironmentVariable("WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS", "--autoplay-policy=no-user-gesture-required --loop=true")'doesn't work :(
InitializeComponent()
Timer_count.Enabled = True
Timer_update.Enabled = True
end Sub
carl benz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I’ve never used VB but I’ve used WebView2 a good amount in C++ Visual Studio and this is how I’m able to achieve it, so I’m sure it’s similar:
webView21->ExecuteScriptAsync("document.querySelector('video').setAttribute('loop',null);");
Should probably link to it, you can set it to VB language preference and there’s a little example on the page as well.
ExecuteScriptAsync() function from MSDN.