Audio Auto-Play Requiring User Gesture?

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Audio Auto-Play Requiring User Gesture?

Postby Greg » Wed Jan 23, 2019 11:00 am

Audio Auto-Play is not working without a user gesture beforehand. Currently using CEF Version 69. I have seen some possible settings affecting this such as "--autoplay-policy=no-user-gesture-required".

What is the best way (if any) to allow audio auto-play without requiring user gesture beforehand (e.g. above setting)?

Thank You
Greg
Newbie
 
Posts: 2
Joined: Wed Jan 23, 2019 10:53 am

Re: Audio Auto-Play Requiring User Gesture?

Postby magreenblatt » Wed Jan 23, 2019 2:45 pm

Have you tried that setting?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Audio Auto-Play Requiring User Gesture?

Postby callum » Mon Mar 18, 2019 4:16 pm

As expected, after upgrading the version of CEF we use to 3.3626.1895.g7001d56, YouTube videos no longer autoplay which breaks a lot of content for one of our common use cases since the user cannot interact with the browser to click to play.

I thought the solution for this was to append a command line option in my overridden OnBeforeCommandLineProcessing() function and adding a line like:

command_line->AppendSwitch("autoplay-policy=no-user-gesture-required");

but that doesn't change anything.

I confirmed that the CEF application doesn't autoplay by default but explicitly passing that switch in to the command line does indeed do the right thing and that looks to pass in the flag directly into CEF in its OnBeforeCommandLineProcessing().

What is the right way to do this?
callum
Expert
 
Posts: 326
Joined: Mon Feb 23, 2015 6:19 pm

Re: Audio Auto-Play Requiring User Gesture?

Postby magreenblatt » Mon Mar 18, 2019 4:40 pm

Try using AppendSwitchWithValue.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Audio Auto-Play Requiring User Gesture?

Postby callum » Mon Mar 18, 2019 4:45 pm

Thanks - came back to say I'd found that too. Thank you.

command_line->AppendSwitchWithValue("autoplay-policy", "no-user-gesture-required");

did the trick and works as expected.
callum
Expert
 
Posts: 326
Joined: Mon Feb 23, 2015 6:19 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 76 guests