Html5 audio can't play again after it stopped -


i declare audio file in page:

var audio = new audio('my.mp3'); 

then use click event play it:

$(document).click(function () {     audio.currenttime = 0; // make sure play begain     audio.play();     }) 

it can play @ first click time, after ended, click document, can not play again.how can let play again?

i tested in chrome , exception occurs due audio.currenttime statement.

this worked (also in ie9):

$(document).click(function () {     audio.src = "my.mp3";     audio.play();  }) 

Comments

Popular posts from this blog

Glib GIOChannel -

jsp - java.sql.SQLException: [Microsoft][ODBC Microsoft Access > Driver] Too few parameters. Expected 1 -

delphi - When I encode/decode SMS PDU (GSM 7 Bit) user data, do I need prepend the UDH first? -