← All Articles

Autoplay Twitter videos with sound

Posted on

It might be annoying scroll Twitter videos and click on each to hear sound. Here is the quick hack. It will unmute video when you hover and mute again when your cursor is out video.

  1. Install Custom JavaScript for websites plugin
  2. Go to twitter.com
  3. Open Custom JavaScript for websites plugin and paste this code:
window.addEventListener('mouseover', ({ target }) => {
  if (target.tagName === 'VIDEO') {
    target.muted = false
  }
})

window.addEventListener('mouseout', ({ target }) => {
  if (target.tagName === 'VIDEO') {
    target.muted = true
  }
})
productivitytwitterjavascript