Chrome Autoplay Policy - Chrome 76
Solution 1
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.
Solution 2
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 &
Related videos on Youtube
wsgg
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut sollicitudin dui in augue pulvinar finibus. Integer commodo neque nec ex posuere maximus. Sed condimentum est id felis fermentum ullamcorper. Pellentesque vestibulum et neque ac mollis. Proin eleifend metus sed ante euismod, non mattis augue vulputate. Donec ipsum turpis, consequat sed lorem ac, lacinia ultrices felis. Proin vel eros libero. Praesent cursus dui elit. Praesent a urna eget turpis scelerisque ullamcorper. Donec tincidunt ante vitae congue suscipit. Nunc ac ornare leo. Vestibulum a nulla odio. Nam maximus in dui ac elementum. Nunc quis arcu vitae leo pretium ornare a eu purus. Sed eu lacus luctus, varius enim eget, imperdiet nisl. Aenean ornare sapien auctor nulla volutpat, vel tempor libero ullamcorper. Suspendisse potenti. Donec non molestie lectus. In condimentum in ante convallis finibus. Morbi ultrices tincidunt ante, in tristique justo vehicula quis. Morbi consequat, odio facilisis scelerisque lobortis, odio risus ullamcorper nunc, a faucibus ipsum mauris in arcu. Suspendisse potenti. Duis feugiat, ligula sed molestie hendrerit, tortor lectus egestas odio, eu dictum augue arcu a ipsum. Nunc urna mauris, varius in dui a, aliquet pharetra nisi. Aenean commodo ipsum non elit congue, interdum gravida urna bibendum.
Updated on August 22, 2021Comments
-
wsgg over 2 years
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
-
Craig MacKenzie over 4 yearsPerfect! This resolved my issue. Thanks for sharing.
-
webp over 4 yearsSo 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) -
code over 4 years@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.
-
webp over 4 years@code_secret so what value should I use to prevent video from automatically played?
-
code over 4 years@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" ?
-
dpren about 4 yearsYou sure? I couldn't replicate with document.getElementById("test").click() What about jQuery is different?
-
mikey over 3 yearssame here.. couldn't do it with plain js
-
Luca_Scorpion over 3 yearsTried in Chrome version 87.0.4280.141, doesn't work with plain js or jQuery.
-
Ork Sophanin over 3 yearsYou're should try Raw javascript.
-
Luca_Scorpion over 3 yearsAs mentioned in my comment, I did try that. Simply using
document.body.click()
doesn't work either. Events like this triggered from JS aren't considered "trusted" and thus don't count as user interaction with the page. -
Ork Sophanin over 3 yearstry this code
$('body').trigger('click');
at the top of yourplay()
code.