Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling Unmuted Autoplay on Specific Websites In Firefox #456

Open
PenguinSoupX opened this issue Jan 2, 2024 · 5 comments
Open

Enabling Unmuted Autoplay on Specific Websites In Firefox #456

PenguinSoupX opened this issue Jan 2, 2024 · 5 comments

Comments

@PenguinSoupX
Copy link

On Firefox, certain sites like aniwave.to automatically mute the audio when videos autoplay. It would be great if Global Speed could include an option to consistently unmute videos on specific websites when the extension is enabled.

Now, i can get around this by toggling mute with a shortcut but its a little tedious to do it everytime i visit a new page. Is there a way to force the video to unmute every time the page loads when the extension is turned on? Or, could there be a sound preset for unmute, similar to the speed presets? which acts globally instead of having to unmute each site individually.

The current issue in Firefox is that when the page is reloaded, the browser tends to mute the video, forgetting the user's previous unmute action. This behavior is not observed in Chrome where it seems to remember even if i reload the page with or without the extension.

@polywock
Copy link
Owner

polywock commented Jan 2, 2024

This javascript should work for most websites. You can add a URL rule that loads it on relevant sites. Let me know if there's any problems setting it up.

  1. Open options page and go down to URL Rules section.
  2. Create a URL rule.
  3. Enable 'ILO' so the script doesn't load twice.
  4. Click -- 0 -- to change the URL conditions.
  5. Add the websites you want the script to load on.
  6. Change the URL Rule's mode from 'speed' to 'javascript. Click edit, and paste in the javascript I provided below.
window.addEventListener('volumechange', e => {
    e.target.muted = false 
    e.defaultMuted = false 
}, true)

setTimeout(() => {
    document.querySelectorAll('video').forEach(v => {
       v.muted = false
       v.defaultMuted = false 
    })
}, 1000)

@PenguinSoupX
Copy link
Author

Thank you for reaching out this quickly but sadly this doesn't work.
This is a clip of the issue, which was made after adding the URL rule.
https://streamable.com/kmarv0

@polywock
Copy link
Owner

polywock commented Jan 3, 2024

Maybe this.

window.addEventListener('playing', e => {
    e.target.muted = false 
    e.defaultMuted = false 
}, true)

setTimeout(() => {
    document.querySelectorAll('video').forEach(v => {
       v.muted = false
       v.defaultMuted = false 
    })
}, 1000)

@PenguinSoupX
Copy link
Author

Awesome, this works
Thank you so much.

@PenguinSoupX
Copy link
Author

Just wanted to give a heads up for anyone running into this issue in the future, the script works but seems to have problem running along with Plasma Integration by KDE addon in Firefox on Linux.
So, when using the addon to unmute videos, it turns out the "enhanced media controls" option in preferences in the Plasma Integration messes with the script.
Just turn that off and it should work perfectly.
2024-01-03_10-15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants