Lines Matching refs:element

9   // MediaMetric class responsible for collecting metrics on a media element.
11 function MediaMetricBase(element) {
12 checkElementIsNotBound(element);
15 this.element = element;
29 function HTMLMediaMetric(element) {
30 MediaMetricBase.prototype.constructor.call(this, element);
31 // Set the basic event handlers for HTML5 media element.
40 this.element.addEventListener('play', onVideoLoad);
41 this.element.addEventListener('loadedmetadata', onVideoLoad);
42 this.element.addEventListener('playing', function(e) {
45 this.element.addEventListener('ended', function(e) {
51 this.element.addEventListener('willPlay', function (e) {
54 this.element.addEventListener('willSeek', function (e) {
57 this.element.addEventListener('willLoop', function (e) {
66 if (this.element.id)
67 this.id = this.element.id;
68 else if (this.element.src)
69 this.id = this.element.src.substring(this.element.src.lastIndexOf("/")+1);
88 this.element.addEventListener('seeked', onSeeked);
97 var idealDuration = metric.element.duration * loopCount;
103 this.element.addEventListener('endLoop', onEndLoop);
123 this.metrics['buffering_time'] = time_to_end - this.element.duration * 1000;
127 var decodedFrames = this.element.webkitDecodedFrameCount;
128 var droppedFrames = this.element.webkitDroppedFrameCount;
135 this.element.webkitVideoDecodedByteCount || 0;
137 this.element.webkitAudioDecodedByteCount || 0;
141 function MediaMetric(element) {
142 if (element instanceof HTMLMediaElement)
143 return new HTMLMediaMetric(element);
144 throw new Error('Unrecognized media element type.');
163 function checkElementIsNotBound(element) {
164 if (!element)
166 if (getMediaMetric(element))
167 throw new Error('Can not create MediaMetric for same element twice.');
170 function getMediaMetric(element) {
172 if (window.__mediaMetrics[i].element == element)