javascript - detect an error on html5 video -
i trying detect when there error on playing video in html5.
to more specific, use case when 1 trying play hls video in mac (so "canplaytype" @ least "maybe") - yet reason video not play.
i have tried listening 'error' event on video tag. doesn't work. in fact, 'error' event not firing if use invalid url source! (see demo here: http://mockup.on.aol.com/yogev/hls.html)
could please help?
thanks!
you should add error event listener before set source of video. so, if add after error listener, error callback:
document.getelementsbytagname('video')[0].src='https://somefalseurl.mp4';
your current demo page creating error listener after error has passed.
Comments
Post a Comment