0

I am using bootstrap to build my website and I would like a little bit of flare added to it. I have read some stuff on here but couldn't find exactly what I want.

  1. glyphicon-volume-up to right of the navbar-header.
  2. music autoplay once site visited
  3. volume default to 50%
  4. switches between glyphicon-volume-off/glyphicon-volume-up (unmute and mute)
Philip Kirkbride
  • 21,381
  • 38
  • 125
  • 225
J V
  • 27
  • 7

1 Answers1

2

You should use the HTML audio tag

<audio controls autoplay>
  <source src="horse.ogg" type="audio/ogg">
  <source src="horse.mp3" type="audio/mpeg">
  Your browser does not support the audio tag.
</audio

You can try it here. Add the autoplay I have above when you go to the link and refresh.

Note: You can also use CSS to hide the audio player and write custom javascript to control the audio with your own buttons.

Community
  • 1
  • 1
Philip Kirkbride
  • 21,381
  • 38
  • 125
  • 225
  • 1
    Note that if you create the element using JS you don't even have to put it on the DOM tree in order to play the audio. – iMoses Mar 27 '16 at 05:55