Open Bug 1562815 Opened 2 years ago Updated 2 years ago

Sound autoplay blocking fails on bbc news site

Categories

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

67 Branch
enhancement

Tracking

()

UNCONFIRMED

People

(Reporter: samtygier, Unassigned)

References

()

Details

(Whiteboard: [sci-exclude])

User Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0

Steps to reproduce:

67.0.4 (64-bit) on Fedora 30.

Make sure "Block websites from automatically playing sound" is enabled and bbc is not listed in exceptions.

Open a BBC news page with a live feed. e.g. https://www.bbc.co.uk/news/uk or https://www.bbc.co.uk/news/politics .

Leave the tab open in the background and carry on browsing as normal.

Actual results:

If a new story with a video is added (without any user interaction needed) then it will start playing with audio.

Expected results:

"Block websites from automatically playing sound" should work.

Has STR: --- → yes
Component: Untriaged → Audio/Video: Playback
Product: Firefox → Core

Alastor, could you take a look at this?

I have the page open in the background and will leave it there for the remainder of the day. If it reproduces I will confirm this bug.

Flags: needinfo?(alwu)

FWIW I saw a video get added but it didn't play. This was in Nightly 69, where "Block websites from automatically playing sound" has been reworked somewhat.

Sam, are you able to reproduce on Nightly?

Flags: needinfo?(samtygier)

Me neither, I didn't see any autoplay video starting in those two sites. I've tried the latest Nightly 69.0a1 and Release Firefox 67.0.4 on Ubuntu 18.04.1.
Do you mind to provide us your prefs setting which are related with autoplay?
Thank you.

Flags: needinfo?(alwu)

I have just had it happen again on Nightly 69.0a1 (2019-07-02) (64-bit). On https://www.bbc.co.uk/news/world which was not the current tab, it was not the top video that had just loaded, but one further down the page. Can I suggest to reproduce have a few of the news pages open (e.g., uk, world, politics ...) during UK working hours. Also I wonder if you need to be in the UK, the BBC serves quite different pages to UK and non-UK browsers.

My settings:
dom.media.autoplay.autoplay-policy-api false
media.autoplay.allow-extension-background-pages true
media.autoplay.block-event.enabled false
media.autoplay.block-webaudio true
media.autoplay.default 1
media.autoplay.enabled.user-gestures-needed true
media.block-autoplay-until-in-foreground true
services.sync.prefs.sync.media.autoplay.default true

Flags: needinfo?(samtygier)

A friendly reminder to check back when you have a chance.

Flags: needinfo?(alwu)

Before those media started autoplay in background, have you ever interact with those tabs? eg. mouse clicking, keyboard pressing on those page.
Because we only block autoplay before page hasn't been activated by user gesture, I'm guessing you might have probabroly activated those sites, so they get allow to start autoplay even if they are in the background.

Try to set the pref media.autoplay.enabled.user-gestures-needed to false to see if it's what you want, but notice that, when you close this pref, the autoplay would only be activated when you click on it, and due to some defects in the current implementation of the user gesture support, it might break some sites.

Flags: needinfo?(alwu) → needinfo?(samtygier)

I've seen this on Nightly a few times - BBC News tabs that have been left open in the background for hours will suddenly start autoplaying video with sound. I likely have interacted with the page before switching to another page. Shouldn't media.block-autoplay-until-in-foreground prevent this happening even if the page has received user input?

My settings:
dom.media.autoplay.autoplay-policy-api false
media.autoplay.allow-extension-background-pages true
media.autoplay.block-event.enabled false
media.autoplay.block-webaudio true
media.autoplay.default 5
media.autoplay.enabled.user-gestures-needed true
media.block-autoplay-until-in-foreground true
services.sync.prefs.sync.media.autoplay.default true

I've not managed to reproduce this on-demand, but by rough STR are:

  1. Open https://www.bbc.co.uk/news/science_and_environment near the end of the day (and probably click in the page too)
  2. Switch to another tab
  3. Come back the next morning
  4. Around between 9.00-9.30AM BST, a video near the bottom of the page starts autoplaying with sound

This has happened twice more today, I can confirm the STR are:

  1. Open https://www.bbc.co.uk/news/uk (or probably any of the main category front pages), click in the page somewhere
  2. Switch to another tab
  3. Wait a few hours

Results: at some point (possibly when the page content is updated, as sam tygier suggests) a video in the 'Latest Updates' section will start autoplaying with sound. Today the video "Why wales has the best flag" played twice, so it's not necessarily a new video but presumably a video in the section that gets refreshed.

For non-UK people, you probably need to visit via a UK proxy to get the same version.

(In reply to Paul Stone from comment #7)

I've seen this on Nightly a few times - BBC News tabs that have been left open in the background for hours will suddenly start autoplaying video with sound. I likely have interacted with the page before switching to another page. Shouldn't media.block-autoplay-until-in-foreground prevent this happening even if the page has received user input?

The pref media.block-autoplay-until-in-foreground is not used for that, it's used to block autoplay starting from an unvisited tab no matter you enable blocking autoplay or not.

(In reply to Paul Stone from comment #8)

This has happened twice more today, I can confirm the STR are:

  1. Open https://www.bbc.co.uk/news/uk (or probably any of the main category front pages), click in the page somewhere
  2. Switch to another tab
  3. Wait a few hours

Results: at some point (possibly when the page content is updated, as sam tygier suggests) a video in the 'Latest Updates' section will start autoplaying with sound. Today the video "Why wales has the best flag" played twice, so it's not necessarily a new video but presumably a video in the section that gets refreshed.

For non-UK people, you probably need to visit via a UK proxy to get the same version.

It sounds like we should probably revoke the autoplay permission for those tabs which have been in background for a long period and didn't play anything.

Type: defect → enhancement
Priority: -- → P3

(In reply to Alastor Wu [:alwu] from comment #10)

It sounds like we should probably revoke the autoplay permission for those tabs which have been in background for a long period and didn't play anything.

What about revoking the autoplay permission fairly soon after it goes into the background if it's not played anything? (e.g. allow 30s for media to start playing after the user has clicked play and switched away). I can't think of other use cases where the user would expect a background tab to suddenly start playing media. Not sure if things like audio notifications for like webmail/chat might break - but I'm not sure if that's handled differently than video autoplay.

(In reply to Paul Stone from comment #11)

I can't think of other use cases where the user would expect a background tab to suddenly start playing media. Not sure if things like audio notifications for like webmail/chat might break - but I'm not sure if that's handled differently than video autoplay.

Hmm, yes, we should definitely consider use cases of background notification sound, eg. IRCClound, Gmail, Slack. We don't want to block those pages even if they're already in the background for a long period.

Now I don't have any good idea about solving this case, because for now we don't have way to distinguish notification sound or normal playback content. A current workaround might be using click-to-play autoplay policy by setting the pref media.autoplay.enabled.user-gestures-needed=false .

Now I don't have any good idea about solving this case, because for now we don't have way to distinguish notification sound or normal playback content. A current workaround might be using click-to-play autoplay policy by setting the pref media.autoplay.enabled.user-gestures-needed=false .

Is it possible to at least distinguish audio-only media from video-with-audio playback?

(In reply to Alastor Wu [:alwu] from comment #12)

Hmm, yes, we should definitely consider use cases of background notification sound, eg. IRCClound, Gmail, Slack. We don't want to block those pages even if they're already in the background for a long period.

Shouldn't those be done through the "will you allow xxx to send notifications?" system?

Flags: needinfo?(samtygier)
Whiteboard: [sci-exclude]
You need to log in before you can comment on or make changes to this bug.