These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:13 pm Advanced search

Audio control with html5

If you are stuck or have questions regarding HTML or other Web technologies, ask your questions here. No question too dumb!

Audio control with html5

Postby SerP » Sun Feb 02, 2014 4:28 pm

The project I am doing needs to containers to be in line with each other where in container #1 will be full audio control and in container #2 will be just play/pause button so if I am clicking play button any media that plays now will stop and a new media will start playing.
I have managed two containers but struggle with audio control. Anyone can help me please?

www.nalchemymusic.comuf.com
SerP
<h6>
 
Posts: 1
Joined: Sun Feb 02, 2014 4:26 pm

Re: Audio control with html5

Postby zcorpan » Tue Feb 04, 2014 2:40 pm

Not sure what you mean with the containers. Do you mean container as in audio format?

As to the controls, you need to invoke pause() on the currently playing audio element. You can do that something like this:

Code: Select all
addEventListener('play', function(e) {
  if (window.currentAudio && window.currentAudio != e.target) {
    window.currentAudio.pause();
  }
  window.currentAudio = e.target;
}, true);
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden


Return to Help & Advice

Who is online

Users browsing this forum: No registered users and 0 guests