Skip to content
This repository has been archived by the owner on Jan 2, 2023. It is now read-only.

Media (with sound) autoplays briefly when I refresh the home page, with "Automatically expand images" on #38

Open
Fofer opened this issue Jun 19, 2021 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@Fofer
Copy link

Fofer commented Jun 19, 2021

The new version has a weird issue. With "Automatically expand images" enabled, nearly every time I refresh reddit.com's home page, I hear a short snippet of sound and see the speaker icon in the address bar. And it's not always the same sound.

What I can confirm now is that the issue goes away if I disable this extension, as well as if I leave it enabled, and only disable that one "automatically expand images" feature. Then when I refresh the page, that quick sound doesn't play. Happy to help troubleshoot, just let me know what else to try.

@bermudalocket bermudalocket self-assigned this Jun 19, 2021
@bermudalocket bermudalocket added the bug Something isn't working label Jun 19, 2021
@bermudalocket
Copy link
Owner

Interesting! Do you have any other extensions enabled?

Are you able to pinpoint the source of the sound after the page loads? For example, are there any videos or gifs on the page that make the sound?

@Fofer
Copy link
Author

Fofer commented Jun 19, 2021

I do have some other extensions enabled, I will try experimenting by disabling them all, maybe do some process of elimination troubleshooting, and see if this is some sort of three-way conflict... I'll report back if I discover anything.

And no, I can't seem to pinpoint the source of the sound after the page loads. It's only image thumbnails I'm seeing, none of them are GIFs or videos that make the sound I just heard. I just know this behavior is new. It's not 100% reproducible either, but pretty regular over the past day or two and only happening on Reddit.

@Fofer
Copy link
Author

Fofer commented Jun 19, 2021

Thus far I'm unable to tie this bug to anything other than the Tweaks for Reddit extension and this particular "Automatically expand images" feature.

In the meantime, I noticed that this audio was autoplaying (briefly) even though this page-specific setting was on "Stop media with sound," which is really odd.
CleanShot 2021-06-19 at 08 00 10

I changed it to "Never auto-play" and haven't experienced this issue since. I'll keep troubleshooting, but figured I'd share this in the meantime.

@bermudalocket
Copy link
Owner

That's very odd. Are you using Safari or Safari Tech Preview?

The "automatically expand images" feature works like this:

  1. Scan page and scrape all posts

    Array.from((subject ?? document).querySelectorAll(".thing"))

  2. Filter out posts that don't have attachments. To work around a Reddit issue where literally every type of attachment (link, video, photo, etc) is classified as a video, another filter is applied which searches each posts's attachment link for domains likely to host an image, seen here:

    const expandableDomains = [ "i.redd.it", "reddit.com", "i.imgur.com", "pbs.twimg.com" ];

  3. At this point we should have an array of posts that contain an image attachment. The last step is to loop through all of these posts and call the simple javascript .click function on each posts's "expando button", completing the "auto expansion".

    .forEach(e => e.querySelector(".expando-button:not(.expanded)")?.click())

So my first thought was that a video or a GIF with sound was being clicked, which theoretically could cause a brief second of sound before Safari realizes and pauses it. But if that were the case, you'd be able to see a video or GIF post somewhere on the page, containing sound that matches what you hear at page load.

I did just realize that the entire time I've been trying to reproduce this, I've had an extension called "Stop the Madness" enabled which, among other things, stops video playback. I've disabled it for now and will try to reproduce the issue.

@bermudalocket
Copy link
Owner

Hey @Fofer, are you still having this issue? Unfortunately I haven't come across it in the last two weeks.

@Fofer
Copy link
Author

Fofer commented Jul 4, 2021

Hi @bermudalocket, yes, I'm still experiencing the issue, so I'd just left the "automatically expand images" feature disabled to avoid it. Later this week I'll have time to experiment again with ALL OTHER extensions disabled, and then perhaps re-enable one at a time to check each one and see if I can pinpoint any additional culprits.

It's just very time consuming with a big handful of extensions and annoying because the issue isn't 100% reproducible, it only pops up from time to time. Noticeable and unnerving, but not consistent.

Of note, I am still running Big Sur 11.2.3 on this Mac (for unrelated but important reasons) so it's also possible this issue would go away if and when I update to the latest macOS. I'm running Safari 14.0.3 with it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants