My JQuery API for skin & functionality customization of html5 video works fine in all browsers.
But IE9 and Opera throws one error message when the buffered value of the video get called. The coding is:
var buffertime = $hdVideo[0].buffered.end(0);
The Error message in Opera is:
Uncaught exception: [object DOMException]
Error thrown at line 208, column 16 in () in localhost/hd-videos/version1.0.d/scripts/hd-video.js:
var buffertime = $hdVideo[0].buffered.end(0);
called from line 55, column 294 in (a) in localhost/hd-videos/version1.0.d/scripts/jquery-1.4.2.min.js:
i=i.handler.apply(this,arguments);
called via Function.prototype.apply() from line 49, column 569 in () in localhost/hd-videos/version1.0.d/scripts/jquery-1.4.2.min.js:
return typeof c!==”undefined”&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w
In IE9:
SCRIPT87: Invalid argument.
hd-video.js, line 208 character 17
What is the right way to get buffered value?
You have to check 2 things:
The length of the buffered property
var buffertime = ($hdVideo[0].buffered && $hdVideo[0].buffered.length) ? $hdVideo[0].buffered.end(0) || 0;//add 0 or $hdVideo[0].duration