How to configure video / audio autoplay policy in a UWP WebView?

Viewed 309

Problem

FYI this has also been raised on GitHub -> https://github.com/windows-toolkit/Microsoft.Toolkit.Win32/issues/245

When using a WebView in my voice driven UWP app, HTML <video /> / <autoplay /> elements sometimes do not autoplay. The following error is returned when calling HTMLMediaElement.play() method : AbortError

After reading through https://docs.microsoft.com/en-us/microsoft-edge/dev-guide/browser-features/autoplay-policies this could be because there was no previous user gesture made. The problem is in voice driven apps, a "gesture" is not a "click" or a "tap", is a user spoken command.

Possible solution

I would like to be able to allow autoplay without requiring user-gestures like clicks, taps first. Same to what electronjs already provides via autoplay policy.

Attempted solutions

  • Faking click events

Similar issues

https://github.com/whatwg/html/issues/505 https://github.com/bbc/VideoContext/issues/66

0 Answers
Related