1

I would like to add a play button somewhere on the page, and when they click it, the player at the bottom will play also, then the play button will disappear. Is that possible? Thanks.

tmv1845331
  • 71
  • 2
  • 10

1 Answers1

1

You need a little bit JavaScript code.
Add an event-listener for the button, select the audio-tag (your player) and call the play-method. Then hide the button with the css-property "display: none;" or "visibility: hidden;" (also with JavaScript).

<button onclick="document.getElementsByTagName('audio')[0].play(); this.style.visibility = 'hidden';">play</button>
<audio controls src="demo.mp3"></audio>
Martin Wantke
  • 3,250
  • 26
  • 16