Reputation: 69
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.
Upvotes: 1
Views: 201
Reputation: 4571
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>
Upvotes: 1