how to restart an mp3 file in javascript -
i having problem restarting mp3 file. have next event handler set trigger when space key pressed. have sound tag element stored in aud:
var isplaying=false; var h=function(e){ console.log('confirm event has triggered'); if(e.keycode==32){ if(isplaying){ aud.pause(); aud.currenttime=0; isplaying=false; }else{ aud.play(); isplaying=true; } } }; the first time press space sound begins playing fine. sec time press space sound pauses expected. 3rd time press space expecting sound restart beginning, instead continues point paused. if currenttime unsupported. using chrome.
it turns out problem node server did not serve byte ranges. apparently chrome ignores playback features unless server capable in way.
javascript mp3 html5-audio
No comments:
Post a Comment