javascript - "'undefined' is not an object" error on audio ended property -



javascript - "'undefined' is not an object" error on audio ended property -

i'm using sound element in html5 , checking see if played sound has ended. seems work fine inspector in safari 7 reporting error:

typeerror: 'undefined' not object (evaluating 'audioplayer.ended')

outside of function, have sound player variable stated:

var audioplayer;

in window.onload function, define audioplayer variable audioplayer element:

window.onload = function() { audioplayer = document.getelementbyid('audioplayer'); }

in html's body element, have sound element defined proper id:

<audio id='audioplayer'> <source id='mp3audiosource' source='north pole promise clip 1.mp3' type='audio/mpeg'> please update browser back upwards sound playback. </audio>

if open error details, reports timervariable "anonymous function"

var timervar = setinterval(function(){timer()}, 10);

update

i found out setinterval function defined outside of window.onload, , function interval calls has elements depends on using may not defined until page total loaded.

javascript html audio

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -