Closed Bug 1376321 (block-autoplay) Opened 7 years ago Closed 4 years ago

[meta] blocking autoplay meta bug [***see URL link for more details***]

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
Tracking Status
relnote-firefox --- 66+

People

(Reporter: bwu, Unassigned)

References

(Depends on 16 open bugs, )

Details

(Keywords: dev-doc-needed, feature, meta, Whiteboard: use `media.autoplay.blocking_policy` to select different blocking autoplay policy)

Attachments

(1 file)

This is a meta bug to track all the bugs related to media.autoplay.enabled=false. 
I have seen many bugs related to this and will set many bugs depend on this.
Depends on: 1323063, 1373904
Fixing subject as it does not seem to describe what is being tracked here.
Summary: Make media.autoplay.enabled work → Make media.autoplay.enabled=false work
Depends on: 1231886
See Also: → 1379999
Summary: Make media.autoplay.enabled=false work → [meta] make media.autoplay.enabled=false work
Alias: disable-autoplay-by-pref
Depends on: 1382574
See Also: → 1313233
Depends on: 1382884
Depends on: 1395171
Depends on: 1412772
Depends on: 1182329
See Also: 1379999
Depends on: 1413098
Depends on: 1415444
Depends on: 1415478
Depends on: 1336400
Depends on: 1419349
Depends on: 1420375
Depends on: 1420378
Depends on: autoplay-UX-spec
Depends on: 1421518
Depends on: 1428288
Depends on: 1428722
Alias: disable-autoplay-by-pref → block-autoplay
Depends on: 1430012
Depends on: 1430019
Depends on: 1430544
Depends on: 1433987
Depends on: 1435035
Depends on: 1435037
No longer depends on: 1431674
Depends on: 1437308
Depends on: 1437333
Current design for the logic of HTMLMediaElement.play() when block-autoplay is enabled.
Depends on: 1473671
Depends on: 1474430
Depends on: 1475099
Depends on: 1476701
Depends on: 1477273
Depends on: 1477415
Depends on: 1477926
Depends on: 1478024
For the writing team when the time comes, from the intent-to-ship message:

SUMMARY:

We intend to change the behaviour of HTMLMediaElement to block autoplay of audible audio and video in Firefox on desktop and mobile.

We are not going to block WebAudio at the same time. While we do plan to block audible autoplay of WebAudio content in the near future, we have not finalized our WebAudio blocking logic or intended ship date for blocking WebAudio.


TIMELINE:

We intend to run shield studies on the user impact of enabling HTMLMediaElement autoplay blocking. If those go well we hope to ship in Firefox 63 (2018-10-23) or Firefox 64 (2018-12-11). Upon conclusion of our experiments, I’ll follow up here with a confirmed ship date for this feature.

We hope to block autoplay in WebAudio in a release soon after, hopefully Firefox 64 or 65.


DETAILS:

We intend to block autoplay of HTMLMediaElement in tabs which haven't had user interaction. Web authors should assume that they require a user gesture (mouse click on a "play" button for example) in order to play audible media.

HTMLMediaElements with a "muted" attribute or "volume=0" are still allowed to play.

As with other browsers implementing this feature, we express playback being blocked by rejecting the promise returned by HTMLMediaElement.play(). Web authors should always check whether the promise returned by HTMLMediaElement.play() is rejected, and handle that case accordingly.

We also plan to allow users to create their own whitelist of sites which they trust to autoplay.

We are planning to experiment via shield studies with prompting users to approve/block playback on sites that try to autoplay before receiving user interaction.


ADVICE FOR WEB AUTHORS:

In general, the advice that applies to other browsers [1][2] with respect to autoplaying media will apply to Firefox as well; you cannot assume that you can just call HTMLMediaElement.play() for audible media and expect it to always play. You should always check whether the play promise is rejected, and handle that case accordingly.

For example:

var promise = document.querySelector('video').play();

if (promise !== undefined) {
    promise.catch(error => {
        // Auto-play was prevented
        // Show a UI element to let the user manually start playback
    }).then(() => {
        // Auto-play started
    });
}

(This example comes from WebKit’s announcement on blocking autoplay [2])

To test block autoplay in Firefox 63 (currently in Firefox Nightly channel), download the latest Nightly and open about:config in the URL bar and set the preferences:

media.autoplay.enabled=false
media.autoplay.enabled.user-gestures-needed=true
media.autoplay.ask-permission=true
Keywords: dev-doc-needed
No longer depends on: 1478024
Depends on: 1478226
Depends on: 1478599
No longer depends on: 1478599
Depends on: 1478860
Depends on: 1478869
Depends on: 1478946
Depends on: 1479589
Depends on: 1480281
Depends on: 1480484
Depends on: 1480738
Depends on: 1481322
Blocks: 1478860
No longer depends on: 1478860
Depends on: 1482259
Depends on: 1482284
Depends on: 1483703
Depends on: 1485160
No longer depends on: 1482284
Depends on: 1487844
Depends on: 1489278
Depends on: 1493027
Depends on: 1494144
Depends on: 1497737
Depends on: 1499803
Whiteboard: if you want to disable muted autoplay, please also set "media.autoplay.allow-muted=false"
Depends on: 1497582
Depends on: 1500234
Depends on: 1502046
Depends on: 1506557
Depends on: 1509933
Depends on: 1512283
Depends on: 1513039
Depends on: 1513681
Depends on: 1513612
Depends on: 1512362
Depends on: 1514615
Depends on: 1516482
Depends on: 1516598
Depends on: 1517526
Depends on: 1517562
Depends on: 1519229
Summary: [meta] make media.autoplay.enabled=false work → [meta] blocking autoplay meta bug (pref "media.autoplay.default")

