Page 1 of 1

autoplay-policy not working for html5 video tag

PostPosted: Thu Jul 29, 2021 12:13 am
by ValentinNikin
I have a video tag with "autoplay" option, and I want to CEF start playing this video without user interaction.
I know about chrome restrictions, and already use "--autoplay-policy=no-user-gesture-required" command line option. For html5 audio tag, or youtube video this option is help, but not for html5 video tag.

Application type: Offscreen.
This is my CefSettings:
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
            };


This is example of the html page:
Code: Select all
<html>
<header></header>
<body>
   <video autoplay controls>
      <source src="video.mp4">
   </audio>
</body>
</html>


I also tried to playing this page from the chrome browser, and autoplay is worked (If chrome started with --autoplay-policy=no-user-gesture-required option).

Re: autoplay-policy not working for html5 video tag

PostPosted: Thu Jul 29, 2021 12:15 am
by amaitland
mp4 videos often use `H264/AAC` audio which aren't supported due to licencing restrictions.

Try with a open source video format.

https://github.com/cefsharp/CefSharp/wi ... audiovideo

Re: autoplay-policy not working for html5 video tag

PostPosted: Thu Jul 29, 2021 1:19 am
by ValentinNikin
amaitland, thank you for quick reply.
Do I understand correctly, what if I need supporting h264 and other proprietary codecs I must rebuild Cef with some flags?

Re: autoplay-policy not working for html5 video tag

PostPosted: Thu Jul 29, 2021 2:23 am
by amaitland
Additionally you will need to obtain the relevant licences for h264 and AAC (non free).

Re: autoplay-policy not working for html5 video tag

PostPosted: Thu Jul 29, 2021 2:56 am
by ValentinNikin
I see. Thank you