- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, im trying to use the timeupdate eventlistener for make a time music played, but time is not started.
The code im currently using is:
===HTML===
<span id="curtimeText">00:00</span>
===Javascript===
audio = new Audio();
audio.src = "http://streamRadioURL/;stream.mp3";
audio.addEventListener("timeupdate", function(){ seektimeupdate(); });
function seektimeupdate(){
var curmins = Math.floor(audio.currentTime / 60);
var cursecs = Math.floor(audio.currentTime - curmins * 60);
if(cursecs < 10){ cursecs = "0"+cursecs; }
if(curmins < 10){ curmins = "0"+curmins; }
var waktu = curmins+":"+cursecs;
alert(waktu);
}
This wont however work.
Thank you before.
- Tags:
- HTML5
- Intel® XDK
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Update:
function seektimeupdate(){
var curmins = Math.floor(audio.currentTime / 60);
var cursecs = Math.floor(audio.currentTime - curmins * 60);
if(cursecs < 10){ cursecs = "0"+cursecs; }
if(curmins < 10){ curmins = "0"+curmins; }
var waktu = curmins+":"+cursecs;
$("#curtimeText").text(waktu);
}
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page