0

A stream I set up has an autoplay feature through its streaming provider, but it only applies to video. Audio (on the right channel) remains muted until the user clicks unmute. I want the audio to autoplay as well.

I figure simulating a click on the mute button on page load would do what I want. But doing this in console gives a click is undefined error. Why is this?

document.getElementsByClassName("vjs-mute-control").click
calyxofheld
  • 1,538
  • 3
  • 24
  • 62

1 Answers1

1

document.getElementsByClassName returns an array, so you probably should do

document.getElementsByClassName('classname')[0].click

unlike the document.getElementById which returns one item

Raz Buchnik
  • 7,753
  • 14
  • 53
  • 96