diff options
Diffstat (limited to 'contrib/site/js/clappr-stats.min.js')
-rw-r--r-- | contrib/site/js/clappr-stats.min.js | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/contrib/site/js/clappr-stats.min.js b/contrib/site/js/clappr-stats.min.js deleted file mode 100644 index 2d79921..0000000 --- a/contrib/site/js/clappr-stats.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("Clappr")):"function"==typeof define&&define.amd?define(["Clappr"],t):"object"==typeof exports?exports.ClapprStats=t(require("Clappr")):e.ClapprStats=t(e.Clappr)}("undefined"!=typeof self?self:this,function(e){return function(e){function t(e){delete installedChunks[e]}function n(e){var t=document.getElementsByTagName("head")[0],n=document.createElement("script");n.type="text/javascript",n.charset="utf-8",n.src=f.p+""+e+"."+w+".hot-update.js",t.appendChild(n)}function r(e){return e=e||1e4,new Promise(function(t,n){if("undefined"==typeof XMLHttpRequest)return n(new Error("No browser support"));try{var r=new XMLHttpRequest,i=f.p+""+w+".hot-update.json";r.open("GET",i,!0),r.timeout=e,r.send(null)}catch(e){return n(e)}r.onreadystatechange=function(){if(4===r.readyState)if(0===r.status)n(new Error("Manifest request to "+i+" timed out."));else if(404===r.status)t();else if(200!==r.status&&304!==r.status)n(new Error("Manifest request to "+i+" failed."));else{try{var e=JSON.parse(r.responseText)}catch(e){return void n(e)}t(e)}}})}function i(e){var t=C[e];if(!t)return f;var n=function(n){return t.hot.active?(C[n]?C[n].parents.indexOf(e)<0&&C[n].parents.push(e):(T=[e],_=n),t.children.indexOf(n)<0&&t.children.push(n)):(console.warn("[HMR] unexpected require("+n+") from disposed module "+e),T=[]),f(n)};for(var r in f)Object.prototype.hasOwnProperty.call(f,r)&&"e"!==r&&Object.defineProperty(n,r,function(e){return{configurable:!0,enumerable:!0,get:function(){return f[e]},set:function(t){f[e]=t}}}(r));return n.e=function(e){function t(){N--,"prepare"===k&&(j[e]||l(e),0===N&&0===x&&d())}return"ready"===k&&s("prepare"),N++,f.e(e).then(t,function(e){throw t(),e})},n}function o(e){var t={_acceptedDependencies:{},_declinedDependencies:{},_selfAccepted:!1,_selfDeclined:!1,_disposeHandlers:[],_main:_!==e,active:!0,accept:function(e,n){if(void 0===e)t._selfAccepted=!0;else if("function"==typeof e)t._selfAccepted=e;else if("object"==typeof e)for(var r=0;r<e.length;r++)t._acceptedDependencies[e[r]]=n||function(){};else t._acceptedDependencies[e]=n||function(){}},decline:function(e){if(void 0===e)t._selfDeclined=!0;else if("object"==typeof e)for(var n=0;n<e.length;n++)t._declinedDependencies[e[n]]=!0;else t._declinedDependencies[e]=!0},dispose:function(e){t._disposeHandlers.push(e)},addDisposeHandler:function(e){t._disposeHandlers.push(e)},removeDisposeHandler:function(e){var n=t._disposeHandlers.indexOf(e);n>=0&&t._disposeHandlers.splice(n,1)},check:c,apply:p,status:function(e){if(!e)return k;P.push(e)},addStatusHandler:function(e){P.push(e)},removeStatusHandler:function(e){var t=P.indexOf(e);t>=0&&P.splice(t,1)},data:g[e]};return _=void 0,t}function s(e){k=e;for(var t=0;t<P.length;t++)P[t].call(null,e)}function a(e){return+e+""===e?+e:e}function c(e){if("idle"!==k)throw new Error("check() is only allowed in idle status");return b=e,s("check"),r(E).then(function(e){if(!e)return s("idle"),null;A={},j={},R=e.c,m=e.h,s("prepare");var t=new Promise(function(e,t){y={resolve:e,reject:t}});v={};return l(0),"prepare"===k&&0===N&&0===x&&d(),t})}function u(e,t){if(R[e]&&A[e]){A[e]=!1;for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(v[n]=t[n]);0==--x&&0===N&&d()}}function l(e){R[e]?(A[e]=!0,x++,n(e)):j[e]=!0}function d(){s("ready");var e=y;if(y=null,e)if(b)Promise.resolve().then(function(){return p(b)}).then(function(t){e.resolve(t)},function(t){e.reject(t)});else{var t=[];for(var n in v)Object.prototype.hasOwnProperty.call(v,n)&&t.push(a(n));e.resolve(t)}}function p(n){function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.indexOf(r)<0&&e.push(r)}}if("ready"!==k)throw new Error("apply() is only allowed in ready status");n=n||{};var i,o,c,u,l,d={},p=[],h={},_=function(){console.warn("[HMR] unexpected require("+b.moduleId+") to disposed module")};for(var y in v)if(Object.prototype.hasOwnProperty.call(v,y)){l=a(y);var b;b=v[y]?function(e){for(var t=[e],n={},i=t.slice().map(function(e){return{chain:[e],id:e}});i.length>0;){var o=i.pop(),s=o.id,a=o.chain;if((u=C[s])&&!u.hot._selfAccepted){if(u.hot._selfDeclined)return{type:"self-declined",chain:a,moduleId:s};if(u.hot._main)return{type:"unaccepted",chain:a,moduleId:s};for(var c=0;c<u.parents.length;c++){var l=u.parents[c],d=C[l];if(d){if(d.hot._declinedDependencies[s])return{type:"declined",chain:a.concat([l]),moduleId:s,parentId:l};t.indexOf(l)>=0||(d.hot._acceptedDependencies[s]?(n[l]||(n[l]=[]),r(n[l],[s])):(delete n[l],t.push(l),i.push({chain:a.concat([l]),id:l})))}}}}return{type:"accepted",moduleId:e,outdatedModules:t,outdatedDependencies:n}}(l):{type:"disposed",moduleId:y};var E=!1,O=!1,P=!1,x="";switch(b.chain&&(x="\nUpdate propagation: "+b.chain.join(" -> ")),b.type){case"self-declined":n.onDeclined&&n.onDeclined(b),n.ignoreDeclined||(E=new Error("Aborted because of self decline: "+b.moduleId+x));break;case"declined":n.onDeclined&&n.onDeclined(b),n.ignoreDeclined||(E=new Error("Aborted because of declined dependency: "+b.moduleId+" in "+b.parentId+x));break;case"unaccepted":n.onUnaccepted&&n.onUnaccepted(b),n.ignoreUnaccepted||(E=new Error("Aborted because "+l+" is not accepted"+x));break;case"accepted":n.onAccepted&&n.onAccepted(b),O=!0;break;case"disposed":n.onDisposed&&n.onDisposed(b),P=!0;break;default:throw new Error("Unexception type "+b.type)}if(E)return s("abort"),Promise.reject(E);if(O){h[l]=v[l],r(p,b.outdatedModules);for(l in b.outdatedDependencies)Object.prototype.hasOwnProperty.call(b.outdatedDependencies,l)&&(d[l]||(d[l]=[]),r(d[l],b.outdatedDependencies[l]))}P&&(r(p,[b.moduleId]),h[l]=_)}var N=[];for(o=0;o<p.length;o++)l=p[o],C[l]&&C[l].hot._selfAccepted&&N.push({module:l,errorHandler:C[l].hot._selfAccepted});s("dispose"),Object.keys(R).forEach(function(e){!1===R[e]&&t(e)});for(var j,A=p.slice();A.length>0;)if(l=A.pop(),u=C[l]){var S={},I=u.hot._disposeHandlers;for(c=0;c<I.length;c++)(i=I[c])(S);for(g[l]=S,u.hot.active=!1,delete C[l],delete d[l],c=0;c<u.children.length;c++){var M=C[u.children[c]];M&&((j=M.parents.indexOf(l))>=0&&M.parents.splice(j,1))}}var D,H;for(l in d)if(Object.prototype.hasOwnProperty.call(d,l)&&(u=C[l]))for(H=d[l],c=0;c<H.length;c++)D=H[c],(j=u.children.indexOf(D))>=0&&u.children.splice(j,1);s("apply"),w=m;for(l in h)Object.prototype.hasOwnProperty.call(h,l)&&(e[l]=h[l]);var B=null;for(l in d)if(Object.prototype.hasOwnProperty.call(d,l)&&(u=C[l])){H=d[l];var F=[];for(o=0;o<H.length;o++)if(D=H[o],i=u.hot._acceptedDependencies[D]){if(F.indexOf(i)>=0)continue;F.push(i)}for(o=0;o<F.length;o++){i=F[o];try{i(H)}catch(e){n.onErrored&&n.onErrored({type:"accept-errored",moduleId:l,dependencyId:H[o],error:e}),n.ignoreErrored||B||(B=e)}}}for(o=0;o<N.length;o++){var U=N[o];l=U.module,T=[l];try{f(l)}catch(e){if("function"==typeof U.errorHandler)try{U.errorHandler(e)}catch(t){n.onErrored&&n.onErrored({type:"self-accept-error-handler-errored",moduleId:l,error:t,orginalError:e,originalError:e}),n.ignoreErrored||B||(B=t),B||(B=e)}else n.onErrored&&n.onErrored({type:"self-accept-errored",moduleId:l,error:e}),n.ignoreErrored||B||(B=e)}}return B?(s("fail"),Promise.reject(B)):(s("idle"),new Promise(function(e){e(p)}))}function f(t){if(C[t])return C[t].exports;var n=C[t]={i:t,l:!1,exports:{},hot:o(t),parents:(O=T,T=[],O),children:[]};return e[t].call(n.exports,n,n.exports,i(t)),n.l=!0,n.exports}var h=window.webpackHotUpdateClapprStats;window.webpackHotUpdateClapprStats=function(e,t){u(e,t),h&&h(e,t)};var _,y,v,m,b=!0,w="bf811df379b6e7cd5f8d",E=1e4,g={},T=[],O=[],P=[],k="idle",x=0,N=0,j={},A={},R={},C={};return f.m=e,f.c=C,f.d=function(e,t,n){f.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},f.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(t,"a",t),t},f.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},f.p="latest/",f.h=function(){return w},i("./src/clappr-stats.js")(f.s="./src/clappr-stats.js")}({"./node_modules/lodash.get/index.js":function(e,t,n){"use strict";(function(t){function n(e,t){return null==e?void 0:e[t]}function r(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function i(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function o(){this.__data__=ve?ve(null):{}}function s(e){return this.has(e)&&delete this.__data__[e]}function a(e){var t=this.__data__;if(ve){var n=t[e];return n===$?void 0:n}return de.call(t,e)?t[e]:void 0}function c(e){var t=this.__data__;return ve?void 0!==t[e]:de.call(t,e)}function u(e,t){return this.__data__[e]=ve&&void 0===t?$:t,this}function l(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function d(){this.__data__=[]}function p(e){var t=this.__data__,n=g(t,e);return!(n<0)&&(n==t.length-1?t.pop():_e.call(t,n,1),!0)}function f(e){var t=this.__data__,n=g(t,e);return n<0?void 0:t[n][1]}function h(e){return g(this.__data__,e)>-1}function _(e,t){var n=this.__data__,r=g(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}function y(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function v(){this.__data__={hash:new i,map:new(ye||l),string:new i}}function m(e){return x(this,e).delete(e)}function b(e){return x(this,e).get(e)}function w(e){return x(this,e).has(e)}function E(e,t){return x(this,e).set(e,t),this}function g(e,t){for(var n=e.length;n--;)if(M(e[n][0],t))return n;return-1}function T(e,t){t=j(t,e)?[t]:k(t);for(var n=0,r=t.length;null!=e&&n<r;)e=e[C(t[n++])];return n&&n==r?e:void 0}function O(e){return!(!H(e)||R(e))&&(D(e)||r(e)?fe:te).test(S(e))}function P(e){if("string"==typeof e)return e;if(F(e))return be?be.call(e):"";var t=e+"";return"0"==t&&1/e==-Y?"-0":t}function k(e){return Ee(e)?e:we(e)}function x(e,t){var n=e.__data__;return A(t)?n["string"==typeof t?"string":"hash"]:n.map}function N(e,t){var r=n(e,t);return O(r)?r:void 0}function j(e,t){if(Ee(e))return!1;var n=void 0===e?"undefined":G(e);return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!F(e))||(J.test(e)||!K.test(e)||null!=t&&e in Object(t))}function A(e){var t=void 0===e?"undefined":G(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function R(e){return!!ue&&ue in e}function C(e){if("string"==typeof e||F(e))return e;var t=e+"";return"0"==t&&1/e==-Y?"-0":t}function S(e){if(null!=e){try{return le.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function I(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError(q);var n=function n(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s),s};return n.cache=new(I.Cache||y),n}function M(e,t){return e===t||e!==e&&t!==t}function D(e){var t=H(e)?pe.call(e):"";return t==V||t==W}function H(e){var t=void 0===e?"undefined":G(e);return!!e&&("object"==t||"function"==t)}function B(e){return!!e&&"object"==(void 0===e?"undefined":G(e))}function F(e){return"symbol"==(void 0===e?"undefined":G(e))||B(e)&&pe.call(e)==z}function U(e){return null==e?"":P(e)}function L(e,t,n){var r=null==e?void 0:T(e,t);return void 0===r?n:r}var G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},q="Expected a function",$="__lodash_hash_undefined__",Y=1/0,V="[object Function]",W="[object GeneratorFunction]",z="[object Symbol]",K=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,J=/^\w*$/,X=/^\./,Q=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Z=/[\\^$.*+?()[\]{}|]/g,ee=/\\(\\)?/g,te=/^\[object .+?Constructor\]$/,ne="object"==(void 0===t?"undefined":G(t))&&t&&t.Object===Object&&t,re="object"==("undefined"==typeof self?"undefined":G(self))&&self&&self.Object===Object&&self,ie=ne||re||Function("return this")(),oe=Array.prototype,se=Function.prototype,ae=Object.prototype,ce=ie["__core-js_shared__"],ue=function(){var e=/[^.]+$/.exec(ce&&ce.keys&&ce.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),le=se.toString,de=ae.hasOwnProperty,pe=ae.toString,fe=RegExp("^"+le.call(de).replace(Z,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),he=ie.Symbol,_e=oe.splice,ye=N(ie,"Map"),ve=N(Object,"create"),me=he?he.prototype:void 0,be=me?me.toString:void 0;i.prototype.clear=o,i.prototype.delete=s,i.prototype.get=a,i.prototype.has=c,i.prototype.set=u,l.prototype.clear=d,l.prototype.delete=p,l.prototype.get=f,l.prototype.has=h,l.prototype.set=_,y.prototype.clear=v,y.prototype.delete=m,y.prototype.get=b,y.prototype.has=w,y.prototype.set=E;var we=I(function(e){e=U(e);var t=[];return X.test(e)&&t.push(""),e.replace(Q,function(e,n,r,i){t.push(r?i.replace(ee,"$1"):n||e)}),t});I.Cache=y;var Ee=Array.isArray;e.exports=L}).call(t,n("./node_modules/webpack/buildin/global.js"))},"./node_modules/webpack/buildin/global.js":function(e,t,n){"use strict";var r,i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"===("undefined"==typeof window?"undefined":i(window))&&(r=window)}e.exports=r},"./src/clappr-stats.js":function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,r)}if("value"in i)return i.value;var s=i.get;if(void 0!==s)return s.call(r)},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n("clappr"),u=n("./node_modules/lodash.get/index.js"),l=function(e){return e&&e.__esModule?e:{default:e}}(u),d=function(e){function t(e){r(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n._runEach=(0,l.default)(e,"options.clapprStats.runEach",5e3),n._onReport=(0,l.default)(e,"options.clapprStats.onReport",n._defaultReport),n._uriToMeasureLatency=(0,l.default)(e,"options.clapprStats.uriToMeasureLatency"),n._urisToMeasureBandwidth=(0,l.default)(e,"options.clapprStats.urisToMeasureBandwidth"),n._runBandwidthTestEvery=(0,l.default)(e,"options.clapprStats.runBandwidthTestEvery",10),n._bwMeasureCount=0,n._completion={watch:(0,l.default)(e,"options.clapprStats.onCompletion",[]),calls:[]},n._newMetrics(),n.on(t.REPORT_EVENT,n._onReport),n}return o(t,e),a(t,[{key:"_now",value:function(){return window.performance&&"function"==typeof window.performance.now?window.performance.now():new Date}},{key:"_inc",value:function(e){this._metrics.counters[e]+=1}},{key:"_timerHasStarted",value:function(e){return void 0!==this["_start"+e]}},{key:"_start",value:function(e){this["_start"+e]=this._now()}},{key:"_stop",value:function(e){this._metrics.timers[e]+=this._now()-this["_start"+e]}},{key:"_defaultReport",value:function(e){console.log(e)}},{key:"name",get:function(){return"clappr_stats"}},{key:"_playbackName",get:function(){return this.container.playback.name}},{key:"_playbackType",get:function(){return this.container.getPlaybackType()}}]),a(t,[{key:"bindEvents",value:function(){var e=this;this.listenTo(this.container,c.Events.CONTAINER_BITRATE,this.onBitrate),this.listenTo(this.container,c.Events.CONTAINER_STOP,this.stopReporting),this.listenTo(this.container,c.Events.CONTAINER_ENDED,this.stopReporting),this.listenToOnce(this.container.playback,c.Events.PLAYBACK_PLAY_INTENT,this.startTimers),this.listenToOnce(this.container,c.Events.CONTAINER_PLAY,this.onFirstPlaying),this.listenTo(this.container,c.Events.CONTAINER_PLAY,this.onPlay),this.listenTo(this.container,c.Events.CONTAINER_PAUSE,this.onPause),this.listenToOnce(this.container,c.Events.CONTAINER_STATE_BUFFERING,this.onBuffering),this.listenTo(this.container,c.Events.CONTAINER_SEEK,this.onSeek),this.listenTo(this.container,c.Events.CONTAINER_ERROR,function(){return e._inc("error")}),this.listenTo(this.container,c.Events.CONTAINER_FULLSCREEN,function(){return e._inc("fullscreen")}),this.listenTo(this.container,c.Events.CONTAINER_PLAYBACKDVRSTATECHANGED,function(t){t&&e._inc("dvrUsage")}),this.listenTo(this.container.playback,c.Events.PLAYBACK_PROGRESS,this.onProgress),this.listenTo(this.container.playback,c.Events.PLAYBACK_TIMEUPDATE,this.onTimeUpdate)}},{key:"destroy",value:function(){this.stopReporting(),s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}},{key:"onBitrate",value:function(e){var t=parseInt((0,l.default)(e,"bitrate",0),10),n=this._now();if(this._metrics.extra.bitratesHistory.length>0){var r=this._metrics.extra.bitratesHistory[this._metrics.extra.bitratesHistory.length-1];r.end=n,r.time=n-r.start}this._metrics.extra.bitratesHistory.push({start:this._now(),bitrate:t}),this._inc("changeLevel")}},{key:"stopReporting",value:function(){this._buildReport(),clearInterval(this._intervalId),this._newMetrics(),this.stopListening(),this.bindEvents()}},{key:"startTimers",value:function(){this._intervalId=setInterval(this._buildReport.bind(this),this._runEach),this._start("session"),this._start("startup")}},{key:"onFirstPlaying",value:function(){this.listenTo(this.container,c.Events.CONTAINER_TIMEUPDATE,this.onContainerUpdateWhilePlaying),this._start("watch"),this._stop("startup")}},{key:"playAfterPause",value:function(){this.listenTo(this.container,c.Events.CONTAINER_TIMEUPDATE,this.onContainerUpdateWhilePlaying),this._stop("pause"),this._start("watch")}},{key:"onPlay",value:function(){this._inc("play")}},{key:"onPause",value:function(){this._stop("watch"),this._start("pause"),this._inc("pause"),this.listenToOnce(this.container,c.Events.CONTAINER_PLAY,this.playAfterPause),this.stopListening(this.container,c.Events.CONTAINER_TIMEUPDATE,this.onContainerUpdateWhilePlaying)}},{key:"onSeek",value:function(e){this._inc("seek"),this._metrics.extra.watchHistory.push([1e3*e,1e3*e])}},{key:"onTimeUpdate",value:function(e){var t=1e3*e.current,n=1e3*e.total,r=this._metrics.extra.watchHistory.length;if(this._metrics.extra.duration=n,this._metrics.extra.currentTime=t,this._metrics.extra.watchedPercentage=t/n*100,0===r?this._metrics.extra.watchHistory.push([t,t]):this._metrics.extra.watchHistory[r-1][1]=t,this._metrics.extra.bitratesHistory.length>0){var i=this._metrics.extra.bitratesHistory[this._metrics.extra.bitratesHistory.length-1];i.end||(i.time=this._now()-i.start)}this._onCompletion()}},{key:"onContainerUpdateWhilePlaying",value:function(){this.container.playback.isPlaying()&&(this._stop("watch"),this._start("watch"))}},{key:"onBuffering",value:function(){this._inc("buffering"),this._start("buffering"),this.listenToOnce(this.container,c.Events.CONTAINER_STATE_BUFFERFULL,this.onBufferfull)}},{key:"onBufferfull",value:function(){this._stop("buffering"),this.listenToOnce(this.container,c.Events.CONTAINER_STATE_BUFFERING,this.onBuffering)}},{key:"onProgress",value:function(e){this._metrics.extra.buffersize=1e3*e.current}},{key:"_newMetrics",value:function(){this._metrics={counters:{play:0,pause:0,error:0,buffering:0,decodedFrames:0,droppedFrames:0,fps:0,changeLevel:0,seek:0,fullscreen:0,dvrUsage:0},timers:{startup:0,watch:0,pause:0,buffering:0,session:0,latency:0},extra:{playbackName:"",playbackType:"",bitratesHistory:[],bitrateWeightedMean:0,bitrateMostUsed:0,buffersize:0,watchHistory:[],watchedPercentage:0,bufferingPercentage:0,bandwidth:0,duration:0,currentTime:0}}}},{key:"_onCompletion",value:function(){var e=this._metrics.extra.watchedPercentage,n=this._completion.watch,r=-1!=this._completion.calls.indexOf(e);-1==n.indexOf(e)||r||(c.Log.info(this.name+" PERCENTAGE_EVENT: "+e),this._completion.calls.push(e),this.trigger(t.PERCENTAGE_EVENT,e))}},{key:"_buildReport",value:function(){this._stop("session"),this._start("session"),this._metrics.extra.playbackName=this._playbackName,this._metrics.extra.playbackType=this._playbackType,this._calculateBitrates(),this._calculatePercentages(),this._fetchFPS(),this._measureLatency(),this._measureBandwidth(),this.trigger(t.REPORT_EVENT,JSON.parse(JSON.stringify(this._metrics)))}},{key:"_fetchFPS",value:function(){var e={html5_video:this._html5FetchFPS,hls:this._html5FetchFPS,dash_shaka_playback:this._html5FetchFPS};e[this._playbackName]&&e[this._playbackName].call(this)}},{key:"_calculateBitrates",value:function(){var e=this._metrics.extra.bitratesHistory.map(function(e){return e.time}).reduce(function(e,t){return e+t},0);this._metrics.extra.bitrateWeightedMean=this._metrics.extra.bitratesHistory.map(function(e){return e.bitrate*e.time}).reduce(function(e,t){return e+t},0)/e,this._metrics.extra.bitratesHistory.length>0&&(this._metrics.extra.bitrateMostUsed=this._metrics.extra.bitratesHistory.slice().sort(function(e,t){return e.time<t.time})[0].bitrate)}},{key:"_calculatePercentages",value:function(){this._metrics.extra.duration>0&&(this._metrics.extra.bufferingPercentage=this._metrics.timers.buffering/this._metrics.extra.duration*100)}},{key:"_html5FetchFPS",value:function(){var e=this.container.playback.el,t=e.webkitDecodedFrameCount||e.mozDecodedFrames||0,n=e.webkitDroppedFrameCount||e.mozParsedFrames-e.mozDecodedFrames||0,r=t-(this._lastDecodedFramesCount||0);this._metrics.counters.decodedFrames=t,this._metrics.counters.droppedFrames=n,this._metrics.counters.fps=r/(this._runEach/1e3),this._lastDecodedFramesCount=t}},{key:"_measureLatency",value:function(){var e=this;if(this._uriToMeasureLatency){var t,n=[],r=function(){t=n[2]-n[1],e._metrics.timers.latency=t};!function t(){if(n.push(e._now()),n.length>2)r();else{var i=new Image;i.onload=t,i.src=e._uriToMeasureLatency+"?"+Math.random()+"="+e._now()}}()}}},{key:"_measureBandwidth",value:function(){var e=this;if(this._urisToMeasureBandwidth&&this._bwMeasureCount%this._runBandwidthTestEvery==0){var t=0,n=function(n){var r=(e._urisToMeasureBandwidth[t-1].end-e._urisToMeasureBandwidth[t-1].start)/1e3,i=8*n.loaded/r;e._metrics.extra.bandwidth=i,e._urisToMeasureBandwidth.forEach(function(e){e.start=0,e.end=0,e.expired=!1,clearTimeout(e.timer)})};!function r(i){if(t>0&&(e._urisToMeasureBandwidth[t-1].end=e._now(),clearTimeout(e._urisToMeasureBandwidth[t-1].timer)),t>=e._urisToMeasureBandwidth.length||t>0&&e._urisToMeasureBandwidth[t-1].expired)n(i);else{var o=new XMLHttpRequest;o.open("GET",e._urisToMeasureBandwidth[t].url,!0),o.responseType="arraybuffer",o.onload=o.onabort=r,e._urisToMeasureBandwidth[t].start=e._now(),e._urisToMeasureBandwidth[t].timer=setTimeout(function(t){e._urisToMeasureBandwidth[t].expired=!0,o.abort()},e._urisToMeasureBandwidth[t].timeout,t),o.send()}t++}()}this._bwMeasureCount++}}]),t}(c.ContainerPlugin);t.default=d,d.REPORT_EVENT="clappr:stats:report",d.PERCENTAGE_EVENT="clappr:stats:percentage",e.exports=t.default},clappr:function(t,n){t.exports=e}})});
\ No newline at end of file |