results-collection
results-collection copied to clipboard
Disable autoplay policy enforcement in Chrome
Recent changes in the Chrome browser's policy for media "autoplay" [1] have implications for automated tests. At least 84 tests that were previously known to pass in automated scenarios now fail with error messages like:
play() failed because the user didn't interact with the document first. https://goo.gl/xX8pDD
Extend the invocation of the Chrome browser with a flag which is purported to disable this feature [2].
[1] https://developers.google.com/web/updates/2017/09/autoplay-policy-changes [2] https://peter.sh/experiments/chromium-command-line-switches/#no-user-gesture-required
Hi @beaufortfrancois! I'd like to avoid regressing with future releases of Chrome; do you know of a canonical source documenting the --autoplay-policy
command-line option?
Listing of the 84 ests effected by policy change
These tests were identified by searching results data for references to "https://goo.gl/xX8pDD"
- mediacapture-fromelement/creation.html
- mediacapture-fromelement/ended.html
- mediacapture-fromelement/capture.html
- media-source/mediasource-redundant-seek.html
- media-source/mediasource-play-then-seek-back.html
- media-source/mediasource-seek-during-pending-seek.html
- media-source/mediasource-duration.html
- media-source/mediasource-play.html
- media-source/mediasource-seek-beyond-duration.html
- webaudio/the-audio-api/the-mediaelementaudiosourcenode-interface/mediaElementAudioSourceToScriptProcessorTest.html
- encrypted-media/drm-mp4-setmediakeys-again-after-resetting-src.https.html
- encrypted-media/drm-mp4-waiting-for-a-key.https.html
- encrypted-media/drm-mp4-playback-temporary-encrypted-clear-sources.https.html
- encrypted-media/drm-mp4-playback-temporary-setMediaKeys-after-update.https.html
- encrypted-media/clearkey-mp4-playback-temporary-events.https.html
- encrypted-media/drm-mp4-playback-temporary-clear-encrypted.https.html
- encrypted-media/drm-mp4-playback-temporary.https.html
- encrypted-media/drm-mp4-playback-temporary-multikey-sequential.https.html
- encrypted-media/drm-mp4-playback-temporary-two-videos.https.html
- encrypted-media/clearkey-mp4-playback-temporary-encrypted-clear-sources.https.html
- encrypted-media/clearkey-mp4-setmediakeys-again-after-resetting-src.https.html
- encrypted-media/drm-mp4-setmediakeys-again-after-playback.https.html
- encrypted-media/drm-mp4-playback-temporary-multikey.https.html
- encrypted-media/clearkey-mp4-playback-temporary-multikey-sequential.https.html
- encrypted-media/clearkey-mp4-playback-temporary-waitingforkey.https.html
- encrypted-media/clearkey-mp4-playback-temporary-multikey.https.html
- encrypted-media/drm-mp4-playback-temporary-setMediaKeys-after-src.https.html
- encrypted-media/clearkey-mp4-playback-temporary-setMediaKeys-onencrypted.https.html
- encrypted-media/clearkey-mp4-playback-temporary-encrypted-clear.https.html
- encrypted-media/clearkey-mp4-playback-temporary-setMediaKeys-after-src.https.html
- encrypted-media/clearkey-mp4-playback-temporary-multikey-sequential-readyState.https.html
- encrypted-media/clearkey-mp4-playback-temporary-multisession.https.html
- encrypted-media/drm-mp4-playback-temporary-encrypted-clear.https.html
- encrypted-media/clearkey-mp4-waiting-for-a-key.https.html
- encrypted-media/drm-mp4-playback-temporary-multikey-sequential-readyState.https.html
- encrypted-media/clearkey-mp4-playback-temporary-two-videos.https.html
- encrypted-media/drm-mp4-playback-temporary-setMediaKeys-immediately.https.html
- encrypted-media/clearkey-mp4-playback-temporary.https.html
- encrypted-media/drm-mp4-playback-temporary-waitingforkey.https.html
- encrypted-media/clearkey-mp4-playback-temporary-setMediaKeys-after-update.https.html
- encrypted-media/drm-mp4-playback-temporary-multisession.https.html
- encrypted-media/clearkey-mp4-playback-temporary-setMediaKeys-immediately.https.html
- encrypted-media/clearkey-mp4-setmediakeys-again-after-playback.https.html
- encrypted-media/drm-mp4-playback-temporary-setMediaKeys-onencrypted.https.html
- encrypted-media/clearkey-mp4-playback-temporary-clear-encrypted.https.html
- encrypted-media/drm-mp4-playback-temporary-events.https.html
- html/semantics/embedded-content/media-elements/ready-states/autoplay.html
- html/semantics/embedded-content/media-elements/event_pause_noautoplay.html
- html/semantics/embedded-content/media-elements/audio_loop_base.html
- html/semantics/embedded-content/media-elements/event_timeupdate_noautoplay.html
- html/semantics/embedded-content/media-elements/paused_true_during_pause.html
- html/semantics/embedded-content/media-elements/video_loop_base.html
- html/semantics/embedded-content/media-elements/event_play_noautoplay.html
- html/semantics/embedded-content/media-elements/track/track-element/track-cues-sorted-before-dispatch.html
- html/semantics/embedded-content/media-elements/track/track-element/track-remove-active-cue.html
- html/semantics/embedded-content/media-elements/track/track-element/track-disabled-addcue.html
- html/semantics/embedded-content/media-elements/track/track-element/track-disabled.html
- html/semantics/embedded-content/media-elements/track/track-element/track-cue-negative-duration.html
- html/semantics/embedded-content/media-elements/track/track-element/track-cues-enter-exit.html
- html/semantics/embedded-content/media-elements/track/track-element/track-cues-cuechange.html
- html/semantics/embedded-content/media-elements/track/track-element/track-cue-negative-timestamp-events.html
- html/semantics/embedded-content/media-elements/track/track-element/track-cues-missed.html
- html/semantics/embedded-content/media-elements/track/track-element/track-mode.html
- html/semantics/embedded-content/media-elements/track/track-element/track-remove-insert-ready-state.html
- html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-empty-cue.html
- html/semantics/embedded-content/media-elements/interfaces/TextTrack/cues.html
- html/semantics/embedded-content/media-elements/event_playing_noautoplay.html
- html/semantics/embedded-content/media-elements/playing-the-media-resource/pause-remove-from-document.html
- html/semantics/embedded-content/media-elements/playing-the-media-resource/pause-move-to-other-document.html
- html/semantics/embedded-content/media-elements/playing-the-media-resource/pause-remove-from-document-networkState.html
- html/semantics/embedded-content/media-elements/playing-the-media-resource/pause-move-within-document.html
@mounirlamouri will know for sure what you need there.
@mounirlamouri or @foolip are the flags here the same as when tests are run in your infrastructure? Is there some other flag that we're missing (generally, not specifically about these 84 tests)?
I'm included to say that rather than disabling the requirement, tests should be adapted to pass the requirement. A bit of work, though, for sure.
There are a few ways to interpret the statement "tests should be adapted to pass the requirement":
- the test uses standard web APIs to circumvent the policy
- the test is authored to include metadata which the WPT CLI reacts to by enabling this flag
- the test uses WPT's testdriver tool to instruct WebDriver to disable the policy (via an as-yet-undefined WebDriver command)
- the test does not rely on autoplay and instead uses WPT's testdriver tool to trigger playback by simulating user input
Did you have one of these in mind? Or something else?
I mean tests using the existing test_driver.click
to satisfy the requirement, i.e. the last option, "the test does not rely on autoplay and instead uses WPT's testdriver tool to trigger playback by simulating user input"
I think the overhead may not be worth it in most cases. In Chrome, we run all tests without autoplay policy and have a virtual test suite with some tests running with the policy enabled.
@mounirlamouri, I can't find where --autoplay-policy=no-user-gesture-required
is passed when running LayoutTests, but I do see --autoplay-policy=document-user-activation-required
for the virtual test suite you mentioned, so presumably something other than that is the default.
For the two existing command line arguments we have a plan to get rid of them, and IMHO we should prefer WebDriver solutions where they exist because then we need not solve the problem once for every browser. In this case, we'll presumably have to do something for Safari as well.
@kereliuk, WDYT?
@foolip I think the flag comes from here: https://cs.chromium.org/chromium/src/content/shell/app/shell_main_delegate.cc?rcl=b32d39b663bc6f4e4b6a5d565bfd7babf51bf011&l=209
OK, looks like --autoplay-policy=no-user-gesture-required
actually is still the default code-wise, to be flipped after a successful autoplay launch? Details aren't important for this issue, the question is only whether we should pass --autoplay-policy=no-user-gesture-required
for wpt.fyi, or change some affected tests.
@zcorpan, you must have written a bunch of these tests originally, do you have some hunch about how long it might take to change them to use test_driver.click
, and do you think that's a good idea?