I have a problem with "media.autoplay.default":

If set to 1, then the following video (as a sample, I hav seen this elsewhere) can't be manually started:
https://www.msnbc.com/all-in/watch/fbi-opened-inquiry-into-whether-trump-working-for-russia-report-1424588867508

(In reply to Torsten Villnow from comment #9)

I have a problem with "media.autoplay.default":

If set to 1, then the following video (as a sample, I hav seen this elsewhere) can't be manually started:
https://www.msnbc.com/all-in/watch/fbi-opened-inquiry-into-whether-trump-working-for-russia-report-1424588867508H

Hi, Torsten,

Could you check whether you also have the pref "media.autoplay.enabled.user-gestures-needed=true"? I tested this site in the latest Nightly, it can start playing without problems.

Thank you.

Flags: needinfo?(t.villnow)

Hi Alastor,

"media.autoplay.enabled.user-gestures-needed" was set to false. After having changed it to true the videos on MSNBC can be manually started now. However, as a side-effect the videos on Youtube are now started automatically, which was not the case before this change. Is this working as intended with these settings?

Flags: needinfo?(t.villnow)
Depends on: 1520023

(In reply to Torsten Villnow from comment #11)

Hi Alastor,

"media.autoplay.enabled.user-gestures-needed" was set to false. After having changed it to true the videos on MSNBC can be manually started now. However, as a side-effect the videos on Youtube are now started automatically, which was not the case before this change. Is this working as intended with these settings?

That is a known issue, if you disable "media.autoplay.enabled.user-gestures-needed", then it would break those webistes who are calling video.play() asynchronous in the user-event handler. That issue is blocked by bug1185052, so we're still waiting fot the fix. To only allow autoplay by user clicking, we call this model as click-to-play model, and as you see, it still can't work for every sites, so that is the reason why we don't enable this pref as a default option.

When you turn on the pref "media.autoplay.enabled.user-gestures-needed", video won't be allowed in the beginning, it would be allowed to autoplay after user activates page by user gesture (eg. mouse click, keyboard press, touch). We call this model as user-gesture-activation model. So Youtube would be allowed to autoplay after you activate them.

Depends on: 1520088
Depends on: 1520361
Depends on: 1520431
Depends on: 1520546
Depends on: 1520596
Depends on: 1520663
Depends on: 1520734
Depends on: 1520912
Depends on: 1521947
Depends on: 1522058
Depends on: 1522065
Depends on: 1522923
Depends on: 1523766
Depends on: 1524258
Depends on: 1525156
Depends on: 1528343
Depends on: 1528696
Depends on: 1530220
Depends on: 1531114

Suggested release note for block autoplay (from chsiang):

Block autoplay media: Firefox now blocks all autoplay media with sound by default. Users can add individual sites to an exceptions list or turn the blocking off. Visit our support page to learn how to do that. We recommend websites to follow these strategies to avoid media been blocked and to provide the best user experience.

Depends on: 1534219
Depends on: 1539319
Depends on: 1540807
Depends on: 1541283
Depends on: 1550477
Depends on: 1553217
Depends on: 1556997
Depends on: 1560634
Depends on: 1560635
Depends on: 1562815
Depends on: 1573349
Depends on: 1573350
Depends on: 1572939
Depends on: 1598486
Depends on: 1623513
Depends on: 1631598
Depends on: 1635281
Whiteboard: if you want to disable muted autoplay, please also set "media.autoplay.allow-muted=false" → use `media.autoplay.blocking_policy` to select different blocking autoplay policy

Depends on: 1642250

Depends on: 1648962
Depends on: 1652196
Depends on: 1647779

I've explicitly blocked audio and video on Yahoo Finance and it starts playing when I cycle tabs back and forth into the page. I've been reading a bunch of the related bugs and my understanding is that setting to "block audio and video" should not allow this.
It sometimes doesn't play at first but it triggers soon after and resumes play as soon as I open the tab again. This is CPU intensive more than any other thing, which slows down the rest of the browser.

Upon un-muting the video, it behaves correctly and no longer starts playing when I go back to the page to check on new data.

Depends on: 1674829

(In reply to t28427 from comment #15)

I've explicitly blocked audio and video on Yahoo Finance and it starts playing when I cycle tabs back and forth into the page. I've been reading a bunch of the related bugs and my understanding is that setting to "block audio and video" should not allow this.
It sometimes doesn't play at first but it triggers soon after and resumes play as soon as I open the tab again. This is CPU intensive more than any other thing, which slows down the rest of the browser.

Upon un-muting the video, it behaves correctly and no longer starts playing when I go back to the page to check on new data.

Could you try other blocking autoplay policies [1] to see if any of them work for you? That document also describes what media we would block under different policies.

[1] https://docs.google.com/document/d/1p81bYntlLMTxXoANnQXS9KH0TZ4y8aKKeH9x3GVS3eY/edit#heading=h.k7kwgndce3xw

In addition, we have finished developing this feature already, I will close this bug, but will still use this bug to track any related issues.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Summary: [meta] blocking autoplay meta bug (pref "media.autoplay.default") → [meta] blocking autoplay meta bug [***see URL link for more details***]
Depends on: 1736340
Depends on: 1736210
Depends on: 1738727
Depends on: 1746742
Depends on: 1748544
Depends on: 1809211
Depends on: 1799535
Depends on: 1813822
Depends on: 1826715
Depends on: 1830625
Depends on: 1831636
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: