Closed hejiajun107 closed 10 months ago
Hi @hejiajun107!
We added a way to pass init flags to the browser control in Photino.NET v2.5.0 (just released). You can try to pass --autoplay-policy=no-user-gesture-required
as a string via the SetBrowserControlInitParameters method.
public class Program
{
public static void Main(string[] args)
{
string browserControlInitParams = string.Empty;
if (PhotinoWindow.IsWindowsPlatform)
{
// Windows specific initialization parameters
browserControlInitParams = "--flag --option-with-value=value";
}
else if (PhotinoWindow.IsMacOsPlatform)
{
// macOS specific initialization parameters
browserControlInitParams = JsonSerializer.Serialize(new
{
flag = true,
optionWithValue = "value"
});
}
else if (PhotinoWindow.IsLinuxPlatform)
{
// Linux specific initialization parameters
browserControlInitParams = JsonSerializer.Serialize(new
{
flag = true,
optionWithValue = "value"
});
}
PhotinoWindow window = new PhotinoWindow()
.SetTitle("Photino Testing")
.SetBrowserControlInitParameters(browserControlInitParams)
.LoadRawString("Hello World!");
window.WaitForClose();
}
}
Please let us know if this resolves your issue!
It works
Thank you for confirming this @hejiajun107!
Since the webview disabled miedia autoplay by default,need some option to enabled this wihout user gesture. Like the comandline args in chrome --autoplay-policy=no-user-gesture-required or like android webview option mediaPlaybackRequiresUserGesture