1

I would like to have a button that will play an audio file. The icon of the button will change if the file is playing or stopped. This is what the code for the button looks like

play_circle_filled

If the JS could use getellimentbyID to change the button. The bit I can seem to do is the toggling for play to stopped. All help will be much appreciated. Thanks James

1 Answers1

0

This is a basic code to play audio in html5

<audio id="player">
  <source src="myfile.mp3" />
</audio>

Then in your script, you can run this when the button is pressed:

document.getElementById('player').play();
sg.cc
  • 1,726
  • 19
  • 41