Open Bug 1635281 Opened 1 year ago Updated 11 months ago

Provide an easier way to switch different block autoplay policies

Categories

(Core :: Audio/Video: Playback, enhancement, P3)

enhancement

Tracking

()

Tracking Status
firefox78 --- ?

People

(Reporter: alwu, Unassigned, NeedInfo)

References

Details

Fork from bug1634453 comment5, it suggests Firefox should provide a better way to switch the blocking autoplay policies between user-gesture-activation and click-to-play. This might be implemented by adding one more button/option in the autoplay setting page in the about:preferences#privacy.

In addition, it might be worth to have a explaination about our default policy user-gesture-activation would only block autoplay BEFORE a user activates the page. Maybe we could add a SUMO page or rename our current wording?

[1] https://docs.google.com/document/d/1p81bYntlLMTxXoANnQXS9KH0TZ4y8aKKeH9x3GVS3eY/edit#

However, there is a problem in the click-to-play, this policy didn't work on some pages which calls video.play() inside an async event handler [1], because the way to detect if the input is triggered by user [2] doesn't support being used inside the async event handler. Therefore, we had some bugs reports about this feature doesn't work before, eg. Vimeo, but now it works on Vimeo.

However, for the way of detecting if the action is an user input, Chrome has proposed a different method and we have already implememted that way in [3], which is treating an action as a user triggled action if the action happens within a specific period of time after user performs input on the page. It's not necessary to perform the action on the certain element, it can occur on any places.

Eg. If I click on anywhere inside a page (which is not media element itself), then call video.play() which should not need to be called inside a event handler but needs to be called within a certain period of time, then this video.play() would be treat as an valid user input and we would allow video to play.

That is different from our current implementation, which requires the video.play() should only be called inside the event handler.

If we want to add an option to switch to click-to-play policy, we have to decide if we want to use Chrome's method for determining if the play is called by user or not, in order to block non-user triggered play request.

[1] https://alastor0325.github.io/htmltests/autoplay_tests/async_hanlder.html
[2] https://searchfox.org/mozilla-central/source/dom/base/UserActivation.cpp#36
[3] https://bugzilla.mozilla.org/show_bug.cgi?id=1509933#c3

Adam, Drno,
Do you have any thought about this issue?
Thank you.

Flags: needinfo?(drno)
Flags: needinfo?(astevenson)
Priority: -- → P3
See Also: → 1509933
Severity: -- → S4
You need to log in before you can comment on or make changes to this bug.