0

I am using the audio element of html in my website. It is working fine, but when I pause the player and go to another page, it restart from the beginning which I do not want. How can I use the common control of audio player for the website? I am new in html multimedia operations, and can not figure this out.

Html code is as follows:

<audio controls>
   <source src="lotus_feet.ogg" type="audio/ogg">
   <source src="lotus_feet.mp3" type="audio/mpeg">
</audio>

Any ideas would be much appreciated.

Thanks in advance.

MitulP91
  • 1,279
  • 2
  • 12
  • 24
Amit Jha
  • 331
  • 1
  • 11
  • You can use custom javascript by adding a button and onclick="document.getElementByTagName("audio")[0].pause();" – Angela Aug 12 '13 at 09:13
  • Thanks Angela, I tried this. In such case when I go to another page player restart from the beginning. – Amit Jha Aug 12 '13 at 09:16
  • 1
    Sorry I missed that. In this case, a cookie or some kind of user info is probably required (since localstorage is no longer supported). As for setting the play cursor, see this thread http://stackoverflow.com/questions/9563887/setting-html5-audio-position – Angela Aug 12 '13 at 09:19
  • http://www.w3schools.com/tags/ref_av_dom.asp check this out as well. – nyzm Aug 12 '13 at 09:23

0 Answers0