javascript - how to check audio tag load file complete -


i play audio file using audio tag in html 5 duration of file 20 second. when open page, duration of audio tag 14 second. refresh page. can see duration change 14 sec or 20 sec. don't know why. , when file not loaded completely, can't control player. click play bar, not control

in other case, file load completely, can control currenttime , play(). file not loaded completely, can use play file 1 time, not control it

how sure file load always?

you may check using 'onloadeddata', add listener

<audio onloadeddata="dothisonload()"> </audio> 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

xcode - Swift Playground - Files are not readable -

jboss7.x - JBoss AS 7.3 vs 7.4 and differences -