autoplay-policy not working for html5 video tag

Having problems with building or using the CefSharp .NET binding? Ask your CEF-related questions here. Please ask general usage questions on StackOverflow.

Moderator: amaitland

autoplay-policy not working for html5 video tag

Postby ValentinNikin » Thu Jul 29, 2021 12:13 am

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).
ValentinNikin
Techie
 
Posts: 34
Joined: Fri Jun 18, 2021 1:37 am

Re: autoplay-policy not working for html5 video tag

Postby amaitland » Thu Jul 29, 2021 12:15 am

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
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1290
Joined: Wed Jan 14, 2015 2:35 am

Re: autoplay-policy not working for html5 video tag

Postby ValentinNikin » Thu Jul 29, 2021 1:19 am

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?
ValentinNikin
Techie
 
Posts: 34
Joined: Fri Jun 18, 2021 1:37 am

Re: autoplay-policy not working for html5 video tag

Postby amaitland » Thu Jul 29, 2021 2:23 am

Additionally you will need to obtain the relevant licences for h264 and AAC (non free).
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1290
Joined: Wed Jan 14, 2015 2:35 am

Re: autoplay-policy not working for html5 video tag

Postby ValentinNikin » Thu Jul 29, 2021 2:56 am

I see. Thank you
ValentinNikin
Techie
 
Posts: 34
Joined: Fri Jun 18, 2021 1:37 am


Return to CefSharp Forum

Who is online

Users browsing this forum: No registered users and 27 guests