0

What I'm trying to achieve is: Using one controls of audio-player, play 2-3 or more tracks at once. This means that for example if I have 1track.mp3, 2track.mp3, when play button is clicked, they both get played etc. Unfortunatly i cant share any code now, because i really dont have anything that looks good, if you can give a raw example it would be great! Cheers!
P.s: jquery might be used, its okey. But flash is not allowed!

What I have now is two tags, which is incorrect...

<audio id='player_audio' controls>
  <source src="fhg_pianomp3.ogg" type="audio/ogg">
  <source src="fhg_pianomp3.mp3" type="audio/mpeg">
  <source src="fhg_bassmp3.ogg" type="audio/ogg">
  <source src="fhg_bassmp3.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio> 
<audio id='player_audio1' controls>
  <source src="fhg_bassmp3.ogg" type="audio/ogg">
  <source src="fhg_bassmp3.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio> 
4

1 回答 1

1

It would be possible to generate own buttons and trigger the play and pause events via javascript.

var player1 = document.getElementById('firstPlayer');
var player2 = document.getElementById('secondPlayer');
document.getElementById('yourPlayButton').onclick = function() {
  player1.play();
  player2.play();
}
于 2012-12-01T11:30:49.167 回答