Hiii Everyone,
This is the sample code for my audio play.It will buffer and start play in 10 secs after that it willnot play again the same audio this the scenario I tried.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>audio.js</title>
<script src="./audiojs/audio.min.js"></script>
<link rel="stylesheet" href="./includes/index.css" media="screen">
<style>
.play-pause {
display: none;
}
.audiojs {
width: 100%;
}
</style>
</head>
<body>
<header>
<h1>audio.js</h1>
</header>
<audio src="http://kolber.github.io/audiojs/demos/mp3/juicy.mp3" id="player"></audio>
<label id="audio_stats"></label>
<script>
var element = document.getElementById("player");
var settings = {
autoplay: false,
loop: false,
preload: true,
swfLocation: 'audiojs/audiojs.swf',
trackEnded: function (e) {
document.getElementById("audio_stats").innerText = "Completed...";
}
}
audiojs.events.ready(function () {
var a = audiojs.create(element, settings);
var count = 11;
var counter = setInterval(timer, 1000);
function timer() {
count = count - 1;
if (count <= 0) {
clearInterval(counter);
a.play();
document.getElementById("audio_stats").innerText = "Playing...";
return;
}
document.getElementById("audio_stats").innerText = "Will Start in " + count + " sec.";
}
});
</script>
</body>
</html>
And this is the reference https://kolber.github.io/audiojs/ In my site I have nearly 17 audio. Each div enclose with single audio. first div is having audio with id "player(means 1st audio)" similarly in 2nd div "player1(means 2nd audio)" audio will be there.for first div I will have one button with "next question" similarly for all 17 divs there will be previous and next button.What is the issue is all 17 audios are buffered and played simultaneously Instead "player(means 1st audio)" will start buffer once the page opened.And when I click next button second audio should start buffer.And if I press previous button "player(means 1st audio)" should not be play again because only one time It should play.Similarly it will work for all audio.If anybody give me solution for this Issue.It will be more helpful.Im struggling in this issue longtime.Please help me anyone.Thanks in advance.