I am using JPlayer js library as an audio player. I want to change the content of a div at specific time of the song. In the code below currentTime
has the time.
I want to make something like
if currentTime=='00:15' alert('track is now on 15th second');
if currentTime=='00:45' alert('track is now on 45th second');
if currentTime=='01:20' alert('track is now on 01:20th second');
if currentTime=='02:15' alert('track is now on 02:15th second');
But i'm unable to take curretnTime
as a variable or assign its value to a variable. I'm newbie in js. Below is the actual code from jplayer
<script type="text/javascript">
var current_time;
$(document).ready(function(){
$("#jquery_jplayer_1").jPlayer({
ready: function () {
$(this).jPlayer("setMedia", {
title: "Bubble",
m4a: "http://www.jplayer.org/audio/m4a/Miaow-07-Bubble.m4a",
oga: "http://www.jplayer.org/audio/ogg/Miaow-07-Bubble.ogg"
});
},
cssSelectorAncestor: "#jp_container_1",
swfPath: "/js",
supplied: "mp3, oga",
useStateClassSkin: true,
autoBlur: false,
smoothPlayBar: true,
keyEnabled: true,
remainingDuration: true,
toggleDuration: true,
cssSelectorAncestor: "",
cssSelector: {
currentTime: "#state1",
}
});
});
</script>