23

I'm building a kiosk media which runs on Chrome that plays video with audio. I know that chrome by default only allows autoplay for videos with muted props.

And i know that i WAS able to override this by enabling a flag in chrome via chrome://flags/#autoplay-policy

I have just updated to Chrome 76 and this flag seems to be gone and the autoplaying of video doesn't seem to work anymore!

Any idea how do i overcome this?

[Chrome 76.0.3809.100 (Official Build) (64-bit)] Mac OS Mojave

wsgg
  • 934
  • 1
  • 20
  • 43

4 Answers4

44

I just spoke to some developers from Google about this issue recently. I submitted a bug. They have been very helpful.

Even though autoplay policy chrome flag was removed in https://chromium-review.googlesource.com/c/chromium/src/+/1593800, you can still run Chrome with a specific autoplay policy from the command line.

Autoplay policy that does not require any user gesture.

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --autoplay-policy=no-user-gesture-required

They say this command will stay, so that's good but even better Chrome allows you to always enable autoplay by explicitly allowing a website to make sound "Site Settings > Sound"

Good luck.

code
  • 1,041
  • 1
  • 12
  • 28
  • 1
    Perfect! This resolved my issue. Thanks for sharing. – Craig MacKenzie Aug 29 '19 at 17:54
  • 1
    So what does this `no-user-gesture-required` option do? It will always allow auto-play? When this `#autoplay-policy` was still available, the setting value to disable auto-play was "Document user activation is required". What is its equivalent command line option? (In my testing, using `--autoplay-policy=no-user-gesture-required` doesn't stop video from auto-playing) – webp Nov 25 '19 at 15:27
  • @webp the "no-user-gesture-required" means that the user does not need to interact with the document for video or audio sources to start playing automatically. – code Nov 25 '19 at 21:39
  • 3
    @code_secret so what value should I use to prevent video from automatically played? – webp Nov 26 '19 at 02:53
  • @webp I'm not really understanding what you mean. This post was stating an issue with autoplaying to work in kiosk mode. If you don't want your videos to autoplay... did you try adding the tag autostart="false" ? – code Nov 26 '19 at 19:04
7

You can use command line code to execute chrome in kiosk mode with no-user-gesture-required:

google-chrome-stable --kiosk http://google.com/ --new-window --start-maximized --incognito  --autoplay-policy=no-user-gesture-required --disable-features=PreloadMediaEngagementData,AutoplayIgnoreWebAudio,MediaEngagementBypassAutoplayPolicies &
Guray Celik
  • 1,281
  • 1
  • 14
  • 13
0

According to the new policy of Chrome:
Chrome has prevented any sound, I also met this problem.
I just add this trigger click to my script page and it's really working correctly:

$('body).trigger('click');
סטנלי גרונן
  • 2,917
  • 23
  • 46
  • 68
Ork Sophanin
  • 138
  • 6
-2

I just add a div in my page and call click trigger on load page! it works correctly!

<div id="test"></div>
<script>
    $(function(){
        $("#test").trigger("click");
    })
</script>