diff --git a/bin/videojs_4.vast.vpaid.js b/bin/videojs_4.vast.vpaid.js index 0440f149..2382a708 100644 --- a/bin/videojs_4.vast.vpaid.js +++ b/bin/videojs_4.vast.vpaid.js @@ -1219,13 +1219,12 @@ function stringEndsWith(string, search) { } function hideFlashEl(el) { - // can't use display none because will not run the flash + // can't use display none or visibility none because will block flash in some browsers el.style.position = 'absolute'; el.style.left = '-1px'; el.style.top = '-1px'; el.style.width = '1px'; el.style.height = '1px'; - el.style.visibility = 'hidden'; } },{}],9:[function(require,module,exports){ @@ -6824,4 +6823,4 @@ videojs.plugin('vastClient', videoJsVAST); },{"./plugin/components/ads-label_4":35,"./plugin/components/black-poster_4":37,"./plugin/videojs.vast.vpaid":38}]},{},[46]) -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJib3dlcl9jb21wb25lbnRzL1ZQQUlERkxBU0hDbGllbnQvanMvSVZQQUlEQWRVbml0LmpzIiwiYm93ZXJfY29tcG9uZW50cy9WUEFJREZMQVNIQ2xpZW50L2pzL1ZQQUlEQWRVbml0LmpzIiwiYm93ZXJfY29tcG9uZW50cy9WUEFJREZMQVNIQ2xpZW50L2pzL1ZQQUlERkxBU0hDbGllbnQuanMiLCJib3dlcl9jb21wb25lbnRzL1ZQQUlERkxBU0hDbGllbnQvanMvZmxhc2hUZXN0ZXIuanMiLCJib3dlcl9jb21wb25lbnRzL1ZQQUlERkxBU0hDbGllbnQvanMvanNGbGFzaEJyaWRnZS5qcyIsImJvd2VyX2NvbXBvbmVudHMvVlBBSURGTEFTSENsaWVudC9qcy9qc0ZsYXNoQnJpZGdlUmVnaXN0cnkuanMiLCJib3dlcl9jb21wb25lbnRzL1ZQQUlERkxBU0hDbGllbnQvanMvcmVnaXN0cnkuanMiLCJib3dlcl9jb21w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ZShrZXkpO1xuICAgICAgICB9KTtcbiAgICB9XG5cbiAgICByZW1vdmVBbGxDYWxsYmFja3MoKSB7XG4gICAgICAgIHJldHVybiB0aGlzLl9jYWxsYmFja3MucmVtb3ZlQWxsKCk7XG4gICAgfVxuXG4gICAgX3RyaWdnZXIoZXZlbnROYW1lLCBldmVudCkge1xuICAgICAgICB0aGlzLl9oYW5kbGVycy5nZXQoZXZlbnROYW1lKS5mb3JFYWNoKChjYWxsYmFjaykgPT4ge1xuICAgICAgICAgICAgLy9jbGlja1RocnUgaGFzIHRvIGJlIHN5bmMsIGlmIG5vdCB3aWxsIGJlIGJsb2NrIGJ5IHRoZSBwb3B1cGJsb2NrZXJcbiAgICAgICAgICAgIGlmIChldmVudE5hbWUgPT09ICdBZENsaWNrVGhydScpIHtcbiAgICAgICAgICAgICAgICBjYWxsYmFjayhldmVudCk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5faGFuZGxlcnMuZ2V0KGV2ZW50TmFtZSkubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2soZXZlbnQpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSwgMCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgIH1cblxuICAgIF9jYWxsQ2FsbGJhY2sobWV0aG9kTmFtZSwgY2FsbGJhY2tJRCwgZXJyLCByZXN1bHQpIHtcblxuICAgICAgICBsZXQgY2FsbGJhY2sgPSB0aGlzLl9jYWxsYmFja3MuZ2V0KGNhbGxiYWNrSUQpO1xuXG4gICAgICAgIC8vbm90IGFsbCBtZXRob2RzIGNhbGxiYWNrJ3MgYXJlIG1hbmRhdG9yeVxuICAgICAgICAvL2J1dCBpZiB0aGVyZSBleGlzdCBhbiBlcnJvciwgZmlyZSB0aGUgZXJyb3Ig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PSAnZW5kZWQnKSB7XG4gICAgICAgICAgICBwbGF5ZXIudHJpZ2dlcigndmFzdC5jb250ZW50RW5kJyk7XG4gICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgIH0pO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIGNoZWNrQWRzRW5hYmxlZChuZXh0KSB7XG4gICAgICBpZiAoc2V0dGluZ3MuYWRzRW5hYmxlZCkge1xuICAgICAgICByZXR1cm4gbmV4dChudWxsKTtcbiAgICAgIH1cbiAgICAgIG5leHQobmV3IFZBU1RFcnJvcignQWRzIGFyZSBub3QgZW5hYmxlZCcpKTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwcmVwYXJlUGxheWVyRm9yQWQobmV4dCkge1xuICAgICAgaWYgKGNhblBsYXlQcmVyb2xsQWQoKSkge1xuICAgICAgICBzbmFwc2hvdCA9IHBsYXllclV0aWxzLmdldFBsYXllclNuYXBzaG90KHBsYXllcik7XG4gICAgICAgIHBsYXllci5wYXVzZSgpO1xuICAgICAgICBhZGRTcGlubmVySWNvbigpO1xuXG4gICAgICAgIGlmKHBsYXllci5wYXVzZWQoKSkge1xuICAgICAgICAgIG5leHQobnVsbCk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgcGxheWVyVXRpbHMub25jZShwbGF5ZXIsIFsncGxheWluZyddLCBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHBsYXllci5wYXVzZSgpO1xuICAgICAgICAgICAgbmV4dChudWxsKTtcbiAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgfSBlbHNlIHtcbiAgICAgICAgbmV4dChuZXcgVkFTVEVycm9yKCd2aWRlbyBjb250ZW50IGhhcyBiZWVuIHBsYXlpbmcgYmVmb3JlIHByZXJvbGwgYWQnKSk7XG4gICAgICB9XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gY2FuUGxheVByZXJvbGxBZCgpIHtcbiAgICAgIHJldHVybiAhdXRpbGl0aWVzLmlzSVBob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iAgICAgICAgICAgIHRoaXMuX2NhbGxiYWNrcy5yZW1vdmUoa2V5KTtcbiAgICAgICAgfSk7XG4gICAgfVxuXG4gICAgcmVtb3ZlQWxsQ2FsbGJhY2tzKCkge1xuICAgICAgICByZXR1cm4gdGhpcy5fY2FsbGJhY2tzLnJlbW92ZUFsbCgpO1xuICAgIH1cblxuICAgIF90cmlnZ2VyKGV2ZW50TmFtZSwgZXZlbnQpIHtcbiAgICAgICAgdGhpcy5faGFuZGxlcnMuZ2V0KGV2ZW50TmFtZSkuZm9yRWFjaCgoY2FsbGJhY2spID0+IHtcbiAgICAgICAgICAgIC8vY2xpY2tUaHJ1IGhhcyB0byBiZSBzeW5jLCBpZiBub3Qgd2lsbCBiZSBibG9jayBieSB0aGUgcG9wdXBibG9ja2VyXG4gICAgICAgICAgICBpZiAoZXZlbnROYW1lID09PSAnQWRDbGlja1RocnUnKSB7XG4gICAgICAgICAgICAgICAgY2FsbGJhY2soZXZlbnQpO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuX2hhbmRsZXJzLmdldChldmVudE5hbWUpLmxlbmd0aCA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrKGV2ZW50KTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0sIDApO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICB9XG5cbiAgICBfY2FsbENhbGxiYWNrKG1ldGhvZE5hbWUsIGNhbGxiYWNrSUQsIGVyciwgcmVzdWx0KSB7XG5cbiAgICAgICAgbGV0IGNhbGxiYWNrID0gdGhpcy5fY2FsbGJhY2tzLmdldChjYWxsYmFja0lEKTtcblxuICAgICAgICAvL25vdCBhbGwgbWV0aG9kcyBjYWxsYmFjaydzIGFyZSBtYW5kYXRvcnlcbiAgICAgICAgLy9idXQgaW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gICAgaWYgKGV2dC50eXBlID09PSAnZW5kZWQnKSB7XG4gICAgICAgICAgICBwbGF5ZXIudHJpZ2dlcigndmFzdC5jb250ZW50RW5kJyk7XG4gICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgIH0pO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIGNoZWNrQWRzRW5hYmxlZChuZXh0KSB7XG4gICAgICBpZiAoc2V0dGluZ3MuYWRzRW5hYmxlZCkge1xuICAgICAgICByZXR1cm4gbmV4dChudWxsKTtcbiAgICAgIH1cbiAgICAgIG5leHQobmV3IFZBU1RFcnJvcignQWRzIGFyZSBub3QgZW5hYmxlZCcpKTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBwcmVwYXJlUGxheWVyRm9yQWQobmV4dCkge1xuICAgICAgaWYgKGNhblBsYXlQcmVyb2xsQWQoKSkge1xuICAgICAgICBzbmFwc2hvdCA9IHBsYXllclV0aWxzLmdldFBsYXllclNuYXBzaG90KHBsYXllcik7XG4gICAgICAgIHBsYXllci5wYXVzZSgpO1xuICAgICAgICBhZGRTcGlubmVySWNvbigpO1xuXG4gICAgICAgIGlmKHBsYXllci5wYXVzZWQoKSkge1xuICAgICAgICAgIG5leHQobnVsbCk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgcGxheWVyVXRpbHMub25jZShwbGF5ZXIsIFsncGxheWluZyddLCBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHBsYXllci5wYXVzZSgpO1xuICAgICAgICAgICAgbmV4dChudWxsKTtcbiAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgfSBlbHNlIHtcbiAgICAgICAgbmV4dChuZXcgVkFTVEVycm9yKCd2aWRlbyBjb250ZW50IGhhcyBiZWVuIHBsYXlpbmcgYmVmb3JlIHByZXJvbGwgYWQnKSk7XG4gICAgICB9XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gY2FuUGxheVByZXJvbGxBZCgpIHtcbiAgICAgIHJldHVybiA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iAgcmV0dXJuIHN0ci5yZXBsYWNlKC8mYXBvczsvZywgXCInXCIpXG4gICAgLnJlcGxhY2UoLyZxdW90Oy9nLCAnXCInKVxuICAgIC5yZXBsYWNlKC8mZ3Q7L2csICc+JylcbiAgICAucmVwbGFjZSgvJmx0Oy9nLCAnPCcpXG4gICAgLnJlcGxhY2UoLyZhbXA7L2csICcmJyk7XG59O1xuXG5tb2R1bGUuZXhwb3J0cyA9IHhtbDsiLCIndXNlIHN0cmljdCc7XG5cbnJlcXVpcmUoJy4vcGx1Z2luL2NvbXBvbmVudHMvYWRzLWxhYmVsXzQnKTtcbnJlcXVpcmUoJy4vcGx1Z2luL2NvbXBvbmVudHMvYmxhY2stcG9zdGVyXzQnKTtcblxudmFyIHZpZGVvSnNWQVNUID0gcmVxdWlyZSgnLi9wbHVnaW4vdmlkZW9qcy52YXN0LnZwYWlkJyk7XG5cbnZpZGVvanMucGx1Z2luKCd2YXN0Q2xpZW50JywgdmlkZW9Kc1ZBU1QpO1xuXG4iXX0= diff --git a/bin/videojs_4.vast.vpaid.min.js b/bin/videojs_4.vast.vpaid.min.js index 7d5c3e77..0af774cc 100644 --- a/bin/videojs_4.vast.vpaid.min.js +++ b/bin/videojs_4.vast.vpaid.min.js @@ -1,4 +1,4 @@ -(function t(e,n,i){function r(s,o){if(!n[s]){if(!e[s]){var u=typeof require=="function"&&require;if(!o&&u)return u(s,!0);if(a)return a(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[s]={exports:{}};e[s][0].call(c.exports,function(t){var n=e[s][1][t];return r(n?n:t)},c,c.exports,t,e,n,i)}return n[s].exports}var a=typeof require=="function"&&require;for(var s=0;s0){i(e)}},0)}})}},{key:"_callCallback",value:function _(t,e,n,i){var r=this._callbacks.get(e);if(!r){if(n&&e===""){this.trigger(f,n)}return}p.call(this,e,n,i)}},{key:"_handShake",value:function k(t,e){this._ready=true;if(this._handShakeHandler){this._handShakeHandler(t,e);delete this._handShakeHandler}}},{key:"getSize",value:function E(){return{width:this._width,height:this._height}}},{key:"setSize",value:function T(t,e){this._width=s(t,this._width);this._height=s(e,this._height);this._el.setAttribute("width",this._width);this._el.setAttribute("height",this._height)}},{key:"getWidth",value:function w(){return this._width}},{key:"setWidth",value:function b(t){this.setSize(t,this._height)}},{key:"getHeight",value:function S(){return this._height}},{key:"setHeight",value:function V(t){this.setSize(this._width,t)}},{key:"getFlashID",value:function C(){return this._flashID}},{key:"getFlashURL",value:function I(){return this._flashURL}},{key:"isReady",value:function F(){return this._ready}},{key:"destroy",value:function L(){this.offAll();this.removeAllCallbacks();c.removeInstanceByID(this._flashID);if(this._el.parentElement){this._el.parentElement.removeChild(this._el)}}}]);return t}();function p(t,e,n){var i=this;setTimeout(function(){var r=i._callbacks.get(t);if(r){i._callbacks.remove(t);r(e,n)}},0)}Object.defineProperty(h,"VPAID_FLASH_HANDLER",{writable:false,configurable:false,value:d});window[d]=function(t,e,n,i,r,a){var s=c.getInstanceByID(t);if(!s)return;if(n==="handShake"){s._handShake(r,a)}else{if(e!=="event"){s._callCallback(n,i,r,a)}else{s._trigger(n,a)}}}},{"./jsFlashBridgeRegistry":6,"./registry":7,"./utils":8}],6:[function(t,e,n){"use strict";var i=t("./registry").SingleValueRegistry;var r=new i;var a={};Object.defineProperty(a,"addInstance",{writable:false,configurable:false,value:function s(t,e){r.add(t,e)}});Object.defineProperty(a,"getInstanceByID",{writable:false,configurable:false,value:function o(t){return r.get(t)}});Object.defineProperty(a,"removeInstanceByID",{writable:false,configurable:false,value:function u(t){return r.remove(t)}});e.exports=a},{"./registry":7}],7:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:true});var i=function(){function t(t,e){for(var n=0;n0?t:e}var u=function(){if(String.prototype.endsWith)return String.prototype.endsWith;return function t(e,n){var i=this.toString();if(n===undefined||n>i.length){n=i.length}n-=e.length;var r=i.indexOf(e,n);return r!==-1&&r===n}}();function l(t,e){return u.call(t,e)}function c(t){t.style.position="absolute";t.style.left="-1px";t.style.top="-1px";t.style.width="1px";t.style.height="1px";t.style.visibility="hidden"}},{}],9:[function(t,e,n){"use strict";var i=["handshakeVersion","initAd","startAd","stopAd","skipAd","resizeAd","pauseAd","resumeAd","expandAd","collapseAd","subscribe","unsubscribe"];var r=["AdLoaded","AdStarted","AdStopped","AdSkipped","AdSkippableStateChange","AdSizeChange","AdLinearChange","AdDurationChange","AdExpandedChange","AdRemainingTimeChange","AdVolumeChange","AdImpression","AdVideoStart","AdVideoFirstQuartile","AdVideoMidpoint","AdVideoThirdQuartile","AdVideoComplete","AdClickThru","AdInteraction","AdUserAcceptInvitation","AdUserMinimize","AdUserClose","AdPaused","AdPlaying","AdLog","AdError"];var a=["getAdLinear","getAdWidth","getAdHeight","getAdExpanded","getAdSkippableState","getAdRemainingTime","getAdDuration","getAdVolume","getAdCompanions","getAdIcons"];var s=["setAdVolume"];function o(t,e,n){}o.prototype.handshakeVersion=function(t,e){};o.prototype.initAd=function(t,e,n,i,r,a,s){};o.prototype.startAd=function(t){};o.prototype.stopAd=function(t){};o.prototype.skipAd=function(t){};o.prototype.resizeAd=function(t,e,n,i){};o.prototype.pauseAd=function(t){};o.prototype.resumeAd=function(t){};o.prototype.expandAd=function(t){};o.prototype.collapseAd=function(t){};o.prototype.subscribe=function(t,e,n){};o.prototype.unsubscribe=function(t,e){};o.prototype.getAdLinear=function(t){};o.prototype.getAdWidth=function(t){};o.prototype.getAdHeight=function(t){};o.prototype.getAdExpanded=function(t){};o.prototype.getAdSkippableState=function(t){};o.prototype.getAdRemainingTime=function(t){};o.prototype.getAdDuration=function(t){};o.prototype.getAdVolume=function(t){};o.prototype.getAdCompanions=function(t){};o.prototype.getAdIcons=function(t){};o.prototype.setAdVolume=function(t,e){};l(o,"METHODS",i);l(o,"GETTERS",a);l(o,"SETTERS",s);l(o,"EVENTS",r);var u=i.filter(function(t){return["skipAd"].indexOf(t)===-1});l(o,"checkVPAIDInterface",function c(t){var e=u.every(function(e){return typeof t[e]==="function"});return e});e.exports=o;function l(t,e,n){Object.defineProperty(t,e,{writable:false,configurable:false,value:n})}},{}],10:[function(t,e,n){"use strict";var i=t("./IVPAIDAdUnit");var r=t("./subscriber");var a=i.checkVPAIDInterface;var s=t("./utils");var o=i.METHODS;var u="AdError";var l="AdClickThru";var c=i.EVENTS.filter(function(t){return t!=l});function d(t,e,n,i){this._isValid=a(t);if(this._isValid){this._creative=t;this._el=e;this._videoEl=n;this._iframe=i;this._subscribers=new r;f.call(this)}}d.prototype=Object.create(i.prototype);d.prototype.isValidVPAIDAd=function g(){return this._isValid};i.METHODS.forEach(function(t){var e=["subscribe","unsubscribe","initAd"];if(e.indexOf(t)!==-1)return;d.prototype[t]=function(){var e=i.prototype[t].length;var n=Array.prototype.slice.call(arguments);var r=e===n.length?n.pop():undefined;setTimeout(function(){var e,i=null;try{e=this._creative[t].apply(this._creative,n)}catch(a){i=a}v(r,this._subscribers,i,e)}.bind(this),0)}});d.prototype.initAd=function m(t,e,n,i,r,a,o){r=r||{};a=s.extend({slot:this._el,videoSlot:this._videoEl},a||{});setTimeout(function(){var s;try{this._creative.initAd(t,e,n,i,r,a)}catch(u){s=u}v(o,this._subscribers,s)}.bind(this),0)};d.prototype.subscribe=function y(t,e,n){this._subscribers.subscribe(e,t,n)};d.prototype.unsubscribe=function A(t,e){this._subscribers.unsubscribe(e,t)};d.prototype.on=d.prototype.subscribe;d.prototype.off=d.prototype.unsubscribe;i.GETTERS.forEach(function(t){d.prototype[t]=function(e){setTimeout(function(){var n,i=null;try{n=this._creative[t]()}catch(r){i=r}v(e,this._subscribers,i,n)}.bind(this),0)}});d.prototype.setAdVolume=function _(t,e){setTimeout(function(){var n,i=null;try{this._creative.setAdVolume(t);n=this._creative.getAdVolume()}catch(r){i=r}if(!i){i=s.validate(n===t,"failed to apply volume: "+t)}v(e,this._subscribers,i,n)}.bind(this),0)};d.prototype._destroy=function k(){this.stopAd();this._subscribers.unsubscribeAll()};function f(){c.forEach(function(t){this._creative.subscribe(p.bind(this,t),t)}.bind(this));this._creative.subscribe(h.bind(this),l);if(this._videoEl){var t=this._iframe.contentDocument.documentElement;var e=this._videoEl;t.addEventListener("click",function(n){if(n.target===t){e.click()}})}}function h(t,e,n){this._subscribers.triggerSync(l,{url:t,id:e,playerHandles:n})}function p(t){this._subscribers.trigger(t,Array.prototype.slice(arguments,1))}function v(t,e,n,i){if(t){t(n,i)}else if(n){e.trigger(u,n)}}e.exports=d},{"./IVPAIDAdUnit":9,"./subscriber":12,"./utils":13}],11:[function(t,e,n){"use strict";var i=t("./utils");var r=i.unique("vpaidIframe");var a=t("./VPAIDAdUnit");var s=""+''+''+'
'+''+'"+""+"";var o="AdStopped";function u(t,e,n,a){n=n||{};this._id=r();this._destroyed=false;this._frameContainer=i.createElementInEl(t,"div");this._videoEl=e;this._vpaidOptions=a||{timeout:1e4};this._templateConfig={template:n.template||s,extraOptions:n.extraOptions||{}}}u.prototype.destroy=function m(){if(this._destroyed){return}this._destroyed=true;d.call(this)};u.prototype.isDestroyed=function y(){return this._destroyed};u.prototype.loadAdUnit=function A(t,e){v.call(this);d.call(this);var n=this;var r=i.createIframeWithContent(this._frameContainer,this._templateConfig.template,i.extend({iframeURL_JS:t,iframeID:this.getID(),origin:g()},this._templateConfig.extraOptions));this._frame=r;this._onLoad=i.callbackTimeout(this._vpaidOptions.timeout,s.bind(this),u.bind(this));window.addEventListener("message",this._onLoad);function s(t){if(t.origin!==g())return;var r=JSON.parse(t.data);if(r.id!==n.getID())return;var s,u,l;if(!n._frame.contentWindow){u="the iframe is not anymore in the DOM tree"}else{l=n._frame.contentWindow.getVPAIDAd;u=i.validate(typeof l==="function","the ad didn't return a function to create an ad")}if(!u){var d=n._frame.contentWindow.document.querySelector(".ad-element");s=new a(l(),d,n._videoEl,n._frame);s.subscribe(o,c.bind(n));u=i.validate(s.isValidVPAIDAd(),"the add is not fully complaint with VPAID specification")}n._adUnit=s;h.call(n);e(u,u?null:s);return true}function u(){e("timeout",null)}};u.prototype.unloadAdUnit=function _(){d.call(this)};u.prototype.getID=function(){return this._id};function l(t){var e=this[t];if(e){e.remove();delete this[t]}}function c(){f.call(this);delete this._adUnit}function d(){f.call(this);p.call(this)}function f(){l.call(this,"_frame");h.call(this)}function h(){if(this._onLoad){window.removeEventListener("message",this._onLoad);i.clearCallbackTimeout(this._onLoad);delete this._onLoad}}function p(){if(this._adUnit){this._adUnit.stopAd();delete this._adUnit}}function v(){if(this._destroyed){throw new Error("VPAIDHTML5Client already destroyed!")}}function g(){if(window.location.origin){return window.location.origin}else{return window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"")}}e.exports=u;window.VPAIDHTML5Client=u},{"./VPAIDAdUnit":10,"./utils":13}],12:[function(t,e,n){"use strict";function i(){this._subscribers={}}i.prototype.subscribe=function r(t,e,n){if(!this.isHandlerAttached(t,e)){this.get(e).push({handler:t,context:n,eventName:e})}};i.prototype.unsubscribe=function a(t,e){this._subscribers[e]=this.get(e).filter(function(e){return t!==e.handler})};i.prototype.unsubscribeAll=function s(){this._subscribers={}};i.prototype.trigger=function(t,e){var n=this;var i=this.get(t).concat(this.get("*"));i.forEach(function(t){setTimeout(function(){if(n.isHandlerAttached(t.handler,t.eventName)){t.handler.call(t.context,e)}},0)})};i.prototype.triggerSync=function(t,e){var n=this.get(t).concat(this.get("*"));n.forEach(function(t){t.handler.call(t.context,e)})};i.prototype.get=function o(t){if(!this._subscribers[t]){this._subscribers[t]=[]}return this._subscribers[t]};i.prototype.isHandlerAttached=function u(t,e){return this.get(e).some(function(e){return t===e.handler})};e.exports=i},{}],13:[function(t,e,n){"use strict";function i(){}function r(t,e){return t?null:new Error(e)}var a={};function s(t){var e=a[t];if(e){clearTimeout(e);delete a[t]}}function o(t,e,n){var r,o;o=setTimeout(function(){e=i;delete o[r];n()},t);r=function(){if(e.apply(this,arguments)){s(r)}};a[r]=o;return r}function u(t,e,n){var i=document.createElement(e);if(n)i.id=n;t.appendChild(i);return i}function l(t,e,n){var i=c(t,null,n.zIndex);if(!f(i,d(e,n)))return;return i}function c(t,e,n){var i=document.createElement("iframe");i.src=e||"about:blank";i.marginWidth="0";i.marginHeight="0";i.frameBorder="0";i.width="100%";i.height="100%";i.style.position="absolute";i.style.left="0";i.style.top="0";i.style.margin="0px";i.style.padding="0px";i.style.border="none";if(n){i.style.zIndex=n}i.setAttribute("SCROLLING","NO");t.innerHTML="";t.appendChild(i);return i}function d(t,e){Object.keys(e).forEach(function(n){var i=typeof i==="object"?JSON.stringify(e[n]):e[n];t=t.replace(new RegExp("{{"+n+"}}","g"),i)});return t}function f(t,e){var n=t.contentWindow&&t.contentWindow.document;if(!n)return false;n.write(e);return true}function h(t,e){Object.keys(e).forEach(function(n){t[n]=e[n]});return t}function p(t){var e=-1;return function(){return t+"_"+ ++e}}e.exports={noop:i,validate:r,clearCallbackTimeout:s,callbackTimeout:o,createElementInEl:u,createIframeWithContent:l,createIframe:c,simpleTemplate:d,setIframeContent:f,extend:h,unique:p}},{}],14:[function(t,e,n){"use strict";var i=t("./InLine");var r=t("./Wrapper");function a(t){if(!(this instanceof a)){return new a(t)}this.initialize(t)}a.prototype.initialize=function(t){this.id=t.attr("id");this.sequence=t.attr("sequence");if(t.inLine){this.inLine=new i(t.inLine)}if(t.wrapper){this.wrapper=new r(t.wrapper)}};e.exports=a},{"./InLine":17,"./Wrapper":27}],15:[function(t,e,n){"use strict";var i=t("./TrackingEvent");var r=t("../../utils/utilityFunctions");var a=t("../../utils/xml");function s(t){if(!(this instanceof s)){return new s(t)}this.creativeType=a.attr(t.staticResource,"creativeType");this.staticResource=a.keyValue(t.staticResource);var e=null;if(a.keyValue(t.HTMLResource)){e=a.keyValue(t.HTMLResource)}else if(a.keyValue(t.hTMLResource)){e=a.keyValue(t.hTMLResource)}this.htmlResource=e; -var n=null;if(a.keyValue(t.IFrameResource)){n=a.keyValue(t.IFrameResource)}else if(a.keyValue(t.iFrameresource)){n=a.keyValue(t.iFrameresource)}this.iframeResource=n;this.id=a.attr(t,"id");this.width=a.attr(t,"width");this.height=a.attr(t,"height");this.expandedWidth=a.attr(t,"expandedWidth");this.expandedHeight=a.attr(t,"expandedHeight");this.scalable=a.attr(t,"scalable");this.maintainAspectRatio=a.attr(t,"maintainAspectRatio");this.minSuggestedDuration=a.attr(t,"minSuggestedDuration");this.apiFramework=a.attr(t,"apiFramework");this.companionClickThrough=a.keyValue(t.companionClickThrough);this.trackingEvents=o(t.trackingEvents&&t.trackingEvents.tracking);function o(t){var e=[];if(r.isDefined(t)){t=r.isArray(t)?t:[t];t.forEach(function(t){e.push(new i(t))})}return e}}e.exports=s},{"../../utils/utilityFunctions":44,"../../utils/xml":45,"./TrackingEvent":20}],16:[function(t,e,n){"use strict";var i=t("./Linear");var r=t("./Companion");var a=t("../../utils/utilityFunctions");function s(t){if(!(this instanceof s)){return new s(t)}this.id=t.attr("id");this.sequence=t.attr("sequence");this.adId=t.attr("adId");this.apiFramework=t.attr("apiFramework");if(t.linear){this.linear=new i(t.linear)}if(t.companionAds){var e=[];var n=t.companionAds&&t.companionAds.companion;if(a.isDefined(n)){n=a.isArray(n)?n:[n];n.forEach(function(t){e.push(new r(t))})}this.companionAds=e}}s.prototype.isSupported=function(){if(this.linear){return this.linear.isSupported()}return true};s.parseCreatives=function o(t){var e=[];var n;if(a.isDefined(t)&&a.isDefined(t.creative)){n=a.isArray(t.creative)?t.creative:[t.creative];n.forEach(function(t){e.push(new s(t))})}return e};e.exports=s},{"../../utils/utilityFunctions":44,"./Companion":15,"./Linear":18}],17:[function(t,e,n){"use strict";var i=t("./vastUtil");var r=t("./Creative");var a=t("../../utils/utilityFunctions");var s=t("../../utils/xml");function o(t){if(!(this instanceof o)){return new o(t)}this.adTitle=s.keyValue(t.adTitle);this.adSystem=s.keyValue(t.adSystem);this.impressions=i.parseImpressions(t.impression);this.creatives=r.parseCreatives(t.creatives);this.description=s.keyValue(t.description);this.advertiser=s.keyValue(t.advertiser);this.surveys=e(t.survey);this.error=s.keyValue(t.error);this.pricing=s.keyValue(t.pricing);this.extensions=t.extensions;function e(t){if(t){return a.transformArray(a.isArray(t)?t:[t],function(t){if(a.isNotEmptyString(t.keyValue)){return{uri:t.keyValue,type:t.attr("type")}}return undefined})}return[]}}o.prototype.isSupported=function(){var t,e;if(this.creatives.length===0){return false}for(t=0,e=this.creatives.length;t0){d(r.shift(),[],a)}else{e(t,i)}}else{e(null,i)}}});function a(t,e){var i=n._requestVASTXml.bind(n,t);o.waterfall([i,s],e)}function s(t,e){var n;try{n=c.toJXONTree(t);if(l.isArray(n.ad)){n.ads=n.ad}else if(n.ad){n.ads=[n.ad]}else{n.ads=[]}e(u(n),n)}catch(i){e(new r("on VASTClient.getVASTAd.buildVastWaterfall, error parsing xml",100),null)}}function u(t){var e=c.attr(t,"version");if(!t.ad){return new r("on VASTClient.getVASTAd.validateVASTTree, no Ad in VAST tree",303)}if(e&&(e!=3&&e!=2)){return new r('on VASTClient.getVASTAd.validateVASTTree, not supported VAST version "'+e+'"',102)}return null}function d(t,e,i){if(e.length>=n.WRAPPER_LIMIT){return i(new r("on VASTClient.getVASTAd.getAd, players wrapper limit reached (the limit is "+n.WRAPPER_LIMIT+")",302),e)}o.waterfall([function(e){if(l.isString(t)){p(t,e)}else{e(null,t)}},f],function(t,n){if(n){e.push(n)}if(t){return i(t,e)}if(n.wrapper){return d(n.wrapper.VASTAdTagURI,e,i)}return i(null,e)})}function f(t,e){try{var n=new i(t);e(h(n),n)}catch(a){e(new r("on VASTClient.getVASTAd.buildAd, error parsing xml",100),null)}}function h(t){var e=t.wrapper;var n=t.inLine;var i="on VASTClient.getVASTAd.validateAd, ";if(n&&e){return new r(i+"InLine and Wrapper both found on the same Ad",101)}if(!n&&!e){return new r(i+"nor wrapper nor inline elements found on the Ad",101)}if(n&&!n.isSupported()){return new r(i+"could not find MediaFile that is supported by this video player",403)}if(e&&!e.VASTAdTagURI){return new r(i+"missing 'VASTAdTagURI' in wrapper",101)}return null}function p(t,e){n._requestVASTXml(t,function(t,n){if(t){return e(t)}try{var i=c.toJXONTree(n);e(u(i),i.ad)}catch(a){e(new r("on VASTClient.getVASTAd.requestVASTAd, error parsing xml",100))}})}};d.prototype._requestVASTXml=function h(t,e){try{if(l.isFunction(t)){t(i)}else{u.get(t,i,{withCredentials:true})}}catch(n){e(n)}function i(t,n,i){if(t){var a=l.isDefined(i)?"on VASTClient.requestVastXML, HTTP request error with status '"+i+"'":"on VASTClient.requestVastXML, Error getting the the VAST XML with he passed adTagXML fn";return e(new r(a,301),null)}e(null,n)}};d.prototype._buildVASTResponse=function p(t){var e=new a;n(e,t);i(e);return e;function n(t,e){e.forEach(function(e){t.addAd(e)})}function i(t){var e=t.trackingEvents.progress;if(!t.hasLinear()){throw new r("on VASTClient._buildVASTResponse, Received an Ad type that is not supported",200)}if(t.duration===undefined){throw new r("on VASTClient._buildVASTResponse, Missing duration field in VAST response",101)}if(e){e.forEach(function(t){if(!l.isNumber(t.offset)){throw new r("on VASTClient._buildVASTResponse, missing or wrong offset attribute on progress tracking event",101)}})}}};d.prototype._trackError=function(t,e){if(!l.isArray(e)||e.length===0){return}var n=[];e.forEach(i);s.track(n,{ERRORCODE:t.code||900});function i(t){if(t.wrapper&&t.wrapper.error){n.push(t.wrapper.error)}if(t.inLine&&t.inLine.error){n.push(t.inLine.error)}}};e.exports=d},{"../../utils/async":39,"../../utils/http":41,"../../utils/utilityFunctions":44,"../../utils/xml":45,"./Ad":14,"./VASTError":22,"./VASTResponse":24,"./vastUtil":29}],22:[function(t,e,n){"use strict";function i(t,e){this.message="VAST Error: "+(t||"");if(e){this.code=e}}i.prototype=new Error;i.prototype.name="VAST Error";e.exports=i},{}],23:[function(t,e,n){"use strict";var i=t("./VASTResponse");var r=t("./VASTError");var a=t("./VASTTracker");var s=t("./vastUtil");var o=t("../../utils/async");var u=t("../../utils/dom");var l=t("../../utils/playerUtils");var c=t("../../utils/utilityFunctions");function d(t){if(!(this instanceof d)){return new d(t)}this.player=t}d.prototype.playAd=function f(t,e){var n=this;e=e||c.noop;if(!(t instanceof i)){return e(new r("On VASTIntegrator, missing required VASTResponse"))}o.waterfall([function(e){e(null,t)},this._selectAdSource.bind(this),this._createVASTTracker.bind(this),this._addClickThrough.bind(this),this._addSkipButton.bind(this),this._setupEvents.bind(this),this._playSelectedAd.bind(this)],function(t,i){if(t&&i){n._trackError(t,i)}e(t,i)});this._adUnit={_src:null,type:"VAST",pauseAd:function(){n.player.pause(true)},resumeAd:function(){n.player.play(true)},isPaused:function(){return n.player.paused(true)},getSrc:function(){return this._src}};return this._adUnit};d.prototype._selectAdSource=function h(t,e){var n;var i=u.getDimension(this.player.el()).width;t.mediaFiles.sort(function a(t,e){var n=Math.abs(i-t.width);var r=Math.abs(i-e.width);return n-r});n=this.player.selectSource(t.mediaFiles).source;if(n){if(this._adUnit){this._adUnit._src=n}return e(null,n,t)}e(new r("Could not find Ad mediafile supported by this player",403),t)};d.prototype._createVASTTracker=function p(t,e,n){try{n(null,t,new a(t.src,e),e)}catch(i){n(i,e)}};d.prototype._setupEvents=function v(t,e,n,i){var r;var a=this.player;a.on("fullscreenchange",o);a.on("vast.adStart",d);a.on("pause",u);a.on("timeupdate",c);a.on("volumechange",f);l.once(a,["vast.adEnd","vast.adsCancel"],s);l.once(a,["vast.adEnd","vast.adsCancel","vast.adSkip"],function(t){if(t.type==="vast.adEnd"){e.trackComplete()}});return i(null,t,n);function s(){a.off("fullscreenchange",o);a.off("vast.adStart",d);a.off("pause",u);a.off("timeupdate",c);a.off("volumechange",f)}function o(){if(a.isFullscreen()){e.trackFullscreen()}else{e.trackExitFullscreen()}}function u(){if(Math.abs(a.duration()-a.currentTime())<2){return}e.trackPause();l.once(a,["play","vast.adEnd","vast.adsCancel"],function(t){if(t.type==="play"){e.trackResume()}})}function c(){var t=a.currentTime()*1e3;e.trackProgress(t)}function d(){e.trackImpressions();e.trackCreativeView()}function f(){var t=a.muted();if(t){e.trackMute()}else if(r){e.trackUnmute()}r=t}};d.prototype._addSkipButton=function g(t,e,n,i){var r;var a=this;if(c.isNumber(n.skipoffset)){r=n.skipoffset/1e3;s(this.player,r)}i(null,t,e,n);function s(t,e){var n=o(t);var i=d.bind(a,n,e,t);t.el().appendChild(n);t.on("timeupdate",i);l.once(t,["vast.adEnd","vast.adsCancel"],r);function r(){t.off("timeupdate",i);u.remove(n)}}function o(t){var n=window.document.createElement("div");u.addClass(n,"vast-skip-button");n.onclick=function(i){if(u.hasClass(n,"enabled")){e.trackSkip();t.trigger("vast.adSkip")}if(window.Event.prototype.stopPropagation!==undefined){i.stopPropagation()}else{return false}};return n}function d(t,e,n){var i=Math.ceil(e-n.currentTime());if(i>0){t.innerHTML="Skip in "+c.toFixedDigits(i,2)+"..."}else{if(!u.hasClass(t,"enabled")){u.addClass(t,"enabled");t.innerHTML="Skip ad"}}}};d.prototype._addClickThrough=function m(t,e,n,i){var r=this.player;var a=d(r,e,n);var o=f.bind(this,a,n,r);r.el().insertBefore(a,r.controlBar.el());r.on("timeupdate",o);l.once(r,["vast.adEnd","vast.adsCancel"],p);return i(null,t,e,n);function d(t,e,n){var i=window.document.createElement("a");var r=n.clickThrough;u.addClass(i,"vast-blocker");i.href=h(r,t);if(c.isString(r)){i.target="_blank"}i.onclick=function(n){if(t.paused()){t.play();if(window.Event.prototype.stopPropagation!==undefined){n.stopPropagation()}return false}t.pause();e.trackClick()};return i}function f(t,e,n){t.href=h(e.clickThrough,n)}function h(e,n){var i={ASSETURI:t.src,CONTENTPLAYHEAD:s.formatProgress(n.currentTime()*1e3)};return e?s.parseURLMacro(e,i):"#"}function p(){r.off("timeupdate",o);u.remove(a)}};d.prototype._playSelectedAd=function y(t,e,n){var i=this.player;i.preload("auto");i.src(t);l.once(i,["durationchange","error","vast.adsCancel"],function(t){if(t.type==="durationchange"){a()}else if(t.type==="error"){n(new r("on VASTIntegrator, Player is unable to play the Ad",400),e)}});function a(){l.once(i,["playing","vast.adsCancel"],function(t){if(t.type==="vast.adsCancel"){return}i.trigger("vast.adStart");i.on("ended",r);i.on("vast.adsCancel",r);i.on("vast.adSkip",r);function r(t){if(t.type==="ended"&&i.duration()-i.currentTime()>3){return}i.off("ended",r);i.off("vast.adsCancel",r);i.off("vast.adSkip",r);if(t.type==="ended"||t.type==="vast.adSkip"){n(null,e)}}});i.play()}};d.prototype._trackError=function A(t,e){s.track(e.errorURLMacros,{ERRORCODE:t.code||900})};e.exports=d},{"../../utils/async":39,"../../utils/dom":40,"../../utils/playerUtils":42,"../../utils/utilityFunctions":44,"./VASTError":22,"./VASTResponse":24,"./VASTTracker":25,"./vastUtil":29}],24:[function(t,e,n){"use strict";var i=t("./Ad");var r=t("./VideoClicks");var a=t("./Linear");var s=t("./InLine");var o=t("./Wrapper");var u=t("../../utils/utilityFunctions");var l=t("../../utils/xml");window.InLine__A=s;function c(){if(!(this instanceof c)){return new c}this._linearAdded=false;this.ads=[];this.errorURLMacros=[];this.impressions=[];this.clickTrackings=[];this.customClicks=[];this.trackingEvents={};this.mediaFiles=[];this.clickThrough=undefined;this.adTitle="";this.duration=undefined;this.skipoffset=undefined}c.prototype.addAd=function(t){var e,n;if(t instanceof i){e=t.inLine;n=t.wrapper;this.ads.push(t);if(e){this._addInLine(e)}if(n){this._addWrapper(n)}}};c.prototype._addErrorTrackUrl=function(t){var e=t instanceof l.JXONTree?l.keyValue(t):t;if(e){this.errorURLMacros.push(e)}};c.prototype._addImpressions=function(t){u.isArray(t)&&d(this.impressions,t)};c.prototype._addClickThrough=function(t){if(u.isNotEmptyString(t)){this.clickThrough=t}};c.prototype._addClickTrackings=function(t){u.isArray(t)&&d(this.clickTrackings,t)};c.prototype._addCustomClicks=function(t){u.isArray(t)&&d(this.customClicks,t)};c.prototype._addTrackingEvents=function(t){var e=this.trackingEvents;if(t){t=u.isArray(t)?t:[t];t.forEach(function(t){if(!e[t.name]){e[t.name]=[]}e[t.name].push(t)})}};c.prototype._addTitle=function(t){if(u.isNotEmptyString(t)){this.adTitle=t}};c.prototype._addDuration=function(t){if(u.isNumber(t)){this.duration=t}};c.prototype._addVideoClicks=function(t){if(t instanceof r){this._addClickThrough(t.clickThrough);this._addClickTrackings(t.clickTrackings);this._addCustomClicks(t.customClicks)}};c.prototype._addMediaFiles=function(t){u.isArray(t)&&d(this.mediaFiles,t)};c.prototype._addSkipoffset=function(t){if(t){this.skipoffset=t}};c.prototype._addAdParameters=function(t){if(t){this.adParameters=t}};c.prototype._addLinear=function(t){if(t instanceof a){this._addDuration(t.duration);this._addTrackingEvents(t.trackingEvents);this._addVideoClicks(t.videoClicks);this._addMediaFiles(t.mediaFiles);this._addSkipoffset(t.skipoffset);this._addAdParameters(t.adParameters);this._linearAdded=true}};c.prototype._addInLine=function(t){var e=this;if(t instanceof s){this._addTitle(t.adTitle);this._addErrorTrackUrl(t.error);this._addImpressions(t.impressions);t.creatives.forEach(function(t){if(t.linear){e._addLinear(t.linear)}})}};c.prototype._addWrapper=function(t){var e=this;if(t instanceof o){this._addErrorTrackUrl(t.error);this._addImpressions(t.impressions);t.creatives.forEach(function(t){var n=t.linear;if(n){e._addVideoClicks(n.videoClicks);e.clickThrough=undefined;e._addTrackingEvents(n.trackingEvents)}})}};c.prototype.hasLinear=function(){return this._linearAdded};function d(t,e){e.forEach(function(e){t.push(e)})}e.exports=c},{"../../utils/utilityFunctions":44,"../../utils/xml":45,"./Ad":14,"./InLine":17,"./Linear":18,"./VideoClicks":26,"./Wrapper":27}],25:[function(t,e,n){"use strict";var i=t("./VASTError");var r=t("./VASTResponse");var a=t("./vastUtil");var s=t("../../utils/utilityFunctions");function o(t,e){if(!(this instanceof o)){return new o(t,e)}this.sanityCheck(t,e);this.initialize(t,e)}o.prototype.initialize=function(t,e){this.response=e;this.assetURI=t;this.progress=0;this.quartiles={firstQuartile:{tracked:false,time:Math.round(25*e.duration)/100},midpoint:{tracked:false,time:Math.round(50*e.duration)/100},thirdQuartile:{tracked:false,time:Math.round(75*e.duration)/100}}};o.prototype.sanityCheck=function(t,e){if(!s.isString(t)||s.isEmptyString(t)){throw new i("on VASTTracker constructor, missing required the URI of the ad asset being played")}if(!(e instanceof r)){throw new i("on VASTTracker constructor, missing required VAST response")}};o.prototype.trackURLs=function u(t,e){if(s.isArray(t)&&t.length>0){e=s.extend({ASSETURI:this.assetURI,CONTENTPLAYHEAD:a.formatProgress(this.progress)},e||{});a.track(t,e)}};o.prototype.trackEvent=function l(t,e){this.trackURLs(n(this.response.trackingEvents[t]));if(e){this.response.trackingEvents[t]=undefined}function n(t){var e;if(t){e=[];t.forEach(function(t){e.push(t.uri)})}return e}};o.prototype.trackProgress=function c(t){var e=this;var n=[];var i=true;var r=false;var a=this.response.trackingEvents;if(s.isNumber(t)){u("start",i,t>0);u("rewind",r,o(this.progress,t));l(t);d(t);f();this.progress=t}function o(e,n){var i=3e3;return e>t&&Math.abs(n-e)>i}function u(t,e,i){if(a[t]&&i){n.push({name:t,trackOnce:!!e})}}function l(t){var n=e.quartiles;var r=e.quartiles.firstQuartile;var a=e.quartiles.midpoint;var s=e.quartiles.thirdQuartile;if(!r.tracked){o("firstQuartile",t)}else if(!a.tracked){o("midpoint",t)}else if(!s.tracked){o("thirdQuartile",t)}function o(t,e){var r=n[t];if(c(r,e)){r.tracked=true;u(t,i,true)}}}function c(t,e){var n=t.time;return e>=n&&e<=n+5e3}function d(t){if(!s.isArray(a.progress)){return}var n=[];a.progress.forEach(function(i){if(i.offset<=t){e.trackURLs([i.uri])}else{n.push(i)}});a.progress=n}function f(){n.forEach(function(t){e.trackEvent(t.name,t.trackOnce)})}};["rewind","fullscreen","exitFullscreen","pause","resume","mute","unmute","acceptInvitation","acceptInvitationLinear","collapse","expand"].forEach(function(t){o.prototype["track"+s.capitalize(t)]=function(){this.trackEvent(t)}});["start","skip","close","closeLinear"].forEach(function(t){o.prototype["track"+s.capitalize(t)]=function(){this.trackEvent(t,true)}});["firstQuartile","midpoint","thirdQuartile"].forEach(function(t){o.prototype["track"+s.capitalize(t)]=function(){this.quartiles[t].tracked=true;this.trackEvent(t,true)}});o.prototype.trackComplete=function(){if(this.quartiles.thirdQuartile.tracked){this.trackEvent("complete",true)}};o.prototype.trackErrorWithCode=function d(t){if(s.isNumber(t)){this.trackURLs(this.response.errorURLMacros,{ERRORCODE:t})}};o.prototype.trackImpressions=function f(){this.trackURLs(this.response.impressions)};o.prototype.trackCreativeView=function h(){this.trackEvent("creativeView")};o.prototype.trackClick=function p(){this.trackURLs(this.response.clickTrackings)};e.exports=o},{"../../utils/utilityFunctions":44,"./VASTError":22,"./VASTResponse":24,"./vastUtil":29}],26:[function(t,e,n){"use strict";var i=t("../../utils/utilityFunctions");var r=t("../../utils/xml");function a(t){if(!(this instanceof a)){return new a(t)}this.clickThrough=r.keyValue(t.clickThrough);this.clickTrackings=e(t.clickTracking);this.customClicks=e(t.customClick);function e(t){var e=[];if(t){t=i.isArray(t)?t:[t];t.forEach(function(t){e.push(r.keyValue(t))})}return e}}e.exports=a},{"../../utils/utilityFunctions":44,"../../utils/xml":45}],27:[function(t,e,n){"use strict";var i=t("./vastUtil");var r=t("./Creative");var a=t("../../utils/utilityFunctions");var s=t("../../utils/xml");function o(t){if(!(this instanceof o)){return new o(t)}this.adSystem=s.keyValue(t.adSystem);this.impressions=i.parseImpressions(t.impression);this.VASTAdTagURI=s.keyValue(t.vASTAdTagURI);this.creatives=r.parseCreatives(t.creatives);this.error=s.keyValue(t.error);this.extensions=t.extensions;this.followAdditionalWrappers=a.isDefined(s.attr(t,"followAdditionalWrappers"))?s.attr(t,"followAdditionalWrappers"):true;this.allowMultipleAds=s.attr(t,"allowMultipleAds");this.fallbackOnNoAd=s.attr(t,"fallbackOnNoAd")}e.exports=o},{"../../utils/utilityFunctions":44,"../../utils/xml":45,"./Creative":16,"./vastUtil":29}],28:[function(t,e,n){"use strict";var i=t("../../utils/utilityFunctions");var r=/(\d\d):(\d\d):(\d\d)(\.(\d\d\d))?/;var a={duration:function s(t){var e,n;if(i.isString(t)){e=t.match(r);if(e){n=a(e[1])+s(e[2])+o(e[3])+parseInt(e[5]||0)}}return isNaN(n)?null:n;function a(t){return parseInt(t,10)*60*60*1e3}function s(t){return parseInt(t,10)*60*1e3}function o(t){return parseInt(t,10)*1e3}},offset:function o(t,e){if(n(t)){return i(t,e)}return a.duration(t);function n(t){var e=/^\d+(\.\d+)?%$/g;return e.test(t)}function i(t,e){if(e){return r(e,parseFloat(t.replace("%","")))}return null}function r(t,e){return t*e/100}}};e.exports=a},{"../../utils/utilityFunctions":44}],29:[function(t,e,n){"use strict";var i=t("../../utils/utilityFunctions");var r=t("../vpaid/VPAIDHTML5Tech");var a=t("../vpaid/VPAIDFlashTech");var s=t("VPAIDFLASHClient/js/VPAIDFLASHClient");var o={track:function u(t,e){var n=o.parseURLMacros(t,e);var i=[];n.forEach(function(t){var e=new Image;e.src=t;i.push(e)});return i},parseURLMacros:function l(t,e){var n=[];e=e||{};if(!e["CACHEBUSTING"]){e["CACHEBUSTING"]=Math.round(Math.random()*1e10)}t.forEach(function(t){n.push(o._parseURLMacro(t,e))});return n},parseURLMacro:function c(t,e){e=e||{};if(!e["CACHEBUSTING"]){e["CACHEBUSTING"]=Math.round(Math.random()*1e10)}return o._parseURLMacro(t,e)},_parseURLMacro:function d(t,e){e=e||{};i.forEach(e,function(e,n){t=t.replace(new RegExp("\\["+n+"\\]","gm"),e)});return t},parseDuration:function f(t){var e=/(\d\d):(\d\d):(\d\d)(\.(\d\d\d))?/;var n,r;if(i.isString(t)){n=t.match(e);if(n){r=a(n[1])+s(n[2])+o(n[3])+parseInt(n[5]||0)}}return isNaN(r)?null:r;function a(t){return parseInt(t,10)*60*60*1e3}function s(t){return parseInt(t,10)*60*1e3}function o(t){return parseInt(t,10)*1e3}},parseImpressions:function h(t){if(t){t=i.isArray(t)?t:[t];return i.transformArray(t,function(t){if(i.isNotEmptyString(t.keyValue)){return t.keyValue}return undefined})}return[]},formatProgress:function p(t){var e,n,r,a;e=t/(60*60*1e3);e=Math.floor(e);n=t/(60*1e3)%60;n=Math.floor(n);r=t/1e3%60;r=Math.floor(r);a=t%1e3;return i.toFixedDigits(e,2)+":"+i.toFixedDigits(n,2)+":"+i.toFixedDigits(r,2)+"."+i.toFixedDigits(a,3)},parseOffset:function v(t,e){if(n(t)){return i(t,e)}return o.parseDuration(t);function n(t){var e=/^\d+(\.\d+)?%$/g;return e.test(t)}function i(t,e){if(e){return r(e,parseFloat(t.replace("%","")))}return null}function r(t,e){return t*e/100}},VPAID_techs:[a,r],isVPAID:function g(t){return!!t&&t.apiFramework==="VPAID"},findSupportedVPAIDTech:function m(t){var e,n,i;for(e=0,n=this.VPAID_techs.length;e=1&&e<=2}function a(t){var e=t.split(".");return parseInt(e[0],10)}};f.prototype._initAd=function(t,e,n){var i=this.player.el().querySelector(".vjs-tech");var r=l.getDimension(i);t.initAd(r.width,r.height,this.VIEW_MODE.NORMAL,-1,{AdParameters:e.adParameters||""},function(i){n(i,t,e)})};f.prototype._createVASTTracker=function(t,e){return new a(t,e)};f.prototype._setupEvents=function(t,e,n){var i=t.options.src;var r=this._createVASTTracker(i,e);var a=this.player;var o=this;t.on("AdSkipped",function(){a.trigger("vpaid.AdSkipped");r.trackSkip()});t.on("AdImpression",function(){a.trigger("vpaid.AdImpression");r.trackImpressions()});t.on("AdStarted",function(){a.trigger("vpaid.AdStarted");r.trackCreativeView();u()});t.on("AdVideoStart",function(){a.trigger("vpaid.AdVideoStart");r.trackStart();u()});t.on("AdPlaying",function(){a.trigger("vpaid.AdPlaying");r.trackResume();u()});t.on("AdPaused",function(){a.trigger("vpaid.AdPaused");r.trackPause();c()});function u(){if(o._adUnit&&o._adUnit.isPaused()){o._adUnit._paused=false}a.trigger("play")}function c(){if(o._adUnit){o._adUnit._paused=true}a.trigger("pause")}t.on("AdVideoFirstQuartile",function(){a.trigger("vpaid.AdVideoFirstQuartile");r.trackFirstQuartile()});t.on("AdVideoMidpoint",function(){a.trigger("vpaid.AdVideoMidpoint");r.trackMidpoint()});t.on("AdVideoThirdQuartile",function(){a.trigger("vpaid.AdVideoThirdQuartile");r.trackThirdQuartile()});t.on("AdVideoComplete",function(){a.trigger("vpaid.AdVideoComplete");r.trackComplete()});t.on("AdClickThru",function(n){a.trigger("vpaid.AdClickThru");var i=n.url;var o=n.playerHandles;var u=d.isNotEmptyString(i)?i:l(e.clickThrough);r.trackClick();if(o&&u){window.open(u,"_blank")}function l(e){var n={ASSETURI:t.options.src,CONTENTPLAYHEAD:0};return e?s.parseURLMacro(e,n):null}});t.on("AdUserAcceptInvitation",function(){a.trigger("vpaid.AdUserAcceptInvitation");r.trackAcceptInvitation();r.trackAcceptInvitationLinear()});t.on("AdUserClose",function(){a.trigger("vpaid.AdUserClose");r.trackClose();r.trackCloseLinear()});t.on("AdUserMinimize",function(){a.trigger("vpaid.AdUserMinimize");r.trackCollapse()});t.on("AdError",function(){a.trigger("vpaid.AdError");r.trackErrorWithCode(901)});t.on("AdVolumeChange",function(){a.trigger("vpaid.AdVolumeChange");var e=a.volume();t.getAdVolume(function(t,n){if(n===0&&e>0){r.trackMute()}if(n>0&&e===0){r.trackUnmute()}a.volume(n)})});var f=h.bind(this,a,t,this.VIEW_MODE);var p=d.throttle(f,100);var v=this.settings.autoResize;if(v){l.addEventListener(window,"resize",p);l.addEventListener(window,"orientationchange",p)}a.on("vast.resize",f);a.on("vpaid.pauseAd",g);a.on("vpaid.resumeAd",m);a.one("vpaid.adEnd",function(){a.off("vast.resize",f);a.off("vpaid.pauseAd",g);a.off("vpaid.resumeAd",m);if(v){l.removeEventListener(window,"resize",p);l.removeEventListener(window,"orientationchange",p)}});n(null,t,e);function g(){t.pauseAd(d.noop)}function m(){t.resumeAd(d.noop)}};f.prototype._addSkipButton=function(t,e,n){var i;var r=this.player;t.on("AdSkippableStateChange",a);c.once(r,["vast.adEnd","vast.adsCancel"],o);n(null,t,e);function a(){r.trigger("vpaid.AdSkippableStateChange");t.getAdSkippableState(function(t,e){if(e){if(!i){s(r)}}else{o(r)}})}function s(t){i=u(t);t.el().appendChild(i)}function o(){l.remove(i);i=null}function u(){var e=window.document.createElement("div");l.addClass(e,"vast-skip-button");l.addClass(e,"enabled");e.innerHTML="Skip ad";e.onclick=function(e){t.skipAd(d.noop);if(window.Event.prototype.stopPropagation!==undefined){e.stopPropagation()}else{return false}};return e}};f.prototype._linkPlayerControls=function(t,e,n){var i=this;r(this.player,t);a(this.player,t,this.VIEW_MODE);n(null,t,e);function r(t,e){t.on("volumechange",n);e.on("AdVolumeChange",i);t.one("vpaid.adEnd",function(){t.off("volumechange",n)});function n(){var n=t.muted()?0:t.volume();e.setAdVolume(n,p)}function i(){t.trigger("vpaid.AdVolumeChange");e.getAdVolume(function(e,n){if(e){p(e)}else{t.volume(n)}})}}function a(t,e,n){var r=h.bind(i,t,e,n);t.on("fullscreenchange",r);t.one("vpaid.adEnd",function(){t.off("fullscreenchange",r)})}};f.prototype._startAd=function(t,e,n){var i=this.player;t.startAd(function(r){if(!r){i.trigger("vast.adStart")}n(r,t,e)})};f.prototype._finishPlaying=function(t,e,n){var r=this.player;t.on("AdStopped",function(){r.trigger("vpaid.AdStopped");a(null)});t.on("AdError",function(t){var e=t?t.message:"on VPAIDIntegrator, error while waiting for the adUnit to finish playing";a(new i(e))});function a(i){n(i,t,e)}};f.prototype._trackError=function m(t,e){s.track(t.errorURLMacros,{ERRORCODE:e||901})};function h(t,e,n){var i=t.el().querySelector(".vjs-tech");var r=l.getDimension(i);var a=t.isFullscreen()?n.FULLSCREEN:n.NORMAL;e.resizeAd(r.width,r.height,a,p)}function p(t){if(t&&console&&console.log){console.log("ERROR: "+t.message,t)}}e.exports=f},{"../../utils/async":39,"../../utils/dom":40,"../../utils/playerUtils":42,"../../utils/utilityFunctions":44,"../vast/VASTError":22,"../vast/VASTResponse":24,"../vast/VASTTracker":25,"../vast/vastUtil":29,"./VPAIDAdUnitWrapper":30}],34:[function(t,e,n){"use strict";var i=t("../../utils/dom");var r=document.createElement("div");r.className="vjs-ads-label vjs-control vjs-label-hidden";r.innerHTML="Advertisement";var a=function(t){return{init:function e(n,a){a.el=r;t.call(this,n,a);setTimeout(function(){var t=n.controlBar&&(n.controlBar.getChild("timerControls")||n.controlBar.getChild("currentTimeDisplay"));if(t){n.controlBar.el().insertBefore(r,t.el())}i.removeClass(r,"vjs-label-hidden")},0)},el:function n(){return r}}};e.exports=a},{"../../utils/dom":40}],35:[function(t,e,n){"use strict";var i=videojs.Component;var r=t("./ads-label")(i);videojs.AdsLabel=videojs.Component.extend(r)},{"./ads-label":34}],36:[function(t,e,n){"use strict";var i=document.createElement("div");var r=function(t){return{init:function e(n,r){r.el=i;i.className="vjs-black-poster";t.call(this,n,r);var a=n.getChild("posterImage");setTimeout(function(){if(a&&n&&n.el()){n.el().insertBefore(i,a.el())}},0)},el:function n(){return i}}};e.exports=r},{}],37:[function(t,e,n){"use strict";var i=videojs.Component;var r=t("./black-poster")(i);videojs.BlackPoster=videojs.Component.extend(r)},{"./black-poster":36}],38:[function(t,e,n){"use strict";var i=t("../ads/vast/VASTClient");var r=t("../ads/vast/VASTError");var a=t("../ads/vast/vastUtil");var s=t("../ads/vast/VASTIntegrator");var o=t("../ads/vpaid/VPAIDIntegrator");var u=t("../utils/async");var l=t("../utils/dom");var c=t("../utils/playerUtils");var d=t("../utils/utilityFunctions");e.exports=function f(t){var e;var n=this;var f=new i;var h=false;var p={timeout:500,iosPrerollCancelTimeout:2e3,adCancelTimeout:3e3,playAdAlways:false,adsEnabled:true,autoResize:true,vpaidFlashLoaderPath:"/VPAIDFlash.swf"};var v=d.extend({},p,t||{});if(d.isUndefined(v.adTagUrl)&&d.isDefined(v.url)){v.adTagUrl=v.url}if(d.isString(v.adTagUrl)){v.adTagUrl=d.echoFn(v.adTagUrl)}if(d.isDefined(v.adTagXML)&&!d.isFunction(v.adTagXML)){return k(new r("on VideoJS VAST plugin, the passed adTagXML option does not contain a function"))}if(!d.isDefined(v.adTagUrl)&&!d.isFunction(v.adTagXML)){return k(new r("on VideoJS VAST plugin, missing adTagUrl on options object"))}a.runFlashSupportCheck(v.vpaidFlashLoaderPath);c.prepareForAds(n);if(v.playAdAlways){n.on("vast.contentEnd",function(){setTimeout(function(){n.trigger("vast.reset")},0)})}n.on("vast.firstPlay",g);n.on("vast.reset",function(){e=null;m()});n.vast={isEnabled:function(){return v.adsEnabled},enable:function(){v.adsEnabled=true},disable:function(){v.adsEnabled=false}};return n.vast;function g(){c.removeNativePoster(n);c.once(n,["vast.adsCancel","vast.adEnd"],function(){t();i()});u.waterfall([s,o,p,y],function(t,e){if(t){k(t,e)}else{n.trigger("vast.adEnd")}});function t(){if(n.vast&&n.vast.adUnit){n.vast.adUnit=null}}function i(){a();if(e){c.restorePlayerSnapshot(n,e);e=null}}function a(){c.once(n,["playing","vast.reset","vast.firstPlay"],function(t){if(t.type!=="playing"){return}n.trigger("vast.contentStart");c.once(n,["ended","vast.reset","vast.firstPlay"],function(t){if(t.type==="ended"){n.trigger("vast.contentEnd")}})})}function s(t){if(v.adsEnabled){return t(null)}t(new r("Ads are not enabled"))}function o(t){if(f()){e=c.getPlayerSnapshot(n);n.pause();g();if(n.paused()){t(null)}else{c.once(n,["playing"],function(){n.pause();t(null)})}}else{t(new r("video content has been playing before preroll ad"))}}function f(){return!d.isIPhone()||n.currentTime()<=v.iosPrerollCancelTimeout}function p(t){var e;h=false;e=setTimeout(function(){k(new r("timeout while waiting for the video to start playing",402))},v.adCancelTimeout);c.once(n,["vast.adStart","vast.adsCancel"],i);function i(){if(e){clearTimeout(e);e=null}}t(null)}function g(){l.addClass(n.el(),"vjs-vast-ad-loading");c.once(n,["vast.adStart","vast.adsCancel"],m)}function m(){setTimeout(function(){l.removeClass(n.el(),"vjs-vast-ad-loading")},100)}}function m(){n.trigger("vast.adsCancel");h=true}function y(t){u.waterfall([A,_],t)}function A(t){f.getVASTResponse(v.adTagUrl?v.adTagUrl():v.adTagXML,t)}function _(t,e){if(h){return}var i=E(t)?new o(n,v):new s(n);var r=false;c.once(n,["vast.adStart","vast.adsCancel"],function(t){if(t.type==="vast.adStart"){a()}});c.once(n,["vast.adEnd","vast.adsCancel"],u);if(d.isIDevice()){l()}n.vast.vastResponse=t;n.vast.adUnit=i.playAd(t,e);function a(){if(r||n.controlBar.getChild("AdsLabel")){return}n.controlBar.addChild("AdsLabel")}function u(){n.controlBar.removeChild("AdsLabel");r=true}function l(){var t=3;var e=0;var i=0;n.on("timeupdate",a);n.on("ended",r);c.once(n,["vast.adEnd","vast.adsCancel","vast.adError"],s);function r(){if(n.duration()-e>t){n.pause(true);n.play(true);n.currentTime(e)}}function a(){var r=n.currentTime();var a=Math.abs(r-e);if(a>t){i+=1;if(i>=2){n.pause(true)}n.currentTime(e)}else{e=r}}function s(){n.off("timeupdate",a);n.off("ended",r)}}}function k(t,e){n.trigger({type:"vast.adError",error:t});m();if(console&&console.log){console.log("AD ERROR:",t.message,t,e)}}function E(t){var e,n;var i=t.mediaFiles;for(e=0,n=i.length;e0){u=setTimeout(function(){l&&l.abort()},o)}function c(t,e,n){if(!r.isString(t)||r.isEmptyString(t)){throw new a("Invalid url '"+t+"'")}if(!r.isFunction(e)){throw new a("Invalid handler '"+e+"' for the http request")}if(r.isDefined(n)&&!r.isObject(n)){throw new a("Invalid options map '"+n+"'")}}function d(t,e){r.forEach(e,function(e,n){if(r.isDefined(e)){t.setRequestHeader(n,e)}})}function f(){n(-1,null,null,"")}};s.prototype.get=function(t,e,n){this.run("GET",t,i,n);function i(t,n,i,s){if(r(t)){e(null,n,t,i,s)}else{e(new a(s),n,t,i,s)}}function r(t){return 200<=t&&t<300}};function o(){var t=new XMLHttpRequest;if(!("withCredentials"in t)){t=new XDomainRequest}return t}var u=new s(o);e.exports={http:u,HttpRequest:s,HttpRequestError:a,createXhr:o}},{"./urlUtils":43,"./utilityFunctions":44}],42:[function(t,e,n){"use strict";var i=t("./dom");var r=t("./utilityFunctions");var a={};a.getPlayerSnapshot=function s(t){var e=t.el().querySelector(".vjs-tech");var n={ended:t.ended(),src:t.currentSrc(),currentTime:t.currentTime(),type:t.currentType(),playing:!t.paused(),suppressedTracks:i(t)};if(e){n.nativePoster=e.poster;n.style=e.getAttribute("style")}return n;function i(t){var e=t.remoteTextTracks?t.remoteTextTracks():[];if(e&&r.isArray(e.tracks_)){e=e.tracks_}if(!r.isArray(e)){e=[]}var n=[];e.forEach(function(t){n.push({track:t,mode:t.mode});t.mode="disabled"});return n}};a.restorePlayerSnapshot=function o(t,e){var n=t.el().querySelector(".vjs-tech");var i=20;if(e.nativePoster){n.poster=e.nativePoster}if("style"in e){n.setAttribute("style",e.style||"")}if(s(t,e)){t.one("contentloadedmetadata",o);t.one("canplay",u);r();t.src({src:e.src,type:e.type});t.load()}else{o();if(e.playing){t.play()}}function r(){var e=setTimeout(function(){t.trigger("canplay")},1e3);t.one("canplay",function(){clearTimeout(e)})}function s(t,e){if(t.src()){return t.src()!==e.src}return t.currentSrc()!==e.src}function o(){var t=e.suppressedTracks;t.forEach(function(t){t.track.mode=t.mode})}function u(){if(!a.isReadyToResume(t)&&i--){setTimeout(u,50)}else{try{if(t.currentTime()!==e.currentTime){if(e.playing){t.one("seeked",function(){t.play()})}t.currentTime(e.currentTime)}else if(e.playing){t.play()}}catch(n){videojs.log.warn("Failed to resume the content after an advertisement",n)}}}};a.isReadyToResume=function(t){if(t.readyState()>1){return true}if(t.seekable()===undefined){return true}if(t.seekable().length>0){return true}return false};a.prepareForAds=function(t){var e=t.addChild("blackPoster");var n=true;var a;s();t.on("play",u);t.on("vast.reset",l);t.on("vast.firstPlay",f);t.on("error",p);t.on("vast.adStart",p);t.on("vast.adsCancel",p);t.on("vast.adError",p);t.on("vast.adStart",v);t.on("vast.adEnd",g);t.on("vast.adsCancel",g);function s(){var e=t.play;t.play=function(n){var i=this;if(c()){s()}else{u(n)}return this;function s(){if(!r.isIPhone()){a=d();t.muted(true)}e.apply(i,arguments)}function u(n){if(o()&&!n){t.vast.adUnit.resumeAd()}else{e.apply(i,arguments)}}};var n=t.pause;t.pause=function(e){if(o()&&!e){t.vast.adUnit.pauseAd()}else{n.apply(this,arguments)}return this};var i=t.paused;t.paused=function(e){if(o()&&!e){return t.vast.adUnit.isPaused()}return i.apply(this,arguments)}}function o(){return t.vast&&t.vast.adUnit}function u(){if(c()){n=false;t.trigger("vast.firstPlay")}}function l(){n=true;e.show();f()}function c(){return n}function d(){return{muted:t.muted(),volume:t.volume()}}function f(){if(a){t.currentTime(0);h(a);a=null}}function h(e){if(r.isObject(e)){t.volume(e.volume);t.muted(e.muted)}}function p(){if(!i.hasClass(e.el(),"vjs-hidden")){e.hide()}}function v(){i.addClass(t.el(),"vjs-ad-playing")}function g(){i.removeClass(t.el(),"vjs-ad-playing")}};a.removeNativePoster=function(t){var e=t.el().querySelector(".vjs-tech");if(e){e.removeAttribute("poster")}};a.once=function u(t,e,n){function i(){n.apply(null,arguments);e.forEach(function(e){t.off(e,i)})}e.forEach(function(e){t.on(e,i)})};e.exports=a},{"./dom":40,"./utilityFunctions":44}],43:[function(t,e,n){"use strict";var i=t("./utilityFunctions");var r=document.createElement("a");var a=document.documentMode;function s(t){var e=t;if(a){r.setAttribute("href",e);e=r.href}r.setAttribute("href",e);return{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:i.isNotEmptyString(r.port)?r.port:80,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}function o(t,e){var n,r;e=i.isFunction(e)?e:function(){return true};t=t.trim().replace(/^\?/,"");n=t.split("&");r={};i.forEach(n,function(t){var n,i,a;if(t!==""){n=t.split("=");i=n[0];a=n[1];if(e(i,a)){r[i]=a}}});return r}function u(t){var e=[];i.forEach(t,function(t,n){e.push(n+"="+t)});return e.join("&")}e.exports={urlParts:s,queryStringToObj:o,objToQueryString:u}},{"./utilityFunctions":44}],44:[function(t,e,n){"use strict";var i=1;var r=/[A-Z]/g;var a=/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i;var s=/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function o(){}function u(t){return t===null}function l(t){return t!==undefined}function c(t){return t===undefined}function d(t){return typeof t==="object"}function f(t){return typeof t==="function"}function h(t){return typeof t==="number"}function p(t){return j.isObject(t)&&t.window===t}function v(t){return Object.prototype.toString.call(t)==="[object Array]"}function g(t){if(t===null||j.isWindow(t)||j.isFunction(t)||j.isUndefined(t)){return false}var e=t.length;if(t.nodeType===i&&e){return true}return j.isString(t)||j.isArray(t)||e===0||typeof e==="number"&&e>0&&e-1 in t}function m(t){return typeof t==="string"}function y(t){return j.isString(t)&&t.length===0}function A(t){return j.isString(t)&&t.length!==0}function _(t){return Array.prototype.slice.call(t)}function k(t,e,n){var i,r;if(t){if(f(t)){for(i in t){if(i!=="prototype"&&i!=="length"&&i!=="name"&&(!t.hasOwnProperty||t.hasOwnProperty(i))){e.call(n,t[i],i,t)}}}else if(v(t)){var a=typeof t!=="object";for(i=0,r=t.length;i=e){n=i;t.apply(this,arguments)}}}function F(t,e){var n;return function(){if(n){clearTimeout(n)}n=setTimeout(function(){t.apply(this,arguments);n=undefined},e)}}function L(t,e,n){var i=e(t);for(var r=0;r0}return t.getElementsByTagNameNS(i,"parsererror").length>0}catch(r){}}};r.parseText=function s(t){if(/^\s*$/.test(t)){return null}if(/^(?:true|false)$/i.test(t)){return t.toLowerCase()==="true"}if(isFinite(t)){return parseFloat(t)}if(i.isISO8601(t)){return new Date(t)}return t.trim()};r.JXONTree=function o(t){var e=r.parseText;if(t.documentElement){return new r.JXONTree(t.documentElement)}if(t.hasChildNodes()){var n="";for(var a,s,o,u=0;u0:t.hasAttributes();if(l){var c;for(var d=0;d/g,">").replace(/"/g,""").replace(/'/g,"'")};r.decode=function f(t){return t.replace(/'/g,"'").replace(/"/g,'"').replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&")};e.exports=r},{"./utilityFunctions":44}],46:[function(t,e,n){"use strict";t("./plugin/components/ads-label_4");t("./plugin/components/black-poster_4");var i=t("./plugin/videojs.vast.vpaid");videojs.plugin("vastClient",i)},{"./plugin/components/ads-label_4":35,"./plugin/components/black-poster_4":37,"./plugin/videojs.vast.vpaid":38}]},{},[46]); +(function t(e,n,i){function r(s,o){if(!n[s]){if(!e[s]){var u=typeof require=="function"&&require;if(!o&&u)return u(s,!0);if(a)return a(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[s]={exports:{}};e[s][0].call(c.exports,function(t){var n=e[s][1][t];return r(n?n:t)},c,c.exports,t,e,n,i)}return n[s].exports}var a=typeof require=="function"&&require;for(var s=0;s0){i(e)}},0)}})}},{key:"_callCallback",value:function _(t,e,n,i){var r=this._callbacks.get(e);if(!r){if(n&&e===""){this.trigger(f,n)}return}p.call(this,e,n,i)}},{key:"_handShake",value:function k(t,e){this._ready=true;if(this._handShakeHandler){this._handShakeHandler(t,e);delete this._handShakeHandler}}},{key:"getSize",value:function E(){return{width:this._width,height:this._height}}},{key:"setSize",value:function T(t,e){this._width=s(t,this._width);this._height=s(e,this._height);this._el.setAttribute("width",this._width);this._el.setAttribute("height",this._height)}},{key:"getWidth",value:function w(){return this._width}},{key:"setWidth",value:function b(t){this.setSize(t,this._height)}},{key:"getHeight",value:function S(){return this._height}},{key:"setHeight",value:function V(t){this.setSize(this._width,t)}},{key:"getFlashID",value:function C(){return this._flashID}},{key:"getFlashURL",value:function I(){return this._flashURL}},{key:"isReady",value:function F(){return this._ready}},{key:"destroy",value:function L(){this.offAll();this.removeAllCallbacks();c.removeInstanceByID(this._flashID);if(this._el.parentElement){this._el.parentElement.removeChild(this._el)}}}]);return t}();function p(t,e,n){var i=this;setTimeout(function(){var r=i._callbacks.get(t);if(r){i._callbacks.remove(t);r(e,n)}},0)}Object.defineProperty(h,"VPAID_FLASH_HANDLER",{writable:false,configurable:false,value:d});window[d]=function(t,e,n,i,r,a){var s=c.getInstanceByID(t);if(!s)return;if(n==="handShake"){s._handShake(r,a)}else{if(e!=="event"){s._callCallback(n,i,r,a)}else{s._trigger(n,a)}}}},{"./jsFlashBridgeRegistry":6,"./registry":7,"./utils":8}],6:[function(t,e,n){"use strict";var i=t("./registry").SingleValueRegistry;var r=new i;var a={};Object.defineProperty(a,"addInstance",{writable:false,configurable:false,value:function s(t,e){r.add(t,e)}});Object.defineProperty(a,"getInstanceByID",{writable:false,configurable:false,value:function o(t){return r.get(t)}});Object.defineProperty(a,"removeInstanceByID",{writable:false,configurable:false,value:function u(t){return r.remove(t)}});e.exports=a},{"./registry":7}],7:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:true});var i=function(){function t(t,e){for(var n=0;n0?t:e}var u=function(){if(String.prototype.endsWith)return String.prototype.endsWith;return function t(e,n){var i=this.toString();if(n===undefined||n>i.length){n=i.length}n-=e.length;var r=i.indexOf(e,n);return r!==-1&&r===n}}();function l(t,e){return u.call(t,e)}function c(t){t.style.position="absolute";t.style.left="-1px";t.style.top="-1px";t.style.width="1px";t.style.height="1px"}},{}],9:[function(t,e,n){"use strict";var i=["handshakeVersion","initAd","startAd","stopAd","skipAd","resizeAd","pauseAd","resumeAd","expandAd","collapseAd","subscribe","unsubscribe"];var r=["AdLoaded","AdStarted","AdStopped","AdSkipped","AdSkippableStateChange","AdSizeChange","AdLinearChange","AdDurationChange","AdExpandedChange","AdRemainingTimeChange","AdVolumeChange","AdImpression","AdVideoStart","AdVideoFirstQuartile","AdVideoMidpoint","AdVideoThirdQuartile","AdVideoComplete","AdClickThru","AdInteraction","AdUserAcceptInvitation","AdUserMinimize","AdUserClose","AdPaused","AdPlaying","AdLog","AdError"];var a=["getAdLinear","getAdWidth","getAdHeight","getAdExpanded","getAdSkippableState","getAdRemainingTime","getAdDuration","getAdVolume","getAdCompanions","getAdIcons"];var s=["setAdVolume"];function o(t,e,n){}o.prototype.handshakeVersion=function(t,e){};o.prototype.initAd=function(t,e,n,i,r,a,s){};o.prototype.startAd=function(t){};o.prototype.stopAd=function(t){};o.prototype.skipAd=function(t){};o.prototype.resizeAd=function(t,e,n,i){};o.prototype.pauseAd=function(t){};o.prototype.resumeAd=function(t){};o.prototype.expandAd=function(t){};o.prototype.collapseAd=function(t){};o.prototype.subscribe=function(t,e,n){};o.prototype.unsubscribe=function(t,e){};o.prototype.getAdLinear=function(t){};o.prototype.getAdWidth=function(t){};o.prototype.getAdHeight=function(t){};o.prototype.getAdExpanded=function(t){};o.prototype.getAdSkippableState=function(t){};o.prototype.getAdRemainingTime=function(t){};o.prototype.getAdDuration=function(t){};o.prototype.getAdVolume=function(t){};o.prototype.getAdCompanions=function(t){};o.prototype.getAdIcons=function(t){};o.prototype.setAdVolume=function(t,e){};l(o,"METHODS",i);l(o,"GETTERS",a);l(o,"SETTERS",s);l(o,"EVENTS",r);var u=i.filter(function(t){return["skipAd"].indexOf(t)===-1});l(o,"checkVPAIDInterface",function c(t){var e=u.every(function(e){return typeof t[e]==="function"});return e});e.exports=o;function l(t,e,n){Object.defineProperty(t,e,{writable:false,configurable:false,value:n})}},{}],10:[function(t,e,n){"use strict";var i=t("./IVPAIDAdUnit");var r=t("./subscriber");var a=i.checkVPAIDInterface;var s=t("./utils");var o=i.METHODS;var u="AdError";var l="AdClickThru";var c=i.EVENTS.filter(function(t){return t!=l});function d(t,e,n,i){this._isValid=a(t);if(this._isValid){this._creative=t;this._el=e;this._videoEl=n;this._iframe=i;this._subscribers=new r;f.call(this)}}d.prototype=Object.create(i.prototype);d.prototype.isValidVPAIDAd=function g(){return this._isValid};i.METHODS.forEach(function(t){var e=["subscribe","unsubscribe","initAd"];if(e.indexOf(t)!==-1)return;d.prototype[t]=function(){var e=i.prototype[t].length;var n=Array.prototype.slice.call(arguments);var r=e===n.length?n.pop():undefined;setTimeout(function(){var e,i=null;try{e=this._creative[t].apply(this._creative,n)}catch(a){i=a}v(r,this._subscribers,i,e)}.bind(this),0)}});d.prototype.initAd=function m(t,e,n,i,r,a,o){r=r||{};a=s.extend({slot:this._el,videoSlot:this._videoEl},a||{});setTimeout(function(){var s;try{this._creative.initAd(t,e,n,i,r,a)}catch(u){s=u}v(o,this._subscribers,s)}.bind(this),0)};d.prototype.subscribe=function y(t,e,n){this._subscribers.subscribe(e,t,n)};d.prototype.unsubscribe=function A(t,e){this._subscribers.unsubscribe(e,t)};d.prototype.on=d.prototype.subscribe;d.prototype.off=d.prototype.unsubscribe;i.GETTERS.forEach(function(t){d.prototype[t]=function(e){setTimeout(function(){var n,i=null;try{n=this._creative[t]()}catch(r){i=r}v(e,this._subscribers,i,n)}.bind(this),0)}});d.prototype.setAdVolume=function _(t,e){setTimeout(function(){var n,i=null;try{this._creative.setAdVolume(t);n=this._creative.getAdVolume()}catch(r){i=r}if(!i){i=s.validate(n===t,"failed to apply volume: "+t)}v(e,this._subscribers,i,n)}.bind(this),0)};d.prototype._destroy=function k(){this.stopAd();this._subscribers.unsubscribeAll()};function f(){c.forEach(function(t){this._creative.subscribe(p.bind(this,t),t)}.bind(this));this._creative.subscribe(h.bind(this),l);if(this._videoEl){var t=this._iframe.contentDocument.documentElement;var e=this._videoEl;t.addEventListener("click",function(n){if(n.target===t){e.click()}})}}function h(t,e,n){this._subscribers.triggerSync(l,{url:t,id:e,playerHandles:n})}function p(t){this._subscribers.trigger(t,Array.prototype.slice(arguments,1))}function v(t,e,n,i){if(t){t(n,i)}else if(n){e.trigger(u,n)}}e.exports=d},{"./IVPAIDAdUnit":9,"./subscriber":12,"./utils":13}],11:[function(t,e,n){"use strict";var i=t("./utils");var r=i.unique("vpaidIframe");var a=t("./VPAIDAdUnit");var s=""+''+''+'
'+''+'"+""+"";var o="AdStopped";function u(t,e,n,a){n=n||{};this._id=r();this._destroyed=false;this._frameContainer=i.createElementInEl(t,"div");this._videoEl=e;this._vpaidOptions=a||{timeout:1e4};this._templateConfig={template:n.template||s,extraOptions:n.extraOptions||{}}}u.prototype.destroy=function m(){if(this._destroyed){return}this._destroyed=true;d.call(this)};u.prototype.isDestroyed=function y(){return this._destroyed};u.prototype.loadAdUnit=function A(t,e){v.call(this);d.call(this);var n=this;var r=i.createIframeWithContent(this._frameContainer,this._templateConfig.template,i.extend({iframeURL_JS:t,iframeID:this.getID(),origin:g()},this._templateConfig.extraOptions));this._frame=r;this._onLoad=i.callbackTimeout(this._vpaidOptions.timeout,s.bind(this),u.bind(this));window.addEventListener("message",this._onLoad);function s(t){if(t.origin!==g())return;var r=JSON.parse(t.data);if(r.id!==n.getID())return;var s,u,l;if(!n._frame.contentWindow){u="the iframe is not anymore in the DOM tree"}else{l=n._frame.contentWindow.getVPAIDAd;u=i.validate(typeof l==="function","the ad didn't return a function to create an ad")}if(!u){var d=n._frame.contentWindow.document.querySelector(".ad-element");s=new a(l(),d,n._videoEl,n._frame);s.subscribe(o,c.bind(n));u=i.validate(s.isValidVPAIDAd(),"the add is not fully complaint with VPAID specification")}n._adUnit=s;h.call(n);e(u,u?null:s);return true}function u(){e("timeout",null)}};u.prototype.unloadAdUnit=function _(){d.call(this)};u.prototype.getID=function(){return this._id};function l(t){var e=this[t];if(e){e.remove();delete this[t]}}function c(){f.call(this);delete this._adUnit}function d(){f.call(this);p.call(this)}function f(){l.call(this,"_frame");h.call(this)}function h(){if(this._onLoad){window.removeEventListener("message",this._onLoad);i.clearCallbackTimeout(this._onLoad);delete this._onLoad}}function p(){if(this._adUnit){this._adUnit.stopAd();delete this._adUnit}}function v(){if(this._destroyed){throw new Error("VPAIDHTML5Client already destroyed!")}}function g(){if(window.location.origin){return window.location.origin}else{return window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"")}}e.exports=u;window.VPAIDHTML5Client=u},{"./VPAIDAdUnit":10,"./utils":13}],12:[function(t,e,n){"use strict";function i(){this._subscribers={}}i.prototype.subscribe=function r(t,e,n){if(!this.isHandlerAttached(t,e)){this.get(e).push({handler:t,context:n,eventName:e})}};i.prototype.unsubscribe=function a(t,e){this._subscribers[e]=this.get(e).filter(function(e){return t!==e.handler})};i.prototype.unsubscribeAll=function s(){this._subscribers={}};i.prototype.trigger=function(t,e){var n=this;var i=this.get(t).concat(this.get("*"));i.forEach(function(t){setTimeout(function(){if(n.isHandlerAttached(t.handler,t.eventName)){t.handler.call(t.context,e)}},0)})};i.prototype.triggerSync=function(t,e){var n=this.get(t).concat(this.get("*"));n.forEach(function(t){t.handler.call(t.context,e)})};i.prototype.get=function o(t){if(!this._subscribers[t]){this._subscribers[t]=[]}return this._subscribers[t]};i.prototype.isHandlerAttached=function u(t,e){return this.get(e).some(function(e){return t===e.handler})};e.exports=i},{}],13:[function(t,e,n){"use strict";function i(){}function r(t,e){return t?null:new Error(e)}var a={};function s(t){var e=a[t];if(e){clearTimeout(e);delete a[t]}}function o(t,e,n){var r,o;o=setTimeout(function(){e=i;delete o[r];n()},t);r=function(){if(e.apply(this,arguments)){s(r)}};a[r]=o;return r}function u(t,e,n){var i=document.createElement(e);if(n)i.id=n;t.appendChild(i);return i}function l(t,e,n){var i=c(t,null,n.zIndex);if(!f(i,d(e,n)))return;return i}function c(t,e,n){var i=document.createElement("iframe");i.src=e||"about:blank";i.marginWidth="0";i.marginHeight="0";i.frameBorder="0";i.width="100%";i.height="100%";i.style.position="absolute";i.style.left="0";i.style.top="0";i.style.margin="0px";i.style.padding="0px";i.style.border="none";if(n){i.style.zIndex=n}i.setAttribute("SCROLLING","NO");t.innerHTML="";t.appendChild(i);return i}function d(t,e){Object.keys(e).forEach(function(n){var i=typeof i==="object"?JSON.stringify(e[n]):e[n];t=t.replace(new RegExp("{{"+n+"}}","g"),i)});return t}function f(t,e){var n=t.contentWindow&&t.contentWindow.document;if(!n)return false;n.write(e);return true}function h(t,e){Object.keys(e).forEach(function(n){t[n]=e[n]});return t}function p(t){var e=-1;return function(){return t+"_"+ ++e}}e.exports={noop:i,validate:r,clearCallbackTimeout:s,callbackTimeout:o,createElementInEl:u,createIframeWithContent:l,createIframe:c,simpleTemplate:d,setIframeContent:f,extend:h,unique:p}},{}],14:[function(t,e,n){"use strict";var i=t("./InLine");var r=t("./Wrapper");function a(t){if(!(this instanceof a)){return new a(t)}this.initialize(t)}a.prototype.initialize=function(t){this.id=t.attr("id");this.sequence=t.attr("sequence");if(t.inLine){this.inLine=new i(t.inLine)}if(t.wrapper){this.wrapper=new r(t.wrapper)}};e.exports=a},{"./InLine":17,"./Wrapper":27}],15:[function(t,e,n){"use strict";var i=t("./TrackingEvent");var r=t("../../utils/utilityFunctions");var a=t("../../utils/xml");function s(t){if(!(this instanceof s)){return new s(t)}this.creativeType=a.attr(t.staticResource,"creativeType");this.staticResource=a.keyValue(t.staticResource);var e=null;if(a.keyValue(t.HTMLResource)){e=a.keyValue(t.HTMLResource)}else if(a.keyValue(t.hTMLResource)){e=a.keyValue(t.hTMLResource)}this.htmlResource=e;var n=null;if(a.keyValue(t.IFrameResource)){ +n=a.keyValue(t.IFrameResource)}else if(a.keyValue(t.iFrameresource)){n=a.keyValue(t.iFrameresource)}this.iframeResource=n;this.id=a.attr(t,"id");this.width=a.attr(t,"width");this.height=a.attr(t,"height");this.expandedWidth=a.attr(t,"expandedWidth");this.expandedHeight=a.attr(t,"expandedHeight");this.scalable=a.attr(t,"scalable");this.maintainAspectRatio=a.attr(t,"maintainAspectRatio");this.minSuggestedDuration=a.attr(t,"minSuggestedDuration");this.apiFramework=a.attr(t,"apiFramework");this.companionClickThrough=a.keyValue(t.companionClickThrough);this.trackingEvents=o(t.trackingEvents&&t.trackingEvents.tracking);function o(t){var e=[];if(r.isDefined(t)){t=r.isArray(t)?t:[t];t.forEach(function(t){e.push(new i(t))})}return e}}e.exports=s},{"../../utils/utilityFunctions":44,"../../utils/xml":45,"./TrackingEvent":20}],16:[function(t,e,n){"use strict";var i=t("./Linear");var r=t("./Companion");var a=t("../../utils/utilityFunctions");function s(t){if(!(this instanceof s)){return new s(t)}this.id=t.attr("id");this.sequence=t.attr("sequence");this.adId=t.attr("adId");this.apiFramework=t.attr("apiFramework");if(t.linear){this.linear=new i(t.linear)}if(t.companionAds){var e=[];var n=t.companionAds&&t.companionAds.companion;if(a.isDefined(n)){n=a.isArray(n)?n:[n];n.forEach(function(t){e.push(new r(t))})}this.companionAds=e}}s.prototype.isSupported=function(){if(this.linear){return this.linear.isSupported()}return true};s.parseCreatives=function o(t){var e=[];var n;if(a.isDefined(t)&&a.isDefined(t.creative)){n=a.isArray(t.creative)?t.creative:[t.creative];n.forEach(function(t){e.push(new s(t))})}return e};e.exports=s},{"../../utils/utilityFunctions":44,"./Companion":15,"./Linear":18}],17:[function(t,e,n){"use strict";var i=t("./vastUtil");var r=t("./Creative");var a=t("../../utils/utilityFunctions");var s=t("../../utils/xml");function o(t){if(!(this instanceof o)){return new o(t)}this.adTitle=s.keyValue(t.adTitle);this.adSystem=s.keyValue(t.adSystem);this.impressions=i.parseImpressions(t.impression);this.creatives=r.parseCreatives(t.creatives);this.description=s.keyValue(t.description);this.advertiser=s.keyValue(t.advertiser);this.surveys=e(t.survey);this.error=s.keyValue(t.error);this.pricing=s.keyValue(t.pricing);this.extensions=t.extensions;function e(t){if(t){return a.transformArray(a.isArray(t)?t:[t],function(t){if(a.isNotEmptyString(t.keyValue)){return{uri:t.keyValue,type:t.attr("type")}}return undefined})}return[]}}o.prototype.isSupported=function(){var t,e;if(this.creatives.length===0){return false}for(t=0,e=this.creatives.length;t0){d(r.shift(),[],a)}else{e(t,i)}}else{e(null,i)}}});function a(t,e){var i=n._requestVASTXml.bind(n,t);o.waterfall([i,s],e)}function s(t,e){var n;try{n=c.toJXONTree(t);if(l.isArray(n.ad)){n.ads=n.ad}else if(n.ad){n.ads=[n.ad]}else{n.ads=[]}e(u(n),n)}catch(i){e(new r("on VASTClient.getVASTAd.buildVastWaterfall, error parsing xml",100),null)}}function u(t){var e=c.attr(t,"version");if(!t.ad){return new r("on VASTClient.getVASTAd.validateVASTTree, no Ad in VAST tree",303)}if(e&&(e!=3&&e!=2)){return new r('on VASTClient.getVASTAd.validateVASTTree, not supported VAST version "'+e+'"',102)}return null}function d(t,e,i){if(e.length>=n.WRAPPER_LIMIT){return i(new r("on VASTClient.getVASTAd.getAd, players wrapper limit reached (the limit is "+n.WRAPPER_LIMIT+")",302),e)}o.waterfall([function(e){if(l.isString(t)){p(t,e)}else{e(null,t)}},f],function(t,n){if(n){e.push(n)}if(t){return i(t,e)}if(n.wrapper){return d(n.wrapper.VASTAdTagURI,e,i)}return i(null,e)})}function f(t,e){try{var n=new i(t);e(h(n),n)}catch(a){e(new r("on VASTClient.getVASTAd.buildAd, error parsing xml",100),null)}}function h(t){var e=t.wrapper;var n=t.inLine;var i="on VASTClient.getVASTAd.validateAd, ";if(n&&e){return new r(i+"InLine and Wrapper both found on the same Ad",101)}if(!n&&!e){return new r(i+"nor wrapper nor inline elements found on the Ad",101)}if(n&&!n.isSupported()){return new r(i+"could not find MediaFile that is supported by this video player",403)}if(e&&!e.VASTAdTagURI){return new r(i+"missing 'VASTAdTagURI' in wrapper",101)}return null}function p(t,e){n._requestVASTXml(t,function(t,n){if(t){return e(t)}try{var i=c.toJXONTree(n);e(u(i),i.ad)}catch(a){e(new r("on VASTClient.getVASTAd.requestVASTAd, error parsing xml",100))}})}};d.prototype._requestVASTXml=function h(t,e){try{if(l.isFunction(t)){t(i)}else{u.get(t,i,{withCredentials:true})}}catch(n){e(n)}function i(t,n,i){if(t){var a=l.isDefined(i)?"on VASTClient.requestVastXML, HTTP request error with status '"+i+"'":"on VASTClient.requestVastXML, Error getting the the VAST XML with he passed adTagXML fn";return e(new r(a,301),null)}e(null,n)}};d.prototype._buildVASTResponse=function p(t){var e=new a;n(e,t);i(e);return e;function n(t,e){e.forEach(function(e){t.addAd(e)})}function i(t){var e=t.trackingEvents.progress;if(!t.hasLinear()){throw new r("on VASTClient._buildVASTResponse, Received an Ad type that is not supported",200)}if(t.duration===undefined){throw new r("on VASTClient._buildVASTResponse, Missing duration field in VAST response",101)}if(e){e.forEach(function(t){if(!l.isNumber(t.offset)){throw new r("on VASTClient._buildVASTResponse, missing or wrong offset attribute on progress tracking event",101)}})}}};d.prototype._trackError=function(t,e){if(!l.isArray(e)||e.length===0){return}var n=[];e.forEach(i);s.track(n,{ERRORCODE:t.code||900});function i(t){if(t.wrapper&&t.wrapper.error){n.push(t.wrapper.error)}if(t.inLine&&t.inLine.error){n.push(t.inLine.error)}}};e.exports=d},{"../../utils/async":39,"../../utils/http":41,"../../utils/utilityFunctions":44,"../../utils/xml":45,"./Ad":14,"./VASTError":22,"./VASTResponse":24,"./vastUtil":29}],22:[function(t,e,n){"use strict";function i(t,e){this.message="VAST Error: "+(t||"");if(e){this.code=e}}i.prototype=new Error;i.prototype.name="VAST Error";e.exports=i},{}],23:[function(t,e,n){"use strict";var i=t("./VASTResponse");var r=t("./VASTError");var a=t("./VASTTracker");var s=t("./vastUtil");var o=t("../../utils/async");var u=t("../../utils/dom");var l=t("../../utils/playerUtils");var c=t("../../utils/utilityFunctions");function d(t){if(!(this instanceof d)){return new d(t)}this.player=t}d.prototype.playAd=function f(t,e){var n=this;e=e||c.noop;if(!(t instanceof i)){return e(new r("On VASTIntegrator, missing required VASTResponse"))}o.waterfall([function(e){e(null,t)},this._selectAdSource.bind(this),this._createVASTTracker.bind(this),this._addClickThrough.bind(this),this._addSkipButton.bind(this),this._setupEvents.bind(this),this._playSelectedAd.bind(this)],function(t,i){if(t&&i){n._trackError(t,i)}e(t,i)});this._adUnit={_src:null,type:"VAST",pauseAd:function(){n.player.pause(true)},resumeAd:function(){n.player.play(true)},isPaused:function(){return n.player.paused(true)},getSrc:function(){return this._src}};return this._adUnit};d.prototype._selectAdSource=function h(t,e){var n;var i=u.getDimension(this.player.el()).width;t.mediaFiles.sort(function a(t,e){var n=Math.abs(i-t.width);var r=Math.abs(i-e.width);return n-r});n=this.player.selectSource(t.mediaFiles).source;if(n){if(this._adUnit){this._adUnit._src=n}return e(null,n,t)}e(new r("Could not find Ad mediafile supported by this player",403),t)};d.prototype._createVASTTracker=function p(t,e,n){try{n(null,t,new a(t.src,e),e)}catch(i){n(i,e)}};d.prototype._setupEvents=function v(t,e,n,i){var r;var a=this.player;a.on("fullscreenchange",o);a.on("vast.adStart",d);a.on("pause",u);a.on("timeupdate",c);a.on("volumechange",f);l.once(a,["vast.adEnd","vast.adsCancel"],s);l.once(a,["vast.adEnd","vast.adsCancel","vast.adSkip"],function(t){if(t.type==="vast.adEnd"){e.trackComplete()}});return i(null,t,n);function s(){a.off("fullscreenchange",o);a.off("vast.adStart",d);a.off("pause",u);a.off("timeupdate",c);a.off("volumechange",f)}function o(){if(a.isFullscreen()){e.trackFullscreen()}else{e.trackExitFullscreen()}}function u(){if(Math.abs(a.duration()-a.currentTime())<2){return}e.trackPause();l.once(a,["play","vast.adEnd","vast.adsCancel"],function(t){if(t.type==="play"){e.trackResume()}})}function c(){var t=a.currentTime()*1e3;e.trackProgress(t)}function d(){e.trackImpressions();e.trackCreativeView()}function f(){var t=a.muted();if(t){e.trackMute()}else if(r){e.trackUnmute()}r=t}};d.prototype._addSkipButton=function g(t,e,n,i){var r;var a=this;if(c.isNumber(n.skipoffset)){r=n.skipoffset/1e3;s(this.player,r)}i(null,t,e,n);function s(t,e){var n=o(t);var i=d.bind(a,n,e,t);t.el().appendChild(n);t.on("timeupdate",i);l.once(t,["vast.adEnd","vast.adsCancel"],r);function r(){t.off("timeupdate",i);u.remove(n)}}function o(t){var n=window.document.createElement("div");u.addClass(n,"vast-skip-button");n.onclick=function(i){if(u.hasClass(n,"enabled")){e.trackSkip();t.trigger("vast.adSkip")}if(window.Event.prototype.stopPropagation!==undefined){i.stopPropagation()}else{return false}};return n}function d(t,e,n){var i=Math.ceil(e-n.currentTime());if(i>0){t.innerHTML="Skip in "+c.toFixedDigits(i,2)+"..."}else{if(!u.hasClass(t,"enabled")){u.addClass(t,"enabled");t.innerHTML="Skip ad"}}}};d.prototype._addClickThrough=function m(t,e,n,i){var r=this.player;var a=d(r,e,n);var o=f.bind(this,a,n,r);r.el().insertBefore(a,r.controlBar.el());r.on("timeupdate",o);l.once(r,["vast.adEnd","vast.adsCancel"],p);return i(null,t,e,n);function d(t,e,n){var i=window.document.createElement("a");var r=n.clickThrough;u.addClass(i,"vast-blocker");i.href=h(r,t);if(c.isString(r)){i.target="_blank"}i.onclick=function(n){if(t.paused()){t.play();if(window.Event.prototype.stopPropagation!==undefined){n.stopPropagation()}return false}t.pause();e.trackClick()};return i}function f(t,e,n){t.href=h(e.clickThrough,n)}function h(e,n){var i={ASSETURI:t.src,CONTENTPLAYHEAD:s.formatProgress(n.currentTime()*1e3)};return e?s.parseURLMacro(e,i):"#"}function p(){r.off("timeupdate",o);u.remove(a)}};d.prototype._playSelectedAd=function y(t,e,n){var i=this.player;i.preload("auto");i.src(t);l.once(i,["durationchange","error","vast.adsCancel"],function(t){if(t.type==="durationchange"){a()}else if(t.type==="error"){n(new r("on VASTIntegrator, Player is unable to play the Ad",400),e)}});function a(){l.once(i,["playing","vast.adsCancel"],function(t){if(t.type==="vast.adsCancel"){return}i.trigger("vast.adStart");i.on("ended",r);i.on("vast.adsCancel",r);i.on("vast.adSkip",r);function r(t){if(t.type==="ended"&&i.duration()-i.currentTime()>3){return}i.off("ended",r);i.off("vast.adsCancel",r);i.off("vast.adSkip",r);if(t.type==="ended"||t.type==="vast.adSkip"){n(null,e)}}});i.play()}};d.prototype._trackError=function A(t,e){s.track(e.errorURLMacros,{ERRORCODE:t.code||900})};e.exports=d},{"../../utils/async":39,"../../utils/dom":40,"../../utils/playerUtils":42,"../../utils/utilityFunctions":44,"./VASTError":22,"./VASTResponse":24,"./VASTTracker":25,"./vastUtil":29}],24:[function(t,e,n){"use strict";var i=t("./Ad");var r=t("./VideoClicks");var a=t("./Linear");var s=t("./InLine");var o=t("./Wrapper");var u=t("../../utils/utilityFunctions");var l=t("../../utils/xml");window.InLine__A=s;function c(){if(!(this instanceof c)){return new c}this._linearAdded=false;this.ads=[];this.errorURLMacros=[];this.impressions=[];this.clickTrackings=[];this.customClicks=[];this.trackingEvents={};this.mediaFiles=[];this.clickThrough=undefined;this.adTitle="";this.duration=undefined;this.skipoffset=undefined}c.prototype.addAd=function(t){var e,n;if(t instanceof i){e=t.inLine;n=t.wrapper;this.ads.push(t);if(e){this._addInLine(e)}if(n){this._addWrapper(n)}}};c.prototype._addErrorTrackUrl=function(t){var e=t instanceof l.JXONTree?l.keyValue(t):t;if(e){this.errorURLMacros.push(e)}};c.prototype._addImpressions=function(t){u.isArray(t)&&d(this.impressions,t)};c.prototype._addClickThrough=function(t){if(u.isNotEmptyString(t)){this.clickThrough=t}};c.prototype._addClickTrackings=function(t){u.isArray(t)&&d(this.clickTrackings,t)};c.prototype._addCustomClicks=function(t){u.isArray(t)&&d(this.customClicks,t)};c.prototype._addTrackingEvents=function(t){var e=this.trackingEvents;if(t){t=u.isArray(t)?t:[t];t.forEach(function(t){if(!e[t.name]){e[t.name]=[]}e[t.name].push(t)})}};c.prototype._addTitle=function(t){if(u.isNotEmptyString(t)){this.adTitle=t}};c.prototype._addDuration=function(t){if(u.isNumber(t)){this.duration=t}};c.prototype._addVideoClicks=function(t){if(t instanceof r){this._addClickThrough(t.clickThrough);this._addClickTrackings(t.clickTrackings);this._addCustomClicks(t.customClicks)}};c.prototype._addMediaFiles=function(t){u.isArray(t)&&d(this.mediaFiles,t)};c.prototype._addSkipoffset=function(t){if(t){this.skipoffset=t}};c.prototype._addAdParameters=function(t){if(t){this.adParameters=t}};c.prototype._addLinear=function(t){if(t instanceof a){this._addDuration(t.duration);this._addTrackingEvents(t.trackingEvents);this._addVideoClicks(t.videoClicks);this._addMediaFiles(t.mediaFiles);this._addSkipoffset(t.skipoffset);this._addAdParameters(t.adParameters);this._linearAdded=true}};c.prototype._addInLine=function(t){var e=this;if(t instanceof s){this._addTitle(t.adTitle);this._addErrorTrackUrl(t.error);this._addImpressions(t.impressions);t.creatives.forEach(function(t){if(t.linear){e._addLinear(t.linear)}})}};c.prototype._addWrapper=function(t){var e=this;if(t instanceof o){this._addErrorTrackUrl(t.error);this._addImpressions(t.impressions);t.creatives.forEach(function(t){var n=t.linear;if(n){e._addVideoClicks(n.videoClicks);e.clickThrough=undefined;e._addTrackingEvents(n.trackingEvents)}})}};c.prototype.hasLinear=function(){return this._linearAdded};function d(t,e){e.forEach(function(e){t.push(e)})}e.exports=c},{"../../utils/utilityFunctions":44,"../../utils/xml":45,"./Ad":14,"./InLine":17,"./Linear":18,"./VideoClicks":26,"./Wrapper":27}],25:[function(t,e,n){"use strict";var i=t("./VASTError");var r=t("./VASTResponse");var a=t("./vastUtil");var s=t("../../utils/utilityFunctions");function o(t,e){if(!(this instanceof o)){return new o(t,e)}this.sanityCheck(t,e);this.initialize(t,e)}o.prototype.initialize=function(t,e){this.response=e;this.assetURI=t;this.progress=0;this.quartiles={firstQuartile:{tracked:false,time:Math.round(25*e.duration)/100},midpoint:{tracked:false,time:Math.round(50*e.duration)/100},thirdQuartile:{tracked:false,time:Math.round(75*e.duration)/100}}};o.prototype.sanityCheck=function(t,e){if(!s.isString(t)||s.isEmptyString(t)){throw new i("on VASTTracker constructor, missing required the URI of the ad asset being played")}if(!(e instanceof r)){throw new i("on VASTTracker constructor, missing required VAST response")}};o.prototype.trackURLs=function u(t,e){if(s.isArray(t)&&t.length>0){e=s.extend({ASSETURI:this.assetURI,CONTENTPLAYHEAD:a.formatProgress(this.progress)},e||{});a.track(t,e)}};o.prototype.trackEvent=function l(t,e){this.trackURLs(n(this.response.trackingEvents[t]));if(e){this.response.trackingEvents[t]=undefined}function n(t){var e;if(t){e=[];t.forEach(function(t){e.push(t.uri)})}return e}};o.prototype.trackProgress=function c(t){var e=this;var n=[];var i=true;var r=false;var a=this.response.trackingEvents;if(s.isNumber(t)){u("start",i,t>0);u("rewind",r,o(this.progress,t));l(t);d(t);f();this.progress=t}function o(e,n){var i=3e3;return e>t&&Math.abs(n-e)>i}function u(t,e,i){if(a[t]&&i){n.push({name:t,trackOnce:!!e})}}function l(t){var n=e.quartiles;var r=e.quartiles.firstQuartile;var a=e.quartiles.midpoint;var s=e.quartiles.thirdQuartile;if(!r.tracked){o("firstQuartile",t)}else if(!a.tracked){o("midpoint",t)}else if(!s.tracked){o("thirdQuartile",t)}function o(t,e){var r=n[t];if(c(r,e)){r.tracked=true;u(t,i,true)}}}function c(t,e){var n=t.time;return e>=n&&e<=n+5e3}function d(t){if(!s.isArray(a.progress)){return}var n=[];a.progress.forEach(function(i){if(i.offset<=t){e.trackURLs([i.uri])}else{n.push(i)}});a.progress=n}function f(){n.forEach(function(t){e.trackEvent(t.name,t.trackOnce)})}};["rewind","fullscreen","exitFullscreen","pause","resume","mute","unmute","acceptInvitation","acceptInvitationLinear","collapse","expand"].forEach(function(t){o.prototype["track"+s.capitalize(t)]=function(){this.trackEvent(t)}});["start","skip","close","closeLinear"].forEach(function(t){o.prototype["track"+s.capitalize(t)]=function(){this.trackEvent(t,true)}});["firstQuartile","midpoint","thirdQuartile"].forEach(function(t){o.prototype["track"+s.capitalize(t)]=function(){this.quartiles[t].tracked=true;this.trackEvent(t,true)}});o.prototype.trackComplete=function(){if(this.quartiles.thirdQuartile.tracked){this.trackEvent("complete",true)}};o.prototype.trackErrorWithCode=function d(t){if(s.isNumber(t)){this.trackURLs(this.response.errorURLMacros,{ERRORCODE:t})}};o.prototype.trackImpressions=function f(){this.trackURLs(this.response.impressions)};o.prototype.trackCreativeView=function h(){this.trackEvent("creativeView")};o.prototype.trackClick=function p(){this.trackURLs(this.response.clickTrackings)};e.exports=o},{"../../utils/utilityFunctions":44,"./VASTError":22,"./VASTResponse":24,"./vastUtil":29}],26:[function(t,e,n){"use strict";var i=t("../../utils/utilityFunctions");var r=t("../../utils/xml");function a(t){if(!(this instanceof a)){return new a(t)}this.clickThrough=r.keyValue(t.clickThrough);this.clickTrackings=e(t.clickTracking);this.customClicks=e(t.customClick);function e(t){var e=[];if(t){t=i.isArray(t)?t:[t];t.forEach(function(t){e.push(r.keyValue(t))})}return e}}e.exports=a},{"../../utils/utilityFunctions":44,"../../utils/xml":45}],27:[function(t,e,n){"use strict";var i=t("./vastUtil");var r=t("./Creative");var a=t("../../utils/utilityFunctions");var s=t("../../utils/xml");function o(t){if(!(this instanceof o)){return new o(t)}this.adSystem=s.keyValue(t.adSystem);this.impressions=i.parseImpressions(t.impression);this.VASTAdTagURI=s.keyValue(t.vASTAdTagURI);this.creatives=r.parseCreatives(t.creatives);this.error=s.keyValue(t.error);this.extensions=t.extensions;this.followAdditionalWrappers=a.isDefined(s.attr(t,"followAdditionalWrappers"))?s.attr(t,"followAdditionalWrappers"):true;this.allowMultipleAds=s.attr(t,"allowMultipleAds");this.fallbackOnNoAd=s.attr(t,"fallbackOnNoAd")}e.exports=o},{"../../utils/utilityFunctions":44,"../../utils/xml":45,"./Creative":16,"./vastUtil":29}],28:[function(t,e,n){"use strict";var i=t("../../utils/utilityFunctions");var r=/(\d\d):(\d\d):(\d\d)(\.(\d\d\d))?/;var a={duration:function s(t){var e,n;if(i.isString(t)){e=t.match(r);if(e){n=a(e[1])+s(e[2])+o(e[3])+parseInt(e[5]||0)}}return isNaN(n)?null:n;function a(t){return parseInt(t,10)*60*60*1e3}function s(t){return parseInt(t,10)*60*1e3}function o(t){return parseInt(t,10)*1e3}},offset:function o(t,e){if(n(t)){return i(t,e)}return a.duration(t);function n(t){var e=/^\d+(\.\d+)?%$/g;return e.test(t)}function i(t,e){if(e){return r(e,parseFloat(t.replace("%","")))}return null}function r(t,e){return t*e/100}}};e.exports=a},{"../../utils/utilityFunctions":44}],29:[function(t,e,n){"use strict";var i=t("../../utils/utilityFunctions");var r=t("../vpaid/VPAIDHTML5Tech");var a=t("../vpaid/VPAIDFlashTech");var s=t("VPAIDFLASHClient/js/VPAIDFLASHClient");var o={track:function u(t,e){var n=o.parseURLMacros(t,e);var i=[];n.forEach(function(t){var e=new Image;e.src=t;i.push(e)});return i},parseURLMacros:function l(t,e){var n=[];e=e||{};if(!e["CACHEBUSTING"]){e["CACHEBUSTING"]=Math.round(Math.random()*1e10)}t.forEach(function(t){n.push(o._parseURLMacro(t,e))});return n},parseURLMacro:function c(t,e){e=e||{};if(!e["CACHEBUSTING"]){e["CACHEBUSTING"]=Math.round(Math.random()*1e10)}return o._parseURLMacro(t,e)},_parseURLMacro:function d(t,e){e=e||{};i.forEach(e,function(e,n){t=t.replace(new RegExp("\\["+n+"\\]","gm"),e)});return t},parseDuration:function f(t){var e=/(\d\d):(\d\d):(\d\d)(\.(\d\d\d))?/;var n,r;if(i.isString(t)){n=t.match(e);if(n){r=a(n[1])+s(n[2])+o(n[3])+parseInt(n[5]||0)}}return isNaN(r)?null:r;function a(t){return parseInt(t,10)*60*60*1e3}function s(t){return parseInt(t,10)*60*1e3}function o(t){return parseInt(t,10)*1e3}},parseImpressions:function h(t){if(t){t=i.isArray(t)?t:[t];return i.transformArray(t,function(t){if(i.isNotEmptyString(t.keyValue)){return t.keyValue}return undefined})}return[]},formatProgress:function p(t){var e,n,r,a;e=t/(60*60*1e3);e=Math.floor(e);n=t/(60*1e3)%60;n=Math.floor(n);r=t/1e3%60;r=Math.floor(r);a=t%1e3;return i.toFixedDigits(e,2)+":"+i.toFixedDigits(n,2)+":"+i.toFixedDigits(r,2)+"."+i.toFixedDigits(a,3)},parseOffset:function v(t,e){if(n(t)){return i(t,e)}return o.parseDuration(t);function n(t){var e=/^\d+(\.\d+)?%$/g;return e.test(t)}function i(t,e){if(e){return r(e,parseFloat(t.replace("%","")))}return null}function r(t,e){return t*e/100}},VPAID_techs:[a,r],isVPAID:function g(t){return!!t&&t.apiFramework==="VPAID"},findSupportedVPAIDTech:function m(t){var e,n,i;for(e=0,n=this.VPAID_techs.length;e=1&&e<=2}function a(t){var e=t.split(".");return parseInt(e[0],10)}};f.prototype._initAd=function(t,e,n){var i=this.player.el().querySelector(".vjs-tech");var r=l.getDimension(i);t.initAd(r.width,r.height,this.VIEW_MODE.NORMAL,-1,{AdParameters:e.adParameters||""},function(i){n(i,t,e)})};f.prototype._createVASTTracker=function(t,e){return new a(t,e)};f.prototype._setupEvents=function(t,e,n){var i=t.options.src;var r=this._createVASTTracker(i,e);var a=this.player;var o=this;t.on("AdSkipped",function(){a.trigger("vpaid.AdSkipped");r.trackSkip()});t.on("AdImpression",function(){a.trigger("vpaid.AdImpression");r.trackImpressions()});t.on("AdStarted",function(){a.trigger("vpaid.AdStarted");r.trackCreativeView();u()});t.on("AdVideoStart",function(){a.trigger("vpaid.AdVideoStart");r.trackStart();u()});t.on("AdPlaying",function(){a.trigger("vpaid.AdPlaying");r.trackResume();u()});t.on("AdPaused",function(){a.trigger("vpaid.AdPaused");r.trackPause();c()});function u(){if(o._adUnit&&o._adUnit.isPaused()){o._adUnit._paused=false}a.trigger("play")}function c(){if(o._adUnit){o._adUnit._paused=true}a.trigger("pause")}t.on("AdVideoFirstQuartile",function(){a.trigger("vpaid.AdVideoFirstQuartile");r.trackFirstQuartile()});t.on("AdVideoMidpoint",function(){a.trigger("vpaid.AdVideoMidpoint");r.trackMidpoint()});t.on("AdVideoThirdQuartile",function(){a.trigger("vpaid.AdVideoThirdQuartile");r.trackThirdQuartile()});t.on("AdVideoComplete",function(){a.trigger("vpaid.AdVideoComplete");r.trackComplete()});t.on("AdClickThru",function(n){a.trigger("vpaid.AdClickThru");var i=n.url;var o=n.playerHandles;var u=d.isNotEmptyString(i)?i:l(e.clickThrough);r.trackClick();if(o&&u){window.open(u,"_blank")}function l(e){var n={ASSETURI:t.options.src,CONTENTPLAYHEAD:0};return e?s.parseURLMacro(e,n):null}});t.on("AdUserAcceptInvitation",function(){a.trigger("vpaid.AdUserAcceptInvitation");r.trackAcceptInvitation();r.trackAcceptInvitationLinear()});t.on("AdUserClose",function(){a.trigger("vpaid.AdUserClose");r.trackClose();r.trackCloseLinear()});t.on("AdUserMinimize",function(){a.trigger("vpaid.AdUserMinimize");r.trackCollapse()});t.on("AdError",function(){a.trigger("vpaid.AdError");r.trackErrorWithCode(901)});t.on("AdVolumeChange",function(){a.trigger("vpaid.AdVolumeChange");var e=a.volume();t.getAdVolume(function(t,n){if(n===0&&e>0){r.trackMute()}if(n>0&&e===0){r.trackUnmute()}a.volume(n)})});var f=h.bind(this,a,t,this.VIEW_MODE);var p=d.throttle(f,100);var v=this.settings.autoResize;if(v){l.addEventListener(window,"resize",p);l.addEventListener(window,"orientationchange",p)}a.on("vast.resize",f);a.on("vpaid.pauseAd",g);a.on("vpaid.resumeAd",m);a.one("vpaid.adEnd",function(){a.off("vast.resize",f);a.off("vpaid.pauseAd",g);a.off("vpaid.resumeAd",m);if(v){l.removeEventListener(window,"resize",p);l.removeEventListener(window,"orientationchange",p)}});n(null,t,e);function g(){t.pauseAd(d.noop)}function m(){t.resumeAd(d.noop)}};f.prototype._addSkipButton=function(t,e,n){var i;var r=this.player;t.on("AdSkippableStateChange",a);c.once(r,["vast.adEnd","vast.adsCancel"],o);n(null,t,e);function a(){r.trigger("vpaid.AdSkippableStateChange");t.getAdSkippableState(function(t,e){if(e){if(!i){s(r)}}else{o(r)}})}function s(t){i=u(t);t.el().appendChild(i)}function o(){l.remove(i);i=null}function u(){var e=window.document.createElement("div");l.addClass(e,"vast-skip-button");l.addClass(e,"enabled");e.innerHTML="Skip ad";e.onclick=function(e){t.skipAd(d.noop);if(window.Event.prototype.stopPropagation!==undefined){e.stopPropagation()}else{return false}};return e}};f.prototype._linkPlayerControls=function(t,e,n){var i=this;r(this.player,t);a(this.player,t,this.VIEW_MODE);n(null,t,e);function r(t,e){t.on("volumechange",n);e.on("AdVolumeChange",i);t.one("vpaid.adEnd",function(){t.off("volumechange",n)});function n(){var n=t.muted()?0:t.volume();e.setAdVolume(n,p)}function i(){t.trigger("vpaid.AdVolumeChange");e.getAdVolume(function(e,n){if(e){p(e)}else{t.volume(n)}})}}function a(t,e,n){var r=h.bind(i,t,e,n);t.on("fullscreenchange",r);t.one("vpaid.adEnd",function(){t.off("fullscreenchange",r)})}};f.prototype._startAd=function(t,e,n){var i=this.player;t.startAd(function(r){if(!r){i.trigger("vast.adStart")}n(r,t,e)})};f.prototype._finishPlaying=function(t,e,n){var r=this.player;t.on("AdStopped",function(){r.trigger("vpaid.AdStopped");a(null)});t.on("AdError",function(t){var e=t?t.message:"on VPAIDIntegrator, error while waiting for the adUnit to finish playing";a(new i(e))});function a(i){n(i,t,e)}};f.prototype._trackError=function m(t,e){s.track(t.errorURLMacros,{ERRORCODE:e||901})};function h(t,e,n){var i=t.el().querySelector(".vjs-tech");var r=l.getDimension(i);var a=t.isFullscreen()?n.FULLSCREEN:n.NORMAL;e.resizeAd(r.width,r.height,a,p)}function p(t){if(t&&console&&console.log){console.log("ERROR: "+t.message,t)}}e.exports=f},{"../../utils/async":39,"../../utils/dom":40,"../../utils/playerUtils":42,"../../utils/utilityFunctions":44,"../vast/VASTError":22,"../vast/VASTResponse":24,"../vast/VASTTracker":25,"../vast/vastUtil":29,"./VPAIDAdUnitWrapper":30}],34:[function(t,e,n){"use strict";var i=t("../../utils/dom");var r=document.createElement("div");r.className="vjs-ads-label vjs-control vjs-label-hidden";r.innerHTML="Advertisement";var a=function(t){return{init:function e(n,a){a.el=r;t.call(this,n,a);setTimeout(function(){var t=n.controlBar&&(n.controlBar.getChild("timerControls")||n.controlBar.getChild("currentTimeDisplay"));if(t){n.controlBar.el().insertBefore(r,t.el())}i.removeClass(r,"vjs-label-hidden")},0)},el:function n(){return r}}};e.exports=a},{"../../utils/dom":40}],35:[function(t,e,n){"use strict";var i=videojs.Component;var r=t("./ads-label")(i);videojs.AdsLabel=videojs.Component.extend(r)},{"./ads-label":34}],36:[function(t,e,n){"use strict";var i=document.createElement("div");var r=function(t){return{init:function e(n,r){r.el=i;i.className="vjs-black-poster";t.call(this,n,r);var a=n.getChild("posterImage");setTimeout(function(){if(a&&n&&n.el()){n.el().insertBefore(i,a.el())}},0)},el:function n(){return i}}};e.exports=r},{}],37:[function(t,e,n){"use strict";var i=videojs.Component;var r=t("./black-poster")(i);videojs.BlackPoster=videojs.Component.extend(r)},{"./black-poster":36}],38:[function(t,e,n){"use strict";var i=t("../ads/vast/VASTClient");var r=t("../ads/vast/VASTError");var a=t("../ads/vast/vastUtil");var s=t("../ads/vast/VASTIntegrator");var o=t("../ads/vpaid/VPAIDIntegrator");var u=t("../utils/async");var l=t("../utils/dom");var c=t("../utils/playerUtils");var d=t("../utils/utilityFunctions");e.exports=function f(t){var e;var n=this;var f=new i;var h=false;var p={timeout:500,iosPrerollCancelTimeout:2e3,adCancelTimeout:3e3,playAdAlways:false,adsEnabled:true,autoResize:true,vpaidFlashLoaderPath:"/VPAIDFlash.swf"};var v=d.extend({},p,t||{});if(d.isUndefined(v.adTagUrl)&&d.isDefined(v.url)){v.adTagUrl=v.url}if(d.isString(v.adTagUrl)){v.adTagUrl=d.echoFn(v.adTagUrl)}if(d.isDefined(v.adTagXML)&&!d.isFunction(v.adTagXML)){return k(new r("on VideoJS VAST plugin, the passed adTagXML option does not contain a function"))}if(!d.isDefined(v.adTagUrl)&&!d.isFunction(v.adTagXML)){return k(new r("on VideoJS VAST plugin, missing adTagUrl on options object"))}a.runFlashSupportCheck(v.vpaidFlashLoaderPath);c.prepareForAds(n);if(v.playAdAlways){n.on("vast.contentEnd",function(){setTimeout(function(){n.trigger("vast.reset")},0)})}n.on("vast.firstPlay",g);n.on("vast.reset",function(){e=null;m()});n.vast={isEnabled:function(){return v.adsEnabled},enable:function(){v.adsEnabled=true},disable:function(){v.adsEnabled=false}};return n.vast;function g(){c.removeNativePoster(n);c.once(n,["vast.adsCancel","vast.adEnd"],function(){t();i()});u.waterfall([s,o,p,y],function(t,e){if(t){k(t,e)}else{n.trigger("vast.adEnd")}});function t(){if(n.vast&&n.vast.adUnit){n.vast.adUnit=null}}function i(){a();if(e){c.restorePlayerSnapshot(n,e);e=null}}function a(){c.once(n,["playing","vast.reset","vast.firstPlay"],function(t){if(t.type!=="playing"){return}n.trigger("vast.contentStart");c.once(n,["ended","vast.reset","vast.firstPlay"],function(t){if(t.type==="ended"){n.trigger("vast.contentEnd")}})})}function s(t){if(v.adsEnabled){return t(null)}t(new r("Ads are not enabled"))}function o(t){if(f()){e=c.getPlayerSnapshot(n);n.pause();g();if(n.paused()){t(null)}else{c.once(n,["playing"],function(){n.pause();t(null)})}}else{t(new r("video content has been playing before preroll ad"))}}function f(){return!d.isIPhone()||n.currentTime()<=v.iosPrerollCancelTimeout}function p(t){var e;h=false;e=setTimeout(function(){k(new r("timeout while waiting for the video to start playing",402))},v.adCancelTimeout);c.once(n,["vast.adStart","vast.adsCancel"],i);function i(){if(e){clearTimeout(e);e=null}}t(null)}function g(){l.addClass(n.el(),"vjs-vast-ad-loading");c.once(n,["vast.adStart","vast.adsCancel"],m)}function m(){setTimeout(function(){l.removeClass(n.el(),"vjs-vast-ad-loading")},100)}}function m(){n.trigger("vast.adsCancel");h=true}function y(t){u.waterfall([A,_],t)}function A(t){f.getVASTResponse(v.adTagUrl?v.adTagUrl():v.adTagXML,t)}function _(t,e){if(h){return}var i=E(t)?new o(n,v):new s(n);var r=false;c.once(n,["vast.adStart","vast.adsCancel"],function(t){if(t.type==="vast.adStart"){a()}});c.once(n,["vast.adEnd","vast.adsCancel"],u);if(d.isIDevice()){l()}n.vast.vastResponse=t;n.vast.adUnit=i.playAd(t,e);function a(){if(r||n.controlBar.getChild("AdsLabel")){return}n.controlBar.addChild("AdsLabel")}function u(){n.controlBar.removeChild("AdsLabel");r=true}function l(){var t=3;var e=0;var i=0;n.on("timeupdate",a);n.on("ended",r);c.once(n,["vast.adEnd","vast.adsCancel","vast.adError"],s);function r(){if(n.duration()-e>t){n.pause(true);n.play(true);n.currentTime(e)}}function a(){var r=n.currentTime();var a=Math.abs(r-e);if(a>t){i+=1;if(i>=2){n.pause(true)}n.currentTime(e)}else{e=r}}function s(){n.off("timeupdate",a);n.off("ended",r)}}}function k(t,e){n.trigger({type:"vast.adError",error:t});m();if(console&&console.log){console.log("AD ERROR:",t.message,t,e)}}function E(t){var e,n;var i=t.mediaFiles;for(e=0,n=i.length;e0){u=setTimeout(function(){l&&l.abort()},o)}function c(t,e,n){if(!r.isString(t)||r.isEmptyString(t)){throw new a("Invalid url '"+t+"'")}if(!r.isFunction(e)){throw new a("Invalid handler '"+e+"' for the http request")}if(r.isDefined(n)&&!r.isObject(n)){throw new a("Invalid options map '"+n+"'")}}function d(t,e){r.forEach(e,function(e,n){if(r.isDefined(e)){t.setRequestHeader(n,e)}})}function f(){n(-1,null,null,"")}};s.prototype.get=function(t,e,n){this.run("GET",t,i,n);function i(t,n,i,s){if(r(t)){e(null,n,t,i,s)}else{e(new a(s),n,t,i,s)}}function r(t){return 200<=t&&t<300}};function o(){var t=new XMLHttpRequest;if(!("withCredentials"in t)){t=new XDomainRequest}return t}var u=new s(o);e.exports={http:u,HttpRequest:s,HttpRequestError:a,createXhr:o}},{"./urlUtils":43,"./utilityFunctions":44}],42:[function(t,e,n){"use strict";var i=t("./dom");var r=t("./utilityFunctions");var a={};a.getPlayerSnapshot=function s(t){var e=t.el().querySelector(".vjs-tech");var n={ended:t.ended(),src:t.currentSrc(),currentTime:t.currentTime(),type:t.currentType(),playing:!t.paused(),suppressedTracks:i(t)};if(e){n.nativePoster=e.poster;n.style=e.getAttribute("style")}return n;function i(t){var e=t.remoteTextTracks?t.remoteTextTracks():[];if(e&&r.isArray(e.tracks_)){e=e.tracks_}if(!r.isArray(e)){e=[]}var n=[];e.forEach(function(t){n.push({track:t,mode:t.mode});t.mode="disabled"});return n}};a.restorePlayerSnapshot=function o(t,e){var n=t.el().querySelector(".vjs-tech");var i=20;if(e.nativePoster){n.poster=e.nativePoster}if("style"in e){n.setAttribute("style",e.style||"")}if(s(t,e)){t.one("contentloadedmetadata",o);t.one("canplay",u);r();t.src({src:e.src,type:e.type});t.load()}else{o();if(e.playing){t.play()}}function r(){var e=setTimeout(function(){t.trigger("canplay")},1e3);t.one("canplay",function(){clearTimeout(e)})}function s(t,e){if(t.src()){return t.src()!==e.src}return t.currentSrc()!==e.src}function o(){var t=e.suppressedTracks;t.forEach(function(t){t.track.mode=t.mode})}function u(){if(!a.isReadyToResume(t)&&i--){setTimeout(u,50)}else{try{if(t.currentTime()!==e.currentTime){if(e.playing){t.one("seeked",function(){t.play()})}t.currentTime(e.currentTime)}else if(e.playing){t.play()}}catch(n){videojs.log.warn("Failed to resume the content after an advertisement",n)}}}};a.isReadyToResume=function(t){if(t.readyState()>1){return true}if(t.seekable()===undefined){return true}if(t.seekable().length>0){return true}return false};a.prepareForAds=function(t){var e=t.addChild("blackPoster");var n=true;var a;s();t.on("play",u);t.on("vast.reset",l);t.on("vast.firstPlay",f);t.on("error",p);t.on("vast.adStart",p);t.on("vast.adsCancel",p);t.on("vast.adError",p);t.on("vast.adStart",v);t.on("vast.adEnd",g);t.on("vast.adsCancel",g);function s(){var e=t.play;t.play=function(n){var i=this;if(c()){s()}else{u(n)}return this;function s(){if(!r.isIPhone()){a=d();t.muted(true)}e.apply(i,arguments)}function u(n){if(o()&&!n){t.vast.adUnit.resumeAd()}else{e.apply(i,arguments)}}};var n=t.pause;t.pause=function(e){if(o()&&!e){t.vast.adUnit.pauseAd()}else{n.apply(this,arguments)}return this};var i=t.paused;t.paused=function(e){if(o()&&!e){return t.vast.adUnit.isPaused()}return i.apply(this,arguments)}}function o(){return t.vast&&t.vast.adUnit}function u(){if(c()){n=false;t.trigger("vast.firstPlay")}}function l(){n=true;e.show();f()}function c(){return n}function d(){return{muted:t.muted(),volume:t.volume()}}function f(){if(a){t.currentTime(0);h(a);a=null}}function h(e){if(r.isObject(e)){t.volume(e.volume);t.muted(e.muted)}}function p(){if(!i.hasClass(e.el(),"vjs-hidden")){e.hide()}}function v(){i.addClass(t.el(),"vjs-ad-playing")}function g(){i.removeClass(t.el(),"vjs-ad-playing")}};a.removeNativePoster=function(t){var e=t.el().querySelector(".vjs-tech");if(e){e.removeAttribute("poster")}};a.once=function u(t,e,n){function i(){n.apply(null,arguments);e.forEach(function(e){t.off(e,i)})}e.forEach(function(e){t.on(e,i)})};e.exports=a},{"./dom":40,"./utilityFunctions":44}],43:[function(t,e,n){"use strict";var i=t("./utilityFunctions");var r=document.createElement("a");var a=document.documentMode;function s(t){var e=t;if(a){r.setAttribute("href",e);e=r.href}r.setAttribute("href",e);return{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:i.isNotEmptyString(r.port)?r.port:80,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}function o(t,e){var n,r;e=i.isFunction(e)?e:function(){return true};t=t.trim().replace(/^\?/,"");n=t.split("&");r={};i.forEach(n,function(t){var n,i,a;if(t!==""){n=t.split("=");i=n[0];a=n[1];if(e(i,a)){r[i]=a}}});return r}function u(t){var e=[];i.forEach(t,function(t,n){e.push(n+"="+t)});return e.join("&")}e.exports={urlParts:s,queryStringToObj:o,objToQueryString:u}},{"./utilityFunctions":44}],44:[function(t,e,n){"use strict";var i=1;var r=/[A-Z]/g;var a=/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i;var s=/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function o(){}function u(t){return t===null}function l(t){return t!==undefined}function c(t){return t===undefined}function d(t){return typeof t==="object"}function f(t){return typeof t==="function"}function h(t){return typeof t==="number"}function p(t){return j.isObject(t)&&t.window===t}function v(t){return Object.prototype.toString.call(t)==="[object Array]"}function g(t){if(t===null||j.isWindow(t)||j.isFunction(t)||j.isUndefined(t)){return false}var e=t.length;if(t.nodeType===i&&e){return true}return j.isString(t)||j.isArray(t)||e===0||typeof e==="number"&&e>0&&e-1 in t}function m(t){return typeof t==="string"}function y(t){return j.isString(t)&&t.length===0}function A(t){return j.isString(t)&&t.length!==0}function _(t){return Array.prototype.slice.call(t)}function k(t,e,n){var i,r;if(t){if(f(t)){for(i in t){if(i!=="prototype"&&i!=="length"&&i!=="name"&&(!t.hasOwnProperty||t.hasOwnProperty(i))){e.call(n,t[i],i,t)}}}else if(v(t)){var a=typeof t!=="object";for(i=0,r=t.length;i=e){n=i;t.apply(this,arguments)}}}function F(t,e){var n;return function(){if(n){clearTimeout(n)}n=setTimeout(function(){t.apply(this,arguments);n=undefined},e)}}function L(t,e,n){var i=e(t);for(var r=0;r0}return t.getElementsByTagNameNS(i,"parsererror").length>0}catch(r){}}};r.parseText=function s(t){if(/^\s*$/.test(t)){return null}if(/^(?:true|false)$/i.test(t)){return t.toLowerCase()==="true"}if(isFinite(t)){return parseFloat(t)}if(i.isISO8601(t)){return new Date(t)}return t.trim()};r.JXONTree=function o(t){var e=r.parseText;if(t.documentElement){return new r.JXONTree(t.documentElement)}if(t.hasChildNodes()){var n="";for(var a,s,o,u=0;u0:t.hasAttributes();if(l){var c;for(var d=0;d/g,">").replace(/"/g,""").replace(/'/g,"'")};r.decode=function f(t){return t.replace(/'/g,"'").replace(/"/g,'"').replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&")};e.exports=r},{"./utilityFunctions":44}],46:[function(t,e,n){"use strict";t("./plugin/components/ads-label_4");t("./plugin/components/black-poster_4");var i=t("./plugin/videojs.vast.vpaid");videojs.plugin("vastClient",i)},{"./plugin/components/ads-label_4":35,"./plugin/components/black-poster_4":37,"./plugin/videojs.vast.vpaid":38}]},{},[46]); //# sourceMappingURL=videojs_4.vast.vpaid.min.js.map diff --git a/bin/videojs_4.vast.vpaid.min.js.map b/bin/videojs_4.vast.vpaid.min.js.map index 37d73cd9..7a7e29bb 100644 --- a/bin/videojs_4.vast.vpaid.min.js.map +++ b/bin/videojs_4.vast.vpaid.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["node_modules/browserify/node_modules/browser-pack/_prelude.js","bower_components/VPAIDFLASHClient/js/IVPAIDAdUnit.js","videojs_4.vast.vpaid.js","bower_components/VPAIDFLASHClient/js/VPAIDAdUnit.js","bower_components/VPAIDFLASHClient/js/VPAIDFLASHClient.js","bower_components/VPAIDFLASHClient/js/flashTester.js","bower_components/VPAIDFLASHClient/js/jsFlashBridge.js","bower_components/VPAIDFLASHClient/js/jsFlashBridgeRegistry.js","bower_components/VPAIDFLASHClient/js/registry.js","bower_components/VPAIDFLASHClient/js/utils.js","bower_components/VPAIDHTML5Client/js/IVPAIDAdUnit.js","bower_components/VPAIDHTML5Client/js/VPAIDAdUnit.js","bower_components/VPAIDHTML5Client/js/VPAIDHTML5Client.js","bower_components/VPAIDHTML5Client/js/subscriber.js","bower_components/VPAIDHTML5Client/js/utils.js","src/scripts/ads/vast/Ad.js","src/scripts/ads/vast/Companion.js","src/scripts/ads/vast/Creative.js","src/scripts/ads/vast/InLine.js","src/scripts/ads/vast/Linear.js","src/scripts/ads/vast/MediaFile.js","src/scripts/ads/vast/TrackingEvent.js","src/scripts/ads/vast/VASTClient.js","src/scripts/ads/vast/VASTError.js","src/scripts/ads/vast/VASTIntegrator.js","src/scripts/ads/vast/VASTResponse.js","src/scripts/ads/vast/VASTTracker.js","src/scripts/ads/vast/VideoClicks.js","src/scripts/ads/vast/Wrapper.js","src/scripts/ads/vast/parsers.js","src/scripts/ads/vast/vastUtil.js","src/scripts/ads/vpaid/VPAIDAdUnitWrapper.js","src/scripts/ads/vpaid/VPAIDFlashTech.js","src/scripts/ads/vpaid/VPAIDHTML5Tech.js","src/scripts/ads/vpaid/VPAIDIntegrator.js","src/scripts/plugin/components/ads-label.js","src/scripts/plugin/components/ads-label_4.js","src/scripts/plugin/components/black-poster.js","src/scripts/plugin/components/black-poster_4.js","src/scripts/plugin/videojs.vast.vpaid.js","src/scripts/utils/async.js","src/scripts/utils/dom.js","src/scripts/utils/http.js","src/scripts/utils/playerUtils.js","src/scripts/utils/urlUtils.js","src/scripts/utils/utilityFunctions.js","src/scripts/utils/xml.js","src/scripts/videojs_4.vast.vpaid.js"],"names":["e","t","n","r","s","o","u","a","require","i","f","Error","code","l","exports","call","length",1,"module","Object","defineProperty","value","_createClass","defineProperties","target","props","descriptor","enumerable","configurable","writable","key","Constructor","protoProps","staticProps","prototype","_classCallCheck","instance","TypeError","IVPAIDAdUnit","this","handshakeVersion","playerVPAIDVersion","arguments","undefined","callback","initAd","width","height","viewMode","desiredBitrate","creativeData","AdParameters","environmentVars","flashVars","resizeAd","startAd","stopAd","pauseAd","resumeAd","expandAd","collapseAd","skipAd","getAdLinear","getAdWidth","getAdHeight","getAdExpanded","getAdSkippableState","getAdRemainingTime","getAdDuration","setAdVolume","soundVolume","getAdVolume","getAdCompanions","getAdIcons",2,"_typeof","Symbol","iterator","obj","constructor","_possibleConstructorReturn","self","ReferenceError","_inherits","subClass","superClass","create","setPrototypeOf","__proto__","ALL_VPAID_METHODS","getOwnPropertyNames","filter","property","indexOf","VPAIDAdUnit","_IVPAIDAdUnit","flash","_this","getPrototypeOf","_destroyed","_flash","_destroy","_this2","forEach","methodName","removeCallbackByMethodName","EVENTS","event","offEvent","isDestroyed","on","eventName","off","callFlashMethod","setSize","getWidth","getHeight","volume","./IVPAIDAdUnit",3,"JSFlashBridge","noop","callbackTimeout","isPositiveInt","createElementWithID","uniqueVPAID","unique","createFlashTester","ERROR","FLASH_VERSION","flashTester","isSupported","VPAIDFLASHClient","vpaidParentEl","swfConfig","data","params","wmode","salign","align","allowScriptAccess","scale","allowFullScreen","quality","vpaidOptions","debug","timeout","hasExternalDependencies","onError","_vpaidParentEl","_flashID","movie","FlashVars","VPAID_FLASH_HANDLER","el","swfobject","createSWF","handler","err","$loadPendedAdUnit","error","setTimeout","destroy","_destroyAdUnit","_loadLater","_adUnitLoad","removeCallback","_adUnit","loadAdUnit","adURL","$throwIfDestroyed","isReady","message","url","unloadAdUnit","getFlashID","getFlashURL","setStaticProperty","hasFlashPlayerVersion","window","document","body","propertyName","./VPAIDAdUnit","./flashTester.js","./jsFlashBridge","./utils",4,"FLASH_TEST","FLASH_TEST_EL","utils","MultipleValuesRegistry","FlashTester","parent","parentEl","hideFlashEl","_handlers","_isSupported","support","get","add","./registry",5,"stringEndsWith","SingleValueRegistry","registry","flashURL","flashID","loadHandShake","_el","_flashURL","_width","_height","_callbacks","_uniqueMethodIdentifier","_ready","_handShakeHandler","addInstance","remove","removeByKey","offAll","removeAll","args","callbackID","concat","$asyncCallback","_trigger","removeByValue","suffix","filterKeys","removeAllCallbacks","_callCallback","result","trigger","_handShake","getSize","newWidth","newHeight","setAttribute","setWidth","setHeight","removeInstanceByID","parentElement","removeChild","_this3","typeID","typeName","getInstanceByID","./jsFlashBridgeRegistry",6,"instances","JSFlashBridgeRegistry","id",7,"_registries","push","keys","findByValue","index","splice","old","map","size","_this4",8,"prefix","count","timer","onSuccess","onTimeout","clearTimeout","apply","cleanContent","nEl","createElement","innerHTML","appendChild","newVal","oldVal","isNaN","parseFloat","isFinite","endsWith","String","searchString","position","subjectString","toString","lastIndex","string","search","style","left","top","visibility",9,"METHODS","GETTERS","SETTERS","creative","video","VPAIDVersion","subscribe","context","unsubscribe","addStaticToInterface","VPAID1_METHODS","method","checkVPAIDInterface","every","Interface","name",10,"Subscriber","AD_CLICK","FILTERED_EVENTS","VPAIDCreative","iframe","_isValid","_creative","_videoEl","_iframe","_subscribers","$addEventsSubscribers","isValidVPAIDAd","ignores","ariaty","Array","slice","pop","callOrTriggerEvent","bind","extend","slot","videoSlot","getter","validate","unsubscribeAll","$trigger","$clickThruHook","documentElement","contentDocument","videoEl","addEventListener","click","playerHandles","triggerSync","subscribers","./subscriber",11,"defaultTemplate","AD_STOPPED","VPAIDHTML5Client","templateConfig","_id","_frameContainer","createElementInEl","_vpaidOptions","_templateConfig","template","extraOptions","$unloadPreviousAdUnit","that","frame","createIframeWithContent","iframeURL_JS","iframeID","getID","origin","getOrigin","_frame","_onLoad","onLoad","JSON","parse","adUnit","createAd","contentWindow","getVPAIDAd","adEl","querySelector","$adDestroyed","$destroyLoadListener","$removeEl","$removeAdElements","$destroyAdUnit","removeEventListener","clearCallbackTimeout","location","protocol","hostname","port",12,"isHandlerAttached","subscriber","some",13,"isValid","timeouts","func","tagName","createIframe","zIndex","setIframeContent","simpleTemplate","src","marginWidth","marginHeight","frameBorder","margin","padding","border","stringify","replace","RegExp","iframeEl","content","iframeDoc","write","toExtend","fromSource",14,"InLine","Wrapper","Ad","adJTree","initialize","attr","sequence","inLine","wrapper","./InLine","./Wrapper",15,"TrackingEvent","utilities","xml","Companion","companionJTree","creativeType","staticResource","keyValue","htmlResource","HTMLResource","hTMLResource","iframeResource","IFrameResource","iFrameresource","expandedWidth","expandedHeight","scalable","maintainAspectRatio","minSuggestedDuration","apiFramework","companionClickThrough","trackingEvents","parseTrackingEvents","tracking","trackings","isDefined","isArray","trackingData","../../utils/utilityFunctions","../../utils/xml","./TrackingEvent",16,"Linear","Creative","creativeJTree","adId","linear","companionAds","companions","companion","companionData","parseCreatives","creativesJTree","creatives","creativesData","./Companion","./Linear",17,"vastUtil","inlineJTree","adTitle","adSystem","impressions","parseImpressions","impression","description","advertiser","surveys","parseSurveys","survey","pricing","extensions","inlineSurveys","transformArray","isNotEmptyString","uri","type","len","./Creative","./vastUtil",18,"MediaFile","VideoClicks","parsers","linearJTree","duration","mediaFiles","parseMediaFiles","mediaFile","skipoffset","offset","videoClicks","adParameters","decode","mediaFilesJxonTree","mfData","./MediaFile","./VideoClicks","./parsers",19,"attributesList","mediaFileJTree","x","attribute","isVPAID","findSupportedVPAIDTech","isFlashSupported",20,"trackingJTree",21,"VASTError","VASTResponse","async","http","VASTClient","options","defaultOptions","WRAPPER_LIMIT","settings","errorURLMacros","getVASTResponse","adTagUrl","sanityCheck","isFunction","waterfall","_getVASTAd","buildVASTResponse","adsChain","cb","response","_buildVASTResponse","getAdWaterfall","vastTree","waterfallAds","ads","_trackError","getAd","shift","waterfallHandler","adChain","requestVastXML","_requestVASTXml","buildVastWaterfall","xmlStr","toJXONTree","ad","validateVASTTree","vastVersion","next","isString","requestVASTAd","buildAd","VASTAdTagURI","adJxonTree","validateAd","errMsgPrefix","requestVASTXml","requestHandler","withCredentials","status","errMsg","addAdsToResponse","validateResponse","addAd","progressEvents","progress","hasLinear","progressEvent","isNumber","addErrorUrlMacros","track","ERRORCODE","../../utils/async","../../utils/http","./Ad","./VASTError","./VASTResponse",22,23,"VASTTracker","dom","playerUtils","VASTIntegrator","player","playAd","vastResponse","_selectAdSource","_createVASTTracker","_addClickThrough","_addSkipButton","_setupEvents","_playSelectedAd","_src","pause","play","isPaused","paused","getSrc","selectAdSource","source","playerWidth","getDimension","sort","compareTo","b","deltaA","Math","abs","deltaB","selectSource","createVASTTracker","adMediaFile","setupEvents","tracker","previouslyMuted","trackFullscreenChange","trackImpressions","trackPause","trackProgress","trackVolumeChange","once","unbindEvents","evt","trackComplete","isFullscreen","trackFullscreen","trackExitFullscreen","currentTime","trackResume","currentTimeInMs","trackCreativeView","muted","trackMute","trackUnmute","addSkipButton","skipOffsetInSec","addSkipButtonToPlayer","skipOffset","skipButton","createSkipButton","updateSkipButton","updateSkipButtonState","removeSkipButton","addClass","onclick","hasClass","trackSkip","Event","stopPropagation","timeLeft","ceil","toFixedDigits","addClickThrough","blocker","createClickThroughBlocker","updateBlocker","updateBlockerURL","insertBefore","controlBar","removeBlocker","clickThroughMacro","clickThrough","href","generateClickThroughURL","trackClick","variables","ASSETURI","CONTENTPLAYHEAD","formatProgress","parseURLMacro","playSelectedAd","preload","proceed","trackError","../../utils/dom","../../utils/playerUtils","./VASTTracker",24,"InLine__A","_linearAdded","clickTrackings","customClicks","_addInLine","_addWrapper","_addErrorTrackUrl","errorURL","JXONTree","_addImpressions","appendToArray","_addClickTrackings","_addCustomClicks","_addTrackingEvents","eventsMap","trackingEvent","_addTitle","title","_addDuration","_addVideoClicks","_addMediaFiles","_addSkipoffset","_addAdParameters","_addLinear","array","items","item",25,"assetURI","quartiles","firstQuartile","tracked","time","round","midpoint","thirdQuartile","isEmptyString","trackURLs","urls","trackEvent","trackOnce","getEventUris","uris","newProgressInMs","events","ONCE","ALWAYS","addTrackEvent","hasRewound","addQuartileEvents","trackProgressEvents","trackEvents","currentProgress","newProgress","REWIND_THRESHOLD","canBeAdded","trackQuartile","quartileName","quartile","canBeTracked","quartileTime","pendingProgressEvts","capitalize","trackErrorWithCode","errorcode",26,"videoClickJTree","parseClickTrackings","clickTracking","customClick","clickTrackingData",27,"wrapperJTree","vASTAdTagURI","followAdditionalWrappers","allowMultipleAds","fallbackOnNoAd",28,"durationRegex","parseDuration","durationStr","match","durationInMs","parseHoursToMs","parseMinToMs","parseSecToMs","parseInt","hourStr","minStr","secStr","parseOffset","isPercentage","calculatePercentage","percentageRegex","test","percentStr","calcPercent","quantity","percent",29,"VPAIDHTML5Tech","VPAIDFlashTech","URLMacros","sources","parseURLMacros","trackImgs","img","Image","parseMacros","parsedURLs","random","URLMacro","_parseURLMacro","parseMacro","hours","minutes","seconds","milliseconds","floor","VPAID_techs","isVPAIDMediaFile","mimeType","VPAIDTech","supports","runFlashSupportCheck","vpaidFlashLoaderPath","runFlashTest","../vpaid/VPAIDFlashTech","../vpaid/VPAIDHTML5Tech","VPAIDFLASHClient/js/VPAIDFLASHClient",30,"VPAIDAdUnitWrapper","vpaidAdUnit","opts","isObject","responseTimeout","VPAIDInterfaceMethods","canSubscribeToEvents","canUnsubscribeFromEvents","adUnitAsyncCall","arrayLikeObjToArray","timeoutId","wrapCallback","evtName","waitForEvent","responseListener","unshift","version","adUnitData","getterName","../vast/VASTError",31,"containerEl","vpaidFlashClient","loadFlashCreative","objectEl","flashClientOpts","container","isDomElement","console","log",32,"vpaidHTMLClient","INVALID_MEDIA_FILE","isOldIE","INVALID_DOM_CONTAINER_EL","toLowerCase","MISSING_CALLBACK","PREFIX","INVALID_DOM_VIDEO_EL","VPAIDHTML5Client/js/VPAIDHTML5Client",33,"VPAIDIntegrator","VIEW_MODE","NORMAL","FULLSCREEN","THUMBNAIL","createVPAIDContainerEl","VPAID_VERSION","playVPaidAd","tech","_findSupportedTech","triggerVpaidAdEnd","one","removeAdUnit","_loadAdUnit","_playAdUnit","_finishPlaying","adComplete","_paused","removeClass","vpaidMediaFiles","_createVPAIDAdUnitWrapper","vjsTechEl","WrappedAdUnit","techClass","_handshake","_initAd","_linkPlayerControls","_startAd","handshake","isSupportedVersion","majorNum","major","parts","split","dimension","adUnitSrc","notifyPlayToPlayer","trackStart","notifyPauseToPlayer","trackFirstQuartile","trackMidpoint","trackThirdQuartile","clickThruUrl","open","trackAcceptInvitation","trackAcceptInvitationLinear","trackClose","trackCloseLinear","trackCollapse","lastVolume","currentVolume","updateViewSize","updateViewSizeThrottled","throttle","autoResize","pauseAdUnit","resumeAdUnit","isSkippable","linkVolumeControl","linkFullScreenControl","updateAdUnitVolume","updatePlayerVolume","vol","logError","finishPlayingAd","errorCode","MODE","../vast/VASTResponse","../vast/VASTTracker","../vast/vastUtil","./VPAIDAdUnitWrapper",34,"element","className","AdsLabelFactory","baseComponent","init","currentTimeComp","getChild","getElement",35,"baseVideoJsComponent","videojs","Component","AdsLabel","./ads-label",36,"BlackPosterFactory","posterImg",37,"BlackPoster","./black-poster",38,"VASTPlugin","snapshot","vast","adsCanceled","defaultOpts","iosPrerollCancelTimeout","adCancelTimeout","playAdAlways","adsEnabled","isUndefined","echoFn","adTagXML","trackAdError","prepareForAds","tryToPlayPrerollAd","cancelAds","isEnabled","enable","disable","removeNativePoster","restoreVideoContent","checkAdsEnabled","preparePlayerForAd","startAdCancelTimeout","playPrerollAd","setupContentEvents","restorePlayerSnapshot","canPlayPrerollAd","getPlayerSnapshot","addSpinnerIcon","isIPhone","adCancelTimeoutId","clearAdCancelTimeout","removeSpinnerIcon","getVastResponse","adIntegrator","adFinished","addAdsLabel","removeAdsLabel","isIDevice","preventManualProgress","addChild","PROGRESS_THRESHOLD","previousTime","skipad_attempts","preventAdSeek","preventAdSkip","stopPreventManualProgress","progressDelta","../ads/vast/VASTClient","../ads/vast/VASTError","../ads/vast/VASTIntegrator","../ads/vast/vastUtil","../ads/vpaid/VPAIDIntegrator","../utils/async","../utils/dom","../utils/playerUtils","../utils/utilityFunctions",39,"setImmediate","fn","tasks","makeCallback","wrapIterator","when","condition","isAllowed","./utilityFunctions",40,"isVisible","getComputedStyle","isHidden","display","isShown","hide","__prev_style_display_","show","cssClass","classes","classList","contains","getAttribute","join","newClasses","attachEvent","detachEvent","dispatchEvent","fireEvent","eventType","isDescendant","child","node","parentNode","getTextContent","textContent","text","prependChild","firstChild","removeNode","Element","handlerWrap","rect","getBoundingClientRect","offsetWidth","offsetHeight",41,"urlUtils","HttpRequestError","HttpRequest","createXhr","run","xhr","urlParts","headers","setHeaders","onload","statusText","getAllResponseHeaders","responseText","onerror","requestError","onabort","send","abort","setRequestHeader","processResponse","headersString","isSuccess","XMLHttpRequest","XDomainRequest","./urlUtils",42,"ended","currentSrc","currentType","playing","suppressedTracks","getSuppressedTracks","nativePoster","poster","tracks","remoteTextTracks","tracks_","mode","attempts","hasSrcChanged","restoreTracks","tryToResume","ensureCanplayEvtGetsFired","load","trackSnapshot","isReadyToResume","warn","readyState","seekable","blackPoster","_firstPlay","volumeSnapshot","monkeyPatchPlayerApi","tryToTriggerFirstPlay","resetFirstPlay","restoreContentVolume","hideBlackPoster","addStyles","removeStyles","origPlay","callOrigPlay","isFirstPlay","firstPlay","resume","saveVolumeSnapshot","isAdPlaying","origPause","callOrigPause","origPaused","callOrigPaused","restoreVolumeSnapshot","removeAttribute","listener","./dom",43,"urlParsingNode","msie","documentMode","host","hash","pathname","charAt","queryStringToObj","qs","cond","pairs","qsObj","trim","pair","objToQueryString",44,"NODE_TYPE_ELEMENT","SNAKE_CASE_REGEXP","EMAIL_REGEXP","ISO8086_REGEXP","isNull","str","num","isWindow","isArrayLike","nodeType","hasOwnProperty","isPrimitive","snake_case","separator","letter","pos","isValidEmail","email","arg","k","toUpperCase","decapitalize","transformer","transformedArray","transformedItem","digits","formattedNum","NaN","delay","previousCall","Date","getTime","debounce","wait","treeSearch","root","getChildren","found","children","val","isISO8601","getInternetExplorerVersion","navigator","rv","appName","ua","userAgent","re","res","exec","_UA","isMobile","isAndroid",45,"strToXMLDoc","stringContainingXMLSource","DOMParser","xmlDocument","ActiveXObject","loadXML","parseString","parser","parsedDocument","parseFromString","isParseError","erroneousParse","parsererrorNS","getElementsByTagName","namespaceURI","getElementsByTagNameNS","parseText","sValue","oXMLParent","hasChildNodes","sCollectedTxt","oNode","sProp","vContent","nItem","childNodes","nodeValue","nodeName","hasAttr","hasAttributes","attributes","oAttrib","nAttrib","xmlString","xmlDoc","getKeyValue","xmlObj","getAttrValue","encode","encodeXML","decodeXML",46,"videoJsVAST","plugin","./plugin/components/ads-label_4","./plugin/components/black-poster_4","./plugin/videojs.vast.vpaid"],"mappings":"CAAA,QAAAA,GAAAC,EAAAC,EAAAC,GAAA,QAAAC,GAAAC,EAAAC,GAAA,IAAAJ,EAAAG,GAAA,CAAA,IAAAJ,EAAAI,GAAA,CAAA,GAAAE,SAAAC,UAAA,YAAAA,OAAA,KAAAF,GAAAC,EAAA,MAAAA,GAAAF,GAAA,EAAA,IAAAI,EAAA,MAAAA,GAAAJ,GAAA,EAAA,IAAAK,GAAA,GAAAC,OAAA,uBAAAN,EAAA,IAAA,MAAAK,GAAAE,KAAA,mBAAAF,EAAA,GAAAG,GAAAX,EAAAG,IAAAS,WAAAb,GAAAI,GAAA,GAAAU,KAAAF,EAAAC,QAAA,SAAAd,GAAA,GAAAE,GAAAD,EAAAI,GAAA,GAAAL,EAAA,OAAAI,GAAAF,EAAAA,EAAAF,IAAAa,EAAAA,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B,IAGAS,GAAAoI,WAAA,QAAAA,GAAA2qB,GACA,GAAAC,GAAAhzB,EAAA8wB,YAAAiC,EACA,OAAA,IAAA/yB,GAAAkR,SAAA8hB,GASAhzB,GAAAK,SAAA,QAAA4yB,GAAAC,GACA,GAAAA,EAAA,CACA,MAAAA,GAAA7yB,SAEA,MAAA9Y,WAGAyY,GAAAT,KAAA,QAAA4zB,GAAAD,EAAA3zB,GACA,GAAA2zB,EAAA,CACA,MAAAA,GAAA,IAAAnzB,EAAA8uB,aAAAtvB,IAEA,MAAAhY,WAGAyY,GAAAozB,OAAA,QAAAC,GAAAxF,GACA,MAAAA,GAAApvB,QAAA,KAAA,SACAA,QAAA,KAAA,QACAA,QAAA,KAAA,QACAA,QAAA,KAAA,UACAA,QAAA,KAAA,UAGAuB,GAAAiF,OAAA,QAAAquB,GAAAzF,GACA,MAAAA,GAAApvB,QAAA,UAAA,KACAA,QAAA,UAAA,KACAA,QAAA,QAAA,KACAA,QAAA,QAAA,KACAA,QAAA,SAAA,KAGA3Y,GAAAJ,QAAAsa,I5C6gNGslB,qBAAqB,KAAKiO,IAAI,SAASnuC,EAAQU,EAAOJ,G6C9pNzD,YAEAN,GAAA,kCACAA,GAAA,qCAEA,IAAAouC,GAAApuC,EAAA,8BAEAo7B,SAAAiT,OAAA,aAAAD,K7CkqNGE,kCAAkC,GAAGC,qCAAqC,GAAGC,8BAA8B,UAAU","file":"videojs_4.vast.vpaid.min.js","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o 0) {\n callback(event);\n }\n }, 0);\n }\n });\n }\n }, {\n key: '_callCallback',\n value: function _callCallback(methodName, callbackID, err, result) {\n\n var callback = this._callbacks.get(callbackID);\n\n //not all methods callback's are mandatory\n //but if there exist an error, fire the error event\n if (!callback) {\n if (err && callbackID === '') {\n this.trigger(ERROR, err);\n }\n return;\n }\n\n $asyncCallback.call(this, callbackID, err, result);\n }\n }, {\n key: '_handShake',\n value: function _handShake(err, data) {\n this._ready = true;\n if (this._handShakeHandler) {\n this._handShakeHandler(err, data);\n delete this._handShakeHandler;\n }\n }\n\n //methods like properties specific to this implementation of VPAID\n\n }, {\n key: 'getSize',\n value: function getSize() {\n return { width: this._width, height: this._height };\n }\n }, {\n key: 'setSize',\n value: function setSize(newWidth, newHeight) {\n this._width = isPositiveInt(newWidth, this._width);\n this._height = isPositiveInt(newHeight, this._height);\n this._el.setAttribute('width', this._width);\n this._el.setAttribute('height', this._height);\n }\n }, {\n key: 'getWidth',\n value: function getWidth() {\n return this._width;\n }\n }, {\n key: 'setWidth',\n value: function setWidth(newWidth) {\n this.setSize(newWidth, this._height);\n }\n }, {\n key: 'getHeight',\n value: function getHeight() {\n return this._height;\n }\n }, {\n key: 'setHeight',\n value: function setHeight(newHeight) {\n this.setSize(this._width, newHeight);\n }\n }, {\n key: 'getFlashID',\n value: function getFlashID() {\n return this._flashID;\n }\n }, {\n key: 'getFlashURL',\n value: function getFlashURL() {\n return this._flashURL;\n }\n }, {\n key: 'isReady',\n value: function isReady() {\n return this._ready;\n }\n }, {\n key: 'destroy',\n value: function destroy() {\n this.offAll();\n this.removeAllCallbacks();\n registry.removeInstanceByID(this._flashID);\n if (this._el.parentElement) {\n this._el.parentElement.removeChild(this._el);\n }\n }\n }]);\n\n return JSFlashBridge;\n}();\n\nfunction $asyncCallback(callbackID, err, result) {\n var _this3 = this;\n\n setTimeout(function () {\n var callback = _this3._callbacks.get(callbackID);\n if (callback) {\n _this3._callbacks.remove(callbackID);\n callback(err, result);\n }\n }, 0);\n}\n\nObject.defineProperty(JSFlashBridge, 'VPAID_FLASH_HANDLER', {\n writable: false,\n configurable: false,\n value: VPAID_FLASH_HANDLER\n});\n\n/**\n * External interface handler\n *\n * @param {string} flashID identifier of the flash who call this\n * @param {string} typeID what type of message is, can be 'event' or 'callback'\n * @param {string} typeName if the typeID is a event the typeName will be the eventName, if is a callback the typeID is the methodName that is related this callback\n * @param {string} callbackID only applies when the typeID is 'callback', identifier of the callback to call\n * @param {object} error error object\n * @param {object} data\n */\nwindow[VPAID_FLASH_HANDLER] = function (flashID, typeID, typeName, callbackID, error, data) {\n var instance = registry.getInstanceByID(flashID);\n if (!instance) return;\n if (typeName === 'handShake') {\n instance._handShake(error, data);\n } else {\n if (typeID !== 'event') {\n instance._callCallback(typeName, callbackID, error, data);\n } else {\n instance._trigger(typeName, data);\n }\n }\n};\n\n},{\"./jsFlashBridgeRegistry\":6,\"./registry\":7,\"./utils\":8}],6:[function(require,module,exports){\n'use strict';\n\nvar SingleValueRegistry = require('./registry').SingleValueRegistry;\nvar instances = new SingleValueRegistry();\n\nvar JSFlashBridgeRegistry = {};\nObject.defineProperty(JSFlashBridgeRegistry, 'addInstance', {\n writable: false,\n configurable: false,\n value: function value(id, instance) {\n instances.add(id, instance);\n }\n});\n\nObject.defineProperty(JSFlashBridgeRegistry, 'getInstanceByID', {\n writable: false,\n configurable: false,\n value: function value(id) {\n return instances.get(id);\n }\n});\n\nObject.defineProperty(JSFlashBridgeRegistry, 'removeInstanceByID', {\n writable: false,\n configurable: false,\n value: function value(id) {\n return instances.remove(id);\n }\n});\n\nmodule.exports = JSFlashBridgeRegistry;\n\n},{\"./registry\":7}],7:[function(require,module,exports){\n'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if (\"value\" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);\n }\n }return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;\n };\n}();\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nvar MultipleValuesRegistry = exports.MultipleValuesRegistry = function () {\n function MultipleValuesRegistry() {\n _classCallCheck(this, MultipleValuesRegistry);\n\n this._registries = {};\n }\n\n _createClass(MultipleValuesRegistry, [{\n key: 'add',\n value: function add(id, value) {\n if (!this._registries[id]) {\n this._registries[id] = [];\n }\n if (this._registries[id].indexOf(value) === -1) {\n this._registries[id].push(value);\n }\n }\n }, {\n key: 'get',\n value: function get(id) {\n return this._registries[id] || [];\n }\n }, {\n key: 'filterKeys',\n value: function filterKeys(handler) {\n return Object.keys(this._registries).filter(handler);\n }\n }, {\n key: 'findByValue',\n value: function findByValue(value) {\n var _this = this;\n\n var keys = Object.keys(this._registries).filter(function (key) {\n return _this._registries[key].indexOf(value) !== -1;\n });\n\n return keys;\n }\n }, {\n key: 'remove',\n value: function remove(key, value) {\n if (!this._registries[key]) {\n return;\n }\n\n var index = this._registries[key].indexOf(value);\n\n if (index < 0) {\n return;\n }\n return this._registries[key].splice(index, 1);\n }\n }, {\n key: 'removeByKey',\n value: function removeByKey(id) {\n var old = this._registries[id];\n delete this._registries[id];\n return old;\n }\n }, {\n key: 'removeByValue',\n value: function removeByValue(value) {\n var _this2 = this;\n\n var keys = this.findByValue(value);\n return keys.map(function (key) {\n return _this2.remove(key, value);\n });\n }\n }, {\n key: 'removeAll',\n value: function removeAll() {\n var old = this._registries;\n this._registries = {};\n return old;\n }\n }, {\n key: 'size',\n value: function size() {\n return Object.keys(this._registries).length;\n }\n }]);\n\n return MultipleValuesRegistry;\n}();\n\nvar SingleValueRegistry = exports.SingleValueRegistry = function () {\n function SingleValueRegistry() {\n _classCallCheck(this, SingleValueRegistry);\n\n this._registries = {};\n }\n\n _createClass(SingleValueRegistry, [{\n key: 'add',\n value: function add(id, value) {\n this._registries[id] = value;\n }\n }, {\n key: 'get',\n value: function get(id) {\n return this._registries[id];\n }\n }, {\n key: 'filterKeys',\n value: function filterKeys(handler) {\n return Object.keys(this._registries).filter(handler);\n }\n }, {\n key: 'findByValue',\n value: function findByValue(value) {\n var _this3 = this;\n\n var keys = Object.keys(this._registries).filter(function (key) {\n return _this3._registries[key] === value;\n });\n\n return keys;\n }\n }, {\n key: 'remove',\n value: function remove(id) {\n var old = this._registries[id];\n delete this._registries[id];\n return old;\n }\n }, {\n key: 'removeByValue',\n value: function removeByValue(value) {\n var _this4 = this;\n\n var keys = this.findByValue(value);\n return keys.map(function (key) {\n return _this4.remove(key);\n });\n }\n }, {\n key: 'removeAll',\n value: function removeAll() {\n var old = this._registries;\n this._registries = {};\n return old;\n }\n }, {\n key: 'size',\n value: function size() {\n return Object.keys(this._registries).length;\n }\n }]);\n\n return SingleValueRegistry;\n}();\n\n},{}],8:[function(require,module,exports){\n'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.unique = unique;\nexports.noop = noop;\nexports.callbackTimeout = callbackTimeout;\nexports.createElementWithID = createElementWithID;\nexports.isPositiveInt = isPositiveInt;\nexports.stringEndsWith = stringEndsWith;\nexports.hideFlashEl = hideFlashEl;\nfunction unique(prefix) {\n var count = -1;\n return function (f) {\n return prefix + '_' + ++count;\n };\n}\n\nfunction noop() {}\n\nfunction callbackTimeout(timer, onSuccess, onTimeout) {\n\n var timeout = setTimeout(function () {\n\n onSuccess = noop;\n onTimeout();\n }, timer);\n\n return function () {\n clearTimeout(timeout);\n onSuccess.apply(this, arguments);\n };\n}\n\nfunction createElementWithID(parent, id) {\n var cleanContent = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2];\n\n var nEl = document.createElement('div');\n nEl.id = id;\n if (cleanContent) {\n parent.innerHTML = '';\n }\n parent.appendChild(nEl);\n return nEl;\n}\n\nfunction isPositiveInt(newVal, oldVal) {\n return !isNaN(parseFloat(newVal)) && isFinite(newVal) && newVal > 0 ? newVal : oldVal;\n}\n\nvar endsWith = function () {\n if (String.prototype.endsWith) return String.prototype.endsWith;\n return function endsWith(searchString, position) {\n var subjectString = this.toString();\n if (position === undefined || position > subjectString.length) {\n position = subjectString.length;\n }\n position -= searchString.length;\n var lastIndex = subjectString.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n };\n}();\n\nfunction stringEndsWith(string, search) {\n return endsWith.call(string, search);\n}\n\nfunction hideFlashEl(el) {\n // can't use display none because will not run the flash\n el.style.position = 'absolute';\n el.style.left = '-1px';\n el.style.top = '-1px';\n el.style.width = '1px';\n el.style.height = '1px';\n el.style.visibility = 'hidden';\n}\n\n},{}],9:[function(require,module,exports){\n'use strict';\n\nvar METHODS = [\n 'handshakeVersion',\n 'initAd',\n 'startAd',\n 'stopAd',\n 'skipAd', // VPAID 2.0 new method\n 'resizeAd',\n 'pauseAd',\n 'resumeAd',\n 'expandAd',\n 'collapseAd',\n 'subscribe',\n 'unsubscribe'\n];\n\nvar EVENTS = [\n 'AdLoaded',\n 'AdStarted',\n 'AdStopped',\n 'AdSkipped',\n 'AdSkippableStateChange', // VPAID 2.0 new event\n 'AdSizeChange', // VPAID 2.0 new event\n 'AdLinearChange',\n 'AdDurationChange', // VPAID 2.0 new event\n 'AdExpandedChange',\n 'AdRemainingTimeChange', // [Deprecated in 2.0] but will be still fired for backwards compatibility\n 'AdVolumeChange',\n 'AdImpression',\n 'AdVideoStart',\n 'AdVideoFirstQuartile',\n 'AdVideoMidpoint',\n 'AdVideoThirdQuartile',\n 'AdVideoComplete',\n 'AdClickThru',\n 'AdInteraction', // VPAID 2.0 new event\n 'AdUserAcceptInvitation',\n 'AdUserMinimize',\n 'AdUserClose',\n 'AdPaused',\n 'AdPlaying',\n 'AdLog',\n 'AdError'\n];\n\nvar GETTERS = [\n 'getAdLinear',\n 'getAdWidth', // VPAID 2.0 new getter\n 'getAdHeight', // VPAID 2.0 new getter\n 'getAdExpanded',\n 'getAdSkippableState', // VPAID 2.0 new getter\n 'getAdRemainingTime',\n 'getAdDuration', // VPAID 2.0 new getter\n 'getAdVolume',\n 'getAdCompanions', // VPAID 2.0 new getter\n 'getAdIcons' // VPAID 2.0 new getter\n];\n\nvar SETTERS = [\n 'setAdVolume'\n];\n\n\n/**\n * This callback is displayed as global member. The callback use nodejs error-first callback style\n * @callback NodeStyleCallback\n * @param {string|null}\n * @param {undefined|object}\n */\n\n\n/**\n * IVPAIDAdUnit\n *\n * @class\n *\n * @param {object} creative\n * @param {HTMLElement} el\n * @param {HTMLVideoElement} video\n */\nfunction IVPAIDAdUnit(creative, el, video) {}\n\n\n/**\n * handshakeVersion\n *\n * @param {string} VPAIDVersion\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.handshakeVersion = function (VPAIDVersion, callback) {};\n\n/**\n * initAd\n *\n * @param {number} width\n * @param {number} height\n * @param {string} viewMode can be 'normal', 'thumbnail' or 'fullscreen'\n * @param {number} desiredBitrate indicates the desired bitrate in kbps\n * @param {object} [creativeData] used for additional initialization data\n * @param {object} [environmentVars] used for passing implementation-specific of js version\n * @param {NodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.initAd = function(width, height, viewMode, desiredBitrate, creativeData, environmentVars, callback) {};\n\n/**\n * startAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.startAd = function(callback) {};\n\n/**\n * stopAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.stopAd = function(callback) {};\n\n/**\n * skipAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.skipAd = function(callback) {};\n\n/**\n * resizeAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.resizeAd = function(width, height, viewMode, callback) {};\n\n/**\n * pauseAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.pauseAd = function(callback) {};\n\n/**\n * resumeAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.resumeAd = function(callback) {};\n\n/**\n * expandAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.expandAd = function(callback) {};\n\n/**\n * collapseAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.collapseAd = function(callback) {};\n\n/**\n * subscribe\n *\n * @param {string} event\n * @param {nodeStyleCallback} handler\n * @param {object} context\n */\nIVPAIDAdUnit.prototype.subscribe = function(event, handler, context) {};\n\n/**\n * startAd\n *\n * @param {string} event\n * @param {function} handler\n */\nIVPAIDAdUnit.prototype.unsubscribe = function(event, handler) {};\n\n\n\n/**\n * getAdLinear\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdLinear = function(callback) {};\n\n/**\n * getAdWidth\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdWidth = function(callback) {};\n\n/**\n * getAdHeight\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdHeight = function(callback) {};\n\n/**\n * getAdExpanded\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdExpanded = function(callback) {};\n\n/**\n * getAdSkippableState\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdSkippableState = function(callback) {};\n\n/**\n * getAdRemainingTime\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdRemainingTime = function(callback) {};\n\n/**\n * getAdDuration\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdDuration = function(callback) {};\n\n/**\n * getAdVolume\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdVolume = function(callback) {};\n\n/**\n * getAdCompanions\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdCompanions = function(callback) {};\n\n/**\n * getAdIcons\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdIcons = function(callback) {};\n\n/**\n * setAdVolume\n *\n * @param {number} volume\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.setAdVolume = function(volume, callback) {};\n\naddStaticToInterface(IVPAIDAdUnit, 'METHODS', METHODS);\naddStaticToInterface(IVPAIDAdUnit, 'GETTERS', GETTERS);\naddStaticToInterface(IVPAIDAdUnit, 'SETTERS', SETTERS);\naddStaticToInterface(IVPAIDAdUnit, 'EVENTS', EVENTS);\n\n\nvar VPAID1_METHODS = METHODS.filter(function(method) {\n return ['skipAd'].indexOf(method) === -1;\n});\n\naddStaticToInterface(IVPAIDAdUnit, 'checkVPAIDInterface', function checkVPAIDInterface (creative) {\n var result = VPAID1_METHODS.every(function(key) {\n return typeof creative[key] === 'function';\n });\n return result;\n});\n\nmodule.exports = IVPAIDAdUnit;\n\nfunction addStaticToInterface(Interface, name, value) {\n Object.defineProperty(Interface, name, {\n writable: false,\n configurable: false,\n value: value\n });\n}\n\n\n},{}],10:[function(require,module,exports){\n'use strict';\n\nvar IVPAIDAdUnit = require('./IVPAIDAdUnit');\nvar Subscriber = require('./subscriber');\nvar checkVPAIDInterface = IVPAIDAdUnit.checkVPAIDInterface;\nvar utils = require('./utils');\nvar METHODS = IVPAIDAdUnit.METHODS;\nvar ERROR = 'AdError';\nvar AD_CLICK = 'AdClickThru';\nvar FILTERED_EVENTS = IVPAIDAdUnit.EVENTS.filter(function (event) {\n return event != AD_CLICK;\n});\n\n/**\n * This callback is displayed as global member. The callback use nodejs error-first callback style\n * @callback NodeStyleCallback\n * @param {string|null}\n * @param {undefined|object}\n */\n\n\n/**\n * VPAIDAdUnit\n * @class\n *\n * @param VPAIDCreative\n * @param {HTMLElement} [el] this will be used in initAd environmentVars.slot if defined\n * @param {HTMLVideoElement} [video] this will be used in initAd environmentVars.videoSlot if defined\n */\nfunction VPAIDAdUnit(VPAIDCreative, el, video, iframe) {\n this._isValid = checkVPAIDInterface(VPAIDCreative);\n if (this._isValid) {\n this._creative = VPAIDCreative;\n this._el = el;\n this._videoEl = video;\n this._iframe = iframe;\n this._subscribers = new Subscriber();\n $addEventsSubscribers.call(this);\n }\n}\n\nVPAIDAdUnit.prototype = Object.create(IVPAIDAdUnit.prototype);\n\n/**\n * isValidVPAIDAd will return if the VPAIDCreative passed in constructor is valid or not\n *\n * @return {boolean}\n */\nVPAIDAdUnit.prototype.isValidVPAIDAd = function isValidVPAIDAd() {\n return this._isValid;\n};\n\nIVPAIDAdUnit.METHODS.forEach(function(method) {\n //NOTE: this methods arguments order are implemented differently from the spec\n var ignores = [\n 'subscribe',\n 'unsubscribe',\n 'initAd'\n ];\n\n if (ignores.indexOf(method) !== -1) return;\n\n VPAIDAdUnit.prototype[method] = function () {\n var ariaty = IVPAIDAdUnit.prototype[method].length;\n // TODO avoid leaking arguments\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n var args = Array.prototype.slice.call(arguments);\n var callback = (ariaty === args.length) ? args.pop() : undefined;\n\n setTimeout(function () {\n var result, error = null;\n try {\n result = this._creative[method].apply(this._creative, args);\n } catch(e) {\n error = e;\n }\n\n callOrTriggerEvent(callback, this._subscribers, error, result);\n }.bind(this), 0);\n };\n});\n\n\n/**\n * initAd concreate implementation\n *\n * @param {number} width\n * @param {number} height\n * @param {string} viewMode can be 'normal', 'thumbnail' or 'fullscreen'\n * @param {number} desiredBitrate indicates the desired bitrate in kbps\n * @param {object} [creativeData] used for additional initialization data\n * @param {object} [environmentVars] used for passing implementation-specific of js version, if el & video was used in constructor slot & videoSlot will be added to the object\n * @param {NodeStyleCallback} callback\n */\nVPAIDAdUnit.prototype.initAd = function initAd(width, height, viewMode, desiredBitrate, creativeData, environmentVars, callback) {\n creativeData = creativeData || {};\n environmentVars = utils.extend({\n slot: this._el,\n videoSlot: this._videoEl\n }, environmentVars || {});\n\n setTimeout(function () {\n var error;\n try {\n this._creative.initAd(width, height, viewMode, desiredBitrate, creativeData, environmentVars);\n } catch (e) {\n error = e;\n }\n\n callOrTriggerEvent(callback, this._subscribers, error);\n }.bind(this), 0);\n};\n\n/**\n * subscribe\n *\n * @param {string} event\n * @param {nodeStyleCallback} handler\n * @param {object} context\n */\nVPAIDAdUnit.prototype.subscribe = function subscribe(event, handler, context) {\n this._subscribers.subscribe(handler, event, context);\n};\n\n\n/**\n * unsubscribe\n *\n * @param {string} event\n * @param {nodeStyleCallback} handler\n */\nVPAIDAdUnit.prototype.unsubscribe = function unsubscribe(event, handler) {\n this._subscribers.unsubscribe(handler, event);\n};\n\n//alias\nVPAIDAdUnit.prototype.on = VPAIDAdUnit.prototype.subscribe;\nVPAIDAdUnit.prototype.off = VPAIDAdUnit.prototype.unsubscribe;\n\nIVPAIDAdUnit.GETTERS.forEach(function(getter) {\n VPAIDAdUnit.prototype[getter] = function (callback) {\n setTimeout(function () {\n\n var result, error = null;\n try {\n result = this._creative[getter]();\n } catch(e) {\n error = e;\n }\n\n callOrTriggerEvent(callback, this._subscribers, error, result);\n }.bind(this), 0);\n };\n});\n\n/**\n * setAdVolume\n *\n * @param volume\n * @param {nodeStyleCallback} callback\n */\nVPAIDAdUnit.prototype.setAdVolume = function setAdVolume(volume, callback) {\n setTimeout(function () {\n\n var result, error = null;\n try {\n this._creative.setAdVolume(volume);\n result = this._creative.getAdVolume();\n } catch(e) {\n error = e;\n }\n\n if (!error) {\n error = utils.validate(result === volume, 'failed to apply volume: ' + volume);\n }\n callOrTriggerEvent(callback, this._subscribers, error, result);\n }.bind(this), 0);\n};\n\nVPAIDAdUnit.prototype._destroy = function destroy() {\n this.stopAd();\n this._subscribers.unsubscribeAll();\n};\n\nfunction $addEventsSubscribers() {\n // some ads implement\n // so they only handle one subscriber\n // to handle this we create our one\n FILTERED_EVENTS.forEach(function (event) {\n this._creative.subscribe($trigger.bind(this, event), event);\n }.bind(this));\n\n // map the click event to be an object instead of depending of the order of the arguments\n // and to be consistent with the flash\n this._creative.subscribe($clickThruHook.bind(this), AD_CLICK);\n\n // because we are adding the element inside the iframe\n // the user is not able to click in the video\n if (this._videoEl) {\n var documentElement = this._iframe.contentDocument.documentElement;\n var videoEl = this._videoEl;\n documentElement.addEventListener('click', function(e) {\n if (e.target === documentElement) {\n videoEl.click();\n }\n });\n }\n}\n\nfunction $clickThruHook(url, id, playerHandles) {\n this._subscribers.triggerSync(AD_CLICK, {url: url, id: id, playerHandles: playerHandles});\n}\n\nfunction $trigger(event) {\n // TODO avoid leaking arguments\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n this._subscribers.trigger(event, Array.prototype.slice(arguments, 1));\n}\n\nfunction callOrTriggerEvent(callback, subscribers, error, result) {\n if (callback) {\n callback(error, result);\n } else if (error) {\n subscribers.trigger(ERROR, error);\n }\n}\n\nmodule.exports = VPAIDAdUnit;\n\n\n},{\"./IVPAIDAdUnit\":9,\"./subscriber\":12,\"./utils\":13}],11:[function(require,module,exports){\n'use strict';\n\nvar utils = require('./utils');\nvar unique = utils.unique('vpaidIframe');\nvar VPAIDAdUnit = require('./VPAIDAdUnit');\n\nvar defaultTemplate = '' +\n '' +\n '' +\n '
' +\n '' +\n '' +\n '' +\n '';\n\nvar AD_STOPPED = 'AdStopped';\n\n/**\n * This callback is displayed as global member. The callback use nodejs error-first callback style\n * @callback NodeStyleCallback\n * @param {string|null}\n * @param {undefined|object}\n */\n\n/**\n * VPAIDHTML5Client\n * @class\n *\n * @param {HTMLElement} el that will contain the iframe to load adUnit and a el to add to adUnit slot\n * @param {HTMLVideoElement} video default video element to be used by adUnit\n * @param {object} [templateConfig] template: html template to be used instead of the default, extraOptions: to be used when rendering the template\n * @param {object} [vpaidOptions] timeout: when loading adUnit\n */\nfunction VPAIDHTML5Client(el, video, templateConfig, vpaidOptions) {\n templateConfig = templateConfig || {};\n\n this._id = unique();\n this._destroyed = false;\n\n this._frameContainer = utils.createElementInEl(el, 'div');\n this._videoEl = video;\n this._vpaidOptions = vpaidOptions || {timeout: 10000};\n\n this._templateConfig = {\n template: templateConfig.template || defaultTemplate,\n extraOptions: templateConfig.extraOptions || {}\n };\n}\n\n/**\n * destroy\n *\n */\nVPAIDHTML5Client.prototype.destroy = function destroy() {\n if (this._destroyed) {\n return;\n }\n this._destroyed = true;\n $unloadPreviousAdUnit.call(this);\n};\n\n/**\n * isDestroyed\n *\n * @return {boolean}\n */\nVPAIDHTML5Client.prototype.isDestroyed = function isDestroyed() {\n return this._destroyed;\n};\n\n/**\n * loadAdUnit\n *\n * @param {string} adURL url of the js of the adUnit\n * @param {nodeStyleCallback} callback\n */\nVPAIDHTML5Client.prototype.loadAdUnit = function loadAdUnit(adURL, callback) {\n $throwIfDestroyed.call(this);\n $unloadPreviousAdUnit.call(this);\n var that = this;\n\n var frame = utils.createIframeWithContent(\n this._frameContainer,\n this._templateConfig.template,\n utils.extend({\n iframeURL_JS: adURL,\n iframeID: this.getID(),\n origin: getOrigin()\n }, this._templateConfig.extraOptions)\n );\n\n this._frame = frame;\n\n this._onLoad = utils.callbackTimeout(\n this._vpaidOptions.timeout,\n onLoad.bind(this),\n onTimeout.bind(this)\n );\n\n window.addEventListener('message', this._onLoad);\n\n function onLoad (e) {\n /*jshint validthis: false */\n //don't clear timeout\n if (e.origin !== getOrigin()) return;\n var result = JSON.parse(e.data);\n\n //don't clear timeout\n if (result.id !== that.getID()) return;\n\n var adUnit, error, createAd;\n if (!that._frame.contentWindow) {\n\n error = 'the iframe is not anymore in the DOM tree';\n\n } else {\n createAd = that._frame.contentWindow.getVPAIDAd;\n error = utils.validate(typeof createAd === 'function', 'the ad didn\\'t return a function to create an ad');\n }\n\n if (!error) {\n var adEl = that._frame.contentWindow.document.querySelector('.ad-element');\n adUnit = new VPAIDAdUnit(createAd(), adEl, that._videoEl, that._frame);\n adUnit.subscribe(AD_STOPPED, $adDestroyed.bind(that));\n error = utils.validate(adUnit.isValidVPAIDAd(), 'the add is not fully complaint with VPAID specification');\n }\n\n that._adUnit = adUnit;\n $destroyLoadListener.call(that);\n callback(error, error ? null : adUnit);\n\n //clear timeout\n return true;\n }\n\n function onTimeout() {\n callback('timeout', null);\n }\n};\n\n/**\n * unloadAdUnit\n *\n */\nVPAIDHTML5Client.prototype.unloadAdUnit = function unloadAdUnit() {\n $unloadPreviousAdUnit.call(this);\n};\n\n/**\n * getID will return the unique id\n *\n * @return {string}\n */\nVPAIDHTML5Client.prototype.getID = function () {\n return this._id;\n};\n\n\n/**\n * $removeEl\n *\n * @param {string} key\n */\nfunction $removeEl(key) {\n var el = this[key];\n if (el) {\n el.remove();\n delete this[key];\n }\n}\n\nfunction $adDestroyed() {\n $removeAdElements.call(this);\n delete this._adUnit;\n}\n\nfunction $unloadPreviousAdUnit() {\n $removeAdElements.call(this);\n $destroyAdUnit.call(this);\n}\n\nfunction $removeAdElements() {\n $removeEl.call(this, '_frame');\n $destroyLoadListener.call(this);\n}\n\n/**\n * $destroyLoadListener\n *\n */\nfunction $destroyLoadListener() {\n if (this._onLoad) {\n window.removeEventListener('message', this._onLoad);\n utils.clearCallbackTimeout(this._onLoad);\n delete this._onLoad;\n }\n}\n\n\nfunction $destroyAdUnit() {\n if (this._adUnit) {\n this._adUnit.stopAd();\n delete this._adUnit;\n }\n}\n\n/**\n * $throwIfDestroyed\n *\n */\nfunction $throwIfDestroyed() {\n if (this._destroyed) {\n throw new Error ('VPAIDHTML5Client already destroyed!');\n }\n}\n\nfunction getOrigin() {\n if( window.location.origin ) {\n return window.location.origin;\n }\n else {\n return window.location.protocol + \"//\" +\n window.location.hostname +\n (window.location.port ? ':' + window.location.port: '');\n }\n}\n\nmodule.exports = VPAIDHTML5Client;\nwindow.VPAIDHTML5Client = VPAIDHTML5Client;\n\n\n},{\"./VPAIDAdUnit\":10,\"./utils\":13}],12:[function(require,module,exports){\n'use strict';\n\nfunction Subscriber() {\n this._subscribers = {};\n}\n\nSubscriber.prototype.subscribe = function subscribe(handler, eventName, context) {\n if (!this.isHandlerAttached(handler, eventName)) {\n this.get(eventName).push({handler: handler, context: context, eventName: eventName});\n }\n};\n\nSubscriber.prototype.unsubscribe = function unsubscribe(handler, eventName) {\n this._subscribers[eventName] = this.get(eventName).filter(function (subscriber) {\n return handler !== subscriber.handler;\n });\n};\n\nSubscriber.prototype.unsubscribeAll = function unsubscribeAll() {\n this._subscribers = {};\n};\n\nSubscriber.prototype.trigger = function(eventName, data) {\n var that = this;\n var subscribers = this.get(eventName)\n .concat(this.get('*'));\n\n subscribers.forEach(function (subscriber) {\n setTimeout(function () {\n if (that.isHandlerAttached(subscriber.handler, subscriber.eventName)) {\n subscriber.handler.call(subscriber.context, data);\n }\n }, 0);\n });\n};\n\nSubscriber.prototype.triggerSync = function(eventName, data) {\n var subscribers = this.get(eventName)\n .concat(this.get('*'));\n\n subscribers.forEach(function (subscriber) {\n subscriber.handler.call(subscriber.context, data);\n });\n};\n\nSubscriber.prototype.get = function get(eventName) {\n if (!this._subscribers[eventName]) {\n this._subscribers[eventName] = [];\n }\n return this._subscribers[eventName];\n};\n\nSubscriber.prototype.isHandlerAttached = function isHandlerAttached(handler, eventName) {\n return this.get(eventName).some(function(subscriber) {\n return handler === subscriber.handler;\n })\n};\n\nmodule.exports = Subscriber;\n\n\n},{}],13:[function(require,module,exports){\n'use strict';\n\n/**\n * noop a empty function\n */\nfunction noop() {}\n\n/**\n * validate if is not validate will return an Error with the message\n *\n * @param {boolean} isValid\n * @param {string} message\n */\nfunction validate(isValid, message) {\n return isValid ? null : new Error(message);\n}\n\nvar timeouts = {};\n/**\n * clearCallbackTimeout\n *\n * @param {function} func handler to remove\n */\nfunction clearCallbackTimeout(func) {\n var timeout = timeouts[func];\n if (timeout) {\n clearTimeout(timeout);\n delete timeouts[func];\n }\n}\n\n/**\n * callbackTimeout if the onSuccess is not called and returns true in the timelimit then onTimeout will be called\n *\n * @param {number} timer\n * @param {function} onSuccess\n * @param {function} onTimeout\n */\nfunction callbackTimeout(timer, onSuccess, onTimeout) {\n var callback, timeout;\n\n timeout = setTimeout(function () {\n onSuccess = noop;\n delete timeout[callback];\n onTimeout();\n }, timer);\n\n callback = function () {\n // TODO avoid leaking arguments\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n if (onSuccess.apply(this, arguments)) {\n clearCallbackTimeout(callback);\n }\n };\n\n timeouts[callback] = timeout;\n\n return callback;\n}\n\n\n/**\n * createElementInEl\n *\n * @param {HTMLElement} parent\n * @param {string} tagName\n * @param {string} id\n */\nfunction createElementInEl(parent, tagName, id) {\n var nEl = document.createElement(tagName);\n if (id) nEl.id = id;\n parent.appendChild(nEl);\n return nEl;\n}\n\n/**\n * createIframeWithContent\n *\n * @param {HTMLElement} parent\n * @param {string} template simple template using {{var}}\n * @param {object} data\n */\nfunction createIframeWithContent(parent, template, data) {\n var iframe = createIframe(parent, null, data.zIndex);\n if (!setIframeContent(iframe, simpleTemplate(template, data))) return;\n return iframe;\n}\n\n/**\n * createIframe\n *\n * @param {HTMLElement} parent\n * @param {string} url\n */\nfunction createIframe(parent, url, zIndex) {\n var nEl = document.createElement('iframe');\n nEl.src = url || 'about:blank';\n nEl.marginWidth = '0';\n nEl.marginHeight = '0';\n nEl.frameBorder = '0';\n nEl.width = '100%';\n nEl.height = '100%';\n nEl.style.position = 'absolute';\n nEl.style.left = '0';\n nEl.style.top = '0';\n nEl.style.margin = '0px';\n nEl.style.padding = '0px';\n nEl.style.border = 'none';\n\n if(zIndex){\n nEl.style.zIndex = zIndex;\n }\n\n nEl.setAttribute('SCROLLING','NO');\n parent.innerHTML = '';\n parent.appendChild(nEl);\n return nEl;\n}\n\n/**\n * simpleTemplate\n *\n * @param {string} template\n * @param {object} data\n */\nfunction simpleTemplate(template, data) {\n Object.keys(data).forEach(function (key) {\n var value = (typeof value === 'object') ? JSON.stringify(data[key]) : data[key];\n template = template.replace(new RegExp('{{' + key + '}}', 'g'), value);\n });\n return template;\n}\n\n/**\n * setIframeContent\n *\n * @param {HTMLIframeElement} iframeEl\n * @param content\n */\nfunction setIframeContent(iframeEl, content) {\n var iframeDoc = iframeEl.contentWindow && iframeEl.contentWindow.document;\n if (!iframeDoc) return false;\n\n iframeDoc.write(content);\n\n return true;\n}\n\n\n/**\n * extend object with keys from another object\n *\n * @param {object} toExtend\n * @param {object} fromSource\n */\nfunction extend(toExtend, fromSource) {\n Object.keys(fromSource).forEach(function(key) {\n toExtend[key] = fromSource[key];\n });\n return toExtend;\n}\n\n\n/**\n * unique will create a unique string everytime is called, sequentially and prefixed\n *\n * @param {string} prefix\n */\nfunction unique(prefix) {\n var count = -1;\n return function () {\n return prefix + '_' + (++count);\n };\n}\n\nmodule.exports = {\n noop: noop,\n validate: validate,\n clearCallbackTimeout: clearCallbackTimeout,\n callbackTimeout: callbackTimeout,\n createElementInEl: createElementInEl,\n createIframeWithContent: createIframeWithContent,\n createIframe: createIframe,\n simpleTemplate: simpleTemplate,\n setIframeContent: setIframeContent,\n extend: extend,\n unique: unique\n};\n\n\n},{}],14:[function(require,module,exports){\n'use strict';\n\nvar InLine = require('./InLine');\nvar Wrapper = require('./Wrapper');\n\nfunction Ad(adJTree) {\n if (!(this instanceof Ad)) {\n return new Ad(adJTree);\n }\n this.initialize(adJTree);\n}\n\nAd.prototype.initialize = function(adJTree) {\n this.id = adJTree.attr('id');\n this.sequence = adJTree.attr('sequence');\n\n if(adJTree.inLine) {\n this.inLine = new InLine(adJTree.inLine);\n }\n\n if(adJTree.wrapper){\n this.wrapper = new Wrapper(adJTree.wrapper);\n }\n};\n\nmodule.exports = Ad;\n},{\"./InLine\":17,\"./Wrapper\":27}],15:[function(require,module,exports){\n'use strict';\n\nvar TrackingEvent = require('./TrackingEvent');\n\nvar utilities = require('../../utils/utilityFunctions');\n\nvar xml = require('../../utils/xml');\n\n\nfunction Companion(companionJTree) {\n if (!(this instanceof Companion)) {\n return new Companion(companionJTree);\n }\n\n //Required Elements\n this.creativeType = xml.attr(companionJTree.staticResource, 'creativeType');\n this.staticResource = xml.keyValue(companionJTree.staticResource);\n\n // Weird bug when the JXON tree is built it doesn't handle casing properly in this situation...\n var htmlResource = null;\n if (xml.keyValue(companionJTree.HTMLResource)) {\n htmlResource = xml.keyValue(companionJTree.HTMLResource);\n } else if (xml.keyValue(companionJTree.hTMLResource)) {\n htmlResource = xml.keyValue(companionJTree.hTMLResource);\n }\n this.htmlResource = htmlResource;\n\n var iframeResource = null;\n if (xml.keyValue(companionJTree.IFrameResource)) {\n iframeResource = xml.keyValue(companionJTree.IFrameResource);\n } else if (xml.keyValue(companionJTree.iFrameresource)) {\n iframeResource = xml.keyValue(companionJTree.iFrameresource);\n }\n this.iframeResource = iframeResource;\n\n //Optional fields\n this.id = xml.attr(companionJTree, 'id');\n this.width = xml.attr(companionJTree, 'width');\n this.height = xml.attr(companionJTree, 'height');\n this.expandedWidth = xml.attr(companionJTree, 'expandedWidth');\n this.expandedHeight = xml.attr(companionJTree, 'expandedHeight');\n this.scalable = xml.attr(companionJTree, 'scalable');\n this.maintainAspectRatio = xml.attr(companionJTree, 'maintainAspectRatio');\n this.minSuggestedDuration = xml.attr(companionJTree, 'minSuggestedDuration');\n this.apiFramework = xml.attr(companionJTree, 'apiFramework');\n this.companionClickThrough = xml.keyValue(companionJTree.companionClickThrough);\n this.trackingEvents = parseTrackingEvents(companionJTree.trackingEvents && companionJTree.trackingEvents.tracking);\n\n /*** Local functions ***/\n function parseTrackingEvents(trackingEvents) {\n var trackings = [];\n if (utilities.isDefined(trackingEvents)) {\n trackingEvents = utilities.isArray(trackingEvents) ? trackingEvents : [trackingEvents];\n trackingEvents.forEach(function (trackingData) {\n trackings.push(new TrackingEvent(trackingData));\n });\n }\n return trackings;\n }\n}\n\nmodule.exports = Companion;\n},{\"../../utils/utilityFunctions\":44,\"../../utils/xml\":45,\"./TrackingEvent\":20}],16:[function(require,module,exports){\n'use strict';\n\nvar Linear = require('./Linear');\nvar Companion = require('./Companion');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction Creative(creativeJTree) {\n if(!(this instanceof Creative)) {\n return new Creative(creativeJTree);\n }\n\n this.id = creativeJTree.attr('id');\n this.sequence = creativeJTree.attr('sequence');\n this.adId = creativeJTree.attr('adId');\n this.apiFramework = creativeJTree.attr('apiFramework');\n\n if(creativeJTree.linear) {\n this.linear = new Linear(creativeJTree.linear);\n }\n\n if (creativeJTree.companionAds) {\n var companions = [];\n var companionAds = creativeJTree.companionAds && creativeJTree.companionAds.companion;\n if (utilities.isDefined(companionAds)) {\n companionAds = utilities.isArray(companionAds) ? companionAds : [companionAds];\n companionAds.forEach(function (companionData) {\n companions.push(new Companion(companionData));\n });\n }\n this.companionAds = companions;\n }\n}\n\n/**\n * Returns true if the browser supports at the creative.\n */\nCreative.prototype.isSupported = function(){\n if(this.linear) {\n return this.linear.isSupported();\n }\n\n return true;\n};\n\nCreative.parseCreatives = function parseCreatives(creativesJTree) {\n var creatives = [];\n var creativesData;\n if (utilities.isDefined(creativesJTree) && utilities.isDefined(creativesJTree.creative)) {\n creativesData = utilities.isArray(creativesJTree.creative) ? creativesJTree.creative : [creativesJTree.creative];\n creativesData.forEach(function (creative) {\n creatives.push(new Creative(creative));\n });\n }\n return creatives;\n};\n\nmodule.exports = Creative;\n\n},{\"../../utils/utilityFunctions\":44,\"./Companion\":15,\"./Linear\":18}],17:[function(require,module,exports){\n'use strict';\n\nvar vastUtil = require('./vastUtil');\nvar Creative = require('./Creative');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nfunction InLine(inlineJTree) {\n if (!(this instanceof InLine)) {\n return new InLine(inlineJTree);\n }\n\n //Required Fields\n this.adTitle = xml.keyValue(inlineJTree.adTitle);\n this.adSystem = xml.keyValue(inlineJTree.adSystem);\n this.impressions = vastUtil.parseImpressions(inlineJTree.impression);\n this.creatives = Creative.parseCreatives(inlineJTree.creatives);\n\n //Optional Fields\n this.description = xml.keyValue(inlineJTree.description);\n this.advertiser = xml.keyValue(inlineJTree.advertiser);\n this.surveys = parseSurveys(inlineJTree.survey);\n this.error = xml.keyValue(inlineJTree.error);\n this.pricing = xml.keyValue(inlineJTree.pricing);\n this.extensions = inlineJTree.extensions;\n\n /*** Local Functions ***/\n function parseSurveys(inlineSurveys) {\n if (inlineSurveys) {\n return utilities.transformArray(utilities.isArray(inlineSurveys) ? inlineSurveys : [inlineSurveys], function (survey) {\n if(utilities.isNotEmptyString(survey.keyValue)){\n return {\n uri: survey.keyValue,\n type: survey.attr('type')\n };\n }\n\n return undefined;\n });\n }\n return [];\n }\n}\n\n\n/**\n * Returns true if the browser supports all the creatives.\n */\nInLine.prototype.isSupported = function(){\n var i,len;\n\n if(this.creatives.length === 0) {\n return false;\n }\n\n for(i = 0, len = this.creatives.length; i< len; i+=1){\n if(!this.creatives[i].isSupported()){\n return false;\n }\n }\n return true;\n};\n\nmodule.exports = InLine;\n\n},{\"../../utils/utilityFunctions\":44,\"../../utils/xml\":45,\"./Creative\":16,\"./vastUtil\":29}],18:[function(require,module,exports){\n'use strict';\n\nvar TrackingEvent = require('./TrackingEvent');\nvar MediaFile = require('./MediaFile');\nvar VideoClicks = require('./VideoClicks');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar parsers = require('./parsers');\n\nvar xml = require('../../utils/xml');\n\n\nfunction Linear(linearJTree) {\n if (!(this instanceof Linear)) {\n return new Linear(linearJTree);\n }\n\n //Required Elements\n this.duration = parsers.duration(xml.keyValue(linearJTree.duration));\n this.mediaFiles = parseMediaFiles(linearJTree.mediaFiles && linearJTree.mediaFiles.mediaFile);\n\n //Optional fields\n this.trackingEvents = parseTrackingEvents(linearJTree.trackingEvents && linearJTree.trackingEvents.tracking, this.duration);\n this.skipoffset = parsers.offset(xml.attr(linearJTree, 'skipoffset'), this.duration);\n\n if (linearJTree.videoClicks) {\n this.videoClicks = new VideoClicks(linearJTree.videoClicks);\n }\n\n if(linearJTree.adParameters) {\n this.adParameters = xml.keyValue(linearJTree.adParameters);\n\n if(xml.attr(linearJTree.adParameters, 'xmlEncoded')){\n this.adParameters = xml.decode(this.adParameters);\n }\n }\n\n /*** Local functions ***/\n function parseTrackingEvents(trackingEvents, duration) {\n var trackings = [];\n if (utilities.isDefined(trackingEvents)) {\n trackingEvents = utilities.isArray(trackingEvents) ? trackingEvents : [trackingEvents];\n trackingEvents.forEach(function (trackingData) {\n trackings.push(new TrackingEvent(trackingData, duration));\n });\n }\n return trackings;\n }\n\n function parseMediaFiles(mediaFilesJxonTree) {\n var mediaFiles = [];\n if (utilities.isDefined(mediaFilesJxonTree)) {\n mediaFilesJxonTree = utilities.isArray(mediaFilesJxonTree) ? mediaFilesJxonTree : [mediaFilesJxonTree];\n\n mediaFilesJxonTree.forEach(function (mfData) {\n mediaFiles.push(new MediaFile(mfData));\n });\n }\n return mediaFiles;\n }\n}\n\n/**\n * Must return true if at least one of the MediaFiles' type is supported\n */\nLinear.prototype.isSupported = function () {\n var i, len;\n for(i=0, len=this.mediaFiles.length; i 0) {\n getAd(waterfallAds.shift(),[], waterfallHandler);\n } else {\n callback(error, adChain);\n }\n } else {\n callback(null, adChain);\n }\n }\n });\n\n /*** Local functions ***/\n function getAdWaterfall(adTagUrl, callback) {\n var requestVastXML = that._requestVASTXml.bind(that, adTagUrl);\n async.waterfall([\n requestVastXML,\n buildVastWaterfall\n ], callback);\n }\n\n function buildVastWaterfall(xmlStr, callback) {\n var vastTree;\n try {\n vastTree = xml.toJXONTree(xmlStr);\n\n if(utilities.isArray(vastTree.ad)) {\n vastTree.ads = vastTree.ad;\n } else if(vastTree.ad){\n vastTree.ads = [vastTree.ad];\n } else {\n vastTree.ads = [];\n }\n callback(validateVASTTree(vastTree), vastTree);\n\n } catch (e) {\n callback(new VASTError(\"on VASTClient.getVASTAd.buildVastWaterfall, error parsing xml\", 100), null);\n }\n }\n\n function validateVASTTree(vastTree) {\n var vastVersion = xml.attr(vastTree, 'version');\n\n if (!vastTree.ad) {\n return new VASTError('on VASTClient.getVASTAd.validateVASTTree, no Ad in VAST tree', 303);\n }\n\n if (vastVersion && (vastVersion != 3 && vastVersion != 2)) {\n return new VASTError('on VASTClient.getVASTAd.validateVASTTree, not supported VAST version \"' + vastVersion + '\"', 102);\n }\n\n return null;\n }\n\n function getAd(adTagUrl, adChain, callback) {\n if (adChain.length >= that.WRAPPER_LIMIT) {\n return callback(new VASTError(\"on VASTClient.getVASTAd.getAd, players wrapper limit reached (the limit is \" + that.WRAPPER_LIMIT + \")\", 302), adChain);\n }\n\n async.waterfall([\n function (next) {\n if (utilities.isString(adTagUrl)) {\n requestVASTAd(adTagUrl, next);\n } else {\n next(null, adTagUrl);\n }\n },\n buildAd\n ], function (error, ad) {\n if (ad) {\n adChain.push(ad);\n }\n\n if (error) {\n return callback(error, adChain);\n }\n\n if (ad.wrapper) {\n return getAd(ad.wrapper.VASTAdTagURI, adChain, callback);\n }\n\n return callback(null, adChain);\n });\n }\n\n function buildAd(adJxonTree, callback) {\n try {\n var ad = new Ad(adJxonTree);\n callback(validateAd(ad), ad);\n } catch (e) {\n callback(new VASTError('on VASTClient.getVASTAd.buildAd, error parsing xml', 100), null);\n }\n }\n\n function validateAd(ad) {\n var wrapper = ad.wrapper;\n var inLine = ad.inLine;\n var errMsgPrefix = 'on VASTClient.getVASTAd.validateAd, ';\n\n if (inLine && wrapper) {\n return new VASTError(errMsgPrefix +\"InLine and Wrapper both found on the same Ad\", 101);\n }\n\n if (!inLine && !wrapper) {\n return new VASTError(errMsgPrefix + \"nor wrapper nor inline elements found on the Ad\", 101);\n }\n\n if (inLine && !inLine.isSupported()) {\n return new VASTError(errMsgPrefix + \"could not find MediaFile that is supported by this video player\", 403);\n }\n\n if (wrapper && !wrapper.VASTAdTagURI) {\n return new VASTError(errMsgPrefix + \"missing 'VASTAdTagURI' in wrapper\", 101);\n }\n\n return null;\n }\n\n function requestVASTAd(adTagUrl, callback) {\n that._requestVASTXml(adTagUrl, function (error, xmlStr) {\n if (error) {\n return callback(error);\n }\n try {\n var vastTree = xml.toJXONTree(xmlStr);\n callback(validateVASTTree(vastTree), vastTree.ad);\n } catch (e) {\n callback(new VASTError(\"on VASTClient.getVASTAd.requestVASTAd, error parsing xml\", 100));\n }\n });\n }\n};\n\nVASTClient.prototype._requestVASTXml = function requestVASTXml(adTagUrl, callback) {\n try {\n if (utilities.isFunction(adTagUrl)) {\n adTagUrl(requestHandler);\n } else {\n http.get(adTagUrl, requestHandler, {\n withCredentials: true\n });\n }\n } catch (e) {\n callback(e);\n }\n\n /*** Local functions ***/\n function requestHandler(error, response, status) {\n if (error) {\n var errMsg = utilities.isDefined(status) ?\n \"on VASTClient.requestVastXML, HTTP request error with status '\" + status + \"'\" :\n \"on VASTClient.requestVastXML, Error getting the the VAST XML with he passed adTagXML fn\";\n return callback(new VASTError(errMsg, 301), null);\n }\n\n callback(null, response);\n }\n};\n\nVASTClient.prototype._buildVASTResponse = function buildVASTResponse(adsChain) {\n var response = new VASTResponse();\n addAdsToResponse(response, adsChain);\n validateResponse(response);\n\n return response;\n\n //*** Local function ****\n function addAdsToResponse(response, ads) {\n ads.forEach(function (ad) {\n response.addAd(ad);\n });\n }\n\n function validateResponse(response) {\n var progressEvents = response.trackingEvents.progress;\n\n if (!response.hasLinear()) {\n throw new VASTError(\"on VASTClient._buildVASTResponse, Received an Ad type that is not supported\", 200);\n }\n\n if (response.duration === undefined) {\n throw new VASTError(\"on VASTClient._buildVASTResponse, Missing duration field in VAST response\", 101);\n }\n\n if (progressEvents) {\n progressEvents.forEach(function (progressEvent) {\n if (!utilities.isNumber(progressEvent.offset)) {\n throw new VASTError(\"on VASTClient._buildVASTResponse, missing or wrong offset attribute on progress tracking event\", 101);\n }\n });\n }\n }\n};\n\nVASTClient.prototype._trackError = function (error, adChain) {\n if (!utilities.isArray(adChain) || adChain.length === 0) { //There is nothing to track\n return;\n }\n\n var errorURLMacros = [];\n adChain.forEach(addErrorUrlMacros);\n vastUtil.track(errorURLMacros, {ERRORCODE: error.code || 900}); //900 <== Undefined error\n\n /*** Local functions ***/\n function addErrorUrlMacros(ad) {\n if (ad.wrapper && ad.wrapper.error) {\n errorURLMacros.push(ad.wrapper.error);\n }\n\n if (ad.inLine && ad.inLine.error) {\n errorURLMacros.push(ad.inLine.error);\n }\n }\n};\n\nmodule.exports = VASTClient;\n\n},{\"../../utils/async\":39,\"../../utils/http\":41,\"../../utils/utilityFunctions\":44,\"../../utils/xml\":45,\"./Ad\":14,\"./VASTError\":22,\"./VASTResponse\":24,\"./vastUtil\":29}],22:[function(require,module,exports){\n'use strict';\n\nfunction VASTError(message, code) {\n this.message = 'VAST Error: ' + (message || '');\n if (code) {\n this.code = code;\n }\n}\n\nVASTError.prototype = new Error();\nVASTError.prototype.name = \"VAST Error\";\n\nmodule.exports = VASTError;\n},{}],23:[function(require,module,exports){\n'use strict';\n\n/**\n * Inner helper class that deals with the logic of the individual steps needed to setup an ad in the player.\n *\n * @param player {object} instance of the player that will play the ad. It assumes that the videojs-contrib-ads plugin\n * has been initialized when you use its utility functions.\n *\n * @constructor\n */\n\nvar VASTResponse = require('./VASTResponse');\nvar VASTError = require('./VASTError');\nvar VASTTracker = require('./VASTTracker');\nvar vastUtil = require('./vastUtil');\n\nvar async = require('../../utils/async');\nvar dom = require('../../utils/dom');\nvar playerUtils = require('../../utils/playerUtils');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VASTIntegrator(player) {\n if (!(this instanceof VASTIntegrator)) {\n return new VASTIntegrator(player);\n }\n\n this.player = player;\n}\n\nVASTIntegrator.prototype.playAd = function playAd(vastResponse, callback) {\n var that = this;\n callback = callback || utilities.noop;\n\n if (!(vastResponse instanceof VASTResponse)) {\n return callback(new VASTError('On VASTIntegrator, missing required VASTResponse'));\n }\n\n async.waterfall([\n function (next) {\n next(null, vastResponse);\n },\n this._selectAdSource.bind(this),\n this._createVASTTracker.bind(this),\n this._addClickThrough.bind(this),\n this._addSkipButton.bind(this),\n this._setupEvents.bind(this),\n this._playSelectedAd.bind(this)\n ], function (error, response) {\n if (error && response) {\n that._trackError(error, response);\n }\n callback(error, response);\n });\n\n this._adUnit = {\n _src: null,\n type: 'VAST',\n pauseAd: function () {\n that.player.pause(true);\n },\n\n resumeAd: function () {\n that.player.play(true);\n },\n\n isPaused: function () {\n return that.player.paused(true);\n },\n\n getSrc: function () {\n return this._src;\n }\n };\n\n return this._adUnit;\n};\n\nVASTIntegrator.prototype._selectAdSource = function selectAdSource(response, callback) {\n var source;\n\n var playerWidth = dom.getDimension(this.player.el()).width;\n response.mediaFiles.sort(function compareTo(a, b) {\n var deltaA = Math.abs(playerWidth - a.width);\n var deltaB = Math.abs(playerWidth - b.width);\n return deltaA - deltaB;\n });\n\n source = this.player.selectSource(response.mediaFiles).source;\n\n if (source) {\n if (this._adUnit) {\n this._adUnit._src = source;\n }\n return callback(null, source, response);\n }\n\n // code 403 <== Couldn't find MediaFile that is supported by this video player\n callback(new VASTError(\"Could not find Ad mediafile supported by this player\", 403), response);\n};\n\nVASTIntegrator.prototype._createVASTTracker = function createVASTTracker(adMediaFile, response, callback) {\n try {\n callback(null, adMediaFile, new VASTTracker(adMediaFile.src, response), response);\n } catch (e) {\n callback(e, response);\n }\n};\n\nVASTIntegrator.prototype._setupEvents = function setupEvents(adMediaFile, tracker, response, callback) {\n var previouslyMuted;\n var player = this.player;\n player.on('fullscreenchange', trackFullscreenChange);\n player.on('vast.adStart', trackImpressions);\n player.on('pause', trackPause);\n player.on('timeupdate', trackProgress);\n player.on('volumechange', trackVolumeChange);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], unbindEvents);\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel', 'vast.adSkip'], function(evt){\n if(evt.type === 'vast.adEnd'){\n tracker.trackComplete();\n }\n });\n\n return callback(null, adMediaFile, response);\n\n /*** Local Functions ***/\n function unbindEvents() {\n player.off('fullscreenchange', trackFullscreenChange);\n player.off('vast.adStart', trackImpressions);\n player.off('pause', trackPause);\n player.off('timeupdate', trackProgress);\n player.off('volumechange', trackVolumeChange);\n }\n\n function trackFullscreenChange() {\n if (player.isFullscreen()) {\n tracker.trackFullscreen();\n } else {\n tracker.trackExitFullscreen();\n }\n }\n\n function trackPause() {\n //NOTE: whenever a video ends the video Element triggers a 'pause' event before the 'ended' event.\n // We should not track this pause event because it makes the VAST tracking confusing again we use a\n // Threshold of 2 seconds to prevent false positives on IOS.\n if (Math.abs(player.duration() - player.currentTime()) < 2) {\n return;\n }\n\n tracker.trackPause();\n playerUtils.once(player, ['play', 'vast.adEnd', 'vast.adsCancel'], function (evt) {\n if(evt.type === 'play'){\n tracker.trackResume();\n }\n });\n }\n\n function trackProgress() {\n var currentTimeInMs = player.currentTime() * 1000;\n tracker.trackProgress(currentTimeInMs);\n }\n\n function trackImpressions() {\n tracker.trackImpressions();\n tracker.trackCreativeView();\n }\n\n function trackVolumeChange() {\n var muted = player.muted();\n if (muted) {\n tracker.trackMute();\n } else if (previouslyMuted) {\n tracker.trackUnmute();\n }\n previouslyMuted = muted;\n }\n};\n\nVASTIntegrator.prototype._addSkipButton = function addSkipButton(source, tracker, response, callback) {\n var skipOffsetInSec;\n var that = this;\n\n if (utilities.isNumber(response.skipoffset)) {\n skipOffsetInSec = response.skipoffset / 1000;\n addSkipButtonToPlayer(this.player, skipOffsetInSec);\n }\n callback(null, source, tracker, response);\n\n /*** Local function ***/\n function addSkipButtonToPlayer(player, skipOffset) {\n var skipButton = createSkipButton(player);\n var updateSkipButton = updateSkipButtonState.bind(that, skipButton, skipOffset, player);\n\n player.el().appendChild(skipButton);\n player.on('timeupdate', updateSkipButton);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeSkipButton);\n\n function removeSkipButton() {\n player.off('timeupdate', updateSkipButton);\n dom.remove(skipButton);\n }\n }\n\n function createSkipButton(player) {\n var skipButton = window.document.createElement(\"div\");\n dom.addClass(skipButton, \"vast-skip-button\");\n\n skipButton.onclick = function (e) {\n if (dom.hasClass(skipButton, 'enabled')) {\n tracker.trackSkip();\n player.trigger('vast.adSkip');\n }\n\n //We prevent event propagation to avoid problems with the clickThrough and so on\n if (window.Event.prototype.stopPropagation !== undefined) {\n e.stopPropagation();\n } else {\n return false;\n }\n };\n\n return skipButton;\n }\n\n function updateSkipButtonState(skipButton, skipOffset, player) {\n var timeLeft = Math.ceil(skipOffset - player.currentTime());\n if (timeLeft > 0) {\n skipButton.innerHTML = \"Skip in \" + utilities.toFixedDigits(timeLeft, 2) + \"...\";\n } else {\n if (!dom.hasClass(skipButton, 'enabled')) {\n dom.addClass(skipButton, 'enabled');\n skipButton.innerHTML = \"Skip ad\";\n }\n }\n }\n};\n\nVASTIntegrator.prototype._addClickThrough = function addClickThrough(mediaFile, tracker, response, callback) {\n var player = this.player;\n var blocker = createClickThroughBlocker(player, tracker, response);\n var updateBlocker = updateBlockerURL.bind(this, blocker, response, player);\n\n player.el().insertBefore(blocker, player.controlBar.el());\n player.on('timeupdate', updateBlocker);\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeBlocker);\n\n return callback(null, mediaFile, tracker, response);\n\n /*** Local Functions ***/\n\n function createClickThroughBlocker(player, tracker, response) {\n var blocker = window.document.createElement(\"a\");\n var clickThroughMacro = response.clickThrough;\n\n dom.addClass(blocker, 'vast-blocker');\n blocker.href = generateClickThroughURL(clickThroughMacro, player);\n\n if (utilities.isString(clickThroughMacro)) {\n blocker.target = \"_blank\";\n }\n\n blocker.onclick = function (e) {\n if (player.paused()) {\n player.play();\n\n //We prevent event propagation to avoid problems with the player's normal pause mechanism\n if (window.Event.prototype.stopPropagation !== undefined) {\n e.stopPropagation();\n }\n return false;\n }\n\n player.pause();\n tracker.trackClick();\n };\n\n return blocker;\n }\n\n function updateBlockerURL(blocker, response, player) {\n blocker.href = generateClickThroughURL(response.clickThrough, player);\n }\n\n function generateClickThroughURL(clickThroughMacro, player) {\n var variables = {\n ASSETURI: mediaFile.src,\n CONTENTPLAYHEAD: vastUtil.formatProgress(player.currentTime() * 1000)\n };\n\n return clickThroughMacro ? vastUtil.parseURLMacro(clickThroughMacro, variables) : '#';\n }\n\n function removeBlocker() {\n player.off('timeupdate', updateBlocker);\n dom.remove(blocker);\n }\n};\n\nVASTIntegrator.prototype._playSelectedAd = function playSelectedAd(source, response, callback) {\n var player = this.player;\n\n player.preload(\"auto\"); //without preload=auto the durationchange event is never fired\n player.src(source);\n\n playerUtils.once(player, ['durationchange', 'error', 'vast.adsCancel'], function (evt) {\n if (evt.type === 'durationchange') {\n playAd();\n } else if(evt.type === 'error') {\n callback(new VASTError(\"on VASTIntegrator, Player is unable to play the Ad\", 400), response);\n }\n //NOTE: If the ads get canceled we do nothing/\n });\n\n /**** local functions ******/\n function playAd() {\n\n playerUtils.once(player, ['playing', 'vast.adsCancel'], function (evt) {\n if(evt.type === 'vast.adsCancel'){\n return;\n }\n\n player.trigger('vast.adStart');\n\n player.on('ended', proceed);\n player.on('vast.adsCancel', proceed);\n player.on('vast.adSkip', proceed);\n\n function proceed(evt) {\n\n if(evt.type === 'ended' && (player.duration() - player.currentTime()) > 3 ) {\n // Ignore ended event if the Ad time was not 'near' the end\n // avoids issues where IOS controls could skip the Ad\n return;\n }\n\n player.off('ended', proceed);\n player.off('vast.adsCancel', proceed);\n player.off('vast.adSkip', proceed);\n\n //NOTE: if the ads get cancel we do nothing apart removing the listners\n if(evt.type === 'ended' || evt.type === 'vast.adSkip'){\n callback(null, response);\n }\n }\n });\n\n player.play();\n }\n};\n\nVASTIntegrator.prototype._trackError = function trackError(error, response) {\n vastUtil.track(response.errorURLMacros, {ERRORCODE: error.code || 900});\n};\n\nmodule.exports = VASTIntegrator;\n},{\"../../utils/async\":39,\"../../utils/dom\":40,\"../../utils/playerUtils\":42,\"../../utils/utilityFunctions\":44,\"./VASTError\":22,\"./VASTResponse\":24,\"./VASTTracker\":25,\"./vastUtil\":29}],24:[function(require,module,exports){\n'use strict';\n\nvar Ad = require('./Ad');\nvar VideoClicks = require('./VideoClicks');\nvar Linear = require('./Linear');\nvar InLine = require('./InLine');\nvar Wrapper = require('./Wrapper');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nwindow.InLine__A = InLine;\nfunction VASTResponse() {\n if (!(this instanceof VASTResponse)) {\n return new VASTResponse();\n }\n\n this._linearAdded = false;\n this.ads = [];\n this.errorURLMacros = [];\n this.impressions = [];\n this.clickTrackings = [];\n this.customClicks = [];\n this.trackingEvents = {};\n this.mediaFiles = [];\n this.clickThrough = undefined;\n this.adTitle = '';\n this.duration = undefined;\n this.skipoffset = undefined;\n}\n\nVASTResponse.prototype.addAd = function (ad) {\n var inLine, wrapper;\n if (ad instanceof Ad) {\n inLine = ad.inLine;\n wrapper = ad.wrapper;\n\n this.ads.push(ad);\n\n if (inLine) {\n this._addInLine(inLine);\n }\n\n if (wrapper) {\n this._addWrapper(wrapper);\n }\n }\n};\n\nVASTResponse.prototype._addErrorTrackUrl = function (error) {\n var errorURL = error instanceof xml.JXONTree ? xml.keyValue(error) : error;\n if (errorURL) {\n this.errorURLMacros.push(errorURL);\n }\n};\n\nVASTResponse.prototype._addImpressions = function (impressions) {\n utilities.isArray(impressions) && appendToArray(this.impressions, impressions);\n};\n\nVASTResponse.prototype._addClickThrough = function (clickThrough) {\n if (utilities.isNotEmptyString(clickThrough)) {\n this.clickThrough = clickThrough;\n }\n};\n\nVASTResponse.prototype._addClickTrackings = function (clickTrackings) {\n utilities.isArray(clickTrackings) && appendToArray(this.clickTrackings, clickTrackings);\n};\n\nVASTResponse.prototype._addCustomClicks = function (customClicks) {\n utilities.isArray(customClicks) && appendToArray(this.customClicks, customClicks);\n};\n\nVASTResponse.prototype._addTrackingEvents = function (trackingEvents) {\n var eventsMap = this.trackingEvents;\n\n if (trackingEvents) {\n trackingEvents = utilities.isArray(trackingEvents) ? trackingEvents : [trackingEvents];\n trackingEvents.forEach(function (trackingEvent) {\n if (!eventsMap[trackingEvent.name]) {\n eventsMap[trackingEvent.name] = [];\n }\n eventsMap[trackingEvent.name].push(trackingEvent);\n });\n }\n};\n\nVASTResponse.prototype._addTitle = function (title) {\n if (utilities.isNotEmptyString(title)) {\n this.adTitle = title;\n }\n};\n\nVASTResponse.prototype._addDuration = function (duration) {\n if (utilities.isNumber(duration)) {\n this.duration = duration;\n }\n};\n\nVASTResponse.prototype._addVideoClicks = function (videoClicks) {\n if (videoClicks instanceof VideoClicks) {\n this._addClickThrough(videoClicks.clickThrough);\n this._addClickTrackings(videoClicks.clickTrackings);\n this._addCustomClicks(videoClicks.customClicks);\n }\n};\n\nVASTResponse.prototype._addMediaFiles = function (mediaFiles) {\n utilities.isArray(mediaFiles) && appendToArray(this.mediaFiles, mediaFiles);\n};\n\nVASTResponse.prototype._addSkipoffset = function (offset) {\n if (offset) {\n this.skipoffset = offset;\n }\n};\n\nVASTResponse.prototype._addAdParameters = function (adParameters) {\n if (adParameters) {\n this.adParameters = adParameters;\n }\n};\n\nVASTResponse.prototype._addLinear = function (linear) {\n if (linear instanceof Linear) {\n this._addDuration(linear.duration);\n this._addTrackingEvents(linear.trackingEvents);\n this._addVideoClicks(linear.videoClicks);\n this._addMediaFiles(linear.mediaFiles);\n this._addSkipoffset(linear.skipoffset);\n this._addAdParameters(linear.adParameters);\n this._linearAdded = true;\n }\n};\n\nVASTResponse.prototype._addInLine = function (inLine) {\n var that = this;\n\n if (inLine instanceof InLine) {\n this._addTitle(inLine.adTitle);\n this._addErrorTrackUrl(inLine.error);\n this._addImpressions(inLine.impressions);\n\n inLine.creatives.forEach(function (creative) {\n if (creative.linear) {\n that._addLinear(creative.linear);\n }\n });\n }\n};\n\nVASTResponse.prototype._addWrapper = function (wrapper) {\n var that = this;\n\n if (wrapper instanceof Wrapper) {\n this._addErrorTrackUrl(wrapper.error);\n this._addImpressions(wrapper.impressions);\n\n wrapper.creatives.forEach(function (creative) {\n var linear = creative.linear;\n if (linear) {\n that._addVideoClicks(linear.videoClicks);\n that.clickThrough = undefined;//We ensure that no clickThrough has been added\n that._addTrackingEvents(linear.trackingEvents);\n }\n });\n }\n};\n\nVASTResponse.prototype.hasLinear = function(){\n return this._linearAdded;\n};\n\nfunction appendToArray(array, items) {\n items.forEach(function (item) {\n array.push(item);\n });\n}\n\nmodule.exports = VASTResponse;\n\n\n},{\"../../utils/utilityFunctions\":44,\"../../utils/xml\":45,\"./Ad\":14,\"./InLine\":17,\"./Linear\":18,\"./VideoClicks\":26,\"./Wrapper\":27}],25:[function(require,module,exports){\n'use strict';\n\nvar VASTError = require('./VASTError');\nvar VASTResponse = require('./VASTResponse');\nvar vastUtil = require('./vastUtil');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VASTTracker(assetURI, vastResponse) {\n if (!(this instanceof VASTTracker)) {\n return new VASTTracker(assetURI, vastResponse);\n }\n\n this.sanityCheck(assetURI, vastResponse);\n this.initialize(assetURI, vastResponse);\n\n}\n\nVASTTracker.prototype.initialize = function(assetURI, vastResponse) {\n this.response = vastResponse;\n this.assetURI = assetURI;\n this.progress = 0;\n this.quartiles = {\n firstQuartile: {tracked: false, time: Math.round(25 * vastResponse.duration) / 100},\n midpoint: {tracked: false, time: Math.round(50 * vastResponse.duration) / 100},\n thirdQuartile: {tracked: false, time: Math.round(75 * vastResponse.duration) / 100}\n };\n};\n\nVASTTracker.prototype.sanityCheck = function(assetURI, vastResponse) {\n if (!utilities.isString(assetURI) || utilities.isEmptyString(assetURI)) {\n throw new VASTError('on VASTTracker constructor, missing required the URI of the ad asset being played');\n }\n\n if (!(vastResponse instanceof VASTResponse)) {\n throw new VASTError('on VASTTracker constructor, missing required VAST response');\n }\n};\n\nVASTTracker.prototype.trackURLs = function trackURLs(urls, variables) {\n if (utilities.isArray(urls) && urls.length > 0) {\n variables = utilities.extend({\n ASSETURI: this.assetURI,\n CONTENTPLAYHEAD: vastUtil.formatProgress(this.progress)\n }, variables || {});\n\n vastUtil.track(urls, variables);\n }\n};\n\nVASTTracker.prototype.trackEvent = function trackEvent(eventName, trackOnce) {\n this.trackURLs(getEventUris(this.response.trackingEvents[eventName]));\n if (trackOnce) {\n this.response.trackingEvents[eventName] = undefined;\n }\n\n /*** Local function ***/\n function getEventUris(trackingEvents) {\n var uris;\n\n if (trackingEvents) {\n uris = [];\n trackingEvents.forEach(function (event) {\n uris.push(event.uri);\n });\n }\n return uris;\n }\n};\n\nVASTTracker.prototype.trackProgress = function trackProgress(newProgressInMs) {\n var that = this;\n var events = [];\n var ONCE = true;\n var ALWAYS = false;\n var trackingEvents = this.response.trackingEvents;\n\n if (utilities.isNumber(newProgressInMs)) {\n addTrackEvent('start', ONCE, newProgressInMs > 0);\n addTrackEvent('rewind', ALWAYS, hasRewound(this.progress, newProgressInMs));\n addQuartileEvents(newProgressInMs);\n trackProgressEvents(newProgressInMs);\n trackEvents();\n this.progress = newProgressInMs;\n }\n\n /*** Local function ***/\n function hasRewound(currentProgress, newProgress) {\n var REWIND_THRESHOLD = 3000; //IOS video clock is very unreliable and we need a 3 seconds threshold to ensure that there was a rewind an that it was on purpose.\n return currentProgress > newProgressInMs && Math.abs(newProgress - currentProgress) > REWIND_THRESHOLD;\n }\n\n function addTrackEvent(eventName, trackOnce, canBeAdded) {\n if (trackingEvents[eventName] && canBeAdded) {\n events.push({\n name: eventName,\n trackOnce: !!trackOnce\n });\n }\n }\n\n function addQuartileEvents(progress) {\n var quartiles = that.quartiles;\n var firstQuartile = that.quartiles.firstQuartile;\n var midpoint = that.quartiles.midpoint;\n var thirdQuartile = that.quartiles.thirdQuartile;\n\n if (!firstQuartile.tracked) {\n trackQuartile('firstQuartile', progress);\n } else if (!midpoint.tracked) {\n trackQuartile('midpoint', progress);\n } else if (!thirdQuartile.tracked){\n trackQuartile('thirdQuartile', progress);\n }\n\n /*** Local function ***/\n function trackQuartile(quartileName, progress){\n var quartile = quartiles[quartileName];\n if(canBeTracked(quartile, progress)){\n quartile.tracked = true;\n addTrackEvent(quartileName, ONCE, true);\n }\n }\n }\n\n function canBeTracked(quartile, progress) {\n var quartileTime = quartile.time;\n //We only fire the quartile event if the progress is bigger than the quartile time by 5 seconds at most.\n return progress >= quartileTime && progress <= (quartileTime + 5000);\n }\n\n function trackProgressEvents(progress) {\n if (!utilities.isArray(trackingEvents.progress)) {\n return; //Nothing to track\n }\n\n var pendingProgressEvts = [];\n\n trackingEvents.progress.forEach(function (evt) {\n if (evt.offset <= progress) {\n that.trackURLs([evt.uri]);\n } else {\n pendingProgressEvts.push(evt);\n }\n });\n trackingEvents.progress = pendingProgressEvts;\n }\n\n function trackEvents() {\n events.forEach(function (event) {\n that.trackEvent(event.name, event.trackOnce);\n });\n }\n};\n\n[\n 'rewind',\n 'fullscreen',\n 'exitFullscreen',\n 'pause',\n 'resume',\n 'mute',\n 'unmute',\n 'acceptInvitation',\n 'acceptInvitationLinear',\n 'collapse',\n 'expand'\n].forEach(function (eventName) {\n VASTTracker.prototype['track' + utilities.capitalize(eventName)] = function () {\n this.trackEvent(eventName);\n };\n });\n\n[\n 'start',\n 'skip',\n 'close',\n 'closeLinear'\n].forEach(function (eventName) {\n VASTTracker.prototype['track' + utilities.capitalize(eventName)] = function () {\n this.trackEvent(eventName, true);\n };\n });\n\n[\n 'firstQuartile',\n 'midpoint',\n 'thirdQuartile'\n].forEach(function (quartile) {\n VASTTracker.prototype['track' + utilities.capitalize(quartile)] = function () {\n this.quartiles[quartile].tracked = true;\n this.trackEvent(quartile, true);\n };\n });\n\nVASTTracker.prototype.trackComplete = function () {\n if(this.quartiles.thirdQuartile.tracked){\n this.trackEvent('complete', true);\n }\n};\n\nVASTTracker.prototype.trackErrorWithCode = function trackErrorWithCode(errorcode) {\n if (utilities.isNumber(errorcode)) {\n this.trackURLs(this.response.errorURLMacros, {ERRORCODE: errorcode});\n }\n};\n\nVASTTracker.prototype.trackImpressions = function trackImpressions() {\n this.trackURLs(this.response.impressions);\n};\n\nVASTTracker.prototype.trackCreativeView = function trackCreativeView() {\n this.trackEvent('creativeView');\n};\n\nVASTTracker.prototype.trackClick = function trackClick() {\n this.trackURLs(this.response.clickTrackings);\n};\n\nmodule.exports = VASTTracker;\n\n},{\"../../utils/utilityFunctions\":44,\"./VASTError\":22,\"./VASTResponse\":24,\"./vastUtil\":29}],26:[function(require,module,exports){\n'use strict';\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nfunction VideoClicks(videoClickJTree) {\n if (!(this instanceof VideoClicks)) {\n return new VideoClicks(videoClickJTree);\n }\n\n this.clickThrough = xml.keyValue(videoClickJTree.clickThrough);\n this.clickTrackings = parseClickTrackings(videoClickJTree.clickTracking);\n this.customClicks = parseClickTrackings(videoClickJTree.customClick);\n\n /*** Local functions ***/\n function parseClickTrackings(trackingData) {\n var clickTrackings = [];\n if (trackingData) {\n trackingData = utilities.isArray(trackingData) ? trackingData : [trackingData];\n trackingData.forEach(function (clickTrackingData) {\n clickTrackings.push(xml.keyValue(clickTrackingData));\n });\n }\n return clickTrackings;\n }\n}\n\nmodule.exports = VideoClicks;\n},{\"../../utils/utilityFunctions\":44,\"../../utils/xml\":45}],27:[function(require,module,exports){\n'use strict';\n\nvar vastUtil = require('./vastUtil');\nvar Creative = require('./Creative');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nfunction Wrapper(wrapperJTree) {\n if(!(this instanceof Wrapper)) {\n return new Wrapper(wrapperJTree);\n }\n\n //Required elements\n this.adSystem = xml.keyValue(wrapperJTree.adSystem);\n this.impressions = vastUtil.parseImpressions(wrapperJTree.impression);\n this.VASTAdTagURI = xml.keyValue(wrapperJTree.vASTAdTagURI);\n\n //Optional elements\n this.creatives = Creative.parseCreatives(wrapperJTree.creatives);\n this.error = xml.keyValue(wrapperJTree.error);\n this.extensions = wrapperJTree.extensions;\n\n //Optional attrs\n this.followAdditionalWrappers = utilities.isDefined(xml.attr(wrapperJTree, 'followAdditionalWrappers'))? xml.attr(wrapperJTree, 'followAdditionalWrappers'): true;\n this.allowMultipleAds = xml.attr(wrapperJTree, 'allowMultipleAds');\n this.fallbackOnNoAd = xml.attr(wrapperJTree, 'fallbackOnNoAd');\n}\n\nmodule.exports = Wrapper;\n\n},{\"../../utils/utilityFunctions\":44,\"../../utils/xml\":45,\"./Creative\":16,\"./vastUtil\":29}],28:[function(require,module,exports){\n'use strict';\n\nvar utilities = require('../../utils/utilityFunctions');\n\nvar durationRegex = /(\\d\\d):(\\d\\d):(\\d\\d)(\\.(\\d\\d\\d))?/;\n\nvar parsers = {\n\n duration: function parseDuration(durationStr) {\n\n var match, durationInMs;\n\n if (utilities.isString(durationStr)) {\n match = durationStr.match(durationRegex);\n if (match) {\n durationInMs = parseHoursToMs(match[1]) + parseMinToMs(match[2]) + parseSecToMs(match[3]) + parseInt(match[5] || 0);\n }\n }\n\n return isNaN(durationInMs) ? null : durationInMs;\n\n /*** local functions ***/\n function parseHoursToMs(hourStr) {\n return parseInt(hourStr, 10) * 60 * 60 * 1000;\n }\n\n function parseMinToMs(minStr) {\n return parseInt(minStr, 10) * 60 * 1000;\n }\n\n function parseSecToMs(secStr) {\n return parseInt(secStr, 10) * 1000;\n }\n },\n\n offset: function parseOffset(offset, duration) {\n if(isPercentage(offset)){\n return calculatePercentage(offset, duration);\n }\n return parsers.duration(offset);\n\n /*** Local function ***/\n function isPercentage(offset) {\n var percentageRegex = /^\\d+(\\.\\d+)?%$/g;\n return percentageRegex.test(offset);\n }\n\n function calculatePercentage(percentStr, duration) {\n if(duration) {\n return calcPercent(duration, parseFloat(percentStr.replace('%', '')));\n }\n return null;\n }\n\n function calcPercent(quantity, percent){\n return quantity * percent / 100;\n }\n }\n\n};\n\n\nmodule.exports = parsers;\n},{\"../../utils/utilityFunctions\":44}],29:[function(require,module,exports){\n'use strict';\n\nvar utilities = require('../../utils/utilityFunctions');\nvar VPAIDHTML5Tech = require('../vpaid/VPAIDHTML5Tech');\nvar VPAIDFlashTech = require('../vpaid/VPAIDFlashTech');\nvar VPAIDFLASHClient = require('VPAIDFLASHClient/js/VPAIDFLASHClient');\n\nvar vastUtil = {\n\n track: function track(URLMacros, variables) {\n var sources = vastUtil.parseURLMacros(URLMacros, variables);\n var trackImgs = [];\n sources.forEach(function (src) {\n var img = new Image();\n img.src = src;\n trackImgs.push(img);\n });\n return trackImgs;\n },\n\n parseURLMacros: function parseMacros(URLMacros, variables) {\n var parsedURLs = [];\n\n variables = variables || {};\n\n if (!(variables[\"CACHEBUSTING\"])) {\n variables[\"CACHEBUSTING\"] = Math.round(Math.random() * 1.0e+10);\n }\n\n URLMacros.forEach(function (URLMacro) {\n parsedURLs.push(vastUtil._parseURLMacro(URLMacro, variables));\n });\n\n return parsedURLs;\n },\n\n parseURLMacro: function parseMacro(URLMacro, variables) {\n variables = variables || {};\n\n if (!(variables[\"CACHEBUSTING\"])) {\n variables[\"CACHEBUSTING\"] = Math.round(Math.random() * 1.0e+10);\n }\n\n return vastUtil._parseURLMacro(URLMacro, variables);\n },\n\n _parseURLMacro: function parseMacro(URLMacro, variables) {\n variables = variables || {};\n\n utilities.forEach(variables, function (value, key) {\n URLMacro = URLMacro.replace(new RegExp(\"\\\\[\" + key + \"\\\\\\]\", 'gm'), value);\n });\n\n return URLMacro;\n },\n\n parseDuration: function parseDuration(durationStr) {\n var durationRegex = /(\\d\\d):(\\d\\d):(\\d\\d)(\\.(\\d\\d\\d))?/;\n var match, durationInMs;\n\n if (utilities.isString(durationStr)) {\n match = durationStr.match(durationRegex);\n if (match) {\n durationInMs = parseHoursToMs(match[1]) + parseMinToMs(match[2]) + parseSecToMs(match[3]) + parseInt(match[5] || 0);\n }\n }\n\n return isNaN(durationInMs) ? null : durationInMs;\n\n /*** local functions ***/\n function parseHoursToMs(hourStr) {\n return parseInt(hourStr, 10) * 60 * 60 * 1000;\n }\n\n function parseMinToMs(minStr) {\n return parseInt(minStr, 10) * 60 * 1000;\n }\n\n function parseSecToMs(secStr) {\n return parseInt(secStr, 10) * 1000;\n }\n },\n\n parseImpressions: function parseImpressions(impressions) {\n if (impressions) {\n impressions = utilities.isArray(impressions) ? impressions : [impressions];\n return utilities.transformArray(impressions, function (impression) {\n if (utilities.isNotEmptyString(impression.keyValue)) {\n return impression.keyValue;\n }\n return undefined;\n });\n }\n return [];\n },\n\n\n //We assume that the progress is going to arrive in milliseconds\n formatProgress: function formatProgress(progress) {\n var hours, minutes, seconds, milliseconds;\n hours = progress / (60 * 60 * 1000);\n hours = Math.floor(hours);\n minutes = (progress / (60 * 1000)) % 60;\n minutes = Math.floor(minutes);\n seconds = (progress / 1000) % 60;\n seconds = Math.floor(seconds);\n milliseconds = progress % 1000;\n return utilities.toFixedDigits(hours, 2) + ':' + utilities.toFixedDigits(minutes, 2) + ':' + utilities.toFixedDigits(seconds, 2) + '.' + utilities.toFixedDigits(milliseconds, 3);\n },\n\n parseOffset: function parseOffset(offset, duration) {\n if (isPercentage(offset)) {\n return calculatePercentage(offset, duration);\n }\n return vastUtil.parseDuration(offset);\n\n /*** Local function ***/\n function isPercentage(offset) {\n var percentageRegex = /^\\d+(\\.\\d+)?%$/g;\n return percentageRegex.test(offset);\n }\n\n function calculatePercentage(percentStr, duration) {\n if (duration) {\n return calcPercent(duration, parseFloat(percentStr.replace('%', '')));\n }\n return null;\n }\n\n function calcPercent(quantity, percent) {\n return quantity * percent / 100;\n }\n },\n\n\n //List of supported VPAID technologies\n VPAID_techs: [\n VPAIDFlashTech,\n VPAIDHTML5Tech\n ],\n\n isVPAID: function isVPAIDMediaFile(mediaFile) {\n return !!mediaFile && mediaFile.apiFramework === 'VPAID';\n },\n\n findSupportedVPAIDTech: function findSupportedVPAIDTech(mimeType) {\n var i, len, VPAIDTech;\n\n for (i = 0, len = this.VPAID_techs.length; i < len; i += 1) {\n VPAIDTech = this.VPAID_techs[i];\n if (VPAIDTech.supports(mimeType)) {\n return VPAIDTech;\n }\n }\n return null;\n },\n\n isFlashSupported: function isFlashSupported() {\n return VPAIDFLASHClient.isSupported();\n },\n\n /**\n * Necessary step for VPAIDFLAShClient to know if flash is supported and not blocked.\n * IMPORTANT NOTE: This is an async test and needs to be run as soon as possible.\n *\n * @param vpaidFlashLoaderPath the path to the vpaidFlashLoader swf obj.\n */\n runFlashSupportCheck: function runFlashSupportCheck(vpaidFlashLoaderPath) {\n VPAIDFLASHClient.runFlashTest({data: vpaidFlashLoaderPath});\n }\n\n};\n\nmodule.exports = vastUtil;\n\n},{\"../../utils/utilityFunctions\":44,\"../vpaid/VPAIDFlashTech\":31,\"../vpaid/VPAIDHTML5Tech\":32,\"VPAIDFLASHClient/js/VPAIDFLASHClient\":3}],30:[function(require,module,exports){\n'use strict';\n\nvar VASTError = require('../vast/VASTError');\n\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VPAIDAdUnitWrapper(vpaidAdUnit, opts) {\n if (!(this instanceof VPAIDAdUnitWrapper)) {\n return new VPAIDAdUnitWrapper(vpaidAdUnit, opts);\n }\n sanityCheck(vpaidAdUnit, opts);\n\n this.options = utilities.extend({}, opts);\n\n this._adUnit = vpaidAdUnit;\n\n /*** Local Functions ***/\n function sanityCheck(adUnit, opts) {\n if (!adUnit || !VPAIDAdUnitWrapper.checkVPAIDInterface(adUnit)) {\n throw new VASTError('on VPAIDAdUnitWrapper, the passed VPAID adUnit does not fully implement the VPAID interface');\n }\n\n if (!utilities.isObject(opts)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper, expected options hash but got '\" + opts + \"'\");\n }\n\n if (!(\"responseTimeout\" in opts) || !utilities.isNumber(opts.responseTimeout) ){\n throw new VASTError(\"on VPAIDAdUnitWrapper, expected responseTimeout in options\");\n }\n }\n}\n\nVPAIDAdUnitWrapper.checkVPAIDInterface = function checkVPAIDInterface(VPAIDAdUnit) {\n //NOTE: skipAd is not part of the method list because it only appears in VPAID 2.0 and we support VPAID 1.0\n var VPAIDInterfaceMethods = [\n 'handshakeVersion', 'initAd', 'startAd', 'stopAd', 'resizeAd', 'pauseAd', 'expandAd', 'collapseAd'\n ];\n\n for (var i = 0, len = VPAIDInterfaceMethods.length; i < len; i++) {\n if (!VPAIDAdUnit || !utilities.isFunction(VPAIDAdUnit[VPAIDInterfaceMethods[i]])) {\n return false;\n }\n }\n\n\n return canSubscribeToEvents(VPAIDAdUnit) && canUnsubscribeFromEvents(VPAIDAdUnit);\n\n /*** Local Functions ***/\n\n function canSubscribeToEvents(adUnit) {\n return utilities.isFunction(adUnit.subscribe) || utilities.isFunction(adUnit.addEventListener) || utilities.isFunction(adUnit.on);\n }\n\n function canUnsubscribeFromEvents(adUnit) {\n return utilities.isFunction(adUnit.unsubscribe) || utilities.isFunction(adUnit.removeEventListener) || utilities.isFunction(adUnit.off);\n\n }\n};\n\nVPAIDAdUnitWrapper.prototype.adUnitAsyncCall = function () {\n var args = utilities.arrayLikeObjToArray(arguments);\n var method = args.shift();\n var cb = args.pop();\n var timeoutId;\n\n sanityCheck(method, cb, this._adUnit);\n args.push(wrapCallback());\n\n this._adUnit[method].apply(this._adUnit, args);\n timeoutId = setTimeout(function () {\n timeoutId = null;\n cb(new VASTError(\"on VPAIDAdUnitWrapper, timeout while waiting for a response on call '\" + method + \"'\"));\n cb = utilities.noop;\n }, this.options.responseTimeout);\n\n /*** Local functions ***/\n function sanityCheck(method, cb, adUnit) {\n if (!utilities.isString(method) || !utilities.isFunction(adUnit[method])) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.adUnitAsyncCall, invalid method name\");\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.adUnitAsyncCall, missing callback\");\n }\n }\n\n function wrapCallback() {\n return function () {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n cb.apply(this, arguments);\n };\n }\n};\n\nVPAIDAdUnitWrapper.prototype.on = function (evtName, handler) {\n var addEventListener = this._adUnit.addEventListener || this._adUnit.subscribe || this._adUnit.on;\n addEventListener.call(this._adUnit, evtName, handler);\n};\n\nVPAIDAdUnitWrapper.prototype.off = function (evtName, handler) {\n var removeEventListener = this._adUnit.removeEventListener || this._adUnit.unsubscribe || this._adUnit.off;\n removeEventListener.call(this._adUnit, evtName, handler);\n};\n\nVPAIDAdUnitWrapper.prototype.waitForEvent = function (evtName, cb, context) {\n var timeoutId;\n sanityCheck(evtName, cb);\n context = context || null;\n\n this.on(evtName, responseListener);\n\n timeoutId = setTimeout(function () {\n cb(new VASTError(\"on VPAIDAdUnitWrapper.waitForEvent, timeout while waiting for event '\" + evtName + \"'\"));\n timeoutId = null;\n cb = utilities.noop;\n }, this.options.responseTimeout);\n\n /*** Local functions ***/\n function sanityCheck(evtName, cb) {\n if (!utilities.isString(evtName)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.waitForEvent, missing evt name\");\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.waitForEvent, missing callback\");\n }\n }\n\n function responseListener() {\n var args = utilities.arrayLikeObjToArray(arguments);\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n\n args.unshift(null);\n cb.apply(context, args);\n }\n};\n\n// VPAID METHODS\nVPAIDAdUnitWrapper.prototype.handshakeVersion = function (version, cb) {\n this.adUnitAsyncCall('handshakeVersion', version, cb);\n};\n\n/* jshint maxparams:6 */\nVPAIDAdUnitWrapper.prototype.initAd = function (width, height, viewMode, desiredBitrate, adUnitData, cb) {\n this.waitForEvent('AdLoaded', cb);\n this._adUnit.initAd(width, height, viewMode, desiredBitrate, adUnitData);\n};\n\nVPAIDAdUnitWrapper.prototype.resizeAd = function (width, height, viewMode, cb) {\n // NOTE: AdSizeChange event is only supported on VPAID 2.0 so for the moment we are not going to use it\n // and will assume that everything is fine after the async call\n this.adUnitAsyncCall('resizeAd', width, height, viewMode, cb);\n};\n\nVPAIDAdUnitWrapper.prototype.startAd = function (cb) {\n this.waitForEvent('AdStarted', cb);\n this._adUnit.startAd();\n};\n\nVPAIDAdUnitWrapper.prototype.stopAd = function (cb) {\n this.waitForEvent('AdStopped', cb);\n this._adUnit.stopAd();\n};\n\nVPAIDAdUnitWrapper.prototype.pauseAd = function (cb) {\n this.waitForEvent('AdPaused', cb);\n this._adUnit.pauseAd();\n};\n\nVPAIDAdUnitWrapper.prototype.resumeAd = function (cb) {\n this.waitForEvent('AdPlaying', cb);\n this._adUnit.resumeAd();\n};\n\nVPAIDAdUnitWrapper.prototype.expandAd = function (cb) {\n this.waitForEvent('AdExpandedChange', cb);\n this._adUnit.expandAd();\n};\n\nVPAIDAdUnitWrapper.prototype.collapseAd = function (cb) {\n this.waitForEvent('AdExpandedChange', cb);\n this._adUnit.collapseAd();\n};\n\nVPAIDAdUnitWrapper.prototype.skipAd = function (cb) {\n this.waitForEvent('AdSkipped', cb);\n this._adUnit.skipAd();\n};\n\n//VPAID property getters\n[\n 'adLinear',\n 'adWidth',\n 'adHeight',\n 'adExpanded',\n 'adSkippableState',\n 'adRemainingTime',\n 'adDuration',\n 'adVolume',\n 'adCompanions',\n 'adIcons'\n].forEach(function (property) {\n var getterName = 'get' + utilities.capitalize(property);\n\n VPAIDAdUnitWrapper.prototype[getterName] = function (cb) {\n this.adUnitAsyncCall(getterName, cb);\n };\n});\n\n//VPAID property setters\nVPAIDAdUnitWrapper.prototype.setAdVolume = function(volume, cb){\n this.adUnitAsyncCall('setAdVolume',volume, cb);\n};\n\nmodule.exports = VPAIDAdUnitWrapper;\n\n},{\"../../utils/utilityFunctions\":44,\"../vast/VASTError\":22}],31:[function(require,module,exports){\n'use strict';\n\nvar VASTError = require('../vast/VASTError');\n\nvar VPAIDFLASHClient = require('VPAIDFLASHClient/js/VPAIDFLASHClient');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar dom = require('../../utils/dom');\n\nfunction VPAIDFlashTech(mediaFile, settings) {\n if (!(this instanceof VPAIDFlashTech)) {\n return new VPAIDFlashTech(mediaFile);\n }\n sanityCheck(mediaFile);\n this.name = 'vpaid-flash';\n this.mediaFile = mediaFile;\n this.containerEl = null;\n this.vpaidFlashClient = null;\n this.settings = settings;\n\n /*** local functions ***/\n function sanityCheck(mediaFile) {\n if (!mediaFile || !utilities.isString(mediaFile.src)) {\n throw new VASTError('on VPAIDFlashTech, invalid MediaFile');\n }\n }\n}\n\nVPAIDFlashTech.VPAIDFLASHClient = VPAIDFLASHClient;\n\nVPAIDFlashTech.supports = function (type) {\n return type === 'application/x-shockwave-flash' && VPAIDFlashTech.VPAIDFLASHClient.isSupported();\n};\n\nVPAIDFlashTech.prototype.loadAdUnit = function loadFlashCreative(containerEl, objectEl, callback) {\n var that = this;\n var flashClientOpts = this.settings && this.settings.vpaidFlashLoaderPath ? {data: this.settings.vpaidFlashLoaderPath} : undefined;\n sanityCheck(containerEl, callback);\n\n this.containerEl = containerEl;\n this.vpaidFlashClient = new VPAIDFlashTech.VPAIDFLASHClient(containerEl, function (error) {\n if (error) {\n return callback(error);\n }\n\n that.vpaidFlashClient.loadAdUnit(that.mediaFile.src, callback);\n }, flashClientOpts);\n\n /*** Local Functions ***/\n function sanityCheck(container, cb) {\n\n if (!dom.isDomElement(container)) {\n throw new VASTError('on VPAIDFlashTech.loadAdUnit, invalid dom container element');\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError('on VPAIDFlashTech.loadAdUnit, missing valid callback');\n }\n }\n};\n\nVPAIDFlashTech.prototype.unloadAdUnit = function () {\n if (this.vpaidFlashClient) {\n try{\n this.vpaidFlashClient.destroy();\n } catch(e){\n if(console && utilities.isFunction(console.log)){\n console.log('VAST ERROR: trying to unload the VPAID adunit');\n }\n }\n this.vpaidFlashClient = null;\n }\n\n if (this.containerEl) {\n dom.remove(this.containerEl);\n this.containerEl = null;\n }\n};\n\nmodule.exports = VPAIDFlashTech;\n\n},{\"../../utils/dom\":40,\"../../utils/utilityFunctions\":44,\"../vast/VASTError\":22,\"VPAIDFLASHClient/js/VPAIDFLASHClient\":3}],32:[function(require,module,exports){\n'use strict';\n\nvar VASTError = require('../vast/VASTError');\n\nvar VPAIDHTML5Client = require('VPAIDHTML5Client/js/VPAIDHTML5Client');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar dom = require('../../utils/dom');\n\nfunction VPAIDHTML5Tech(mediaFile) {\n\n if(!(this instanceof VPAIDHTML5Tech)) {\n return new VPAIDHTML5Tech(mediaFile);\n }\n\n sanityCheck(mediaFile);\n\n this.name = 'vpaid-html5';\n this.containerEl = null;\n this.videoEl = null;\n this.vpaidHTMLClient = null;\n\n this.mediaFile = mediaFile;\n\n function sanityCheck(mediaFile) {\n if (!mediaFile || !utilities.isString(mediaFile.src)) {\n throw new VASTError(VPAIDHTML5Tech.INVALID_MEDIA_FILE);\n }\n }\n}\n\nVPAIDHTML5Tech.VPAIDHTML5Client = VPAIDHTML5Client;\n\nVPAIDHTML5Tech.supports = function (type) {\n return !utilities.isOldIE() && type === 'application/javascript';\n};\n\nVPAIDHTML5Tech.prototype.loadAdUnit = function loadAdUnit(containerEl, videoEl, callback) {\n sanityCheck(containerEl, videoEl, callback);\n\n this.containerEl = containerEl;\n this.videoEl = videoEl;\n this.vpaidHTMLClient = new VPAIDHTML5Tech.VPAIDHTML5Client(containerEl, videoEl, {});\n this.vpaidHTMLClient.loadAdUnit(this.mediaFile.src, callback);\n\n function sanityCheck(container, video, cb) {\n if (!dom.isDomElement(container)) {\n throw new VASTError(VPAIDHTML5Tech.INVALID_DOM_CONTAINER_EL);\n }\n\n if (!dom.isDomElement(video) || video.tagName.toLowerCase() !== 'video') {\n throw new VASTError(VPAIDHTML5Tech.INVALID_DOM_CONTAINER_EL);\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError(VPAIDHTML5Tech.MISSING_CALLBACK);\n }\n }\n};\n\nVPAIDHTML5Tech.prototype.unloadAdUnit = function unloadAdUnit() {\n if (this.vpaidHTMLClient) {\n try {\n this.vpaidHTMLClient.destroy();\n } catch(e) {\n if (console && utilities.isFunction(console.log)) {\n console.log('VAST ERROR: trying to unload the VPAID adunit');\n }\n }\n\n this.vpaidHTMLClient = null;\n }\n\n if (this.containerEl) {\n dom.remove(this.containerEl);\n this.containerEl = null;\n }\n};\n\nvar PREFIX = 'on VPAIDHTML5Tech';\nVPAIDHTML5Tech.INVALID_MEDIA_FILE = PREFIX + ', invalid MediaFile';\nVPAIDHTML5Tech.INVALID_DOM_CONTAINER_EL = PREFIX + ', invalid container HtmlElement';\nVPAIDHTML5Tech.INVALID_DOM_VIDEO_EL = PREFIX + ', invalid HTMLVideoElement';\nVPAIDHTML5Tech.MISSING_CALLBACK = PREFIX + ', missing valid callback';\n\nmodule.exports = VPAIDHTML5Tech;\n},{\"../../utils/dom\":40,\"../../utils/utilityFunctions\":44,\"../vast/VASTError\":22,\"VPAIDHTML5Client/js/VPAIDHTML5Client\":11}],33:[function(require,module,exports){\n'use strict';\n\nvar VASTError = require('../vast/VASTError');\nvar VASTResponse = require('../vast/VASTResponse');\nvar VASTTracker = require('../vast/VASTTracker');\nvar vastUtil = require('../vast/vastUtil');\n\nvar VPAIDAdUnitWrapper = require('./VPAIDAdUnitWrapper');\n\nvar async = require('../../utils/async');\nvar dom = require('../../utils/dom');\nvar playerUtils = require('../../utils/playerUtils');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VPAIDIntegrator(player, settings) {\n if (!(this instanceof VPAIDIntegrator)) {\n return new VPAIDIntegrator(player);\n }\n\n this.VIEW_MODE = {\n NORMAL: 'normal',\n FULLSCREEN: \"fullscreen\",\n THUMBNAIL: \"thumbnail\"\n };\n this.player = player;\n this.containerEl = createVPAIDContainerEl(player);\n this.options = {\n responseTimeout: 5000,\n VPAID_VERSION: '2.0'\n };\n this.settings = settings;\n\n /*** Local functions ***/\n\n function createVPAIDContainerEl() {\n var containerEl = document.createElement('div');\n dom.addClass(containerEl, 'VPAID-container');\n player.el().insertBefore(containerEl, player.controlBar.el());\n return containerEl;\n\n }\n}\n\nVPAIDIntegrator.prototype.playAd = function playVPaidAd(vastResponse, callback) {\n if (!(vastResponse instanceof VASTResponse)) {\n return callback(new VASTError('on VASTIntegrator.playAd, missing required VASTResponse'));\n }\n\n var that = this;\n var player = this.player;\n var tech = this._findSupportedTech(vastResponse, this.settings);\n\n callback = callback || utilities.noop;\n\n this._adUnit = null;\n\n dom.addClass(player.el(), 'vjs-vpaid-ad');\n\n player.on('vast.adsCancel', triggerVpaidAdEnd);\n player.one('vpaid.adEnd', function(){\n player.off('vast.adsCancel', triggerVpaidAdEnd);\n removeAdUnit();\n });\n\n if (tech) {\n async.waterfall([\n function (next) {\n next(null, tech, vastResponse);\n },\n this._loadAdUnit.bind(this),\n this._playAdUnit.bind(this),\n this._finishPlaying.bind(this)\n\n ], adComplete);\n\n this._adUnit = {\n _paused: true,\n type: 'VPAID',\n pauseAd: function() {\n player.trigger('vpaid.pauseAd');\n player.pause(true);//we make sure that the video content gets stopped.\n },\n resumeAd: function() {\n player.trigger('vpaid.resumeAd');\n },\n isPaused: function() {\n return this._paused;\n },\n getSrc: function() {\n return tech.mediaFile;\n }\n };\n\n } else {\n var error = new VASTError('on VPAIDIntegrator.playAd, could not find a supported mediaFile', 403);\n adComplete(error, this._adUnit, vastResponse);\n }\n\n return this._adUnit;\n\n /*** Local functions ***/\n function adComplete(error, adUnit, vastResponse) {\n if (error && vastResponse) {\n that._trackError(vastResponse, error.code);\n }\n player.trigger('vpaid.adEnd');\n callback(error, vastResponse);\n }\n\n function triggerVpaidAdEnd(){\n player.trigger('vpaid.adEnd');\n }\n\n function removeAdUnit() {\n if (tech) {\n tech.unloadAdUnit();\n }\n dom.removeClass(player.el(), 'vjs-vpaid-ad');\n }\n};\n\nVPAIDIntegrator.prototype._findSupportedTech = function (vastResponse, settings) {\n if (!(vastResponse instanceof VASTResponse)) {\n return null;\n }\n\n var vpaidMediaFiles = vastResponse.mediaFiles.filter(vastUtil.isVPAID);\n var i, len, mediaFile, VPAIDTech;\n\n for (i = 0, len = vpaidMediaFiles.length; i < len; i += 1) {\n mediaFile = vpaidMediaFiles[i];\n VPAIDTech = vastUtil.findSupportedVPAIDTech(mediaFile.type);\n if (VPAIDTech) {\n return new VPAIDTech(mediaFile, settings);\n }\n }\n return null;\n};\n\nVPAIDIntegrator.prototype._createVPAIDAdUnitWrapper = function(adUnit, src, responseTimeout) {\n return new VPAIDAdUnitWrapper(adUnit, {src: src, responseTimeout: responseTimeout});\n};\n\nVPAIDIntegrator.prototype._loadAdUnit = function (tech, vastResponse, next) {\n var that = this;\n var player = this.player;\n var vjsTechEl = player.el().querySelector('.vjs-tech');\n var responseTimeout = this.settings.responseTimeout || this.options.responseTimeout;\n tech.loadAdUnit(this.containerEl, vjsTechEl, function (error, adUnit) {\n if (error) {\n return next(error, adUnit, vastResponse);\n }\n\n try {\n var WrappedAdUnit = that._createVPAIDAdUnitWrapper(adUnit, tech.mediaFile.src, responseTimeout);\n var techClass = 'vjs-' + tech.name + '-ad';\n dom.addClass(player.el(), techClass);\n player.one('vpaid.adEnd', function() {\n dom.removeClass(player.el(),techClass);\n });\n next(null, WrappedAdUnit, vastResponse);\n } catch (e) {\n next(e, adUnit, vastResponse);\n }\n });\n};\n\nVPAIDIntegrator.prototype._playAdUnit = function (adUnit, vastResponse, callback) {\n async.waterfall([\n function (next) {\n next(null, adUnit, vastResponse);\n },\n this._handshake.bind(this),\n this._initAd.bind(this),\n this._setupEvents.bind(this),\n this._addSkipButton.bind(this),\n this._linkPlayerControls.bind(this),\n this._startAd.bind(this)\n ], callback);\n};\n\nVPAIDIntegrator.prototype._handshake = function handshake(adUnit, vastResponse, next) {\n adUnit.handshakeVersion(this.options.VPAID_VERSION, function (error, version) {\n if (error) {\n return next(error, adUnit, vastResponse);\n }\n\n if (version && isSupportedVersion(version)) {\n return next(null, adUnit, vastResponse);\n }\n\n return next(new VASTError('on VPAIDIntegrator._handshake, unsupported version \"' + version + '\"'), adUnit, vastResponse);\n });\n\n function isSupportedVersion(version) {\n var majorNum = major(version);\n return majorNum >= 1 && majorNum <= 2;\n }\n\n function major(version) {\n var parts = version.split('.');\n return parseInt(parts[0], 10);\n }\n};\n\nVPAIDIntegrator.prototype._initAd = function (adUnit, vastResponse, next) {\n var tech = this.player.el().querySelector('.vjs-tech');\n var dimension = dom.getDimension(tech);\n adUnit.initAd(dimension.width, dimension.height, this.VIEW_MODE.NORMAL, -1, {AdParameters: vastResponse.adParameters || ''}, function (error) {\n next(error, adUnit, vastResponse);\n });\n};\n\nVPAIDIntegrator.prototype._createVASTTracker = function(adUnitSrc, vastResponse) {\n return new VASTTracker(adUnitSrc, vastResponse);\n};\n\nVPAIDIntegrator.prototype._setupEvents = function (adUnit, vastResponse, next) {\n var adUnitSrc = adUnit.options.src;\n var tracker = this._createVASTTracker(adUnitSrc, vastResponse);\n var player = this.player;\n var that = this;\n\n adUnit.on('AdSkipped', function () {\n player.trigger('vpaid.AdSkipped');\n tracker.trackSkip();\n });\n\n adUnit.on('AdImpression', function () {\n player.trigger('vpaid.AdImpression');\n tracker.trackImpressions();\n });\n\n adUnit.on('AdStarted', function () {\n player.trigger('vpaid.AdStarted');\n tracker.trackCreativeView();\n notifyPlayToPlayer();\n });\n\n adUnit.on('AdVideoStart', function () {\n player.trigger('vpaid.AdVideoStart');\n tracker.trackStart();\n notifyPlayToPlayer();\n });\n\n adUnit.on('AdPlaying', function () {\n player.trigger('vpaid.AdPlaying');\n tracker.trackResume();\n notifyPlayToPlayer();\n });\n\n adUnit.on('AdPaused', function () {\n player.trigger('vpaid.AdPaused');\n tracker.trackPause();\n notifyPauseToPlayer();\n });\n\n function notifyPlayToPlayer(){\n if(that._adUnit && that._adUnit.isPaused()){\n that._adUnit._paused = false;\n }\n player.trigger('play');\n\n }\n\n function notifyPauseToPlayer() {\n if(that._adUnit){\n that._adUnit._paused = true;\n }\n player.trigger('pause');\n }\n\n adUnit.on('AdVideoFirstQuartile', function () {\n player.trigger('vpaid.AdVideoFirstQuartile');\n tracker.trackFirstQuartile();\n });\n\n adUnit.on('AdVideoMidpoint', function () {\n player.trigger('vpaid.AdVideoMidpoint');\n tracker.trackMidpoint();\n });\n\n adUnit.on('AdVideoThirdQuartile', function () {\n player.trigger('vpaid.AdVideoThirdQuartile');\n tracker.trackThirdQuartile();\n });\n\n adUnit.on('AdVideoComplete', function () {\n player.trigger('vpaid.AdVideoComplete');\n tracker.trackComplete();\n });\n\n adUnit.on('AdClickThru', function (data) {\n player.trigger('vpaid.AdClickThru');\n var url = data.url;\n var playerHandles = data.playerHandles;\n var clickThruUrl = utilities.isNotEmptyString(url) ? url : generateClickThroughURL(vastResponse.clickThrough);\n\n tracker.trackClick();\n if (playerHandles && clickThruUrl) {\n window.open(clickThruUrl, '_blank');\n }\n\n function generateClickThroughURL(clickThroughMacro) {\n var variables = {\n ASSETURI: adUnit.options.src,\n CONTENTPLAYHEAD: 0 //In VPAID there is no method to know the current time from the adUnit\n };\n\n return clickThroughMacro ? vastUtil.parseURLMacro(clickThroughMacro, variables) : null;\n }\n });\n\n adUnit.on('AdUserAcceptInvitation', function () {\n player.trigger('vpaid.AdUserAcceptInvitation');\n tracker.trackAcceptInvitation();\n tracker.trackAcceptInvitationLinear();\n });\n\n adUnit.on('AdUserClose', function () {\n player.trigger('vpaid.AdUserClose');\n tracker.trackClose();\n tracker.trackCloseLinear();\n });\n\n adUnit.on('AdUserMinimize', function () {\n player.trigger('vpaid.AdUserMinimize');\n tracker.trackCollapse();\n });\n\n adUnit.on('AdError', function () {\n player.trigger('vpaid.AdError');\n //NOTE: we track errors code 901, as noted in VAST 3.0\n tracker.trackErrorWithCode(901);\n });\n\n adUnit.on('AdVolumeChange', function () {\n player.trigger('vpaid.AdVolumeChange');\n var lastVolume = player.volume();\n adUnit.getAdVolume(function (error, currentVolume) {\n if (currentVolume === 0 && lastVolume > 0) {\n tracker.trackMute();\n }\n\n if (currentVolume > 0 && lastVolume === 0) {\n tracker.trackUnmute();\n }\n\n player.volume(currentVolume);\n });\n });\n\n var updateViewSize = resizeAd.bind(this, player, adUnit, this.VIEW_MODE);\n var updateViewSizeThrottled = utilities.throttle(updateViewSize, 100);\n var autoResize = this.settings.autoResize;\n\n if (autoResize) {\n dom.addEventListener(window, 'resize', updateViewSizeThrottled);\n dom.addEventListener(window, 'orientationchange', updateViewSizeThrottled);\n }\n\n player.on('vast.resize', updateViewSize);\n player.on('vpaid.pauseAd', pauseAdUnit);\n player.on('vpaid.resumeAd', resumeAdUnit);\n\n player.one('vpaid.adEnd', function () {\n player.off('vast.resize', updateViewSize);\n player.off('vpaid.pauseAd', pauseAdUnit);\n player.off('vpaid.resumeAd', resumeAdUnit);\n\n if (autoResize) {\n dom.removeEventListener(window, 'resize', updateViewSizeThrottled);\n dom.removeEventListener(window, 'orientationchange', updateViewSizeThrottled);\n }\n });\n\n next(null, adUnit, vastResponse);\n\n /*** Local Functions ***/\n function pauseAdUnit() {\n adUnit.pauseAd(utilities.noop);\n }\n\n function resumeAdUnit() {\n adUnit.resumeAd(utilities.noop);\n }\n};\n\nVPAIDIntegrator.prototype._addSkipButton = function (adUnit, vastResponse, next) {\n var skipButton;\n var player = this.player;\n\n adUnit.on('AdSkippableStateChange', updateSkipButtonState);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeSkipButton);\n\n next(null, adUnit, vastResponse);\n\n /*** Local function ***/\n function updateSkipButtonState() {\n player.trigger('vpaid.AdSkippableStateChange');\n adUnit.getAdSkippableState(function (error, isSkippable) {\n if (isSkippable) {\n if (!skipButton) {\n addSkipButton(player);\n }\n } else {\n removeSkipButton(player);\n }\n });\n }\n\n function addSkipButton(player) {\n skipButton = createSkipButton(player);\n player.el().appendChild(skipButton);\n }\n\n function removeSkipButton() {\n dom.remove(skipButton);\n skipButton = null;\n }\n\n function createSkipButton() {\n var skipButton = window.document.createElement(\"div\");\n dom.addClass(skipButton, \"vast-skip-button\");\n dom.addClass(skipButton, \"enabled\");\n skipButton.innerHTML = \"Skip ad\";\n\n skipButton.onclick = function (e) {\n adUnit.skipAd(utilities.noop);//We skip the adUnit\n\n //We prevent event propagation to avoid problems with the clickThrough and so on\n if (window.Event.prototype.stopPropagation !== undefined) {\n e.stopPropagation();\n } else {\n return false;\n }\n };\n\n return skipButton;\n }\n};\n\nVPAIDIntegrator.prototype._linkPlayerControls = function (adUnit, vastResponse, next) {\n var that = this;\n linkVolumeControl(this.player, adUnit);\n linkFullScreenControl(this.player, adUnit, this.VIEW_MODE);\n\n next(null, adUnit, vastResponse);\n\n /*** Local functions ***/\n function linkVolumeControl(player, adUnit) {\n player.on('volumechange', updateAdUnitVolume);\n adUnit.on('AdVolumeChange', updatePlayerVolume);\n\n player.one('vpaid.adEnd', function () {\n player.off('volumechange', updateAdUnitVolume);\n });\n\n\n /*** local functions ***/\n function updateAdUnitVolume() {\n var vol = player.muted() ? 0 : player.volume();\n adUnit.setAdVolume(vol, logError);\n }\n\n function updatePlayerVolume() {\n player.trigger('vpaid.AdVolumeChange');\n adUnit.getAdVolume(function (error, vol) {\n if (error) {\n logError(error);\n } else {\n player.volume(vol);\n }\n });\n }\n }\n\n function linkFullScreenControl(player, adUnit, VIEW_MODE) {\n var updateViewSize = resizeAd.bind(that, player, adUnit, VIEW_MODE);\n\n player.on('fullscreenchange', updateViewSize);\n\n player.one('vpaid.adEnd', function () {\n player.off('fullscreenchange', updateViewSize);\n });\n }\n};\n\nVPAIDIntegrator.prototype._startAd = function (adUnit, vastResponse, next) {\n var player = this.player;\n\n adUnit.startAd(function (error) {\n if (!error) {\n player.trigger('vast.adStart');\n }\n next(error, adUnit, vastResponse);\n });\n};\n\nVPAIDIntegrator.prototype._finishPlaying = function (adUnit, vastResponse, next) {\n var player = this.player;\n adUnit.on('AdStopped', function () {\n player.trigger('vpaid.AdStopped');\n finishPlayingAd(null);\n });\n\n adUnit.on('AdError', function (error) {\n var errMsg = error? error.message : 'on VPAIDIntegrator, error while waiting for the adUnit to finish playing';\n finishPlayingAd(new VASTError(errMsg));\n });\n\n /*** local functions ***/\n function finishPlayingAd(error) {\n next(error, adUnit, vastResponse);\n }\n};\n\nVPAIDIntegrator.prototype._trackError = function trackError(response, errorCode) {\n vastUtil.track(response.errorURLMacros, {ERRORCODE: errorCode || 901});\n};\n\nfunction resizeAd(player, adUnit, VIEW_MODE) {\n var tech = player.el().querySelector('.vjs-tech');\n var dimension = dom.getDimension(tech);\n var MODE = player.isFullscreen() ? VIEW_MODE.FULLSCREEN : VIEW_MODE.NORMAL;\n adUnit.resizeAd(dimension.width, dimension.height, MODE, logError);\n}\n\nfunction logError(error) {\n if (error && console && console.log) {\n console.log('ERROR: ' + error.message, error);\n }\n}\n\nmodule.exports = VPAIDIntegrator;\n},{\"../../utils/async\":39,\"../../utils/dom\":40,\"../../utils/playerUtils\":42,\"../../utils/utilityFunctions\":44,\"../vast/VASTError\":22,\"../vast/VASTResponse\":24,\"../vast/VASTTracker\":25,\"../vast/vastUtil\":29,\"./VPAIDAdUnitWrapper\":30}],34:[function(require,module,exports){\n'use strict';\n\nvar dom = require('../../utils/dom');\n\nvar element = document.createElement('div');\nelement.className = 'vjs-ads-label vjs-control vjs-label-hidden';\nelement.innerHTML = 'Advertisement';\n\nvar AdsLabelFactory = function(baseComponent) {\n return {\n /** @constructor */\n init: function init(player, options) {\n options.el = element;\n baseComponent.call(this, player, options);\n\n // We asynchronously reposition the ads label element\n setTimeout(function () {\n var currentTimeComp = player.controlBar &&( player.controlBar.getChild(\"timerControls\") || player.controlBar.getChild(\"currentTimeDisplay\") );\n if(currentTimeComp) {\n player.controlBar.el().insertBefore(element, currentTimeComp.el());\n }\n dom.removeClass(element, 'vjs-label-hidden');\n }, 0);\n },\n\n el: function getElement() {\n return element;\n }\n };\n};\n\nmodule.exports = AdsLabelFactory;\n},{\"../../utils/dom\":40}],35:[function(require,module,exports){\n'use strict';\n\nvar baseVideoJsComponent = videojs.Component;\n\nvar AdsLabel = require('./ads-label')(baseVideoJsComponent);\n\nvideojs.AdsLabel = videojs.Component.extend(AdsLabel);\n\n},{\"./ads-label\":34}],36:[function(require,module,exports){\n'use strict';\n\n/**\n * The component that shows a black screen until the ads plugin has decided if it can or it can not play the ad.\n *\n * Note: In case you wonder why instead of this black poster we don't just show the spinner loader.\n * IOS devices do not work well with animations and the browser chrashes from time to time That is why we chose to\n * have a secondary black poster.\n *\n * It also makes it much more easier for the users of the plugin since it does not change the default behaviour of the\n * spinner and the player works the same way with and without the plugin.\n *\n * @param {vjs.Player|Object} player\n * @param {Object=} options\n * @constructor\n */\nvar element = document.createElement('div');\n\nvar BlackPosterFactory = function(baseComponent) {\n return {\n /** @constructor */\n init: function init(player, options) {\n options.el = element;\n element.className = 'vjs-black-poster';\n baseComponent.call(this, player, options);\n\n var posterImg = player.getChild('posterImage');\n\n //We need to do it asynchronously to be sure that the black poster el is on the dom.\n setTimeout(function() {\n if(posterImg && player && player.el()) {\n player.el().insertBefore(element, posterImg.el());\n }\n }, 0);\n },\n el: function getElement() {\n return element;\n }\n };\n};\n\nmodule.exports = BlackPosterFactory;\n},{}],37:[function(require,module,exports){\n'use strict';\n\nvar baseVideoJsComponent = videojs.Component;\n\nvar BlackPoster = require('./black-poster')(baseVideoJsComponent);\n\nvideojs.BlackPoster = videojs.Component.extend(BlackPoster);\n\n},{\"./black-poster\":36}],38:[function(require,module,exports){\n'use strict';\n\nvar VASTClient = require('../ads/vast/VASTClient');\nvar VASTError = require('../ads/vast/VASTError');\nvar vastUtil = require('../ads/vast/vastUtil');\n\nvar VASTIntegrator = require('../ads/vast/VASTIntegrator');\nvar VPAIDIntegrator = require('../ads/vpaid/VPAIDIntegrator');\n\nvar async = require('../utils/async');\nvar dom = require('../utils/dom');\nvar playerUtils = require('../utils/playerUtils');\nvar utilities = require('../utils/utilityFunctions');\n\nmodule.exports = function VASTPlugin(options) {\n var snapshot;\n var player = this;\n var vast = new VASTClient();\n var adsCanceled = false;\n var defaultOpts = {\n // maximum amount of time in ms to wait to receive `adsready` from the ad\n // implementation after play has been requested. Ad implementations are\n // expected to load any dynamic libraries and make any requests to determine\n // ad policies for a video during this time.\n timeout: 500,\n\n //TODO:finish this IOS FIX\n //Whenever you play an add on IOS, the native player kicks in and we loose control of it. On very heavy pages the 'play' event\n // May occur after the video content has already started. This is wrong if you want to play a preroll ad that needs to happen before the user\n // starts watching the content. To prevent this usec\n iosPrerollCancelTimeout: 2000,\n\n // maximun amount of time for the ad to actually start playing. If this timeout gets\n // triggered the ads will be cancelled\n adCancelTimeout: 3000,\n\n // Boolean flag that configures the player to play a new ad before the user sees the video again\n // the current video\n playAdAlways: false,\n\n // Flag to enable or disable the ads by default.\n adsEnabled: true,\n\n // Boolean flag to enable or disable the resize with window.resize or orientationchange\n autoResize: true,\n\n // Path to the VPAID flash ad's loader\n vpaidFlashLoaderPath: '/VPAIDFlash.swf'\n };\n\n var settings = utilities.extend({}, defaultOpts, options || {});\n\n if(utilities.isUndefined(settings.adTagUrl) && utilities.isDefined(settings.url)){\n settings.adTagUrl = settings.url;\n }\n\n if (utilities.isString(settings.adTagUrl)) {\n settings.adTagUrl = utilities.echoFn(settings.adTagUrl);\n }\n\n if (utilities.isDefined(settings.adTagXML) && !utilities.isFunction(settings.adTagXML)) {\n return trackAdError(new VASTError('on VideoJS VAST plugin, the passed adTagXML option does not contain a function'));\n }\n\n if (!utilities.isDefined(settings.adTagUrl) && !utilities.isFunction(settings.adTagXML)) {\n return trackAdError(new VASTError('on VideoJS VAST plugin, missing adTagUrl on options object'));\n }\n\n vastUtil.runFlashSupportCheck(settings.vpaidFlashLoaderPath);// Necessary step for VPAIDFLASHClient to work.\n\n playerUtils.prepareForAds(player);\n\n if (settings.playAdAlways) {\n // No matter what happens we play a new ad before the user sees the video again.\n player.on('vast.contentEnd', function () {\n setTimeout(function () {\n player.trigger('vast.reset');\n }, 0);\n });\n }\n\n player.on('vast.firstPlay', tryToPlayPrerollAd);\n\n player.on('vast.reset', function () {\n //If we are reseting the plugin, we don't want to restore the content\n snapshot = null;\n cancelAds();\n });\n\n player.vast = {\n isEnabled: function () {\n return settings.adsEnabled;\n },\n\n enable: function () {\n settings.adsEnabled = true;\n },\n\n disable: function () {\n settings.adsEnabled = false;\n }\n };\n\n return player.vast;\n\n /**** Local functions ****/\n function tryToPlayPrerollAd() {\n //We remove the poster to prevent flickering whenever the content starts playing\n playerUtils.removeNativePoster(player);\n\n playerUtils.once(player, ['vast.adsCancel', 'vast.adEnd'], function () {\n removeAdUnit();\n restoreVideoContent();\n });\n\n async.waterfall([\n checkAdsEnabled,\n preparePlayerForAd,\n startAdCancelTimeout,\n playPrerollAd\n ], function (error, response) {\n if (error) {\n trackAdError(error, response);\n } else {\n player.trigger('vast.adEnd');\n }\n });\n\n /*** Local functions ***/\n\n function removeAdUnit() {\n if (player.vast && player.vast.adUnit) {\n player.vast.adUnit = null; //We remove the adUnit\n }\n }\n\n function restoreVideoContent() {\n setupContentEvents();\n if (snapshot) {\n playerUtils.restorePlayerSnapshot(player, snapshot);\n snapshot = null;\n }\n }\n\n function setupContentEvents() {\n playerUtils.once(player, ['playing', 'vast.reset', 'vast.firstPlay'], function (evt) {\n if (evt.type !== 'playing') {\n return;\n }\n\n player.trigger('vast.contentStart');\n\n playerUtils.once(player, ['ended', 'vast.reset', 'vast.firstPlay'], function (evt) {\n if (evt.type === 'ended') {\n player.trigger('vast.contentEnd');\n }\n });\n });\n }\n\n function checkAdsEnabled(next) {\n if (settings.adsEnabled) {\n return next(null);\n }\n next(new VASTError('Ads are not enabled'));\n }\n\n function preparePlayerForAd(next) {\n if (canPlayPrerollAd()) {\n snapshot = playerUtils.getPlayerSnapshot(player);\n player.pause();\n addSpinnerIcon();\n\n if(player.paused()) {\n next(null);\n } else {\n playerUtils.once(player, ['playing'], function() {\n player.pause();\n next(null);\n });\n }\n } else {\n next(new VASTError('video content has been playing before preroll ad'));\n }\n }\n\n function canPlayPrerollAd() {\n return !utilities.isIPhone() || player.currentTime() <= settings.iosPrerollCancelTimeout;\n }\n\n function startAdCancelTimeout(next) {\n var adCancelTimeoutId;\n adsCanceled = false;\n\n adCancelTimeoutId = setTimeout(function () {\n trackAdError(new VASTError('timeout while waiting for the video to start playing', 402));\n }, settings.adCancelTimeout);\n\n playerUtils.once(player, ['vast.adStart', 'vast.adsCancel'], clearAdCancelTimeout);\n\n /*** local functions ***/\n function clearAdCancelTimeout() {\n if (adCancelTimeoutId) {\n clearTimeout(adCancelTimeoutId);\n adCancelTimeoutId = null;\n }\n }\n\n next(null);\n }\n\n function addSpinnerIcon() {\n dom.addClass(player.el(), 'vjs-vast-ad-loading');\n playerUtils.once(player, ['vast.adStart', 'vast.adsCancel'], removeSpinnerIcon);\n }\n\n function removeSpinnerIcon() {\n //IMPORTANT NOTE: We remove the spinnerIcon asynchronously to give time to the browser to start the video.\n // If we remove it synchronously we see a flash of the content video before the ad starts playing.\n setTimeout(function () {\n dom.removeClass(player.el(), 'vjs-vast-ad-loading');\n }, 100);\n }\n\n }\n\n function cancelAds() {\n player.trigger('vast.adsCancel');\n adsCanceled = true;\n }\n\n function playPrerollAd(callback) {\n async.waterfall([\n getVastResponse,\n playAd\n ], callback);\n }\n\n function getVastResponse(callback) {\n vast.getVASTResponse(settings.adTagUrl ? settings.adTagUrl() : settings.adTagXML, callback);\n }\n\n function playAd(vastResponse, callback) {\n //TODO: Find a better way to stop the play. The 'playPrerollWaterfall' ends in an inconsistent situation\n //If the state is not 'preroll?' it means the ads were canceled therefore, we break the waterfall\n if (adsCanceled) {\n return;\n }\n\n var adIntegrator = isVPAID(vastResponse) ? new VPAIDIntegrator(player, settings) : new VASTIntegrator(player);\n var adFinished = false;\n\n playerUtils.once(player, ['vast.adStart', 'vast.adsCancel'], function (evt) {\n if (evt.type === 'vast.adStart') {\n addAdsLabel();\n }\n });\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeAdsLabel);\n\n if (utilities.isIDevice()) {\n preventManualProgress();\n }\n\n player.vast.vastResponse = vastResponse;\n player.vast.adUnit = adIntegrator.playAd(vastResponse, callback);\n\n /*** Local functions ****/\n function addAdsLabel() {\n if (adFinished || player.controlBar.getChild('AdsLabel')) {\n return;\n }\n\n player.controlBar.addChild('AdsLabel');\n }\n\n function removeAdsLabel() {\n player.controlBar.removeChild('AdsLabel');\n adFinished = true;\n }\n\n function preventManualProgress() {\n //IOS video clock is very unreliable and we need a 3 seconds threshold to ensure that the user forwarded/rewound the ad\n var PROGRESS_THRESHOLD = 3;\n var previousTime = 0;\n var skipad_attempts = 0;\n\n player.on('timeupdate', preventAdSeek);\n player.on('ended', preventAdSkip);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel', 'vast.adError'], stopPreventManualProgress);\n\n /*** Local functions ***/\n function preventAdSkip() {\n // Ignore ended event if the Ad time was not 'near' the end\n // and revert time to the previous 'valid' time\n if ((player.duration() - previousTime) > PROGRESS_THRESHOLD) {\n player.pause(true); // this reduce the video jitter if the IOS skip button is pressed\n player.play(true); // we need to trigger the play to put the video element back in a valid state\n player.currentTime(previousTime);\n }\n }\n\n function preventAdSeek() {\n var currentTime = player.currentTime();\n var progressDelta = Math.abs(currentTime - previousTime);\n if (progressDelta > PROGRESS_THRESHOLD) {\n skipad_attempts += 1;\n if (skipad_attempts >= 2) {\n player.pause(true);\n }\n player.currentTime(previousTime);\n } else {\n previousTime = currentTime;\n }\n }\n\n function stopPreventManualProgress() {\n player.off('timeupdate', preventAdSeek);\n player.off('ended', preventAdSkip);\n }\n }\n }\n\n function trackAdError(error, vastResponse) {\n player.trigger({type: 'vast.adError', error: error});\n cancelAds();\n if (console && console.log) {\n console.log('AD ERROR:', error.message, error, vastResponse);\n }\n }\n\n function isVPAID(vastResponse) {\n var i, len;\n var mediaFiles = vastResponse.mediaFiles;\n for (i = 0, len = mediaFiles.length; i < len; i++) {\n if (vastUtil.isVPAID(mediaFiles[i])) {\n return true;\n }\n }\n return false;\n }\n};\n\n},{\"../ads/vast/VASTClient\":21,\"../ads/vast/VASTError\":22,\"../ads/vast/VASTIntegrator\":23,\"../ads/vast/vastUtil\":29,\"../ads/vpaid/VPAIDIntegrator\":33,\"../utils/async\":39,\"../utils/dom\":40,\"../utils/playerUtils\":42,\"../utils/utilityFunctions\":44}],39:[function(require,module,exports){\n//Small subset of async\n\nvar utilities = require('./utilityFunctions');\n\nvar async = {};\n\nasync.setImmediate = function (fn) {\n setTimeout(fn, 0);\n};\n\nasync.iterator = function (tasks) {\n var makeCallback = function (index) {\n var fn = function () {\n if (tasks.length) {\n tasks[index].apply(null, arguments);\n }\n return fn.next();\n };\n fn.next = function () {\n return (index < tasks.length - 1) ? makeCallback(index + 1) : null;\n };\n return fn;\n };\n return makeCallback(0);\n};\n\n\nasync.waterfall = function (tasks, callback) {\n callback = callback || function () { };\n if (!utilities.isArray(tasks)) {\n var err = new Error('First argument to waterfall must be an array of functions');\n return callback(err);\n }\n if (!tasks.length) {\n return callback();\n }\n var wrapIterator = function (iterator) {\n return function (err) {\n if (err) {\n callback.apply(null, arguments);\n callback = function () {\n };\n }\n else {\n var args = Array.prototype.slice.call(arguments, 1);\n var next = iterator.next();\n if (next) {\n args.push(wrapIterator(next));\n }\n else {\n args.push(callback);\n }\n async.setImmediate(function () {\n iterator.apply(null, args);\n });\n }\n };\n };\n wrapIterator(async.iterator(tasks))();\n};\n\nasync.when = function (condition, callback) {\n if (!utilities.isFunction(callback)) {\n throw new Error(\"async.when error: missing callback argument\");\n }\n\n var isAllowed = utilities.isFunction(condition) ? condition : function () {\n return !!condition;\n };\n\n return function () {\n var args = utilities.arrayLikeObjToArray(arguments);\n var next = args.pop();\n\n if (isAllowed.apply(null, args)) {\n return callback.apply(this, arguments);\n }\n\n args.unshift(null);\n return next.apply(null, args);\n };\n};\n\nmodule.exports = async;\n\n\n},{\"./utilityFunctions\":44}],40:[function(require,module,exports){\n'use strict';\n\nvar utilities = require('./utilityFunctions');\n\nvar dom = {};\n\ndom.isVisible = function isVisible(el) {\n var style = window.getComputedStyle(el);\n return style.visibility !== 'hidden';\n};\n\ndom.isHidden = function isHidden(el) {\n var style = window.getComputedStyle(el);\n return style.display === 'none';\n};\n\ndom.isShown = function isShown(el) {\n return !dom.isHidden(el);\n};\n\ndom.hide = function hide(el) {\n el.__prev_style_display_ = el.style.display;\n el.style.display = 'none';\n};\n\ndom.show = function show(el) {\n if (dom.isHidden(el)) {\n el.style.display = el.__prev_style_display_;\n }\n el.__prev_style_display_ = undefined;\n};\n\ndom.hasClass = function hasClass(el, cssClass) {\n var classes, i, len;\n\n if (utilities.isNotEmptyString(cssClass)) {\n if (el.classList) {\n return el.classList.contains(cssClass);\n }\n\n classes = utilities.isString(el.getAttribute('class')) ? el.getAttribute('class').split(/\\s+/) : [];\n cssClass = (cssClass || '');\n\n for (i = 0, len = classes.length; i < len; i += 1) {\n if (classes[i] === cssClass) {\n return true;\n }\n }\n }\n return false;\n};\n\ndom.addClass = function (el, cssClass) {\n var classes;\n\n if (utilities.isNotEmptyString(cssClass)) {\n if (el.classList) {\n return el.classList.add(cssClass);\n }\n\n classes = utilities.isString(el.getAttribute('class')) ? el.getAttribute('class').split(/\\s+/) : [];\n if (utilities.isString(cssClass) && utilities.isNotEmptyString(cssClass.replace(/\\s+/, ''))) {\n classes.push(cssClass);\n el.setAttribute('class', classes.join(' '));\n }\n }\n};\n\ndom.removeClass = function (el, cssClass) {\n var classes;\n\n if (utilities.isNotEmptyString(cssClass)) {\n if (el.classList) {\n return el.classList.remove(cssClass);\n }\n\n classes = utilities.isString(el.getAttribute('class')) ? el.getAttribute('class').split(/\\s+/) : [];\n var newClasses = [];\n var i, len;\n if (utilities.isString(cssClass) && utilities.isNotEmptyString(cssClass.replace(/\\s+/, ''))) {\n\n for (i = 0, len = classes.length; i < len; i += 1) {\n if (cssClass !== classes[i]) {\n newClasses.push(classes[i]);\n }\n }\n el.setAttribute('class', newClasses.join(' '));\n }\n }\n};\n\ndom.addEventListener = function addEventListener(el, type, handler) {\n if(utilities.isArray(el)){\n utilities.forEach(el, function(e) {\n dom.addEventListener(e, type, handler);\n });\n return;\n }\n\n if(utilities.isArray(type)){\n utilities.forEach(type, function(t) {\n dom.addEventListener(el, t, handler);\n });\n return;\n }\n\n if (el.addEventListener) {\n el.addEventListener(type, handler, false);\n } else if (el.attachEvent) {\n // WARNING!!! this is a very naive implementation !\n // the event object that should be passed to the handler\n // would not be there for IE8\n // we should use \"window.event\" and then \"event.srcElement\"\n // instead of \"event.target\"\n el.attachEvent(\"on\" + type, handler);\n }\n};\n\ndom.removeEventListener = function removeEventListener(el, type, handler) {\n if(utilities.isArray(el)){\n utilities.forEach(el, function(e) {\n dom.removeEventListener(e, type, handler);\n });\n return;\n }\n\n if(utilities.isArray(type)){\n utilities.forEach(type, function(t) {\n dom.removeEventListener(el, t, handler);\n });\n return;\n }\n\n if (el.removeEventListener) {\n el.removeEventListener(type, handler, false);\n } else if (el.detachEvent) {\n el.detachEvent(\"on\" + type, handler);\n } else {\n el[\"on\" + type] = null;\n }\n};\n\ndom.dispatchEvent = function dispatchEvent(el, event) {\n if (el.dispatchEvent) {\n el.dispatchEvent(event);\n } else {\n el.fireEvent(\"on\" + event.eventType, event);\n }\n};\n\ndom.isDescendant = function isDescendant(parent, child) {\n var node = child.parentNode;\n while (node !== null) {\n if (node === parent) {\n return true;\n }\n node = node.parentNode;\n }\n return false;\n};\n\ndom.getTextContent = function getTextContent(el){\n return el.textContent || el.text;\n};\n\ndom.prependChild = function prependChild(parent, child) {\n if(child.parentNode){\n child.parentNode.removeChild(child);\n }\n return parent.insertBefore(child, parent.firstChild);\n};\n\ndom.remove = function removeNode(node){\n if(node && node.parentNode){\n node.parentNode.removeChild(node);\n }\n};\n\ndom.isDomElement = function isDomElement(o) {\n return o instanceof Element;\n};\n\ndom.click = function(el, handler) {\n dom.addEventListener(el, 'click', handler);\n};\n\ndom.once = function(el, type, handler) {\n function handlerWrap() {\n handler.apply(null, arguments);\n dom.removeEventListener(el, type, handlerWrap);\n }\n\n dom.addEventListener(el, type, handlerWrap);\n};\n\n//Note: there is no getBoundingClientRect on iPad so we need a fallback\ndom.getDimension = function getDimension(element) {\n var rect;\n\n //On IE9 and below getBoundingClientRect does not work consistently\n if(!utilities.isOldIE() && element.getBoundingClientRect) {\n rect = element.getBoundingClientRect();\n return {\n width: rect.width,\n height: rect.height\n };\n }\n\n return {\n width: element.offsetWidth,\n height: element.offsetHeight\n };\n};\n\nmodule.exports = dom;\n},{\"./utilityFunctions\":44}],41:[function(require,module,exports){\n'use strict';\n\nvar urlUtils = require('./urlUtils');\nvar utilities = require('./utilityFunctions');\n\nfunction HttpRequestError(message) {\n this.message = 'HttpRequest Error: ' + (message || '');\n}\nHttpRequestError.prototype = new Error();\nHttpRequestError.prototype.name = \"HttpRequest Error\";\n\nfunction HttpRequest(createXhr) {\n if (!utilities.isFunction(createXhr)) {\n throw new HttpRequestError('Missing XMLHttpRequest factory method');\n }\n\n this.createXhr = createXhr;\n}\n\nHttpRequest.prototype.run = function (method, url, callback, options) {\n sanityCheck(url, callback, options);\n var timeout, timeoutId;\n var xhr = this.createXhr();\n options = options || {};\n timeout = utilities.isNumber(options.timeout) ? options.timeout : 0;\n\n xhr.open(method, urlUtils.urlParts(url).href, true);\n\n if (options.headers) {\n setHeaders(xhr, options.headers);\n }\n\n if (options.withCredentials) {\n xhr.withCredentials = true;\n }\n\n xhr.onload = function () {\n var statusText, response, status;\n\n /**\n * The only way to do a secure request on IE8 and IE9 is with the XDomainRequest object. Unfortunately, microsoft is\n * so nice that decided that the status property and the 'getAllResponseHeaders' method where not needed so we have to\n * fake them. If the request gets done with an XDomainRequest instance, we will assume that there are no headers and\n * the status will always be 200. If you don't like it, DO NOT USE ANCIENT BROWSERS!!!\n *\n * For mor info go to: https://msdn.microsoft.com/en-us/library/cc288060(v=vs.85).aspx\n */\n if (!xhr.getAllResponseHeaders) {\n xhr.getAllResponseHeaders = function () {\n return null;\n };\n }\n\n if (!xhr.status) {\n xhr.status = 200;\n }\n\n if (utilities.isDefined(timeoutId)) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n\n statusText = xhr.statusText || '';\n\n // responseText is the old-school way of retrieving response (supported by IE8 & 9)\n // response/responseType properties were introduced in XHR Level2 spec (supported by IE10)\n response = ('response' in xhr) ? xhr.response : xhr.responseText;\n\n // normalize IE9 bug (http://bugs.jquery.com/ticket/1450)\n status = xhr.status === 1223 ? 204 : xhr.status;\n\n callback(\n status,\n response,\n xhr.getAllResponseHeaders(),\n statusText);\n };\n\n xhr.onerror = requestError;\n xhr.onabort = requestError;\n\n xhr.send();\n\n if (timeout > 0) {\n timeoutId = setTimeout(function () {\n xhr && xhr.abort();\n }, timeout);\n }\n\n function sanityCheck(url, callback, options) {\n if (!utilities.isString(url) || utilities.isEmptyString(url)) {\n throw new HttpRequestError(\"Invalid url '\" + url + \"'\");\n }\n\n if (!utilities.isFunction(callback)) {\n throw new HttpRequestError(\"Invalid handler '\" + callback + \"' for the http request\");\n }\n\n if (utilities.isDefined(options) && !utilities.isObject(options)) {\n throw new HttpRequestError(\"Invalid options map '\" + options + \"'\");\n }\n }\n\n function setHeaders(xhr, headers) {\n utilities.forEach(headers, function (value, key) {\n if (utilities.isDefined(value)) {\n xhr.setRequestHeader(key, value);\n }\n });\n }\n\n function requestError() {\n callback(-1, null, null, '');\n }\n};\n\nHttpRequest.prototype.get = function (url, callback, options) {\n this.run('GET', url, processResponse, options);\n\n function processResponse(status, response, headersString, statusText) {\n if (isSuccess(status)) {\n callback(null, response, status, headersString, statusText);\n } else {\n callback(new HttpRequestError(statusText), response, status, headersString, statusText);\n }\n }\n\n function isSuccess(status) {\n return 200 <= status && status < 300;\n }\n};\n\nfunction createXhr() {\n var xhr = new XMLHttpRequest();\n if (!(\"withCredentials\" in xhr)) {\n // XDomainRequest for IE.\n xhr = new XDomainRequest();\n }\n return xhr;\n}\n\nvar http = new HttpRequest(createXhr);\n\nmodule.exports = {\n http: http,\n HttpRequest: HttpRequest,\n HttpRequestError: HttpRequestError,\n createXhr: createXhr\n};\n\n},{\"./urlUtils\":43,\"./utilityFunctions\":44}],42:[function(require,module,exports){\n'use strict';\n\nvar dom = require('./dom');\nvar utilities = require('./utilityFunctions');\n\nvar playerUtils = {};\n\n/**\n * Returns an object that captures the portions of player state relevant to\n * video playback. The result of this function can be passed to\n * restorePlayerSnapshot with a player to return the player to the state it\n * was in when this function was invoked.\n * @param {object} player The videojs player object\n */\nplayerUtils.getPlayerSnapshot = function getPlayerSnapshot(player) {\n var tech = player.el().querySelector('.vjs-tech');\n\n var snapshot = {\n ended: player.ended(),\n src: player.currentSrc(),\n currentTime: player.currentTime(),\n type: player.currentType(),\n playing: !player.paused(),\n suppressedTracks: getSuppressedTracks(player)\n };\n\n if (tech) {\n snapshot.nativePoster = tech.poster;\n snapshot.style = tech.getAttribute('style');\n }\n return snapshot;\n\n /**** Local Functions ****/\n function getSuppressedTracks(player) {\n var tracks = player.remoteTextTracks ? player.remoteTextTracks() : [];\n\n if (tracks && utilities.isArray(tracks.tracks_)) {\n tracks = tracks.tracks_;\n }\n\n if (!utilities.isArray(tracks)) {\n tracks = [];\n }\n\n var suppressedTracks = [];\n tracks.forEach(function (track) {\n suppressedTracks.push({\n track: track,\n mode: track.mode\n });\n track.mode = 'disabled';\n });\n\n return suppressedTracks;\n }\n};\n\n/**\n * Attempts to modify the specified player so that its state is equivalent to\n * the state of the snapshot.\n * @param {object} snapshot - the player state to apply\n */\nplayerUtils.restorePlayerSnapshot = function restorePlayerSnapshot(player, snapshot) {\n var tech = player.el().querySelector('.vjs-tech');\n var attempts = 20; // the number of remaining attempts to restore the snapshot\n\n if (snapshot.nativePoster) {\n tech.poster = snapshot.nativePoster;\n }\n\n if ('style' in snapshot) {\n // overwrite all css style properties to restore state precisely\n tech.setAttribute('style', snapshot.style || '');\n }\n\n if (hasSrcChanged(player, snapshot)) {\n\n // on ios7, fiddling with textTracks too early will cause safari to crash\n player.one('contentloadedmetadata', restoreTracks);\n\n player.one('canplay', tryToResume);\n ensureCanplayEvtGetsFired();\n\n // if the src changed for ad playback, reset it\n player.src({src: snapshot.src, type: snapshot.type});\n\n // safari requires a call to `load` to pick up a changed source\n player.load();\n\n } else {\n restoreTracks();\n\n if (snapshot.playing) {\n player.play();\n }\n }\n\n /*** Local Functions ***/\n\n /**\n * Sometimes firefox does not trigger the 'canplay' evt.\n * This code ensure that it always gets triggered triggered.\n */\n function ensureCanplayEvtGetsFired() {\n var timeoutId = setTimeout(function() {\n player.trigger('canplay');\n }, 1000);\n\n player.one('canplay', function(){\n clearTimeout(timeoutId);\n });\n }\n\n /**\n * Determine whether the player needs to be restored to its state\n * before ad playback began. With a custom ad display or burned-in\n * ads, the content player state hasn't been modified and so no\n * restoration is required\n */\n function hasSrcChanged(player, snapshot) {\n if (player.src()) {\n return player.src() !== snapshot.src;\n }\n // the player was configured through source element children\n return player.currentSrc() !== snapshot.src;\n }\n\n function restoreTracks() {\n var suppressedTracks = snapshot.suppressedTracks;\n suppressedTracks.forEach(function (trackSnapshot) {\n trackSnapshot.track.mode = trackSnapshot.mode;\n });\n }\n\n /**\n * Determine if the video element has loaded enough of the snapshot source\n * to be ready to apply the rest of the state\n */\n function tryToResume() {\n\n // if some period of the video is seekable, resume playback\n // otherwise delay a bit and then check again unless we're out of attempts\n\n if (!playerUtils.isReadyToResume(player) && attempts--) {\n setTimeout(tryToResume, 50);\n } else {\n try {\n if(player.currentTime() !== snapshot.currentTime) {\n if (snapshot.playing) { // if needed restore playing status after seek completes\n player.one('seeked', function() {\n player.play();\n });\n }\n player.currentTime(snapshot.currentTime);\n\n } else if (snapshot.playing) {\n // if needed and no seek has been performed, restore playing status immediately\n player.play();\n }\n\n } catch (e) {\n videojs.log.warn('Failed to resume the content after an advertisement', e);\n }\n }\n }\n};\n\nplayerUtils.isReadyToResume = function (player) {\n\n if (player.readyState() > 1) {\n // some browsers and media aren't \"seekable\".\n // readyState greater than 1 allows for seeking without exceptions\n return true;\n }\n\n if (player.seekable() === undefined) {\n // if the player doesn't expose the seekable time ranges, try to\n // resume playback immediately\n return true;\n }\n\n if (player.seekable().length > 0) {\n // if some period of the video is seekable, resume playback\n return true;\n }\n\n return false;\n};\n\n/**\n * This function prepares the player to display ads.\n * Adding convenience events like the 'vast.firsPlay' that gets fired when the video is first played\n * and ads the blackPoster to the player to prevent content from being displayed before the preroll ad.\n *\n * @param player\n */\nplayerUtils.prepareForAds = function (player) {\n var blackPoster = player.addChild('blackPoster');\n var _firstPlay = true;\n var volumeSnapshot;\n\n\n monkeyPatchPlayerApi();\n\n player.on('play', tryToTriggerFirstPlay);\n player.on('vast.reset', resetFirstPlay);//Every time we change the sources we reset the first play.\n player.on('vast.firstPlay', restoreContentVolume);\n player.on('error', hideBlackPoster);//If there is an error in the player we remove the blackposter to show the err msg\n player.on('vast.adStart', hideBlackPoster);\n player.on('vast.adsCancel', hideBlackPoster);\n player.on('vast.adError', hideBlackPoster);\n player.on('vast.adStart', addStyles);\n player.on('vast.adEnd', removeStyles);\n player.on('vast.adsCancel', removeStyles);\n\n /*** Local Functions ***/\n\n /**\n What this function does is ugly and horrible and I should think twice before calling myself a good developer. With that said,\n it is the best solution I could find to mute the video until the 'play' event happens (on mobile devices) and the plugin can decide whether\n to play the ad or not.\n\n We also need this monkeypatch to be able to pause and resume an ad using the player's API\n\n If you have a better solution please do tell me.\n */\n function monkeyPatchPlayerApi() {\n\n /**\n * Monkey patch needed to handle firstPlay and resume of playing ad.\n *\n * @param callOrigPlay necessary flag to prevent infinite loop when you are restoring a VAST ad.\n * @returns {player}\n */\n var origPlay = player.play;\n player.play = function (callOrigPlay) {\n var that = this;\n\n if (isFirstPlay()) {\n firstPlay();\n } else {\n resume(callOrigPlay);\n }\n\n return this;\n\n /*** local functions ***/\n function firstPlay() {\n if (!utilities.isIPhone()) {\n volumeSnapshot = saveVolumeSnapshot();\n player.muted(true);\n }\n\n origPlay.apply(that, arguments);\n }\n\n function resume(callOrigPlay) {\n if (isAdPlaying() && !callOrigPlay) {\n player.vast.adUnit.resumeAd();\n } else {\n origPlay.apply(that, arguments);\n }\n }\n };\n\n\n /**\n * Needed monkey patch to handle pause of playing ad.\n *\n * @param callOrigPlay necessary flag to prevent infinite loop when you are pausing a VAST ad.\n * @returns {player}\n */\n var origPause = player.pause;\n player.pause = function (callOrigPause) {\n if (isAdPlaying() && !callOrigPause) {\n player.vast.adUnit.pauseAd();\n } else {\n origPause.apply(this, arguments);\n }\n return this;\n };\n\n\n /**\n * Needed monkey patch to handle paused state of the player when ads are playing.\n *\n * @param callOrigPlay necessary flag to prevent infinite loop when you are pausing a VAST ad.\n * @returns {player}\n */\n var origPaused = player.paused;\n player.paused = function (callOrigPaused) {\n if (isAdPlaying() && !callOrigPaused) {\n return player.vast.adUnit.isPaused();\n }\n return origPaused.apply(this, arguments);\n };\n }\n\n function isAdPlaying() {\n return player.vast && player.vast.adUnit;\n }\n\n function tryToTriggerFirstPlay() {\n if (isFirstPlay()) {\n _firstPlay = false;\n player.trigger('vast.firstPlay');\n }\n }\n\n function resetFirstPlay() {\n _firstPlay = true;\n blackPoster.show();\n restoreContentVolume();\n }\n\n function isFirstPlay() {\n return _firstPlay;\n }\n\n function saveVolumeSnapshot() {\n return {\n muted: player.muted(),\n volume: player.volume()\n };\n }\n\n function restoreContentVolume() {\n if (volumeSnapshot) {\n player.currentTime(0);\n restoreVolumeSnapshot(volumeSnapshot);\n volumeSnapshot = null;\n }\n }\n\n function restoreVolumeSnapshot(snapshot) {\n if (utilities.isObject(snapshot)) {\n player.volume(snapshot.volume);\n player.muted(snapshot.muted);\n }\n }\n\n function hideBlackPoster() {\n if (!dom.hasClass(blackPoster.el(), 'vjs-hidden')) {\n blackPoster.hide();\n }\n }\n\n function addStyles() {\n dom.addClass(player.el(), 'vjs-ad-playing');\n }\n\n function removeStyles() {\n dom.removeClass(player.el(), 'vjs-ad-playing');\n }\n};\n\n/**\n * Remove the poster attribute from the video element tech, if present. When\n * reusing a video element for multiple videos, the poster image will briefly\n * reappear while the new source loads. Removing the attribute ahead of time\n * prevents the poster from showing up between videos.\n * @param {object} player The videojs player object\n */\nplayerUtils.removeNativePoster = function (player) {\n var tech = player.el().querySelector('.vjs-tech');\n if (tech) {\n tech.removeAttribute('poster');\n }\n};\n\n/**\n * Helper function to listen to many events until one of them gets fired, then we\n * execute the handler and unsubscribe all the event listeners;\n *\n * @param player specific player from where to listen for the events\n * @param events array of events\n * @param handler function to execute once one of the events fires\n */\nplayerUtils.once = function once(player, events, handler) {\n function listener() {\n handler.apply(null, arguments);\n\n events.forEach(function (event) {\n player.off(event, listener);\n });\n }\n\n events.forEach(function (event) {\n player.on(event, listener);\n });\n};\n\n\nmodule.exports = playerUtils;\n},{\"./dom\":40,\"./utilityFunctions\":44}],43:[function(require,module,exports){\n'use strict';\n\nvar utilities = require('./utilityFunctions');\n\n/**\n *\n * IMPORTANT NOTE: This function comes from angularJs and was originally called urlResolve\n * you can take a look at the original code here https://github.com/angular/angular.js/blob/master/src/ng/urlUtils.js\n *\n * Implementation Notes for non-IE browsers\n * ----------------------------------------\n * Assigning a URL to the href property of an anchor DOM node, even one attached to the DOM,\n * results both in the normalizing and parsing of the URL. Normalizing means that a relative\n * URL will be resolved into an absolute URL in the context of the application document.\n * Parsing means that the anchor node's host, hostname, protocol, port, pathname and related\n * properties are all populated to reflect the normalized URL. This approach has wide\n * compatibility - Safari 1+, Mozilla 1+, Opera 7+,e etc. See\n * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html\n *\n * Implementation Notes for IE\n * ---------------------------\n * IE >= 8 and <= 10 normalizes the URL when assigned to the anchor node similar to the other\n * browsers. However, the parsed components will not be set if the URL assigned did not specify\n * them. (e.g. if you assign a.href = \"foo\", then a.protocol, a.host, etc. will be empty.) We\n * work around that by performing the parsing in a 2nd step by taking a previously normalized\n * URL (e.g. by assigning to a.href) and assigning it a.href again. This correctly populates the\n * properties such as protocol, hostname, port, etc.\n *\n * IE7 does not normalize the URL when assigned to an anchor node. (Apparently, it does, if one\n * uses the inner HTML approach to assign the URL as part of an HTML snippet -\n * http://stackoverflow.com/a/472729) However, setting img[src] does normalize the URL.\n * Unfortunately, setting img[src] to something like \"javascript:foo\" on IE throws an exception.\n * Since the primary usage for normalizing URLs is to sanitize such URLs, we can't use that\n * method and IE < 8 is unsupported.\n *\n * References:\n * http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement\n * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html\n * http://url.spec.whatwg.org/#urlutils\n * https://github.com/angular/angular.js/pull/2902\n * http://james.padolsey.com/javascript/parsing-urls-with-the-dom/\n *\n * @kind function\n * @param {string} url The URL to be parsed.\n * @description Normalizes and parses a URL.\n * @returns {object} Returns the normalized URL as a dictionary.\n *\n * | member name | Description |\n * |---------------|----------------|\n * | href | A normalized version of the provided URL if it was not an absolute URL |\n * | protocol | The protocol including the trailing colon |\n * | host | The host and port (if the port is non-default) of the normalizedUrl |\n * | search | The search params, minus the question mark |\n * | hash | The hash string, minus the hash symbol\n * | hostname | The hostname\n * | port | The port, without \":\"\n * | pathname | The pathname, beginning with \"/\"\n *\n */\n\nvar urlParsingNode = document.createElement(\"a\");\n/**\n * documentMode is an IE-only property\n * http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx\n */\nvar msie = document.documentMode;\n\nfunction urlParts(url) {\n var href = url;\n\n if (msie) {\n // Normalize before parse. Refer Implementation Notes on why this is\n // done in two steps on IE.\n urlParsingNode.setAttribute(\"href\", href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: utilities.isNotEmptyString(urlParsingNode.port)? urlParsingNode.port: 80,\n pathname: (urlParsingNode.pathname.charAt(0) === '/')\n ? urlParsingNode.pathname\n : '/' + urlParsingNode.pathname\n };\n}\n\n\n/**\n * This function accepts a query string (search part of a url) and returns a dictionary with\n * the different key value pairs\n * @param {string} qs queryString\n */\nfunction queryStringToObj(qs, cond) {\n var pairs, qsObj;\n\n cond = utilities.isFunction(cond)? cond : function() {\n return true;\n };\n\n qs = qs.trim().replace(/^\\?/, '');\n pairs = qs.split('&');\n qsObj = {};\n\n utilities.forEach(pairs, function (pair) {\n var keyValue, key, value;\n if (pair !== '') {\n keyValue = pair.split('=');\n key = keyValue[0];\n value = keyValue[1];\n if(cond(key, value)){\n qsObj[key] = value;\n }\n }\n });\n\n return qsObj;\n}\n\n/**\n * This function accepts an object and serializes it into a query string without the leading '?'\n * @param obj\n * @returns {string}\n */\nfunction objToQueryString(obj) {\n var pairs = [];\n utilities.forEach(obj, function (value, key) {\n pairs.push(key + '=' + value);\n });\n return pairs.join('&');\n}\n\nmodule.exports = {\n urlParts: urlParts,\n queryStringToObj: queryStringToObj,\n objToQueryString: objToQueryString\n};\n\n},{\"./utilityFunctions\":44}],44:[function(require,module,exports){\n/*jshint unused:false */\n\"use strict\";\n\nvar NODE_TYPE_ELEMENT = 1;\nvar SNAKE_CASE_REGEXP = /[A-Z]/g;\nvar EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i;\n/*jslint maxlen: 500 */\nvar ISO8086_REGEXP = /^([\\+-]?\\d{4}(?!\\d{2}\\b))((-?)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))?|W([0-4]\\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6])))([T\\s]((([01]\\d|2[0-3])((:?)[0-5]\\d)?|24\\:?00)([\\.,]\\d+(?!:))?)?(\\17[0-5]\\d([\\.,]\\d+)?)?([zZ]|([\\+-])([01]\\d|2[0-3]):?([0-5]\\d)?)?)?)?$/;\n\n\nfunction noop(){ }\n\nfunction isNull(o) {\n return o === null;\n}\n\nfunction isDefined(o){\n return o !== undefined;\n}\n\nfunction isUndefined(o){\n return o === undefined;\n}\n\nfunction isObject(obj) {\n return typeof obj === 'object';\n}\n\nfunction isFunction(str){\n return typeof str === 'function';\n}\n\nfunction isNumber(num){\n return typeof num === 'number';\n}\n\nfunction isWindow(obj) {\n return utilities.isObject(obj) && obj.window === obj;\n}\n\nfunction isArray(array){\n return Object.prototype.toString.call( array ) === '[object Array]';\n}\n\nfunction isArrayLike(obj) {\n if (obj === null || utilities.isWindow(obj) || utilities.isFunction(obj) || utilities.isUndefined(obj)) {\n return false;\n }\n\n var length = obj.length;\n\n if (obj.nodeType === NODE_TYPE_ELEMENT && length) {\n return true;\n }\n\n return utilities.isString(obj) || utilities.isArray(obj) || length === 0 ||\n typeof length === 'number' && length > 0 && (length - 1) in obj;\n}\n\nfunction isString(str){\n return typeof str === 'string';\n}\n\nfunction isEmptyString(str) {\n return utilities.isString(str) && str.length === 0;\n}\n\nfunction isNotEmptyString(str) {\n return utilities.isString(str) && str.length !== 0;\n}\n\nfunction arrayLikeObjToArray(args) {\n return Array.prototype.slice.call(args);\n}\n\nfunction forEach(obj, iterator, context) {\n var key, length;\n if (obj) {\n if (isFunction(obj)) {\n for (key in obj) {\n // Need to check if hasOwnProperty exists,\n // as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function\n if (key !== 'prototype' && key !== 'length' && key !== 'name' && (!obj.hasOwnProperty || obj.hasOwnProperty(key))) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n } else if (isArray(obj)) {\n var isPrimitive = typeof obj !== 'object';\n for (key = 0, length = obj.length; key < length; key++) {\n if (isPrimitive || key in obj) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n } else if (obj.forEach && obj.forEach !== forEach) {\n obj.forEach(iterator, context, obj);\n } else {\n for (key in obj) {\n if (obj.hasOwnProperty(key)) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n }\n }\n return obj;\n}\n\nfunction snake_case(name, separator) {\n separator = separator || '_';\n return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n}\n\nfunction isValidEmail(email){\n if(!utilities.isString(email)){\n return false;\n }\n\n return EMAIL_REGEXP.test(email.trim());\n}\n\nfunction extend (obj) {\n var arg, i, k;\n for (i = 1; i < arguments.length; i++) {\n arg = arguments[i];\n for (k in arg) {\n if (arg.hasOwnProperty(k)) {\n if(isObject(obj[k]) && !isNull(obj[k]) && isObject(arg[k])){\n obj[k] = extend({}, obj[k], arg[k]);\n }else {\n obj[k] = arg[k];\n }\n }\n }\n }\n return obj;\n}\n\nfunction capitalize(s){\n return s.charAt(0).toUpperCase() + s.slice(1);\n}\n\nfunction decapitalize(s) {\n return s.charAt(0).toLowerCase() + s.slice(1);\n}\n\n/**\n * This method works the same way array.prototype.map works but if the transformer returns undefine, then\n * it won't be added to the transformed Array.\n */\nfunction transformArray(array, transformer) {\n var transformedArray = [];\n\n array.forEach(function(item, index){\n var transformedItem = transformer(item, index);\n if(utilities.isDefined(transformedItem)) {\n transformedArray.push(transformedItem);\n }\n });\n\n return transformedArray;\n}\n\nfunction toFixedDigits(num, digits) {\n var formattedNum = num + '';\n digits = utilities.isNumber(digits) ? digits : 0;\n num = utilities.isNumber(num) ? num : parseInt(num, 10);\n if(utilities.isNumber(num) && !isNaN(num)){\n formattedNum = num + '';\n while(formattedNum.length < digits) {\n formattedNum = '0' + formattedNum;\n }\n return formattedNum;\n }\n return NaN + '';\n}\n\nfunction throttle(callback, delay) {\n var previousCall = new Date().getTime() - (delay + 1);\n return function() {\n var time = new Date().getTime();\n if ((time - previousCall) >= delay) {\n previousCall = time;\n callback.apply(this, arguments);\n }\n };\n}\n\nfunction debounce (callback, wait) {\n var timeoutId;\n\n return function (){\n if(timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(function(){\n callback.apply(this, arguments);\n timeoutId = undefined;\n }, wait);\n };\n}\n\n// a function designed to blow up the stack in a naive way\n// but it is ok for videoJs children components\nfunction treeSearch(root, getChildren, found){\n var children = getChildren(root);\n for (var i = 0; i < children.length; i++){\n if (found(children[i])) {\n return children[i];\n }\n else {\n var el = treeSearch(children[i], getChildren, found);\n if (el){\n return el;\n }\n }\n }\n}\n\nfunction echoFn(val) {\n return function () {\n return val;\n };\n}\n\n//Note: Supported formats come from http://www.w3.org/TR/NOTE-datetime\n// and the iso8601 regex comes from http://www.pelagodesign.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/\nfunction isISO8601(value) {\n if(utilities.isNumber(value)){\n value = value + ''; //we make sure that we are working with strings\n }\n\n if(!utilities.isString(value)){\n return false;\n }\n\n return ISO8086_REGEXP.test(value.trim());\n}\n\n/**\n * Checks if the Browser is IE9 and below\n * @returns {boolean}\n */\nfunction isOldIE() {\n var version = utilities.getInternetExplorerVersion(navigator);\n if (version === -1) {\n return false;\n }\n\n return version < 10;\n}\n\n/**\n * Returns the version of Internet Explorer or a -1 (indicating the use of another browser).\n * Source: https://msdn.microsoft.com/en-us/library/ms537509(v=vs.85).aspx\n * @returns {number} the version of Internet Explorer or a -1 (indicating the use of another browser).\n */\nfunction getInternetExplorerVersion(navigator) {\n var rv = -1;\n\n if (navigator.appName == 'Microsoft Internet Explorer') {\n var ua = navigator.userAgent;\n var re = new RegExp(\"MSIE ([0-9]{1,}[\\.0-9]{0,})\");\n var res = re.exec(ua);\n if (res !== null) {\n rv = parseFloat(res[1]);\n }\n }\n\n return rv;\n}\n\n/*** Mobile Utility functions ***/\nfunction isIDevice() {\n return /iP(hone|ad)/.test(utilities._UA);\n}\n\nfunction isMobile() {\n return /iP(hone|ad|od)|Android|Windows Phone/.test(utilities._UA);\n}\n\nfunction isIPhone() {\n return /iP(hone|od)/.test(utilities._UA);\n}\n\nfunction isAndroid() {\n return /Android/.test(utilities._UA);\n}\n\nvar utilities = {\n _UA: navigator.userAgent,\n noop: noop,\n isNull: isNull,\n isDefined: isDefined,\n isUndefined: isUndefined,\n isObject: isObject,\n isFunction: isFunction,\n isNumber: isNumber,\n isWindow: isWindow,\n isArray: isArray,\n isArrayLike: isArrayLike,\n isString: isString,\n isEmptyString: isEmptyString,\n isNotEmptyString: isNotEmptyString,\n arrayLikeObjToArray: arrayLikeObjToArray,\n forEach: forEach,\n snake_case: snake_case,\n isValidEmail: isValidEmail,\n extend: extend,\n capitalize: capitalize,\n decapitalize: decapitalize,\n transformArray: transformArray,\n toFixedDigits: toFixedDigits,\n throttle: throttle,\n debounce: debounce,\n treeSearch: treeSearch,\n echoFn: echoFn,\n isISO8601: isISO8601,\n isOldIE: isOldIE,\n getInternetExplorerVersion: getInternetExplorerVersion,\n isIDevice: isIDevice,\n isMobile: isMobile,\n isIPhone: isIPhone,\n isAndroid: isAndroid\n};\n\nmodule.exports = utilities;\n},{}],45:[function(require,module,exports){\n'use strict';\n\nvar utilities = require('./utilityFunctions');\n\nvar xml = {};\n\nxml.strToXMLDoc = function strToXMLDoc(stringContainingXMLSource){\n //IE 8\n if(typeof window.DOMParser === 'undefined'){\n var xmlDocument = new ActiveXObject('Microsoft.XMLDOM');\n xmlDocument.async = false;\n xmlDocument.loadXML(stringContainingXMLSource);\n return xmlDocument;\n }\n\n return parseString(stringContainingXMLSource);\n\n function parseString(stringContainingXMLSource){\n var parser = new DOMParser();\n var parsedDocument;\n\n //Note: This try catch is to deal with the fact that on IE parser.parseFromString does throw an error but the rest of the browsers don't.\n try {\n parsedDocument = parser.parseFromString(stringContainingXMLSource, \"application/xml\");\n\n if(isParseError(parsedDocument) || utilities.isEmptyString(stringContainingXMLSource)){\n throw new Error();\n }\n }catch(e){\n throw new Error(\"xml.strToXMLDOC: Error parsing the string: '\" + stringContainingXMLSource + \"'\");\n }\n\n return parsedDocument;\n }\n\n function isParseError(parsedDocument) {\n try { // parser and parsererrorNS could be cached on startup for efficiency\n var parser = new DOMParser(),\n erroneousParse = parser.parseFromString('INVALID', 'text/xml'),\n parsererrorNS = erroneousParse.getElementsByTagName(\"parsererror\")[0].namespaceURI;\n\n if (parsererrorNS === 'http://www.w3.org/1999/xhtml') {\n // In PhantomJS the parseerror element doesn't seem to have a special namespace, so we are just guessing here :(\n return parsedDocument.getElementsByTagName(\"parsererror\").length > 0;\n }\n\n return parsedDocument.getElementsByTagNameNS(parsererrorNS, 'parsererror').length > 0;\n } catch (e) {\n //Note on IE parseString throws an error by itself and it will never reach this code. Because it will have failed before\n }\n }\n};\n\nxml.parseText = function parseText (sValue) {\n if (/^\\s*$/.test(sValue)) { return null; }\n if (/^(?:true|false)$/i.test(sValue)) { return sValue.toLowerCase() === \"true\"; }\n if (isFinite(sValue)) { return parseFloat(sValue); }\n if (utilities.isISO8601(sValue)) { return new Date(sValue); }\n return sValue.trim();\n};\n\nxml.JXONTree = function JXONTree (oXMLParent) {\n var parseText = xml.parseText;\n\n //The document object is an especial object that it may miss some functions or attrs depending on the browser.\n //To prevent this problem with create the JXONTree using the root childNode which is a fully fleshed node on all supported\n //browsers.\n if(oXMLParent.documentElement){\n return new xml.JXONTree(oXMLParent.documentElement);\n }\n\n if (oXMLParent.hasChildNodes()) {\n var sCollectedTxt = \"\";\n for (var oNode, sProp, vContent, nItem = 0; nItem < oXMLParent.childNodes.length; nItem++) {\n oNode = oXMLParent.childNodes.item(nItem);\n /*jshint bitwise: false*/\n if ((oNode.nodeType - 1 | 1) === 3) { sCollectedTxt += oNode.nodeType === 3 ? oNode.nodeValue.trim() : oNode.nodeValue; }\n else if (oNode.nodeType === 1 && !oNode.prefix) {\n sProp = utilities.decapitalize(oNode.nodeName);\n vContent = new xml.JXONTree(oNode);\n if (this.hasOwnProperty(sProp)) {\n if (this[sProp].constructor !== Array) { this[sProp] = [this[sProp]]; }\n this[sProp].push(vContent);\n } else { this[sProp] = vContent; }\n }\n }\n if (sCollectedTxt) { this.keyValue = parseText(sCollectedTxt); }\n }\n\n //IE8 Stupid fix\n var hasAttr = typeof oXMLParent.hasAttributes === 'undefined'? oXMLParent.attributes.length > 0: oXMLParent.hasAttributes();\n if (hasAttr) {\n var oAttrib;\n for (var nAttrib = 0; nAttrib < oXMLParent.attributes.length; nAttrib++) {\n oAttrib = oXMLParent.attributes.item(nAttrib);\n this[\"@\" + utilities.decapitalize(oAttrib.name)] = parseText(oAttrib.value.trim());\n }\n }\n};\n\nxml.JXONTree.prototype.attr = function(attr) {\n return this['@' + utilities.decapitalize(attr)];\n};\n\nxml.toJXONTree = function toJXONTree(xmlString){\n var xmlDoc = xml.strToXMLDoc(xmlString);\n return new xml.JXONTree(xmlDoc);\n};\n\n/**\n * Helper function to extract the keyvalue of a JXONTree obj\n *\n * @param xmlObj {JXONTree}\n * return the key value or undefined;\n */\nxml.keyValue = function getKeyValue(xmlObj) {\n if(xmlObj){\n return xmlObj.keyValue;\n }\n return undefined;\n};\n\nxml.attr = function getAttrValue(xmlObj, attr) {\n if(xmlObj) {\n return xmlObj['@' + utilities.decapitalize(attr)];\n }\n return undefined;\n};\n\nxml.encode = function encodeXML(str) {\n return str.replace(/&/g, '&')\n .replace(//g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n};\n\nxml.decode = function decodeXML(str) {\n return str.replace(/'/g, \"'\")\n .replace(/"/g, '\"')\n .replace(/>/g, '>')\n .replace(/</g, '<')\n .replace(/&/g, '&');\n};\n\nmodule.exports = xml;\n},{\"./utilityFunctions\":44}],46:[function(require,module,exports){\n'use strict';\n\nrequire('./plugin/components/ads-label_4');\nrequire('./plugin/components/black-poster_4');\n\nvar videoJsVAST = require('./plugin/videojs.vast.vpaid');\n\nvideojs.plugin('vastClient', videoJsVAST);\n\n\n},{\"./plugin/components/ads-label_4\":35,\"./plugin/components/black-poster_4\":37,\"./plugin/videojs.vast.vpaid\":38}]},{},[46])\n\n","'use strict';\n\nlet IVPAIDAdUnit = require('./IVPAIDAdUnit').IVPAIDAdUnit;\nlet ALL_VPAID_METHODS = Object.getOwnPropertyNames(IVPAIDAdUnit.prototype).filter(function (property) {\n return ['constructor'].indexOf(property) === -1;\n});\n\nexport class VPAIDAdUnit extends IVPAIDAdUnit {\n constructor (flash) {\n super();\n this._destroyed = false;\n this._flash = flash;\n }\n\n _destroy() {\n this._destroyed = true;\n ALL_VPAID_METHODS.forEach((methodName) => {\n this._flash.removeCallbackByMethodName(methodName);\n });\n IVPAIDAdUnit.EVENTS.forEach((event) => {\n this._flash.offEvent(event);\n });\n\n this._flash = null;\n }\n\n isDestroyed () {\n return this._destroyed;\n }\n\n on(eventName, callback) {\n this._flash.on(eventName, callback);\n }\n\n off(eventName, callback) {\n this._flash.off(eventName, callback);\n }\n\n //VPAID interface\n handshakeVersion(playerVPAIDVersion = '2.0', callback = undefined) {\n this._flash.callFlashMethod('handshakeVersion', [playerVPAIDVersion], callback);\n }\n initAd (width, height, viewMode, desiredBitrate, creativeData = {AdParameters: ''}, environmentVars = {flashVars: ''}, callback = undefined) {\n //resize element that has the flash object\n this._flash.setSize(width, height);\n creativeData = creativeData || {AdParameters: ''};\n environmentVars = environmentVars || {flashVars: ''};\n\n this._flash.callFlashMethod('initAd', [this._flash.getWidth(), this._flash.getHeight(), viewMode, desiredBitrate, creativeData.AdParameters || '', environmentVars.flashVars || ''], callback);\n }\n resizeAd(width, height, viewMode, callback = undefined) {\n //resize element that has the flash object\n this._flash.setSize(width, height);\n\n //resize ad inside the flash\n this._flash.callFlashMethod('resizeAd', [this._flash.getWidth(), this._flash.getHeight(), viewMode], callback);\n }\n startAd(callback = undefined) {\n this._flash.callFlashMethod('startAd', [], callback);\n }\n stopAd(callback = undefined) {\n this._flash.callFlashMethod('stopAd', [], callback);\n }\n pauseAd(callback = undefined) {\n this._flash.callFlashMethod('pauseAd', [], callback);\n }\n resumeAd(callback = undefined) {\n this._flash.callFlashMethod('resumeAd', [], callback);\n }\n expandAd(callback = undefined) {\n this._flash.callFlashMethod('expandAd', [], callback);\n }\n collapseAd(callback = undefined) {\n this._flash.callFlashMethod('collapseAd', [], callback);\n }\n skipAd(callback = undefined) {\n this._flash.callFlashMethod('skipAd', [], callback);\n }\n\n //properties that will be treat as async methods\n getAdLinear(callback) {\n this._flash.callFlashMethod('getAdLinear', [], callback);\n }\n getAdWidth(callback) {\n this._flash.callFlashMethod('getAdWidth', [], callback);\n }\n getAdHeight(callback) {\n this._flash.callFlashMethod('getAdHeight', [], callback);\n }\n getAdExpanded(callback) {\n this._flash.callFlashMethod('getAdExpanded', [], callback);\n }\n getAdSkippableState(callback) {\n this._flash.callFlashMethod('getAdSkippableState', [], callback);\n }\n getAdRemainingTime(callback) {\n this._flash.callFlashMethod('getAdRemainingTime', [], callback);\n }\n getAdDuration(callback) {\n this._flash.callFlashMethod('getAdDuration', [], callback);\n }\n setAdVolume(volume, callback = undefined) {\n this._flash.callFlashMethod('setAdVolume', [volume], callback);\n }\n getAdVolume(callback) {\n this._flash.callFlashMethod('getAdVolume', [], callback);\n }\n getAdCompanions(callback) {\n this._flash.callFlashMethod('getAdCompanions', [], callback);\n }\n getAdIcons(callback) {\n this._flash.callFlashMethod('getAdIcons', [], callback);\n }\n}\n\n","'use strict';\n\nconst JSFlashBridge = require('./jsFlashBridge').JSFlashBridge;\nconst VPAIDAdUnit = require('./VPAIDAdUnit').VPAIDAdUnit;\n\nconst noop = require('./utils').noop;\nconst callbackTimeout = require('./utils').callbackTimeout;\nconst isPositiveInt = require('./utils').isPositiveInt;\nconst createElementWithID = require('./utils').createElementWithID;\nconst uniqueVPAID = require('./utils').unique('vpaid');\nconst createFlashTester = require('./flashTester.js').createFlashTester;\n\nconst ERROR = 'error';\nconst FLASH_VERSION = '10.1.0';\n\nlet flashTester = {isSupported: ()=> true}; // if the runFlashTest is not run the flashTester will always return true\n\nclass VPAIDFLASHClient {\n constructor (vpaidParentEl, callback, swfConfig = {data: 'VPAIDFlash.swf', width: 800, height: 400}, params = { wmode: 'transparent', salign: 'tl', align: 'left', allowScriptAccess: 'always', scale: 'noScale', allowFullScreen: 'true', quality: 'high'}, vpaidOptions = { debug: false, timeout: 10000 }) {\n\n if (!VPAIDFLASHClient.hasExternalDependencies()) {\n return onError('no swfobject in global scope. check: https://github.com/swfobject/swfobject or https://code.google.com/p/swfobject/');\n }\n\n this._vpaidParentEl = vpaidParentEl;\n this._flashID = uniqueVPAID();\n this._destroyed = false;\n callback = callback || noop;\n\n swfConfig.width = isPositiveInt(swfConfig.width, 800);\n swfConfig.height = isPositiveInt(swfConfig.height, 400);\n\n createElementWithID(vpaidParentEl, this._flashID, true);\n\n params.movie = swfConfig.data;\n params.FlashVars = `flashid=${this._flashID}&handler=${JSFlashBridge.VPAID_FLASH_HANDLER}&debug=${vpaidOptions.debug}&salign=${params.salign}`;\n\n if (!VPAIDFLASHClient.isSupported()) {\n return onError('user don\\'t support flash or doesn\\'t have the minimum required version of flash ' + FLASH_VERSION);\n }\n\n this.el = swfobject.createSWF(swfConfig, params, this._flashID);\n\n if (!this.el) {\n return onError( 'swfobject failed to create object in element' );\n }\n\n var handler = callbackTimeout(vpaidOptions.timeout,\n (err, data) => {\n $loadPendedAdUnit.call(this);\n callback(err, data);\n }, () => {\n callback('vpaid flash load timeout ' + vpaidOptions.timeout);\n }\n );\n\n this._flash = new JSFlashBridge(this.el, swfConfig.data, this._flashID, swfConfig.width, swfConfig.height, handler);\n\n function onError(error) {\n setTimeout(() => {\n callback(new Error(error));\n }, 0);\n return this;\n }\n\n }\n\n destroy () {\n this._destroyAdUnit();\n\n if (this._flash) {\n this._flash.destroy();\n this._flash = null;\n }\n this.el = null;\n this._destroyed = true;\n }\n\n isDestroyed () {\n return this._destroyed;\n }\n\n _destroyAdUnit() {\n delete this._loadLater;\n\n if (this._adUnitLoad) {\n this._adUnitLoad = null;\n this._flash.removeCallback(this._adUnitLoad);\n }\n\n if (this._adUnit) {\n this._adUnit._destroy();\n this._adUnit = null;\n }\n }\n\n loadAdUnit(adURL, callback) {\n $throwIfDestroyed.call(this);\n\n if (this._adUnit) {\n this._destroyAdUnit();\n }\n\n if (this._flash.isReady()) {\n this._adUnitLoad = (err, message) => {\n if (!err) {\n this._adUnit = new VPAIDAdUnit(this._flash);\n }\n this._adUnitLoad = null;\n callback(err, this._adUnit);\n };\n\n this._flash.callFlashMethod('loadAdUnit', [adURL], this._adUnitLoad);\n }else {\n this._loadLater = {url: adURL, callback};\n }\n }\n\n unloadAdUnit(callback = undefined) {\n $throwIfDestroyed.call(this);\n\n this._destroyAdUnit();\n this._flash.callFlashMethod('unloadAdUnit', [], callback);\n }\n getFlashID() {\n $throwIfDestroyed.call(this);\n return this._flash.getFlashID();\n }\n getFlashURL() {\n $throwIfDestroyed.call(this);\n return this._flash.getFlashURL();\n }\n}\n\nsetStaticProperty('isSupported', () => {\n return VPAIDFLASHClient.hasExternalDependencies() && swfobject.hasFlashPlayerVersion(FLASH_VERSION) && flashTester.isSupported();\n}, true);\n\nsetStaticProperty('hasExternalDependencies', () => {\n return !!window.swfobject;\n});\n\nsetStaticProperty('runFlashTest', (swfConfig) => {\n flashTester = createFlashTester(document.body, swfConfig);\n});\n\nfunction $throwIfDestroyed() {\n if(this._destroyed) {\n throw new Error('VPAIDFlashToJS is destroyed!');\n }\n}\n\nfunction $loadPendedAdUnit() {\n if (this._loadLater) {\n this.loadAdUnit(this._loadLater.url, this._loadLater.callback);\n delete this._loadLater;\n }\n}\n\nfunction setStaticProperty(propertyName, value, writable = false) {\n Object.defineProperty(VPAIDFLASHClient, propertyName, {\n writable: writable,\n configurable: false,\n value: value\n });\n}\n\nmodule.exports = VPAIDFLASHClient;\n","'use strict';\n\nconst FLASH_TEST = 'vpaid_video_flash_tester';\nconst FLASH_TEST_EL = 'vpaid_video_flash_tester_el';\nconst JSFlashBridge = require('./jsFlashBridge').JSFlashBridge;\nconst utils = require('./utils');\nconst MultipleValuesRegistry = require('./registry').MultipleValuesRegistry;\n\nclass FlashTester {\n constructor(parent, swfConfig = {data: 'VPAIDFlash.swf', width: 800, height: 400}) {\n this.parentEl = utils.createElementWithID(parent, FLASH_TEST_EL); // some browsers create global variables using the element id http://stackoverflow.com/questions/3434278/do-dom-tree-elements-with-ids-become-global-variables\n utils.hideFlashEl(this.parentEl);\n var params = {};\n params.movie = swfConfig.data;\n params.FlashVars = `flashid=${FLASH_TEST_EL}&handler=${JSFlashBridge.VPAID_FLASH_HANDLER}`;\n\n this.el = swfobject.createSWF(swfConfig, params, FLASH_TEST_EL);\n this._handlers = new MultipleValuesRegistry();\n this._isSupported = false;\n if (this.el) {\n utils.hideFlashEl(this.el);\n this._flash = new JSFlashBridge(this.el, swfConfig.data, FLASH_TEST_EL, 400, 400, ()=> {\n const support = true;\n this._isSupported = support;\n this._handlers.get('change').forEach((callback) => {\n setTimeout(()=> {\n callback('change', support);\n }, 0);\n });\n });\n }\n }\n isSupported() {\n return this._isSupported;\n }\n on(eventName, callback) {\n this._handlers.add(eventName, callback);\n }\n}\n\nexport var createFlashTester = function createFlashTester(el, swfConfig) {\n if (!window[FLASH_TEST]) {\n window[FLASH_TEST] = new FlashTester(el, swfConfig);\n }\n return window[FLASH_TEST];\n};\n","'use strict';\n\nlet unique = require('./utils').unique;\nlet isPositiveInt = require('./utils').isPositiveInt;\nlet stringEndsWith = require('./utils').stringEndsWith;\nlet SingleValueRegistry = require('./registry').SingleValueRegistry;\nlet MultipleValuesRegistry = require('./registry').MultipleValuesRegistry;\nconst registry = require('./jsFlashBridgeRegistry');\nconst VPAID_FLASH_HANDLER = 'vpaid_video_flash_handler';\nconst ERROR = 'AdError';\n\nexport class JSFlashBridge {\n constructor (el, flashURL, flashID, width, height, loadHandShake) {\n this._el = el;\n this._flashID = flashID;\n this._flashURL = flashURL;\n this._width = width;\n this._height = height;\n this._handlers = new MultipleValuesRegistry();\n this._callbacks = new SingleValueRegistry();\n this._uniqueMethodIdentifier = unique(this._flashID);\n this._ready = false;\n this._handShakeHandler = loadHandShake;\n\n registry.addInstance(this._flashID, this);\n }\n\n on(eventName, callback) {\n this._handlers.add(eventName, callback);\n }\n\n off(eventName, callback) {\n return this._handlers.remove(eventName, callback);\n }\n\n offEvent(eventName) {\n return this._handlers.removeByKey(eventName);\n }\n\n offAll() {\n return this._handlers.removeAll();\n }\n\n callFlashMethod(methodName, args = [], callback = undefined) {\n var callbackID = '';\n // if no callback, some methods the return is void so they don't need callback\n if (callback) {\n callbackID = `${this._uniqueMethodIdentifier()}_${methodName}`;\n this._callbacks.add(callbackID, callback);\n }\n\n\n try {\n //methods are created by ExternalInterface.addCallback in as3 code, if for some reason it failed\n //this code will throw an error\n this._el[methodName]([callbackID].concat(args));\n\n } catch (e) {\n if (callback) {\n $asyncCallback.call(this, callbackID, e);\n } else {\n\n //if there isn't any callback to return error use error event handler\n this._trigger(ERROR, e);\n }\n }\n }\n\n removeCallback(callback) {\n return this._callbacks.removeByValue(callback);\n }\n\n removeCallbackByMethodName(suffix) {\n this._callbacks.filterKeys((key) => {\n return stringEndsWith(key, suffix);\n }).forEach((key) => {\n this._callbacks.remove(key);\n });\n }\n\n removeAllCallbacks() {\n return this._callbacks.removeAll();\n }\n\n _trigger(eventName, event) {\n this._handlers.get(eventName).forEach((callback) => {\n //clickThru has to be sync, if not will be block by the popupblocker\n if (eventName === 'AdClickThru') {\n callback(event);\n } else {\n setTimeout(() => {\n if (this._handlers.get(eventName).length > 0) {\n callback(event);\n }\n }, 0);\n }\n });\n }\n\n _callCallback(methodName, callbackID, err, result) {\n\n let callback = this._callbacks.get(callbackID);\n\n //not all methods callback's are mandatory\n //but if there exist an error, fire the error event\n if (!callback) {\n if (err && callbackID === '') {\n this.trigger(ERROR, err);\n }\n return;\n }\n\n $asyncCallback.call(this, callbackID, err, result);\n\n }\n\n _handShake(err, data) {\n this._ready = true;\n if (this._handShakeHandler) {\n this._handShakeHandler(err, data);\n delete this._handShakeHandler;\n }\n }\n\n //methods like properties specific to this implementation of VPAID\n getSize() {\n return {width: this._width, height: this._height};\n }\n setSize(newWidth, newHeight) {\n this._width = isPositiveInt(newWidth, this._width);\n this._height = isPositiveInt(newHeight, this._height);\n this._el.setAttribute('width', this._width);\n this._el.setAttribute('height', this._height);\n }\n getWidth() {\n return this._width;\n }\n setWidth(newWidth) {\n this.setSize(newWidth, this._height);\n }\n getHeight() {\n return this._height;\n }\n setHeight(newHeight) {\n this.setSize(this._width, newHeight);\n }\n getFlashID() {\n return this._flashID;\n }\n getFlashURL() {\n return this._flashURL;\n }\n isReady() {\n return this._ready;\n }\n destroy() {\n this.offAll();\n this.removeAllCallbacks();\n registry.removeInstanceByID(this._flashID);\n if (this._el.parentElement) {\n this._el.parentElement.removeChild(this._el);\n }\n }\n}\n\nfunction $asyncCallback(callbackID, err, result) {\n setTimeout(() => {\n let callback = this._callbacks.get(callbackID);\n if (callback) {\n this._callbacks.remove(callbackID);\n callback(err, result);\n }\n }, 0);\n}\n\nObject.defineProperty(JSFlashBridge, 'VPAID_FLASH_HANDLER', {\n writable: false,\n configurable: false,\n value: VPAID_FLASH_HANDLER\n});\n\n/**\n * External interface handler\n *\n * @param {string} flashID identifier of the flash who call this\n * @param {string} typeID what type of message is, can be 'event' or 'callback'\n * @param {string} typeName if the typeID is a event the typeName will be the eventName, if is a callback the typeID is the methodName that is related this callback\n * @param {string} callbackID only applies when the typeID is 'callback', identifier of the callback to call\n * @param {object} error error object\n * @param {object} data\n */\nwindow[VPAID_FLASH_HANDLER] = (flashID, typeID, typeName, callbackID, error, data) => {\n let instance = registry.getInstanceByID(flashID);\n if (!instance) return;\n if (typeName === 'handShake') {\n instance._handShake(error, data);\n } else {\n if (typeID !== 'event') {\n instance._callCallback(typeName, callbackID, error, data);\n } else {\n instance._trigger(typeName, data);\n }\n }\n};\n\n","'use strict';\n\nlet SingleValueRegistry = require('./registry').SingleValueRegistry;\nlet instances = new SingleValueRegistry();\n\nconst JSFlashBridgeRegistry = {};\nObject.defineProperty(JSFlashBridgeRegistry, 'addInstance', {\n writable: false,\n configurable: false,\n value: function (id, instance) {\n instances.add(id, instance);\n }\n});\n\nObject.defineProperty(JSFlashBridgeRegistry, 'getInstanceByID', {\n writable: false,\n configurable: false,\n value: function (id) {\n return instances.get(id);\n }\n});\n\nObject.defineProperty(JSFlashBridgeRegistry, 'removeInstanceByID', {\n writable: false,\n configurable: false,\n value: function (id) {\n return instances.remove(id);\n }\n});\n\nmodule.exports = JSFlashBridgeRegistry;\n\n","'use strict';\n\nexport class MultipleValuesRegistry {\n constructor () {\n this._registries = {};\n }\n add (id, value) {\n if (!this._registries[id]) {\n this._registries[id] = [];\n }\n if (this._registries[id].indexOf(value) === -1) {\n this._registries[id].push(value);\n }\n }\n get (id) {\n return this._registries[id] || [];\n }\n filterKeys (handler) {\n return Object.keys(this._registries).filter(handler);\n }\n findByValue (value) {\n var keys = Object.keys(this._registries).filter((key) => {\n return this._registries[key].indexOf(value) !== -1;\n });\n\n return keys;\n }\n remove(key, value) {\n if (!this._registries[key]) { return; }\n\n var index = this._registries[key].indexOf(value);\n\n if (index < 0) { return; }\n return this._registries[key].splice(index, 1);\n }\n removeByKey (id) {\n let old = this._registries[id];\n delete this._registries[id];\n return old;\n }\n removeByValue (value) {\n let keys = this.findByValue(value);\n return keys.map((key) => {\n return this.remove(key, value);\n });\n }\n removeAll() {\n let old = this._registries;\n this._registries = {};\n return old;\n }\n size() {\n return Object.keys(this._registries).length;\n }\n}\n\nexport class SingleValueRegistry {\n constructor () {\n this._registries = {};\n }\n add (id, value) {\n this._registries[id] = value;\n }\n get (id) {\n return this._registries[id];\n }\n filterKeys (handler) {\n return Object.keys(this._registries).filter(handler);\n }\n findByValue (value) {\n var keys = Object.keys(this._registries).filter((key) => {\n return this._registries[key] === value;\n });\n\n return keys;\n }\n remove (id) {\n let old = this._registries[id];\n delete this._registries[id];\n return old;\n }\n removeByValue (value) {\n let keys = this.findByValue(value);\n return keys.map((key) => {\n return this.remove(key);\n });\n }\n removeAll() {\n let old = this._registries;\n this._registries = {};\n return old;\n }\n size() {\n return Object.keys(this._registries).length;\n }\n}\n\n","'use strict';\n\nexport function unique(prefix) {\n let count = -1;\n return f => {\n return `${prefix}_${++count}`;\n };\n}\n\nexport function noop() {\n}\n\n\nexport function callbackTimeout(timer, onSuccess, onTimeout) {\n\n let timeout = setTimeout(() => {\n\n onSuccess = noop;\n onTimeout();\n\n }, timer);\n\n return function () {\n clearTimeout(timeout);\n onSuccess.apply(this, arguments);\n };\n}\n\n\nexport function createElementWithID(parent, id, cleanContent = false) {\n var nEl = document.createElement('div');\n nEl.id = id;\n if (cleanContent) {\n parent.innerHTML = '';\n }\n parent.appendChild(nEl);\n return nEl;\n}\n\nexport function isPositiveInt(newVal, oldVal) {\n return !isNaN(parseFloat(newVal)) && isFinite(newVal) && newVal > 0 ? newVal : oldVal;\n}\n\nlet endsWith = (function () {\n if (String.prototype.endsWith) return String.prototype.endsWith;\n return function endsWith (searchString, position) {\n var subjectString = this.toString();\n if (position === undefined || position > subjectString.length) {\n position = subjectString.length;\n }\n position -= searchString.length;\n var lastIndex = subjectString.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n };\n})();\n\nexport function stringEndsWith(string, search) {\n return endsWith.call(string, search);\n}\n\nexport function hideFlashEl(el) {\n // can't use display none because will not run the flash\n el.style.position = 'absolute';\n el.style.left = '-1px';\n el.style.top = '-1px';\n el.style.width = '1px';\n el.style.height = '1px';\n el.style.visibility = 'hidden';\n}\n","'use strict';\n\nvar METHODS = [\n 'handshakeVersion',\n 'initAd',\n 'startAd',\n 'stopAd',\n 'skipAd', // VPAID 2.0 new method\n 'resizeAd',\n 'pauseAd',\n 'resumeAd',\n 'expandAd',\n 'collapseAd',\n 'subscribe',\n 'unsubscribe'\n];\n\nvar EVENTS = [\n 'AdLoaded',\n 'AdStarted',\n 'AdStopped',\n 'AdSkipped',\n 'AdSkippableStateChange', // VPAID 2.0 new event\n 'AdSizeChange', // VPAID 2.0 new event\n 'AdLinearChange',\n 'AdDurationChange', // VPAID 2.0 new event\n 'AdExpandedChange',\n 'AdRemainingTimeChange', // [Deprecated in 2.0] but will be still fired for backwards compatibility\n 'AdVolumeChange',\n 'AdImpression',\n 'AdVideoStart',\n 'AdVideoFirstQuartile',\n 'AdVideoMidpoint',\n 'AdVideoThirdQuartile',\n 'AdVideoComplete',\n 'AdClickThru',\n 'AdInteraction', // VPAID 2.0 new event\n 'AdUserAcceptInvitation',\n 'AdUserMinimize',\n 'AdUserClose',\n 'AdPaused',\n 'AdPlaying',\n 'AdLog',\n 'AdError'\n];\n\nvar GETTERS = [\n 'getAdLinear',\n 'getAdWidth', // VPAID 2.0 new getter\n 'getAdHeight', // VPAID 2.0 new getter\n 'getAdExpanded',\n 'getAdSkippableState', // VPAID 2.0 new getter\n 'getAdRemainingTime',\n 'getAdDuration', // VPAID 2.0 new getter\n 'getAdVolume',\n 'getAdCompanions', // VPAID 2.0 new getter\n 'getAdIcons' // VPAID 2.0 new getter\n];\n\nvar SETTERS = [\n 'setAdVolume'\n];\n\n\n/**\n * This callback is displayed as global member. The callback use nodejs error-first callback style\n * @callback NodeStyleCallback\n * @param {string|null}\n * @param {undefined|object}\n */\n\n\n/**\n * IVPAIDAdUnit\n *\n * @class\n *\n * @param {object} creative\n * @param {HTMLElement} el\n * @param {HTMLVideoElement} video\n */\nfunction IVPAIDAdUnit(creative, el, video) {}\n\n\n/**\n * handshakeVersion\n *\n * @param {string} VPAIDVersion\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.handshakeVersion = function (VPAIDVersion, callback) {};\n\n/**\n * initAd\n *\n * @param {number} width\n * @param {number} height\n * @param {string} viewMode can be 'normal', 'thumbnail' or 'fullscreen'\n * @param {number} desiredBitrate indicates the desired bitrate in kbps\n * @param {object} [creativeData] used for additional initialization data\n * @param {object} [environmentVars] used for passing implementation-specific of js version\n * @param {NodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.initAd = function(width, height, viewMode, desiredBitrate, creativeData, environmentVars, callback) {};\n\n/**\n * startAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.startAd = function(callback) {};\n\n/**\n * stopAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.stopAd = function(callback) {};\n\n/**\n * skipAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.skipAd = function(callback) {};\n\n/**\n * resizeAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.resizeAd = function(width, height, viewMode, callback) {};\n\n/**\n * pauseAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.pauseAd = function(callback) {};\n\n/**\n * resumeAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.resumeAd = function(callback) {};\n\n/**\n * expandAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.expandAd = function(callback) {};\n\n/**\n * collapseAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.collapseAd = function(callback) {};\n\n/**\n * subscribe\n *\n * @param {string} event\n * @param {nodeStyleCallback} handler\n * @param {object} context\n */\nIVPAIDAdUnit.prototype.subscribe = function(event, handler, context) {};\n\n/**\n * startAd\n *\n * @param {string} event\n * @param {function} handler\n */\nIVPAIDAdUnit.prototype.unsubscribe = function(event, handler) {};\n\n\n\n/**\n * getAdLinear\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdLinear = function(callback) {};\n\n/**\n * getAdWidth\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdWidth = function(callback) {};\n\n/**\n * getAdHeight\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdHeight = function(callback) {};\n\n/**\n * getAdExpanded\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdExpanded = function(callback) {};\n\n/**\n * getAdSkippableState\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdSkippableState = function(callback) {};\n\n/**\n * getAdRemainingTime\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdRemainingTime = function(callback) {};\n\n/**\n * getAdDuration\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdDuration = function(callback) {};\n\n/**\n * getAdVolume\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdVolume = function(callback) {};\n\n/**\n * getAdCompanions\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdCompanions = function(callback) {};\n\n/**\n * getAdIcons\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdIcons = function(callback) {};\n\n/**\n * setAdVolume\n *\n * @param {number} volume\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.setAdVolume = function(volume, callback) {};\n\naddStaticToInterface(IVPAIDAdUnit, 'METHODS', METHODS);\naddStaticToInterface(IVPAIDAdUnit, 'GETTERS', GETTERS);\naddStaticToInterface(IVPAIDAdUnit, 'SETTERS', SETTERS);\naddStaticToInterface(IVPAIDAdUnit, 'EVENTS', EVENTS);\n\n\nvar VPAID1_METHODS = METHODS.filter(function(method) {\n return ['skipAd'].indexOf(method) === -1;\n});\n\naddStaticToInterface(IVPAIDAdUnit, 'checkVPAIDInterface', function checkVPAIDInterface (creative) {\n var result = VPAID1_METHODS.every(function(key) {\n return typeof creative[key] === 'function';\n });\n return result;\n});\n\nmodule.exports = IVPAIDAdUnit;\n\nfunction addStaticToInterface(Interface, name, value) {\n Object.defineProperty(Interface, name, {\n writable: false,\n configurable: false,\n value: value\n });\n}\n\n","'use strict';\n\nvar IVPAIDAdUnit = require('./IVPAIDAdUnit');\nvar Subscriber = require('./subscriber');\nvar checkVPAIDInterface = IVPAIDAdUnit.checkVPAIDInterface;\nvar utils = require('./utils');\nvar METHODS = IVPAIDAdUnit.METHODS;\nvar ERROR = 'AdError';\nvar AD_CLICK = 'AdClickThru';\nvar FILTERED_EVENTS = IVPAIDAdUnit.EVENTS.filter(function (event) {\n return event != AD_CLICK;\n});\n\n/**\n * This callback is displayed as global member. The callback use nodejs error-first callback style\n * @callback NodeStyleCallback\n * @param {string|null}\n * @param {undefined|object}\n */\n\n\n/**\n * VPAIDAdUnit\n * @class\n *\n * @param VPAIDCreative\n * @param {HTMLElement} [el] this will be used in initAd environmentVars.slot if defined\n * @param {HTMLVideoElement} [video] this will be used in initAd environmentVars.videoSlot if defined\n */\nfunction VPAIDAdUnit(VPAIDCreative, el, video, iframe) {\n this._isValid = checkVPAIDInterface(VPAIDCreative);\n if (this._isValid) {\n this._creative = VPAIDCreative;\n this._el = el;\n this._videoEl = video;\n this._iframe = iframe;\n this._subscribers = new Subscriber();\n $addEventsSubscribers.call(this);\n }\n}\n\nVPAIDAdUnit.prototype = Object.create(IVPAIDAdUnit.prototype);\n\n/**\n * isValidVPAIDAd will return if the VPAIDCreative passed in constructor is valid or not\n *\n * @return {boolean}\n */\nVPAIDAdUnit.prototype.isValidVPAIDAd = function isValidVPAIDAd() {\n return this._isValid;\n};\n\nIVPAIDAdUnit.METHODS.forEach(function(method) {\n //NOTE: this methods arguments order are implemented differently from the spec\n var ignores = [\n 'subscribe',\n 'unsubscribe',\n 'initAd'\n ];\n\n if (ignores.indexOf(method) !== -1) return;\n\n VPAIDAdUnit.prototype[method] = function () {\n var ariaty = IVPAIDAdUnit.prototype[method].length;\n // TODO avoid leaking arguments\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n var args = Array.prototype.slice.call(arguments);\n var callback = (ariaty === args.length) ? args.pop() : undefined;\n\n setTimeout(function () {\n var result, error = null;\n try {\n result = this._creative[method].apply(this._creative, args);\n } catch(e) {\n error = e;\n }\n\n callOrTriggerEvent(callback, this._subscribers, error, result);\n }.bind(this), 0);\n };\n});\n\n\n/**\n * initAd concreate implementation\n *\n * @param {number} width\n * @param {number} height\n * @param {string} viewMode can be 'normal', 'thumbnail' or 'fullscreen'\n * @param {number} desiredBitrate indicates the desired bitrate in kbps\n * @param {object} [creativeData] used for additional initialization data\n * @param {object} [environmentVars] used for passing implementation-specific of js version, if el & video was used in constructor slot & videoSlot will be added to the object\n * @param {NodeStyleCallback} callback\n */\nVPAIDAdUnit.prototype.initAd = function initAd(width, height, viewMode, desiredBitrate, creativeData, environmentVars, callback) {\n creativeData = creativeData || {};\n environmentVars = utils.extend({\n slot: this._el,\n videoSlot: this._videoEl\n }, environmentVars || {});\n\n setTimeout(function () {\n var error;\n try {\n this._creative.initAd(width, height, viewMode, desiredBitrate, creativeData, environmentVars);\n } catch (e) {\n error = e;\n }\n\n callOrTriggerEvent(callback, this._subscribers, error);\n }.bind(this), 0);\n};\n\n/**\n * subscribe\n *\n * @param {string} event\n * @param {nodeStyleCallback} handler\n * @param {object} context\n */\nVPAIDAdUnit.prototype.subscribe = function subscribe(event, handler, context) {\n this._subscribers.subscribe(handler, event, context);\n};\n\n\n/**\n * unsubscribe\n *\n * @param {string} event\n * @param {nodeStyleCallback} handler\n */\nVPAIDAdUnit.prototype.unsubscribe = function unsubscribe(event, handler) {\n this._subscribers.unsubscribe(handler, event);\n};\n\n//alias\nVPAIDAdUnit.prototype.on = VPAIDAdUnit.prototype.subscribe;\nVPAIDAdUnit.prototype.off = VPAIDAdUnit.prototype.unsubscribe;\n\nIVPAIDAdUnit.GETTERS.forEach(function(getter) {\n VPAIDAdUnit.prototype[getter] = function (callback) {\n setTimeout(function () {\n\n var result, error = null;\n try {\n result = this._creative[getter]();\n } catch(e) {\n error = e;\n }\n\n callOrTriggerEvent(callback, this._subscribers, error, result);\n }.bind(this), 0);\n };\n});\n\n/**\n * setAdVolume\n *\n * @param volume\n * @param {nodeStyleCallback} callback\n */\nVPAIDAdUnit.prototype.setAdVolume = function setAdVolume(volume, callback) {\n setTimeout(function () {\n\n var result, error = null;\n try {\n this._creative.setAdVolume(volume);\n result = this._creative.getAdVolume();\n } catch(e) {\n error = e;\n }\n\n if (!error) {\n error = utils.validate(result === volume, 'failed to apply volume: ' + volume);\n }\n callOrTriggerEvent(callback, this._subscribers, error, result);\n }.bind(this), 0);\n};\n\nVPAIDAdUnit.prototype._destroy = function destroy() {\n this.stopAd();\n this._subscribers.unsubscribeAll();\n};\n\nfunction $addEventsSubscribers() {\n // some ads implement\n // so they only handle one subscriber\n // to handle this we create our one\n FILTERED_EVENTS.forEach(function (event) {\n this._creative.subscribe($trigger.bind(this, event), event);\n }.bind(this));\n\n // map the click event to be an object instead of depending of the order of the arguments\n // and to be consistent with the flash\n this._creative.subscribe($clickThruHook.bind(this), AD_CLICK);\n\n // because we are adding the element inside the iframe\n // the user is not able to click in the video\n if (this._videoEl) {\n var documentElement = this._iframe.contentDocument.documentElement;\n var videoEl = this._videoEl;\n documentElement.addEventListener('click', function(e) {\n if (e.target === documentElement) {\n videoEl.click();\n }\n });\n }\n}\n\nfunction $clickThruHook(url, id, playerHandles) {\n this._subscribers.triggerSync(AD_CLICK, {url: url, id: id, playerHandles: playerHandles});\n}\n\nfunction $trigger(event) {\n // TODO avoid leaking arguments\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n this._subscribers.trigger(event, Array.prototype.slice(arguments, 1));\n}\n\nfunction callOrTriggerEvent(callback, subscribers, error, result) {\n if (callback) {\n callback(error, result);\n } else if (error) {\n subscribers.trigger(ERROR, error);\n }\n}\n\nmodule.exports = VPAIDAdUnit;\n\n","'use strict';\n\nvar utils = require('./utils');\nvar unique = utils.unique('vpaidIframe');\nvar VPAIDAdUnit = require('./VPAIDAdUnit');\n\nvar defaultTemplate = '' +\n '' +\n '' +\n '
' +\n '' +\n '' +\n '' +\n '';\n\nvar AD_STOPPED = 'AdStopped';\n\n/**\n * This callback is displayed as global member. The callback use nodejs error-first callback style\n * @callback NodeStyleCallback\n * @param {string|null}\n * @param {undefined|object}\n */\n\n/**\n * VPAIDHTML5Client\n * @class\n *\n * @param {HTMLElement} el that will contain the iframe to load adUnit and a el to add to adUnit slot\n * @param {HTMLVideoElement} video default video element to be used by adUnit\n * @param {object} [templateConfig] template: html template to be used instead of the default, extraOptions: to be used when rendering the template\n * @param {object} [vpaidOptions] timeout: when loading adUnit\n */\nfunction VPAIDHTML5Client(el, video, templateConfig, vpaidOptions) {\n templateConfig = templateConfig || {};\n\n this._id = unique();\n this._destroyed = false;\n\n this._frameContainer = utils.createElementInEl(el, 'div');\n this._videoEl = video;\n this._vpaidOptions = vpaidOptions || {timeout: 10000};\n\n this._templateConfig = {\n template: templateConfig.template || defaultTemplate,\n extraOptions: templateConfig.extraOptions || {}\n };\n}\n\n/**\n * destroy\n *\n */\nVPAIDHTML5Client.prototype.destroy = function destroy() {\n if (this._destroyed) {\n return;\n }\n this._destroyed = true;\n $unloadPreviousAdUnit.call(this);\n};\n\n/**\n * isDestroyed\n *\n * @return {boolean}\n */\nVPAIDHTML5Client.prototype.isDestroyed = function isDestroyed() {\n return this._destroyed;\n};\n\n/**\n * loadAdUnit\n *\n * @param {string} adURL url of the js of the adUnit\n * @param {nodeStyleCallback} callback\n */\nVPAIDHTML5Client.prototype.loadAdUnit = function loadAdUnit(adURL, callback) {\n $throwIfDestroyed.call(this);\n $unloadPreviousAdUnit.call(this);\n var that = this;\n\n var frame = utils.createIframeWithContent(\n this._frameContainer,\n this._templateConfig.template,\n utils.extend({\n iframeURL_JS: adURL,\n iframeID: this.getID(),\n origin: getOrigin()\n }, this._templateConfig.extraOptions)\n );\n\n this._frame = frame;\n\n this._onLoad = utils.callbackTimeout(\n this._vpaidOptions.timeout,\n onLoad.bind(this),\n onTimeout.bind(this)\n );\n\n window.addEventListener('message', this._onLoad);\n\n function onLoad (e) {\n /*jshint validthis: false */\n //don't clear timeout\n if (e.origin !== getOrigin()) return;\n var result = JSON.parse(e.data);\n\n //don't clear timeout\n if (result.id !== that.getID()) return;\n\n var adUnit, error, createAd;\n if (!that._frame.contentWindow) {\n\n error = 'the iframe is not anymore in the DOM tree';\n\n } else {\n createAd = that._frame.contentWindow.getVPAIDAd;\n error = utils.validate(typeof createAd === 'function', 'the ad didn\\'t return a function to create an ad');\n }\n\n if (!error) {\n var adEl = that._frame.contentWindow.document.querySelector('.ad-element');\n adUnit = new VPAIDAdUnit(createAd(), adEl, that._videoEl, that._frame);\n adUnit.subscribe(AD_STOPPED, $adDestroyed.bind(that));\n error = utils.validate(adUnit.isValidVPAIDAd(), 'the add is not fully complaint with VPAID specification');\n }\n\n that._adUnit = adUnit;\n $destroyLoadListener.call(that);\n callback(error, error ? null : adUnit);\n\n //clear timeout\n return true;\n }\n\n function onTimeout() {\n callback('timeout', null);\n }\n};\n\n/**\n * unloadAdUnit\n *\n */\nVPAIDHTML5Client.prototype.unloadAdUnit = function unloadAdUnit() {\n $unloadPreviousAdUnit.call(this);\n};\n\n/**\n * getID will return the unique id\n *\n * @return {string}\n */\nVPAIDHTML5Client.prototype.getID = function () {\n return this._id;\n};\n\n\n/**\n * $removeEl\n *\n * @param {string} key\n */\nfunction $removeEl(key) {\n var el = this[key];\n if (el) {\n el.remove();\n delete this[key];\n }\n}\n\nfunction $adDestroyed() {\n $removeAdElements.call(this);\n delete this._adUnit;\n}\n\nfunction $unloadPreviousAdUnit() {\n $removeAdElements.call(this);\n $destroyAdUnit.call(this);\n}\n\nfunction $removeAdElements() {\n $removeEl.call(this, '_frame');\n $destroyLoadListener.call(this);\n}\n\n/**\n * $destroyLoadListener\n *\n */\nfunction $destroyLoadListener() {\n if (this._onLoad) {\n window.removeEventListener('message', this._onLoad);\n utils.clearCallbackTimeout(this._onLoad);\n delete this._onLoad;\n }\n}\n\n\nfunction $destroyAdUnit() {\n if (this._adUnit) {\n this._adUnit.stopAd();\n delete this._adUnit;\n }\n}\n\n/**\n * $throwIfDestroyed\n *\n */\nfunction $throwIfDestroyed() {\n if (this._destroyed) {\n throw new Error ('VPAIDHTML5Client already destroyed!');\n }\n}\n\nfunction getOrigin() {\n if( window.location.origin ) {\n return window.location.origin;\n }\n else {\n return window.location.protocol + \"//\" +\n window.location.hostname +\n (window.location.port ? ':' + window.location.port: '');\n }\n}\n\nmodule.exports = VPAIDHTML5Client;\nwindow.VPAIDHTML5Client = VPAIDHTML5Client;\n\n","'use strict';\n\nfunction Subscriber() {\n this._subscribers = {};\n}\n\nSubscriber.prototype.subscribe = function subscribe(handler, eventName, context) {\n if (!this.isHandlerAttached(handler, eventName)) {\n this.get(eventName).push({handler: handler, context: context, eventName: eventName});\n }\n};\n\nSubscriber.prototype.unsubscribe = function unsubscribe(handler, eventName) {\n this._subscribers[eventName] = this.get(eventName).filter(function (subscriber) {\n return handler !== subscriber.handler;\n });\n};\n\nSubscriber.prototype.unsubscribeAll = function unsubscribeAll() {\n this._subscribers = {};\n};\n\nSubscriber.prototype.trigger = function(eventName, data) {\n var that = this;\n var subscribers = this.get(eventName)\n .concat(this.get('*'));\n\n subscribers.forEach(function (subscriber) {\n setTimeout(function () {\n if (that.isHandlerAttached(subscriber.handler, subscriber.eventName)) {\n subscriber.handler.call(subscriber.context, data);\n }\n }, 0);\n });\n};\n\nSubscriber.prototype.triggerSync = function(eventName, data) {\n var subscribers = this.get(eventName)\n .concat(this.get('*'));\n\n subscribers.forEach(function (subscriber) {\n subscriber.handler.call(subscriber.context, data);\n });\n};\n\nSubscriber.prototype.get = function get(eventName) {\n if (!this._subscribers[eventName]) {\n this._subscribers[eventName] = [];\n }\n return this._subscribers[eventName];\n};\n\nSubscriber.prototype.isHandlerAttached = function isHandlerAttached(handler, eventName) {\n return this.get(eventName).some(function(subscriber) {\n return handler === subscriber.handler;\n })\n};\n\nmodule.exports = Subscriber;\n\n","'use strict';\n\n/**\n * noop a empty function\n */\nfunction noop() {}\n\n/**\n * validate if is not validate will return an Error with the message\n *\n * @param {boolean} isValid\n * @param {string} message\n */\nfunction validate(isValid, message) {\n return isValid ? null : new Error(message);\n}\n\nvar timeouts = {};\n/**\n * clearCallbackTimeout\n *\n * @param {function} func handler to remove\n */\nfunction clearCallbackTimeout(func) {\n var timeout = timeouts[func];\n if (timeout) {\n clearTimeout(timeout);\n delete timeouts[func];\n }\n}\n\n/**\n * callbackTimeout if the onSuccess is not called and returns true in the timelimit then onTimeout will be called\n *\n * @param {number} timer\n * @param {function} onSuccess\n * @param {function} onTimeout\n */\nfunction callbackTimeout(timer, onSuccess, onTimeout) {\n var callback, timeout;\n\n timeout = setTimeout(function () {\n onSuccess = noop;\n delete timeout[callback];\n onTimeout();\n }, timer);\n\n callback = function () {\n // TODO avoid leaking arguments\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n if (onSuccess.apply(this, arguments)) {\n clearCallbackTimeout(callback);\n }\n };\n\n timeouts[callback] = timeout;\n\n return callback;\n}\n\n\n/**\n * createElementInEl\n *\n * @param {HTMLElement} parent\n * @param {string} tagName\n * @param {string} id\n */\nfunction createElementInEl(parent, tagName, id) {\n var nEl = document.createElement(tagName);\n if (id) nEl.id = id;\n parent.appendChild(nEl);\n return nEl;\n}\n\n/**\n * createIframeWithContent\n *\n * @param {HTMLElement} parent\n * @param {string} template simple template using {{var}}\n * @param {object} data\n */\nfunction createIframeWithContent(parent, template, data) {\n var iframe = createIframe(parent, null, data.zIndex);\n if (!setIframeContent(iframe, simpleTemplate(template, data))) return;\n return iframe;\n}\n\n/**\n * createIframe\n *\n * @param {HTMLElement} parent\n * @param {string} url\n */\nfunction createIframe(parent, url, zIndex) {\n var nEl = document.createElement('iframe');\n nEl.src = url || 'about:blank';\n nEl.marginWidth = '0';\n nEl.marginHeight = '0';\n nEl.frameBorder = '0';\n nEl.width = '100%';\n nEl.height = '100%';\n nEl.style.position = 'absolute';\n nEl.style.left = '0';\n nEl.style.top = '0';\n nEl.style.margin = '0px';\n nEl.style.padding = '0px';\n nEl.style.border = 'none';\n\n if(zIndex){\n nEl.style.zIndex = zIndex;\n }\n\n nEl.setAttribute('SCROLLING','NO');\n parent.innerHTML = '';\n parent.appendChild(nEl);\n return nEl;\n}\n\n/**\n * simpleTemplate\n *\n * @param {string} template\n * @param {object} data\n */\nfunction simpleTemplate(template, data) {\n Object.keys(data).forEach(function (key) {\n var value = (typeof value === 'object') ? JSON.stringify(data[key]) : data[key];\n template = template.replace(new RegExp('{{' + key + '}}', 'g'), value);\n });\n return template;\n}\n\n/**\n * setIframeContent\n *\n * @param {HTMLIframeElement} iframeEl\n * @param content\n */\nfunction setIframeContent(iframeEl, content) {\n var iframeDoc = iframeEl.contentWindow && iframeEl.contentWindow.document;\n if (!iframeDoc) return false;\n\n iframeDoc.write(content);\n\n return true;\n}\n\n\n/**\n * extend object with keys from another object\n *\n * @param {object} toExtend\n * @param {object} fromSource\n */\nfunction extend(toExtend, fromSource) {\n Object.keys(fromSource).forEach(function(key) {\n toExtend[key] = fromSource[key];\n });\n return toExtend;\n}\n\n\n/**\n * unique will create a unique string everytime is called, sequentially and prefixed\n *\n * @param {string} prefix\n */\nfunction unique(prefix) {\n var count = -1;\n return function () {\n return prefix + '_' + (++count);\n };\n}\n\nmodule.exports = {\n noop: noop,\n validate: validate,\n clearCallbackTimeout: clearCallbackTimeout,\n callbackTimeout: callbackTimeout,\n createElementInEl: createElementInEl,\n createIframeWithContent: createIframeWithContent,\n createIframe: createIframe,\n simpleTemplate: simpleTemplate,\n setIframeContent: setIframeContent,\n extend: extend,\n unique: unique\n};\n\n","'use strict';\n\nvar InLine = require('./InLine');\nvar Wrapper = require('./Wrapper');\n\nfunction Ad(adJTree) {\n if (!(this instanceof Ad)) {\n return new Ad(adJTree);\n }\n this.initialize(adJTree);\n}\n\nAd.prototype.initialize = function(adJTree) {\n this.id = adJTree.attr('id');\n this.sequence = adJTree.attr('sequence');\n\n if(adJTree.inLine) {\n this.inLine = new InLine(adJTree.inLine);\n }\n\n if(adJTree.wrapper){\n this.wrapper = new Wrapper(adJTree.wrapper);\n }\n};\n\nmodule.exports = Ad;","'use strict';\n\nvar TrackingEvent = require('./TrackingEvent');\n\nvar utilities = require('../../utils/utilityFunctions');\n\nvar xml = require('../../utils/xml');\n\n\nfunction Companion(companionJTree) {\n if (!(this instanceof Companion)) {\n return new Companion(companionJTree);\n }\n\n //Required Elements\n this.creativeType = xml.attr(companionJTree.staticResource, 'creativeType');\n this.staticResource = xml.keyValue(companionJTree.staticResource);\n\n // Weird bug when the JXON tree is built it doesn't handle casing properly in this situation...\n var htmlResource = null;\n if (xml.keyValue(companionJTree.HTMLResource)) {\n htmlResource = xml.keyValue(companionJTree.HTMLResource);\n } else if (xml.keyValue(companionJTree.hTMLResource)) {\n htmlResource = xml.keyValue(companionJTree.hTMLResource);\n }\n this.htmlResource = htmlResource;\n\n var iframeResource = null;\n if (xml.keyValue(companionJTree.IFrameResource)) {\n iframeResource = xml.keyValue(companionJTree.IFrameResource);\n } else if (xml.keyValue(companionJTree.iFrameresource)) {\n iframeResource = xml.keyValue(companionJTree.iFrameresource);\n }\n this.iframeResource = iframeResource;\n\n //Optional fields\n this.id = xml.attr(companionJTree, 'id');\n this.width = xml.attr(companionJTree, 'width');\n this.height = xml.attr(companionJTree, 'height');\n this.expandedWidth = xml.attr(companionJTree, 'expandedWidth');\n this.expandedHeight = xml.attr(companionJTree, 'expandedHeight');\n this.scalable = xml.attr(companionJTree, 'scalable');\n this.maintainAspectRatio = xml.attr(companionJTree, 'maintainAspectRatio');\n this.minSuggestedDuration = xml.attr(companionJTree, 'minSuggestedDuration');\n this.apiFramework = xml.attr(companionJTree, 'apiFramework');\n this.companionClickThrough = xml.keyValue(companionJTree.companionClickThrough);\n this.trackingEvents = parseTrackingEvents(companionJTree.trackingEvents && companionJTree.trackingEvents.tracking);\n\n /*** Local functions ***/\n function parseTrackingEvents(trackingEvents) {\n var trackings = [];\n if (utilities.isDefined(trackingEvents)) {\n trackingEvents = utilities.isArray(trackingEvents) ? trackingEvents : [trackingEvents];\n trackingEvents.forEach(function (trackingData) {\n trackings.push(new TrackingEvent(trackingData));\n });\n }\n return trackings;\n }\n}\n\nmodule.exports = Companion;","'use strict';\n\nvar Linear = require('./Linear');\nvar Companion = require('./Companion');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction Creative(creativeJTree) {\n if(!(this instanceof Creative)) {\n return new Creative(creativeJTree);\n }\n\n this.id = creativeJTree.attr('id');\n this.sequence = creativeJTree.attr('sequence');\n this.adId = creativeJTree.attr('adId');\n this.apiFramework = creativeJTree.attr('apiFramework');\n\n if(creativeJTree.linear) {\n this.linear = new Linear(creativeJTree.linear);\n }\n\n if (creativeJTree.companionAds) {\n var companions = [];\n var companionAds = creativeJTree.companionAds && creativeJTree.companionAds.companion;\n if (utilities.isDefined(companionAds)) {\n companionAds = utilities.isArray(companionAds) ? companionAds : [companionAds];\n companionAds.forEach(function (companionData) {\n companions.push(new Companion(companionData));\n });\n }\n this.companionAds = companions;\n }\n}\n\n/**\n * Returns true if the browser supports at the creative.\n */\nCreative.prototype.isSupported = function(){\n if(this.linear) {\n return this.linear.isSupported();\n }\n\n return true;\n};\n\nCreative.parseCreatives = function parseCreatives(creativesJTree) {\n var creatives = [];\n var creativesData;\n if (utilities.isDefined(creativesJTree) && utilities.isDefined(creativesJTree.creative)) {\n creativesData = utilities.isArray(creativesJTree.creative) ? creativesJTree.creative : [creativesJTree.creative];\n creativesData.forEach(function (creative) {\n creatives.push(new Creative(creative));\n });\n }\n return creatives;\n};\n\nmodule.exports = Creative;\n","'use strict';\n\nvar vastUtil = require('./vastUtil');\nvar Creative = require('./Creative');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nfunction InLine(inlineJTree) {\n if (!(this instanceof InLine)) {\n return new InLine(inlineJTree);\n }\n\n //Required Fields\n this.adTitle = xml.keyValue(inlineJTree.adTitle);\n this.adSystem = xml.keyValue(inlineJTree.adSystem);\n this.impressions = vastUtil.parseImpressions(inlineJTree.impression);\n this.creatives = Creative.parseCreatives(inlineJTree.creatives);\n\n //Optional Fields\n this.description = xml.keyValue(inlineJTree.description);\n this.advertiser = xml.keyValue(inlineJTree.advertiser);\n this.surveys = parseSurveys(inlineJTree.survey);\n this.error = xml.keyValue(inlineJTree.error);\n this.pricing = xml.keyValue(inlineJTree.pricing);\n this.extensions = inlineJTree.extensions;\n\n /*** Local Functions ***/\n function parseSurveys(inlineSurveys) {\n if (inlineSurveys) {\n return utilities.transformArray(utilities.isArray(inlineSurveys) ? inlineSurveys : [inlineSurveys], function (survey) {\n if(utilities.isNotEmptyString(survey.keyValue)){\n return {\n uri: survey.keyValue,\n type: survey.attr('type')\n };\n }\n\n return undefined;\n });\n }\n return [];\n }\n}\n\n\n/**\n * Returns true if the browser supports all the creatives.\n */\nInLine.prototype.isSupported = function(){\n var i,len;\n\n if(this.creatives.length === 0) {\n return false;\n }\n\n for(i = 0, len = this.creatives.length; i< len; i+=1){\n if(!this.creatives[i].isSupported()){\n return false;\n }\n }\n return true;\n};\n\nmodule.exports = InLine;\n","'use strict';\n\nvar TrackingEvent = require('./TrackingEvent');\nvar MediaFile = require('./MediaFile');\nvar VideoClicks = require('./VideoClicks');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar parsers = require('./parsers');\n\nvar xml = require('../../utils/xml');\n\n\nfunction Linear(linearJTree) {\n if (!(this instanceof Linear)) {\n return new Linear(linearJTree);\n }\n\n //Required Elements\n this.duration = parsers.duration(xml.keyValue(linearJTree.duration));\n this.mediaFiles = parseMediaFiles(linearJTree.mediaFiles && linearJTree.mediaFiles.mediaFile);\n\n //Optional fields\n this.trackingEvents = parseTrackingEvents(linearJTree.trackingEvents && linearJTree.trackingEvents.tracking, this.duration);\n this.skipoffset = parsers.offset(xml.attr(linearJTree, 'skipoffset'), this.duration);\n\n if (linearJTree.videoClicks) {\n this.videoClicks = new VideoClicks(linearJTree.videoClicks);\n }\n\n if(linearJTree.adParameters) {\n this.adParameters = xml.keyValue(linearJTree.adParameters);\n\n if(xml.attr(linearJTree.adParameters, 'xmlEncoded')){\n this.adParameters = xml.decode(this.adParameters);\n }\n }\n\n /*** Local functions ***/\n function parseTrackingEvents(trackingEvents, duration) {\n var trackings = [];\n if (utilities.isDefined(trackingEvents)) {\n trackingEvents = utilities.isArray(trackingEvents) ? trackingEvents : [trackingEvents];\n trackingEvents.forEach(function (trackingData) {\n trackings.push(new TrackingEvent(trackingData, duration));\n });\n }\n return trackings;\n }\n\n function parseMediaFiles(mediaFilesJxonTree) {\n var mediaFiles = [];\n if (utilities.isDefined(mediaFilesJxonTree)) {\n mediaFilesJxonTree = utilities.isArray(mediaFilesJxonTree) ? mediaFilesJxonTree : [mediaFilesJxonTree];\n\n mediaFilesJxonTree.forEach(function (mfData) {\n mediaFiles.push(new MediaFile(mfData));\n });\n }\n return mediaFiles;\n }\n}\n\n/**\n * Must return true if at least one of the MediaFiles' type is supported\n */\nLinear.prototype.isSupported = function () {\n var i, len;\n for(i=0, len=this.mediaFiles.length; i 0) {\n getAd(waterfallAds.shift(),[], waterfallHandler);\n } else {\n callback(error, adChain);\n }\n } else {\n callback(null, adChain);\n }\n }\n });\n\n /*** Local functions ***/\n function getAdWaterfall(adTagUrl, callback) {\n var requestVastXML = that._requestVASTXml.bind(that, adTagUrl);\n async.waterfall([\n requestVastXML,\n buildVastWaterfall\n ], callback);\n }\n\n function buildVastWaterfall(xmlStr, callback) {\n var vastTree;\n try {\n vastTree = xml.toJXONTree(xmlStr);\n\n if(utilities.isArray(vastTree.ad)) {\n vastTree.ads = vastTree.ad;\n } else if(vastTree.ad){\n vastTree.ads = [vastTree.ad];\n } else {\n vastTree.ads = [];\n }\n callback(validateVASTTree(vastTree), vastTree);\n\n } catch (e) {\n callback(new VASTError(\"on VASTClient.getVASTAd.buildVastWaterfall, error parsing xml\", 100), null);\n }\n }\n\n function validateVASTTree(vastTree) {\n var vastVersion = xml.attr(vastTree, 'version');\n\n if (!vastTree.ad) {\n return new VASTError('on VASTClient.getVASTAd.validateVASTTree, no Ad in VAST tree', 303);\n }\n\n if (vastVersion && (vastVersion != 3 && vastVersion != 2)) {\n return new VASTError('on VASTClient.getVASTAd.validateVASTTree, not supported VAST version \"' + vastVersion + '\"', 102);\n }\n\n return null;\n }\n\n function getAd(adTagUrl, adChain, callback) {\n if (adChain.length >= that.WRAPPER_LIMIT) {\n return callback(new VASTError(\"on VASTClient.getVASTAd.getAd, players wrapper limit reached (the limit is \" + that.WRAPPER_LIMIT + \")\", 302), adChain);\n }\n\n async.waterfall([\n function (next) {\n if (utilities.isString(adTagUrl)) {\n requestVASTAd(adTagUrl, next);\n } else {\n next(null, adTagUrl);\n }\n },\n buildAd\n ], function (error, ad) {\n if (ad) {\n adChain.push(ad);\n }\n\n if (error) {\n return callback(error, adChain);\n }\n\n if (ad.wrapper) {\n return getAd(ad.wrapper.VASTAdTagURI, adChain, callback);\n }\n\n return callback(null, adChain);\n });\n }\n\n function buildAd(adJxonTree, callback) {\n try {\n var ad = new Ad(adJxonTree);\n callback(validateAd(ad), ad);\n } catch (e) {\n callback(new VASTError('on VASTClient.getVASTAd.buildAd, error parsing xml', 100), null);\n }\n }\n\n function validateAd(ad) {\n var wrapper = ad.wrapper;\n var inLine = ad.inLine;\n var errMsgPrefix = 'on VASTClient.getVASTAd.validateAd, ';\n\n if (inLine && wrapper) {\n return new VASTError(errMsgPrefix +\"InLine and Wrapper both found on the same Ad\", 101);\n }\n\n if (!inLine && !wrapper) {\n return new VASTError(errMsgPrefix + \"nor wrapper nor inline elements found on the Ad\", 101);\n }\n\n if (inLine && !inLine.isSupported()) {\n return new VASTError(errMsgPrefix + \"could not find MediaFile that is supported by this video player\", 403);\n }\n\n if (wrapper && !wrapper.VASTAdTagURI) {\n return new VASTError(errMsgPrefix + \"missing 'VASTAdTagURI' in wrapper\", 101);\n }\n\n return null;\n }\n\n function requestVASTAd(adTagUrl, callback) {\n that._requestVASTXml(adTagUrl, function (error, xmlStr) {\n if (error) {\n return callback(error);\n }\n try {\n var vastTree = xml.toJXONTree(xmlStr);\n callback(validateVASTTree(vastTree), vastTree.ad);\n } catch (e) {\n callback(new VASTError(\"on VASTClient.getVASTAd.requestVASTAd, error parsing xml\", 100));\n }\n });\n }\n};\n\nVASTClient.prototype._requestVASTXml = function requestVASTXml(adTagUrl, callback) {\n try {\n if (utilities.isFunction(adTagUrl)) {\n adTagUrl(requestHandler);\n } else {\n http.get(adTagUrl, requestHandler, {\n withCredentials: true\n });\n }\n } catch (e) {\n callback(e);\n }\n\n /*** Local functions ***/\n function requestHandler(error, response, status) {\n if (error) {\n var errMsg = utilities.isDefined(status) ?\n \"on VASTClient.requestVastXML, HTTP request error with status '\" + status + \"'\" :\n \"on VASTClient.requestVastXML, Error getting the the VAST XML with he passed adTagXML fn\";\n return callback(new VASTError(errMsg, 301), null);\n }\n\n callback(null, response);\n }\n};\n\nVASTClient.prototype._buildVASTResponse = function buildVASTResponse(adsChain) {\n var response = new VASTResponse();\n addAdsToResponse(response, adsChain);\n validateResponse(response);\n\n return response;\n\n //*** Local function ****\n function addAdsToResponse(response, ads) {\n ads.forEach(function (ad) {\n response.addAd(ad);\n });\n }\n\n function validateResponse(response) {\n var progressEvents = response.trackingEvents.progress;\n\n if (!response.hasLinear()) {\n throw new VASTError(\"on VASTClient._buildVASTResponse, Received an Ad type that is not supported\", 200);\n }\n\n if (response.duration === undefined) {\n throw new VASTError(\"on VASTClient._buildVASTResponse, Missing duration field in VAST response\", 101);\n }\n\n if (progressEvents) {\n progressEvents.forEach(function (progressEvent) {\n if (!utilities.isNumber(progressEvent.offset)) {\n throw new VASTError(\"on VASTClient._buildVASTResponse, missing or wrong offset attribute on progress tracking event\", 101);\n }\n });\n }\n }\n};\n\nVASTClient.prototype._trackError = function (error, adChain) {\n if (!utilities.isArray(adChain) || adChain.length === 0) { //There is nothing to track\n return;\n }\n\n var errorURLMacros = [];\n adChain.forEach(addErrorUrlMacros);\n vastUtil.track(errorURLMacros, {ERRORCODE: error.code || 900}); //900 <== Undefined error\n\n /*** Local functions ***/\n function addErrorUrlMacros(ad) {\n if (ad.wrapper && ad.wrapper.error) {\n errorURLMacros.push(ad.wrapper.error);\n }\n\n if (ad.inLine && ad.inLine.error) {\n errorURLMacros.push(ad.inLine.error);\n }\n }\n};\n\nmodule.exports = VASTClient;\n","'use strict';\n\nfunction VASTError(message, code) {\n this.message = 'VAST Error: ' + (message || '');\n if (code) {\n this.code = code;\n }\n}\n\nVASTError.prototype = new Error();\nVASTError.prototype.name = \"VAST Error\";\n\nmodule.exports = VASTError;","'use strict';\n\n/**\n * Inner helper class that deals with the logic of the individual steps needed to setup an ad in the player.\n *\n * @param player {object} instance of the player that will play the ad. It assumes that the videojs-contrib-ads plugin\n * has been initialized when you use its utility functions.\n *\n * @constructor\n */\n\nvar VASTResponse = require('./VASTResponse');\nvar VASTError = require('./VASTError');\nvar VASTTracker = require('./VASTTracker');\nvar vastUtil = require('./vastUtil');\n\nvar async = require('../../utils/async');\nvar dom = require('../../utils/dom');\nvar playerUtils = require('../../utils/playerUtils');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VASTIntegrator(player) {\n if (!(this instanceof VASTIntegrator)) {\n return new VASTIntegrator(player);\n }\n\n this.player = player;\n}\n\nVASTIntegrator.prototype.playAd = function playAd(vastResponse, callback) {\n var that = this;\n callback = callback || utilities.noop;\n\n if (!(vastResponse instanceof VASTResponse)) {\n return callback(new VASTError('On VASTIntegrator, missing required VASTResponse'));\n }\n\n async.waterfall([\n function (next) {\n next(null, vastResponse);\n },\n this._selectAdSource.bind(this),\n this._createVASTTracker.bind(this),\n this._addClickThrough.bind(this),\n this._addSkipButton.bind(this),\n this._setupEvents.bind(this),\n this._playSelectedAd.bind(this)\n ], function (error, response) {\n if (error && response) {\n that._trackError(error, response);\n }\n callback(error, response);\n });\n\n this._adUnit = {\n _src: null,\n type: 'VAST',\n pauseAd: function () {\n that.player.pause(true);\n },\n\n resumeAd: function () {\n that.player.play(true);\n },\n\n isPaused: function () {\n return that.player.paused(true);\n },\n\n getSrc: function () {\n return this._src;\n }\n };\n\n return this._adUnit;\n};\n\nVASTIntegrator.prototype._selectAdSource = function selectAdSource(response, callback) {\n var source;\n\n var playerWidth = dom.getDimension(this.player.el()).width;\n response.mediaFiles.sort(function compareTo(a, b) {\n var deltaA = Math.abs(playerWidth - a.width);\n var deltaB = Math.abs(playerWidth - b.width);\n return deltaA - deltaB;\n });\n\n source = this.player.selectSource(response.mediaFiles).source;\n\n if (source) {\n if (this._adUnit) {\n this._adUnit._src = source;\n }\n return callback(null, source, response);\n }\n\n // code 403 <== Couldn't find MediaFile that is supported by this video player\n callback(new VASTError(\"Could not find Ad mediafile supported by this player\", 403), response);\n};\n\nVASTIntegrator.prototype._createVASTTracker = function createVASTTracker(adMediaFile, response, callback) {\n try {\n callback(null, adMediaFile, new VASTTracker(adMediaFile.src, response), response);\n } catch (e) {\n callback(e, response);\n }\n};\n\nVASTIntegrator.prototype._setupEvents = function setupEvents(adMediaFile, tracker, response, callback) {\n var previouslyMuted;\n var player = this.player;\n player.on('fullscreenchange', trackFullscreenChange);\n player.on('vast.adStart', trackImpressions);\n player.on('pause', trackPause);\n player.on('timeupdate', trackProgress);\n player.on('volumechange', trackVolumeChange);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], unbindEvents);\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel', 'vast.adSkip'], function(evt){\n if(evt.type === 'vast.adEnd'){\n tracker.trackComplete();\n }\n });\n\n return callback(null, adMediaFile, response);\n\n /*** Local Functions ***/\n function unbindEvents() {\n player.off('fullscreenchange', trackFullscreenChange);\n player.off('vast.adStart', trackImpressions);\n player.off('pause', trackPause);\n player.off('timeupdate', trackProgress);\n player.off('volumechange', trackVolumeChange);\n }\n\n function trackFullscreenChange() {\n if (player.isFullscreen()) {\n tracker.trackFullscreen();\n } else {\n tracker.trackExitFullscreen();\n }\n }\n\n function trackPause() {\n //NOTE: whenever a video ends the video Element triggers a 'pause' event before the 'ended' event.\n // We should not track this pause event because it makes the VAST tracking confusing again we use a\n // Threshold of 2 seconds to prevent false positives on IOS.\n if (Math.abs(player.duration() - player.currentTime()) < 2) {\n return;\n }\n\n tracker.trackPause();\n playerUtils.once(player, ['play', 'vast.adEnd', 'vast.adsCancel'], function (evt) {\n if(evt.type === 'play'){\n tracker.trackResume();\n }\n });\n }\n\n function trackProgress() {\n var currentTimeInMs = player.currentTime() * 1000;\n tracker.trackProgress(currentTimeInMs);\n }\n\n function trackImpressions() {\n tracker.trackImpressions();\n tracker.trackCreativeView();\n }\n\n function trackVolumeChange() {\n var muted = player.muted();\n if (muted) {\n tracker.trackMute();\n } else if (previouslyMuted) {\n tracker.trackUnmute();\n }\n previouslyMuted = muted;\n }\n};\n\nVASTIntegrator.prototype._addSkipButton = function addSkipButton(source, tracker, response, callback) {\n var skipOffsetInSec;\n var that = this;\n\n if (utilities.isNumber(response.skipoffset)) {\n skipOffsetInSec = response.skipoffset / 1000;\n addSkipButtonToPlayer(this.player, skipOffsetInSec);\n }\n callback(null, source, tracker, response);\n\n /*** Local function ***/\n function addSkipButtonToPlayer(player, skipOffset) {\n var skipButton = createSkipButton(player);\n var updateSkipButton = updateSkipButtonState.bind(that, skipButton, skipOffset, player);\n\n player.el().appendChild(skipButton);\n player.on('timeupdate', updateSkipButton);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeSkipButton);\n\n function removeSkipButton() {\n player.off('timeupdate', updateSkipButton);\n dom.remove(skipButton);\n }\n }\n\n function createSkipButton(player) {\n var skipButton = window.document.createElement(\"div\");\n dom.addClass(skipButton, \"vast-skip-button\");\n\n skipButton.onclick = function (e) {\n if (dom.hasClass(skipButton, 'enabled')) {\n tracker.trackSkip();\n player.trigger('vast.adSkip');\n }\n\n //We prevent event propagation to avoid problems with the clickThrough and so on\n if (window.Event.prototype.stopPropagation !== undefined) {\n e.stopPropagation();\n } else {\n return false;\n }\n };\n\n return skipButton;\n }\n\n function updateSkipButtonState(skipButton, skipOffset, player) {\n var timeLeft = Math.ceil(skipOffset - player.currentTime());\n if (timeLeft > 0) {\n skipButton.innerHTML = \"Skip in \" + utilities.toFixedDigits(timeLeft, 2) + \"...\";\n } else {\n if (!dom.hasClass(skipButton, 'enabled')) {\n dom.addClass(skipButton, 'enabled');\n skipButton.innerHTML = \"Skip ad\";\n }\n }\n }\n};\n\nVASTIntegrator.prototype._addClickThrough = function addClickThrough(mediaFile, tracker, response, callback) {\n var player = this.player;\n var blocker = createClickThroughBlocker(player, tracker, response);\n var updateBlocker = updateBlockerURL.bind(this, blocker, response, player);\n\n player.el().insertBefore(blocker, player.controlBar.el());\n player.on('timeupdate', updateBlocker);\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeBlocker);\n\n return callback(null, mediaFile, tracker, response);\n\n /*** Local Functions ***/\n\n function createClickThroughBlocker(player, tracker, response) {\n var blocker = window.document.createElement(\"a\");\n var clickThroughMacro = response.clickThrough;\n\n dom.addClass(blocker, 'vast-blocker');\n blocker.href = generateClickThroughURL(clickThroughMacro, player);\n\n if (utilities.isString(clickThroughMacro)) {\n blocker.target = \"_blank\";\n }\n\n blocker.onclick = function (e) {\n if (player.paused()) {\n player.play();\n\n //We prevent event propagation to avoid problems with the player's normal pause mechanism\n if (window.Event.prototype.stopPropagation !== undefined) {\n e.stopPropagation();\n }\n return false;\n }\n\n player.pause();\n tracker.trackClick();\n };\n\n return blocker;\n }\n\n function updateBlockerURL(blocker, response, player) {\n blocker.href = generateClickThroughURL(response.clickThrough, player);\n }\n\n function generateClickThroughURL(clickThroughMacro, player) {\n var variables = {\n ASSETURI: mediaFile.src,\n CONTENTPLAYHEAD: vastUtil.formatProgress(player.currentTime() * 1000)\n };\n\n return clickThroughMacro ? vastUtil.parseURLMacro(clickThroughMacro, variables) : '#';\n }\n\n function removeBlocker() {\n player.off('timeupdate', updateBlocker);\n dom.remove(blocker);\n }\n};\n\nVASTIntegrator.prototype._playSelectedAd = function playSelectedAd(source, response, callback) {\n var player = this.player;\n\n player.preload(\"auto\"); //without preload=auto the durationchange event is never fired\n player.src(source);\n\n playerUtils.once(player, ['durationchange', 'error', 'vast.adsCancel'], function (evt) {\n if (evt.type === 'durationchange') {\n playAd();\n } else if(evt.type === 'error') {\n callback(new VASTError(\"on VASTIntegrator, Player is unable to play the Ad\", 400), response);\n }\n //NOTE: If the ads get canceled we do nothing/\n });\n\n /**** local functions ******/\n function playAd() {\n\n playerUtils.once(player, ['playing', 'vast.adsCancel'], function (evt) {\n if(evt.type === 'vast.adsCancel'){\n return;\n }\n\n player.trigger('vast.adStart');\n\n player.on('ended', proceed);\n player.on('vast.adsCancel', proceed);\n player.on('vast.adSkip', proceed);\n\n function proceed(evt) {\n\n if(evt.type === 'ended' && (player.duration() - player.currentTime()) > 3 ) {\n // Ignore ended event if the Ad time was not 'near' the end\n // avoids issues where IOS controls could skip the Ad\n return;\n }\n\n player.off('ended', proceed);\n player.off('vast.adsCancel', proceed);\n player.off('vast.adSkip', proceed);\n\n //NOTE: if the ads get cancel we do nothing apart removing the listners\n if(evt.type === 'ended' || evt.type === 'vast.adSkip'){\n callback(null, response);\n }\n }\n });\n\n player.play();\n }\n};\n\nVASTIntegrator.prototype._trackError = function trackError(error, response) {\n vastUtil.track(response.errorURLMacros, {ERRORCODE: error.code || 900});\n};\n\nmodule.exports = VASTIntegrator;","'use strict';\n\nvar Ad = require('./Ad');\nvar VideoClicks = require('./VideoClicks');\nvar Linear = require('./Linear');\nvar InLine = require('./InLine');\nvar Wrapper = require('./Wrapper');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nwindow.InLine__A = InLine;\nfunction VASTResponse() {\n if (!(this instanceof VASTResponse)) {\n return new VASTResponse();\n }\n\n this._linearAdded = false;\n this.ads = [];\n this.errorURLMacros = [];\n this.impressions = [];\n this.clickTrackings = [];\n this.customClicks = [];\n this.trackingEvents = {};\n this.mediaFiles = [];\n this.clickThrough = undefined;\n this.adTitle = '';\n this.duration = undefined;\n this.skipoffset = undefined;\n}\n\nVASTResponse.prototype.addAd = function (ad) {\n var inLine, wrapper;\n if (ad instanceof Ad) {\n inLine = ad.inLine;\n wrapper = ad.wrapper;\n\n this.ads.push(ad);\n\n if (inLine) {\n this._addInLine(inLine);\n }\n\n if (wrapper) {\n this._addWrapper(wrapper);\n }\n }\n};\n\nVASTResponse.prototype._addErrorTrackUrl = function (error) {\n var errorURL = error instanceof xml.JXONTree ? xml.keyValue(error) : error;\n if (errorURL) {\n this.errorURLMacros.push(errorURL);\n }\n};\n\nVASTResponse.prototype._addImpressions = function (impressions) {\n utilities.isArray(impressions) && appendToArray(this.impressions, impressions);\n};\n\nVASTResponse.prototype._addClickThrough = function (clickThrough) {\n if (utilities.isNotEmptyString(clickThrough)) {\n this.clickThrough = clickThrough;\n }\n};\n\nVASTResponse.prototype._addClickTrackings = function (clickTrackings) {\n utilities.isArray(clickTrackings) && appendToArray(this.clickTrackings, clickTrackings);\n};\n\nVASTResponse.prototype._addCustomClicks = function (customClicks) {\n utilities.isArray(customClicks) && appendToArray(this.customClicks, customClicks);\n};\n\nVASTResponse.prototype._addTrackingEvents = function (trackingEvents) {\n var eventsMap = this.trackingEvents;\n\n if (trackingEvents) {\n trackingEvents = utilities.isArray(trackingEvents) ? trackingEvents : [trackingEvents];\n trackingEvents.forEach(function (trackingEvent) {\n if (!eventsMap[trackingEvent.name]) {\n eventsMap[trackingEvent.name] = [];\n }\n eventsMap[trackingEvent.name].push(trackingEvent);\n });\n }\n};\n\nVASTResponse.prototype._addTitle = function (title) {\n if (utilities.isNotEmptyString(title)) {\n this.adTitle = title;\n }\n};\n\nVASTResponse.prototype._addDuration = function (duration) {\n if (utilities.isNumber(duration)) {\n this.duration = duration;\n }\n};\n\nVASTResponse.prototype._addVideoClicks = function (videoClicks) {\n if (videoClicks instanceof VideoClicks) {\n this._addClickThrough(videoClicks.clickThrough);\n this._addClickTrackings(videoClicks.clickTrackings);\n this._addCustomClicks(videoClicks.customClicks);\n }\n};\n\nVASTResponse.prototype._addMediaFiles = function (mediaFiles) {\n utilities.isArray(mediaFiles) && appendToArray(this.mediaFiles, mediaFiles);\n};\n\nVASTResponse.prototype._addSkipoffset = function (offset) {\n if (offset) {\n this.skipoffset = offset;\n }\n};\n\nVASTResponse.prototype._addAdParameters = function (adParameters) {\n if (adParameters) {\n this.adParameters = adParameters;\n }\n};\n\nVASTResponse.prototype._addLinear = function (linear) {\n if (linear instanceof Linear) {\n this._addDuration(linear.duration);\n this._addTrackingEvents(linear.trackingEvents);\n this._addVideoClicks(linear.videoClicks);\n this._addMediaFiles(linear.mediaFiles);\n this._addSkipoffset(linear.skipoffset);\n this._addAdParameters(linear.adParameters);\n this._linearAdded = true;\n }\n};\n\nVASTResponse.prototype._addInLine = function (inLine) {\n var that = this;\n\n if (inLine instanceof InLine) {\n this._addTitle(inLine.adTitle);\n this._addErrorTrackUrl(inLine.error);\n this._addImpressions(inLine.impressions);\n\n inLine.creatives.forEach(function (creative) {\n if (creative.linear) {\n that._addLinear(creative.linear);\n }\n });\n }\n};\n\nVASTResponse.prototype._addWrapper = function (wrapper) {\n var that = this;\n\n if (wrapper instanceof Wrapper) {\n this._addErrorTrackUrl(wrapper.error);\n this._addImpressions(wrapper.impressions);\n\n wrapper.creatives.forEach(function (creative) {\n var linear = creative.linear;\n if (linear) {\n that._addVideoClicks(linear.videoClicks);\n that.clickThrough = undefined;//We ensure that no clickThrough has been added\n that._addTrackingEvents(linear.trackingEvents);\n }\n });\n }\n};\n\nVASTResponse.prototype.hasLinear = function(){\n return this._linearAdded;\n};\n\nfunction appendToArray(array, items) {\n items.forEach(function (item) {\n array.push(item);\n });\n}\n\nmodule.exports = VASTResponse;\n\n","'use strict';\n\nvar VASTError = require('./VASTError');\nvar VASTResponse = require('./VASTResponse');\nvar vastUtil = require('./vastUtil');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VASTTracker(assetURI, vastResponse) {\n if (!(this instanceof VASTTracker)) {\n return new VASTTracker(assetURI, vastResponse);\n }\n\n this.sanityCheck(assetURI, vastResponse);\n this.initialize(assetURI, vastResponse);\n\n}\n\nVASTTracker.prototype.initialize = function(assetURI, vastResponse) {\n this.response = vastResponse;\n this.assetURI = assetURI;\n this.progress = 0;\n this.quartiles = {\n firstQuartile: {tracked: false, time: Math.round(25 * vastResponse.duration) / 100},\n midpoint: {tracked: false, time: Math.round(50 * vastResponse.duration) / 100},\n thirdQuartile: {tracked: false, time: Math.round(75 * vastResponse.duration) / 100}\n };\n};\n\nVASTTracker.prototype.sanityCheck = function(assetURI, vastResponse) {\n if (!utilities.isString(assetURI) || utilities.isEmptyString(assetURI)) {\n throw new VASTError('on VASTTracker constructor, missing required the URI of the ad asset being played');\n }\n\n if (!(vastResponse instanceof VASTResponse)) {\n throw new VASTError('on VASTTracker constructor, missing required VAST response');\n }\n};\n\nVASTTracker.prototype.trackURLs = function trackURLs(urls, variables) {\n if (utilities.isArray(urls) && urls.length > 0) {\n variables = utilities.extend({\n ASSETURI: this.assetURI,\n CONTENTPLAYHEAD: vastUtil.formatProgress(this.progress)\n }, variables || {});\n\n vastUtil.track(urls, variables);\n }\n};\n\nVASTTracker.prototype.trackEvent = function trackEvent(eventName, trackOnce) {\n this.trackURLs(getEventUris(this.response.trackingEvents[eventName]));\n if (trackOnce) {\n this.response.trackingEvents[eventName] = undefined;\n }\n\n /*** Local function ***/\n function getEventUris(trackingEvents) {\n var uris;\n\n if (trackingEvents) {\n uris = [];\n trackingEvents.forEach(function (event) {\n uris.push(event.uri);\n });\n }\n return uris;\n }\n};\n\nVASTTracker.prototype.trackProgress = function trackProgress(newProgressInMs) {\n var that = this;\n var events = [];\n var ONCE = true;\n var ALWAYS = false;\n var trackingEvents = this.response.trackingEvents;\n\n if (utilities.isNumber(newProgressInMs)) {\n addTrackEvent('start', ONCE, newProgressInMs > 0);\n addTrackEvent('rewind', ALWAYS, hasRewound(this.progress, newProgressInMs));\n addQuartileEvents(newProgressInMs);\n trackProgressEvents(newProgressInMs);\n trackEvents();\n this.progress = newProgressInMs;\n }\n\n /*** Local function ***/\n function hasRewound(currentProgress, newProgress) {\n var REWIND_THRESHOLD = 3000; //IOS video clock is very unreliable and we need a 3 seconds threshold to ensure that there was a rewind an that it was on purpose.\n return currentProgress > newProgressInMs && Math.abs(newProgress - currentProgress) > REWIND_THRESHOLD;\n }\n\n function addTrackEvent(eventName, trackOnce, canBeAdded) {\n if (trackingEvents[eventName] && canBeAdded) {\n events.push({\n name: eventName,\n trackOnce: !!trackOnce\n });\n }\n }\n\n function addQuartileEvents(progress) {\n var quartiles = that.quartiles;\n var firstQuartile = that.quartiles.firstQuartile;\n var midpoint = that.quartiles.midpoint;\n var thirdQuartile = that.quartiles.thirdQuartile;\n\n if (!firstQuartile.tracked) {\n trackQuartile('firstQuartile', progress);\n } else if (!midpoint.tracked) {\n trackQuartile('midpoint', progress);\n } else if (!thirdQuartile.tracked){\n trackQuartile('thirdQuartile', progress);\n }\n\n /*** Local function ***/\n function trackQuartile(quartileName, progress){\n var quartile = quartiles[quartileName];\n if(canBeTracked(quartile, progress)){\n quartile.tracked = true;\n addTrackEvent(quartileName, ONCE, true);\n }\n }\n }\n\n function canBeTracked(quartile, progress) {\n var quartileTime = quartile.time;\n //We only fire the quartile event if the progress is bigger than the quartile time by 5 seconds at most.\n return progress >= quartileTime && progress <= (quartileTime + 5000);\n }\n\n function trackProgressEvents(progress) {\n if (!utilities.isArray(trackingEvents.progress)) {\n return; //Nothing to track\n }\n\n var pendingProgressEvts = [];\n\n trackingEvents.progress.forEach(function (evt) {\n if (evt.offset <= progress) {\n that.trackURLs([evt.uri]);\n } else {\n pendingProgressEvts.push(evt);\n }\n });\n trackingEvents.progress = pendingProgressEvts;\n }\n\n function trackEvents() {\n events.forEach(function (event) {\n that.trackEvent(event.name, event.trackOnce);\n });\n }\n};\n\n[\n 'rewind',\n 'fullscreen',\n 'exitFullscreen',\n 'pause',\n 'resume',\n 'mute',\n 'unmute',\n 'acceptInvitation',\n 'acceptInvitationLinear',\n 'collapse',\n 'expand'\n].forEach(function (eventName) {\n VASTTracker.prototype['track' + utilities.capitalize(eventName)] = function () {\n this.trackEvent(eventName);\n };\n });\n\n[\n 'start',\n 'skip',\n 'close',\n 'closeLinear'\n].forEach(function (eventName) {\n VASTTracker.prototype['track' + utilities.capitalize(eventName)] = function () {\n this.trackEvent(eventName, true);\n };\n });\n\n[\n 'firstQuartile',\n 'midpoint',\n 'thirdQuartile'\n].forEach(function (quartile) {\n VASTTracker.prototype['track' + utilities.capitalize(quartile)] = function () {\n this.quartiles[quartile].tracked = true;\n this.trackEvent(quartile, true);\n };\n });\n\nVASTTracker.prototype.trackComplete = function () {\n if(this.quartiles.thirdQuartile.tracked){\n this.trackEvent('complete', true);\n }\n};\n\nVASTTracker.prototype.trackErrorWithCode = function trackErrorWithCode(errorcode) {\n if (utilities.isNumber(errorcode)) {\n this.trackURLs(this.response.errorURLMacros, {ERRORCODE: errorcode});\n }\n};\n\nVASTTracker.prototype.trackImpressions = function trackImpressions() {\n this.trackURLs(this.response.impressions);\n};\n\nVASTTracker.prototype.trackCreativeView = function trackCreativeView() {\n this.trackEvent('creativeView');\n};\n\nVASTTracker.prototype.trackClick = function trackClick() {\n this.trackURLs(this.response.clickTrackings);\n};\n\nmodule.exports = VASTTracker;\n","'use strict';\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nfunction VideoClicks(videoClickJTree) {\n if (!(this instanceof VideoClicks)) {\n return new VideoClicks(videoClickJTree);\n }\n\n this.clickThrough = xml.keyValue(videoClickJTree.clickThrough);\n this.clickTrackings = parseClickTrackings(videoClickJTree.clickTracking);\n this.customClicks = parseClickTrackings(videoClickJTree.customClick);\n\n /*** Local functions ***/\n function parseClickTrackings(trackingData) {\n var clickTrackings = [];\n if (trackingData) {\n trackingData = utilities.isArray(trackingData) ? trackingData : [trackingData];\n trackingData.forEach(function (clickTrackingData) {\n clickTrackings.push(xml.keyValue(clickTrackingData));\n });\n }\n return clickTrackings;\n }\n}\n\nmodule.exports = VideoClicks;","'use strict';\n\nvar vastUtil = require('./vastUtil');\nvar Creative = require('./Creative');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nfunction Wrapper(wrapperJTree) {\n if(!(this instanceof Wrapper)) {\n return new Wrapper(wrapperJTree);\n }\n\n //Required elements\n this.adSystem = xml.keyValue(wrapperJTree.adSystem);\n this.impressions = vastUtil.parseImpressions(wrapperJTree.impression);\n this.VASTAdTagURI = xml.keyValue(wrapperJTree.vASTAdTagURI);\n\n //Optional elements\n this.creatives = Creative.parseCreatives(wrapperJTree.creatives);\n this.error = xml.keyValue(wrapperJTree.error);\n this.extensions = wrapperJTree.extensions;\n\n //Optional attrs\n this.followAdditionalWrappers = utilities.isDefined(xml.attr(wrapperJTree, 'followAdditionalWrappers'))? xml.attr(wrapperJTree, 'followAdditionalWrappers'): true;\n this.allowMultipleAds = xml.attr(wrapperJTree, 'allowMultipleAds');\n this.fallbackOnNoAd = xml.attr(wrapperJTree, 'fallbackOnNoAd');\n}\n\nmodule.exports = Wrapper;\n","'use strict';\n\nvar utilities = require('../../utils/utilityFunctions');\n\nvar durationRegex = /(\\d\\d):(\\d\\d):(\\d\\d)(\\.(\\d\\d\\d))?/;\n\nvar parsers = {\n\n duration: function parseDuration(durationStr) {\n\n var match, durationInMs;\n\n if (utilities.isString(durationStr)) {\n match = durationStr.match(durationRegex);\n if (match) {\n durationInMs = parseHoursToMs(match[1]) + parseMinToMs(match[2]) + parseSecToMs(match[3]) + parseInt(match[5] || 0);\n }\n }\n\n return isNaN(durationInMs) ? null : durationInMs;\n\n /*** local functions ***/\n function parseHoursToMs(hourStr) {\n return parseInt(hourStr, 10) * 60 * 60 * 1000;\n }\n\n function parseMinToMs(minStr) {\n return parseInt(minStr, 10) * 60 * 1000;\n }\n\n function parseSecToMs(secStr) {\n return parseInt(secStr, 10) * 1000;\n }\n },\n\n offset: function parseOffset(offset, duration) {\n if(isPercentage(offset)){\n return calculatePercentage(offset, duration);\n }\n return parsers.duration(offset);\n\n /*** Local function ***/\n function isPercentage(offset) {\n var percentageRegex = /^\\d+(\\.\\d+)?%$/g;\n return percentageRegex.test(offset);\n }\n\n function calculatePercentage(percentStr, duration) {\n if(duration) {\n return calcPercent(duration, parseFloat(percentStr.replace('%', '')));\n }\n return null;\n }\n\n function calcPercent(quantity, percent){\n return quantity * percent / 100;\n }\n }\n\n};\n\n\nmodule.exports = parsers;","'use strict';\n\nvar utilities = require('../../utils/utilityFunctions');\nvar VPAIDHTML5Tech = require('../vpaid/VPAIDHTML5Tech');\nvar VPAIDFlashTech = require('../vpaid/VPAIDFlashTech');\nvar VPAIDFLASHClient = require('VPAIDFLASHClient/js/VPAIDFLASHClient');\n\nvar vastUtil = {\n\n track: function track(URLMacros, variables) {\n var sources = vastUtil.parseURLMacros(URLMacros, variables);\n var trackImgs = [];\n sources.forEach(function (src) {\n var img = new Image();\n img.src = src;\n trackImgs.push(img);\n });\n return trackImgs;\n },\n\n parseURLMacros: function parseMacros(URLMacros, variables) {\n var parsedURLs = [];\n\n variables = variables || {};\n\n if (!(variables[\"CACHEBUSTING\"])) {\n variables[\"CACHEBUSTING\"] = Math.round(Math.random() * 1.0e+10);\n }\n\n URLMacros.forEach(function (URLMacro) {\n parsedURLs.push(vastUtil._parseURLMacro(URLMacro, variables));\n });\n\n return parsedURLs;\n },\n\n parseURLMacro: function parseMacro(URLMacro, variables) {\n variables = variables || {};\n\n if (!(variables[\"CACHEBUSTING\"])) {\n variables[\"CACHEBUSTING\"] = Math.round(Math.random() * 1.0e+10);\n }\n\n return vastUtil._parseURLMacro(URLMacro, variables);\n },\n\n _parseURLMacro: function parseMacro(URLMacro, variables) {\n variables = variables || {};\n\n utilities.forEach(variables, function (value, key) {\n URLMacro = URLMacro.replace(new RegExp(\"\\\\[\" + key + \"\\\\\\]\", 'gm'), value);\n });\n\n return URLMacro;\n },\n\n parseDuration: function parseDuration(durationStr) {\n var durationRegex = /(\\d\\d):(\\d\\d):(\\d\\d)(\\.(\\d\\d\\d))?/;\n var match, durationInMs;\n\n if (utilities.isString(durationStr)) {\n match = durationStr.match(durationRegex);\n if (match) {\n durationInMs = parseHoursToMs(match[1]) + parseMinToMs(match[2]) + parseSecToMs(match[3]) + parseInt(match[5] || 0);\n }\n }\n\n return isNaN(durationInMs) ? null : durationInMs;\n\n /*** local functions ***/\n function parseHoursToMs(hourStr) {\n return parseInt(hourStr, 10) * 60 * 60 * 1000;\n }\n\n function parseMinToMs(minStr) {\n return parseInt(minStr, 10) * 60 * 1000;\n }\n\n function parseSecToMs(secStr) {\n return parseInt(secStr, 10) * 1000;\n }\n },\n\n parseImpressions: function parseImpressions(impressions) {\n if (impressions) {\n impressions = utilities.isArray(impressions) ? impressions : [impressions];\n return utilities.transformArray(impressions, function (impression) {\n if (utilities.isNotEmptyString(impression.keyValue)) {\n return impression.keyValue;\n }\n return undefined;\n });\n }\n return [];\n },\n\n\n //We assume that the progress is going to arrive in milliseconds\n formatProgress: function formatProgress(progress) {\n var hours, minutes, seconds, milliseconds;\n hours = progress / (60 * 60 * 1000);\n hours = Math.floor(hours);\n minutes = (progress / (60 * 1000)) % 60;\n minutes = Math.floor(minutes);\n seconds = (progress / 1000) % 60;\n seconds = Math.floor(seconds);\n milliseconds = progress % 1000;\n return utilities.toFixedDigits(hours, 2) + ':' + utilities.toFixedDigits(minutes, 2) + ':' + utilities.toFixedDigits(seconds, 2) + '.' + utilities.toFixedDigits(milliseconds, 3);\n },\n\n parseOffset: function parseOffset(offset, duration) {\n if (isPercentage(offset)) {\n return calculatePercentage(offset, duration);\n }\n return vastUtil.parseDuration(offset);\n\n /*** Local function ***/\n function isPercentage(offset) {\n var percentageRegex = /^\\d+(\\.\\d+)?%$/g;\n return percentageRegex.test(offset);\n }\n\n function calculatePercentage(percentStr, duration) {\n if (duration) {\n return calcPercent(duration, parseFloat(percentStr.replace('%', '')));\n }\n return null;\n }\n\n function calcPercent(quantity, percent) {\n return quantity * percent / 100;\n }\n },\n\n\n //List of supported VPAID technologies\n VPAID_techs: [\n VPAIDFlashTech,\n VPAIDHTML5Tech\n ],\n\n isVPAID: function isVPAIDMediaFile(mediaFile) {\n return !!mediaFile && mediaFile.apiFramework === 'VPAID';\n },\n\n findSupportedVPAIDTech: function findSupportedVPAIDTech(mimeType) {\n var i, len, VPAIDTech;\n\n for (i = 0, len = this.VPAID_techs.length; i < len; i += 1) {\n VPAIDTech = this.VPAID_techs[i];\n if (VPAIDTech.supports(mimeType)) {\n return VPAIDTech;\n }\n }\n return null;\n },\n\n isFlashSupported: function isFlashSupported() {\n return VPAIDFLASHClient.isSupported();\n },\n\n /**\n * Necessary step for VPAIDFLAShClient to know if flash is supported and not blocked.\n * IMPORTANT NOTE: This is an async test and needs to be run as soon as possible.\n *\n * @param vpaidFlashLoaderPath the path to the vpaidFlashLoader swf obj.\n */\n runFlashSupportCheck: function runFlashSupportCheck(vpaidFlashLoaderPath) {\n VPAIDFLASHClient.runFlashTest({data: vpaidFlashLoaderPath});\n }\n\n};\n\nmodule.exports = vastUtil;\n","'use strict';\n\nvar VASTError = require('../vast/VASTError');\n\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VPAIDAdUnitWrapper(vpaidAdUnit, opts) {\n if (!(this instanceof VPAIDAdUnitWrapper)) {\n return new VPAIDAdUnitWrapper(vpaidAdUnit, opts);\n }\n sanityCheck(vpaidAdUnit, opts);\n\n this.options = utilities.extend({}, opts);\n\n this._adUnit = vpaidAdUnit;\n\n /*** Local Functions ***/\n function sanityCheck(adUnit, opts) {\n if (!adUnit || !VPAIDAdUnitWrapper.checkVPAIDInterface(adUnit)) {\n throw new VASTError('on VPAIDAdUnitWrapper, the passed VPAID adUnit does not fully implement the VPAID interface');\n }\n\n if (!utilities.isObject(opts)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper, expected options hash but got '\" + opts + \"'\");\n }\n\n if (!(\"responseTimeout\" in opts) || !utilities.isNumber(opts.responseTimeout) ){\n throw new VASTError(\"on VPAIDAdUnitWrapper, expected responseTimeout in options\");\n }\n }\n}\n\nVPAIDAdUnitWrapper.checkVPAIDInterface = function checkVPAIDInterface(VPAIDAdUnit) {\n //NOTE: skipAd is not part of the method list because it only appears in VPAID 2.0 and we support VPAID 1.0\n var VPAIDInterfaceMethods = [\n 'handshakeVersion', 'initAd', 'startAd', 'stopAd', 'resizeAd', 'pauseAd', 'expandAd', 'collapseAd'\n ];\n\n for (var i = 0, len = VPAIDInterfaceMethods.length; i < len; i++) {\n if (!VPAIDAdUnit || !utilities.isFunction(VPAIDAdUnit[VPAIDInterfaceMethods[i]])) {\n return false;\n }\n }\n\n\n return canSubscribeToEvents(VPAIDAdUnit) && canUnsubscribeFromEvents(VPAIDAdUnit);\n\n /*** Local Functions ***/\n\n function canSubscribeToEvents(adUnit) {\n return utilities.isFunction(adUnit.subscribe) || utilities.isFunction(adUnit.addEventListener) || utilities.isFunction(adUnit.on);\n }\n\n function canUnsubscribeFromEvents(adUnit) {\n return utilities.isFunction(adUnit.unsubscribe) || utilities.isFunction(adUnit.removeEventListener) || utilities.isFunction(adUnit.off);\n\n }\n};\n\nVPAIDAdUnitWrapper.prototype.adUnitAsyncCall = function () {\n var args = utilities.arrayLikeObjToArray(arguments);\n var method = args.shift();\n var cb = args.pop();\n var timeoutId;\n\n sanityCheck(method, cb, this._adUnit);\n args.push(wrapCallback());\n\n this._adUnit[method].apply(this._adUnit, args);\n timeoutId = setTimeout(function () {\n timeoutId = null;\n cb(new VASTError(\"on VPAIDAdUnitWrapper, timeout while waiting for a response on call '\" + method + \"'\"));\n cb = utilities.noop;\n }, this.options.responseTimeout);\n\n /*** Local functions ***/\n function sanityCheck(method, cb, adUnit) {\n if (!utilities.isString(method) || !utilities.isFunction(adUnit[method])) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.adUnitAsyncCall, invalid method name\");\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.adUnitAsyncCall, missing callback\");\n }\n }\n\n function wrapCallback() {\n return function () {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n cb.apply(this, arguments);\n };\n }\n};\n\nVPAIDAdUnitWrapper.prototype.on = function (evtName, handler) {\n var addEventListener = this._adUnit.addEventListener || this._adUnit.subscribe || this._adUnit.on;\n addEventListener.call(this._adUnit, evtName, handler);\n};\n\nVPAIDAdUnitWrapper.prototype.off = function (evtName, handler) {\n var removeEventListener = this._adUnit.removeEventListener || this._adUnit.unsubscribe || this._adUnit.off;\n removeEventListener.call(this._adUnit, evtName, handler);\n};\n\nVPAIDAdUnitWrapper.prototype.waitForEvent = function (evtName, cb, context) {\n var timeoutId;\n sanityCheck(evtName, cb);\n context = context || null;\n\n this.on(evtName, responseListener);\n\n timeoutId = setTimeout(function () {\n cb(new VASTError(\"on VPAIDAdUnitWrapper.waitForEvent, timeout while waiting for event '\" + evtName + \"'\"));\n timeoutId = null;\n cb = utilities.noop;\n }, this.options.responseTimeout);\n\n /*** Local functions ***/\n function sanityCheck(evtName, cb) {\n if (!utilities.isString(evtName)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.waitForEvent, missing evt name\");\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.waitForEvent, missing callback\");\n }\n }\n\n function responseListener() {\n var args = utilities.arrayLikeObjToArray(arguments);\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n\n args.unshift(null);\n cb.apply(context, args);\n }\n};\n\n// VPAID METHODS\nVPAIDAdUnitWrapper.prototype.handshakeVersion = function (version, cb) {\n this.adUnitAsyncCall('handshakeVersion', version, cb);\n};\n\n/* jshint maxparams:6 */\nVPAIDAdUnitWrapper.prototype.initAd = function (width, height, viewMode, desiredBitrate, adUnitData, cb) {\n this.waitForEvent('AdLoaded', cb);\n this._adUnit.initAd(width, height, viewMode, desiredBitrate, adUnitData);\n};\n\nVPAIDAdUnitWrapper.prototype.resizeAd = function (width, height, viewMode, cb) {\n // NOTE: AdSizeChange event is only supported on VPAID 2.0 so for the moment we are not going to use it\n // and will assume that everything is fine after the async call\n this.adUnitAsyncCall('resizeAd', width, height, viewMode, cb);\n};\n\nVPAIDAdUnitWrapper.prototype.startAd = function (cb) {\n this.waitForEvent('AdStarted', cb);\n this._adUnit.startAd();\n};\n\nVPAIDAdUnitWrapper.prototype.stopAd = function (cb) {\n this.waitForEvent('AdStopped', cb);\n this._adUnit.stopAd();\n};\n\nVPAIDAdUnitWrapper.prototype.pauseAd = function (cb) {\n this.waitForEvent('AdPaused', cb);\n this._adUnit.pauseAd();\n};\n\nVPAIDAdUnitWrapper.prototype.resumeAd = function (cb) {\n this.waitForEvent('AdPlaying', cb);\n this._adUnit.resumeAd();\n};\n\nVPAIDAdUnitWrapper.prototype.expandAd = function (cb) {\n this.waitForEvent('AdExpandedChange', cb);\n this._adUnit.expandAd();\n};\n\nVPAIDAdUnitWrapper.prototype.collapseAd = function (cb) {\n this.waitForEvent('AdExpandedChange', cb);\n this._adUnit.collapseAd();\n};\n\nVPAIDAdUnitWrapper.prototype.skipAd = function (cb) {\n this.waitForEvent('AdSkipped', cb);\n this._adUnit.skipAd();\n};\n\n//VPAID property getters\n[\n 'adLinear',\n 'adWidth',\n 'adHeight',\n 'adExpanded',\n 'adSkippableState',\n 'adRemainingTime',\n 'adDuration',\n 'adVolume',\n 'adCompanions',\n 'adIcons'\n].forEach(function (property) {\n var getterName = 'get' + utilities.capitalize(property);\n\n VPAIDAdUnitWrapper.prototype[getterName] = function (cb) {\n this.adUnitAsyncCall(getterName, cb);\n };\n});\n\n//VPAID property setters\nVPAIDAdUnitWrapper.prototype.setAdVolume = function(volume, cb){\n this.adUnitAsyncCall('setAdVolume',volume, cb);\n};\n\nmodule.exports = VPAIDAdUnitWrapper;\n","'use strict';\n\nvar VASTError = require('../vast/VASTError');\n\nvar VPAIDFLASHClient = require('VPAIDFLASHClient/js/VPAIDFLASHClient');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar dom = require('../../utils/dom');\n\nfunction VPAIDFlashTech(mediaFile, settings) {\n if (!(this instanceof VPAIDFlashTech)) {\n return new VPAIDFlashTech(mediaFile);\n }\n sanityCheck(mediaFile);\n this.name = 'vpaid-flash';\n this.mediaFile = mediaFile;\n this.containerEl = null;\n this.vpaidFlashClient = null;\n this.settings = settings;\n\n /*** local functions ***/\n function sanityCheck(mediaFile) {\n if (!mediaFile || !utilities.isString(mediaFile.src)) {\n throw new VASTError('on VPAIDFlashTech, invalid MediaFile');\n }\n }\n}\n\nVPAIDFlashTech.VPAIDFLASHClient = VPAIDFLASHClient;\n\nVPAIDFlashTech.supports = function (type) {\n return type === 'application/x-shockwave-flash' && VPAIDFlashTech.VPAIDFLASHClient.isSupported();\n};\n\nVPAIDFlashTech.prototype.loadAdUnit = function loadFlashCreative(containerEl, objectEl, callback) {\n var that = this;\n var flashClientOpts = this.settings && this.settings.vpaidFlashLoaderPath ? {data: this.settings.vpaidFlashLoaderPath} : undefined;\n sanityCheck(containerEl, callback);\n\n this.containerEl = containerEl;\n this.vpaidFlashClient = new VPAIDFlashTech.VPAIDFLASHClient(containerEl, function (error) {\n if (error) {\n return callback(error);\n }\n\n that.vpaidFlashClient.loadAdUnit(that.mediaFile.src, callback);\n }, flashClientOpts);\n\n /*** Local Functions ***/\n function sanityCheck(container, cb) {\n\n if (!dom.isDomElement(container)) {\n throw new VASTError('on VPAIDFlashTech.loadAdUnit, invalid dom container element');\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError('on VPAIDFlashTech.loadAdUnit, missing valid callback');\n }\n }\n};\n\nVPAIDFlashTech.prototype.unloadAdUnit = function () {\n if (this.vpaidFlashClient) {\n try{\n this.vpaidFlashClient.destroy();\n } catch(e){\n if(console && utilities.isFunction(console.log)){\n console.log('VAST ERROR: trying to unload the VPAID adunit');\n }\n }\n this.vpaidFlashClient = null;\n }\n\n if (this.containerEl) {\n dom.remove(this.containerEl);\n this.containerEl = null;\n }\n};\n\nmodule.exports = VPAIDFlashTech;\n","'use strict';\n\nvar VASTError = require('../vast/VASTError');\n\nvar VPAIDHTML5Client = require('VPAIDHTML5Client/js/VPAIDHTML5Client');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar dom = require('../../utils/dom');\n\nfunction VPAIDHTML5Tech(mediaFile) {\n\n if(!(this instanceof VPAIDHTML5Tech)) {\n return new VPAIDHTML5Tech(mediaFile);\n }\n\n sanityCheck(mediaFile);\n\n this.name = 'vpaid-html5';\n this.containerEl = null;\n this.videoEl = null;\n this.vpaidHTMLClient = null;\n\n this.mediaFile = mediaFile;\n\n function sanityCheck(mediaFile) {\n if (!mediaFile || !utilities.isString(mediaFile.src)) {\n throw new VASTError(VPAIDHTML5Tech.INVALID_MEDIA_FILE);\n }\n }\n}\n\nVPAIDHTML5Tech.VPAIDHTML5Client = VPAIDHTML5Client;\n\nVPAIDHTML5Tech.supports = function (type) {\n return !utilities.isOldIE() && type === 'application/javascript';\n};\n\nVPAIDHTML5Tech.prototype.loadAdUnit = function loadAdUnit(containerEl, videoEl, callback) {\n sanityCheck(containerEl, videoEl, callback);\n\n this.containerEl = containerEl;\n this.videoEl = videoEl;\n this.vpaidHTMLClient = new VPAIDHTML5Tech.VPAIDHTML5Client(containerEl, videoEl, {});\n this.vpaidHTMLClient.loadAdUnit(this.mediaFile.src, callback);\n\n function sanityCheck(container, video, cb) {\n if (!dom.isDomElement(container)) {\n throw new VASTError(VPAIDHTML5Tech.INVALID_DOM_CONTAINER_EL);\n }\n\n if (!dom.isDomElement(video) || video.tagName.toLowerCase() !== 'video') {\n throw new VASTError(VPAIDHTML5Tech.INVALID_DOM_CONTAINER_EL);\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError(VPAIDHTML5Tech.MISSING_CALLBACK);\n }\n }\n};\n\nVPAIDHTML5Tech.prototype.unloadAdUnit = function unloadAdUnit() {\n if (this.vpaidHTMLClient) {\n try {\n this.vpaidHTMLClient.destroy();\n } catch(e) {\n if (console && utilities.isFunction(console.log)) {\n console.log('VAST ERROR: trying to unload the VPAID adunit');\n }\n }\n\n this.vpaidHTMLClient = null;\n }\n\n if (this.containerEl) {\n dom.remove(this.containerEl);\n this.containerEl = null;\n }\n};\n\nvar PREFIX = 'on VPAIDHTML5Tech';\nVPAIDHTML5Tech.INVALID_MEDIA_FILE = PREFIX + ', invalid MediaFile';\nVPAIDHTML5Tech.INVALID_DOM_CONTAINER_EL = PREFIX + ', invalid container HtmlElement';\nVPAIDHTML5Tech.INVALID_DOM_VIDEO_EL = PREFIX + ', invalid HTMLVideoElement';\nVPAIDHTML5Tech.MISSING_CALLBACK = PREFIX + ', missing valid callback';\n\nmodule.exports = VPAIDHTML5Tech;","'use strict';\n\nvar VASTError = require('../vast/VASTError');\nvar VASTResponse = require('../vast/VASTResponse');\nvar VASTTracker = require('../vast/VASTTracker');\nvar vastUtil = require('../vast/vastUtil');\n\nvar VPAIDAdUnitWrapper = require('./VPAIDAdUnitWrapper');\n\nvar async = require('../../utils/async');\nvar dom = require('../../utils/dom');\nvar playerUtils = require('../../utils/playerUtils');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VPAIDIntegrator(player, settings) {\n if (!(this instanceof VPAIDIntegrator)) {\n return new VPAIDIntegrator(player);\n }\n\n this.VIEW_MODE = {\n NORMAL: 'normal',\n FULLSCREEN: \"fullscreen\",\n THUMBNAIL: \"thumbnail\"\n };\n this.player = player;\n this.containerEl = createVPAIDContainerEl(player);\n this.options = {\n responseTimeout: 5000,\n VPAID_VERSION: '2.0'\n };\n this.settings = settings;\n\n /*** Local functions ***/\n\n function createVPAIDContainerEl() {\n var containerEl = document.createElement('div');\n dom.addClass(containerEl, 'VPAID-container');\n player.el().insertBefore(containerEl, player.controlBar.el());\n return containerEl;\n\n }\n}\n\nVPAIDIntegrator.prototype.playAd = function playVPaidAd(vastResponse, callback) {\n if (!(vastResponse instanceof VASTResponse)) {\n return callback(new VASTError('on VASTIntegrator.playAd, missing required VASTResponse'));\n }\n\n var that = this;\n var player = this.player;\n var tech = this._findSupportedTech(vastResponse, this.settings);\n\n callback = callback || utilities.noop;\n\n this._adUnit = null;\n\n dom.addClass(player.el(), 'vjs-vpaid-ad');\n\n player.on('vast.adsCancel', triggerVpaidAdEnd);\n player.one('vpaid.adEnd', function(){\n player.off('vast.adsCancel', triggerVpaidAdEnd);\n removeAdUnit();\n });\n\n if (tech) {\n async.waterfall([\n function (next) {\n next(null, tech, vastResponse);\n },\n this._loadAdUnit.bind(this),\n this._playAdUnit.bind(this),\n this._finishPlaying.bind(this)\n\n ], adComplete);\n\n this._adUnit = {\n _paused: true,\n type: 'VPAID',\n pauseAd: function() {\n player.trigger('vpaid.pauseAd');\n player.pause(true);//we make sure that the video content gets stopped.\n },\n resumeAd: function() {\n player.trigger('vpaid.resumeAd');\n },\n isPaused: function() {\n return this._paused;\n },\n getSrc: function() {\n return tech.mediaFile;\n }\n };\n\n } else {\n var error = new VASTError('on VPAIDIntegrator.playAd, could not find a supported mediaFile', 403);\n adComplete(error, this._adUnit, vastResponse);\n }\n\n return this._adUnit;\n\n /*** Local functions ***/\n function adComplete(error, adUnit, vastResponse) {\n if (error && vastResponse) {\n that._trackError(vastResponse, error.code);\n }\n player.trigger('vpaid.adEnd');\n callback(error, vastResponse);\n }\n\n function triggerVpaidAdEnd(){\n player.trigger('vpaid.adEnd');\n }\n\n function removeAdUnit() {\n if (tech) {\n tech.unloadAdUnit();\n }\n dom.removeClass(player.el(), 'vjs-vpaid-ad');\n }\n};\n\nVPAIDIntegrator.prototype._findSupportedTech = function (vastResponse, settings) {\n if (!(vastResponse instanceof VASTResponse)) {\n return null;\n }\n\n var vpaidMediaFiles = vastResponse.mediaFiles.filter(vastUtil.isVPAID);\n var i, len, mediaFile, VPAIDTech;\n\n for (i = 0, len = vpaidMediaFiles.length; i < len; i += 1) {\n mediaFile = vpaidMediaFiles[i];\n VPAIDTech = vastUtil.findSupportedVPAIDTech(mediaFile.type);\n if (VPAIDTech) {\n return new VPAIDTech(mediaFile, settings);\n }\n }\n return null;\n};\n\nVPAIDIntegrator.prototype._createVPAIDAdUnitWrapper = function(adUnit, src, responseTimeout) {\n return new VPAIDAdUnitWrapper(adUnit, {src: src, responseTimeout: responseTimeout});\n};\n\nVPAIDIntegrator.prototype._loadAdUnit = function (tech, vastResponse, next) {\n var that = this;\n var player = this.player;\n var vjsTechEl = player.el().querySelector('.vjs-tech');\n var responseTimeout = this.settings.responseTimeout || this.options.responseTimeout;\n tech.loadAdUnit(this.containerEl, vjsTechEl, function (error, adUnit) {\n if (error) {\n return next(error, adUnit, vastResponse);\n }\n\n try {\n var WrappedAdUnit = that._createVPAIDAdUnitWrapper(adUnit, tech.mediaFile.src, responseTimeout);\n var techClass = 'vjs-' + tech.name + '-ad';\n dom.addClass(player.el(), techClass);\n player.one('vpaid.adEnd', function() {\n dom.removeClass(player.el(),techClass);\n });\n next(null, WrappedAdUnit, vastResponse);\n } catch (e) {\n next(e, adUnit, vastResponse);\n }\n });\n};\n\nVPAIDIntegrator.prototype._playAdUnit = function (adUnit, vastResponse, callback) {\n async.waterfall([\n function (next) {\n next(null, adUnit, vastResponse);\n },\n this._handshake.bind(this),\n this._initAd.bind(this),\n this._setupEvents.bind(this),\n this._addSkipButton.bind(this),\n this._linkPlayerControls.bind(this),\n this._startAd.bind(this)\n ], callback);\n};\n\nVPAIDIntegrator.prototype._handshake = function handshake(adUnit, vastResponse, next) {\n adUnit.handshakeVersion(this.options.VPAID_VERSION, function (error, version) {\n if (error) {\n return next(error, adUnit, vastResponse);\n }\n\n if (version && isSupportedVersion(version)) {\n return next(null, adUnit, vastResponse);\n }\n\n return next(new VASTError('on VPAIDIntegrator._handshake, unsupported version \"' + version + '\"'), adUnit, vastResponse);\n });\n\n function isSupportedVersion(version) {\n var majorNum = major(version);\n return majorNum >= 1 && majorNum <= 2;\n }\n\n function major(version) {\n var parts = version.split('.');\n return parseInt(parts[0], 10);\n }\n};\n\nVPAIDIntegrator.prototype._initAd = function (adUnit, vastResponse, next) {\n var tech = this.player.el().querySelector('.vjs-tech');\n var dimension = dom.getDimension(tech);\n adUnit.initAd(dimension.width, dimension.height, this.VIEW_MODE.NORMAL, -1, {AdParameters: vastResponse.adParameters || ''}, function (error) {\n next(error, adUnit, vastResponse);\n });\n};\n\nVPAIDIntegrator.prototype._createVASTTracker = function(adUnitSrc, vastResponse) {\n return new VASTTracker(adUnitSrc, vastResponse);\n};\n\nVPAIDIntegrator.prototype._setupEvents = function (adUnit, vastResponse, next) {\n var adUnitSrc = adUnit.options.src;\n var tracker = this._createVASTTracker(adUnitSrc, vastResponse);\n var player = this.player;\n var that = this;\n\n adUnit.on('AdSkipped', function () {\n player.trigger('vpaid.AdSkipped');\n tracker.trackSkip();\n });\n\n adUnit.on('AdImpression', function () {\n player.trigger('vpaid.AdImpression');\n tracker.trackImpressions();\n });\n\n adUnit.on('AdStarted', function () {\n player.trigger('vpaid.AdStarted');\n tracker.trackCreativeView();\n notifyPlayToPlayer();\n });\n\n adUnit.on('AdVideoStart', function () {\n player.trigger('vpaid.AdVideoStart');\n tracker.trackStart();\n notifyPlayToPlayer();\n });\n\n adUnit.on('AdPlaying', function () {\n player.trigger('vpaid.AdPlaying');\n tracker.trackResume();\n notifyPlayToPlayer();\n });\n\n adUnit.on('AdPaused', function () {\n player.trigger('vpaid.AdPaused');\n tracker.trackPause();\n notifyPauseToPlayer();\n });\n\n function notifyPlayToPlayer(){\n if(that._adUnit && that._adUnit.isPaused()){\n that._adUnit._paused = false;\n }\n player.trigger('play');\n\n }\n\n function notifyPauseToPlayer() {\n if(that._adUnit){\n that._adUnit._paused = true;\n }\n player.trigger('pause');\n }\n\n adUnit.on('AdVideoFirstQuartile', function () {\n player.trigger('vpaid.AdVideoFirstQuartile');\n tracker.trackFirstQuartile();\n });\n\n adUnit.on('AdVideoMidpoint', function () {\n player.trigger('vpaid.AdVideoMidpoint');\n tracker.trackMidpoint();\n });\n\n adUnit.on('AdVideoThirdQuartile', function () {\n player.trigger('vpaid.AdVideoThirdQuartile');\n tracker.trackThirdQuartile();\n });\n\n adUnit.on('AdVideoComplete', function () {\n player.trigger('vpaid.AdVideoComplete');\n tracker.trackComplete();\n });\n\n adUnit.on('AdClickThru', function (data) {\n player.trigger('vpaid.AdClickThru');\n var url = data.url;\n var playerHandles = data.playerHandles;\n var clickThruUrl = utilities.isNotEmptyString(url) ? url : generateClickThroughURL(vastResponse.clickThrough);\n\n tracker.trackClick();\n if (playerHandles && clickThruUrl) {\n window.open(clickThruUrl, '_blank');\n }\n\n function generateClickThroughURL(clickThroughMacro) {\n var variables = {\n ASSETURI: adUnit.options.src,\n CONTENTPLAYHEAD: 0 //In VPAID there is no method to know the current time from the adUnit\n };\n\n return clickThroughMacro ? vastUtil.parseURLMacro(clickThroughMacro, variables) : null;\n }\n });\n\n adUnit.on('AdUserAcceptInvitation', function () {\n player.trigger('vpaid.AdUserAcceptInvitation');\n tracker.trackAcceptInvitation();\n tracker.trackAcceptInvitationLinear();\n });\n\n adUnit.on('AdUserClose', function () {\n player.trigger('vpaid.AdUserClose');\n tracker.trackClose();\n tracker.trackCloseLinear();\n });\n\n adUnit.on('AdUserMinimize', function () {\n player.trigger('vpaid.AdUserMinimize');\n tracker.trackCollapse();\n });\n\n adUnit.on('AdError', function () {\n player.trigger('vpaid.AdError');\n //NOTE: we track errors code 901, as noted in VAST 3.0\n tracker.trackErrorWithCode(901);\n });\n\n adUnit.on('AdVolumeChange', function () {\n player.trigger('vpaid.AdVolumeChange');\n var lastVolume = player.volume();\n adUnit.getAdVolume(function (error, currentVolume) {\n if (currentVolume === 0 && lastVolume > 0) {\n tracker.trackMute();\n }\n\n if (currentVolume > 0 && lastVolume === 0) {\n tracker.trackUnmute();\n }\n\n player.volume(currentVolume);\n });\n });\n\n var updateViewSize = resizeAd.bind(this, player, adUnit, this.VIEW_MODE);\n var updateViewSizeThrottled = utilities.throttle(updateViewSize, 100);\n var autoResize = this.settings.autoResize;\n\n if (autoResize) {\n dom.addEventListener(window, 'resize', updateViewSizeThrottled);\n dom.addEventListener(window, 'orientationchange', updateViewSizeThrottled);\n }\n\n player.on('vast.resize', updateViewSize);\n player.on('vpaid.pauseAd', pauseAdUnit);\n player.on('vpaid.resumeAd', resumeAdUnit);\n\n player.one('vpaid.adEnd', function () {\n player.off('vast.resize', updateViewSize);\n player.off('vpaid.pauseAd', pauseAdUnit);\n player.off('vpaid.resumeAd', resumeAdUnit);\n\n if (autoResize) {\n dom.removeEventListener(window, 'resize', updateViewSizeThrottled);\n dom.removeEventListener(window, 'orientationchange', updateViewSizeThrottled);\n }\n });\n\n next(null, adUnit, vastResponse);\n\n /*** Local Functions ***/\n function pauseAdUnit() {\n adUnit.pauseAd(utilities.noop);\n }\n\n function resumeAdUnit() {\n adUnit.resumeAd(utilities.noop);\n }\n};\n\nVPAIDIntegrator.prototype._addSkipButton = function (adUnit, vastResponse, next) {\n var skipButton;\n var player = this.player;\n\n adUnit.on('AdSkippableStateChange', updateSkipButtonState);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeSkipButton);\n\n next(null, adUnit, vastResponse);\n\n /*** Local function ***/\n function updateSkipButtonState() {\n player.trigger('vpaid.AdSkippableStateChange');\n adUnit.getAdSkippableState(function (error, isSkippable) {\n if (isSkippable) {\n if (!skipButton) {\n addSkipButton(player);\n }\n } else {\n removeSkipButton(player);\n }\n });\n }\n\n function addSkipButton(player) {\n skipButton = createSkipButton(player);\n player.el().appendChild(skipButton);\n }\n\n function removeSkipButton() {\n dom.remove(skipButton);\n skipButton = null;\n }\n\n function createSkipButton() {\n var skipButton = window.document.createElement(\"div\");\n dom.addClass(skipButton, \"vast-skip-button\");\n dom.addClass(skipButton, \"enabled\");\n skipButton.innerHTML = \"Skip ad\";\n\n skipButton.onclick = function (e) {\n adUnit.skipAd(utilities.noop);//We skip the adUnit\n\n //We prevent event propagation to avoid problems with the clickThrough and so on\n if (window.Event.prototype.stopPropagation !== undefined) {\n e.stopPropagation();\n } else {\n return false;\n }\n };\n\n return skipButton;\n }\n};\n\nVPAIDIntegrator.prototype._linkPlayerControls = function (adUnit, vastResponse, next) {\n var that = this;\n linkVolumeControl(this.player, adUnit);\n linkFullScreenControl(this.player, adUnit, this.VIEW_MODE);\n\n next(null, adUnit, vastResponse);\n\n /*** Local functions ***/\n function linkVolumeControl(player, adUnit) {\n player.on('volumechange', updateAdUnitVolume);\n adUnit.on('AdVolumeChange', updatePlayerVolume);\n\n player.one('vpaid.adEnd', function () {\n player.off('volumechange', updateAdUnitVolume);\n });\n\n\n /*** local functions ***/\n function updateAdUnitVolume() {\n var vol = player.muted() ? 0 : player.volume();\n adUnit.setAdVolume(vol, logError);\n }\n\n function updatePlayerVolume() {\n player.trigger('vpaid.AdVolumeChange');\n adUnit.getAdVolume(function (error, vol) {\n if (error) {\n logError(error);\n } else {\n player.volume(vol);\n }\n });\n }\n }\n\n function linkFullScreenControl(player, adUnit, VIEW_MODE) {\n var updateViewSize = resizeAd.bind(that, player, adUnit, VIEW_MODE);\n\n player.on('fullscreenchange', updateViewSize);\n\n player.one('vpaid.adEnd', function () {\n player.off('fullscreenchange', updateViewSize);\n });\n }\n};\n\nVPAIDIntegrator.prototype._startAd = function (adUnit, vastResponse, next) {\n var player = this.player;\n\n adUnit.startAd(function (error) {\n if (!error) {\n player.trigger('vast.adStart');\n }\n next(error, adUnit, vastResponse);\n });\n};\n\nVPAIDIntegrator.prototype._finishPlaying = function (adUnit, vastResponse, next) {\n var player = this.player;\n adUnit.on('AdStopped', function () {\n player.trigger('vpaid.AdStopped');\n finishPlayingAd(null);\n });\n\n adUnit.on('AdError', function (error) {\n var errMsg = error? error.message : 'on VPAIDIntegrator, error while waiting for the adUnit to finish playing';\n finishPlayingAd(new VASTError(errMsg));\n });\n\n /*** local functions ***/\n function finishPlayingAd(error) {\n next(error, adUnit, vastResponse);\n }\n};\n\nVPAIDIntegrator.prototype._trackError = function trackError(response, errorCode) {\n vastUtil.track(response.errorURLMacros, {ERRORCODE: errorCode || 901});\n};\n\nfunction resizeAd(player, adUnit, VIEW_MODE) {\n var tech = player.el().querySelector('.vjs-tech');\n var dimension = dom.getDimension(tech);\n var MODE = player.isFullscreen() ? VIEW_MODE.FULLSCREEN : VIEW_MODE.NORMAL;\n adUnit.resizeAd(dimension.width, dimension.height, MODE, logError);\n}\n\nfunction logError(error) {\n if (error && console && console.log) {\n console.log('ERROR: ' + error.message, error);\n }\n}\n\nmodule.exports = VPAIDIntegrator;","'use strict';\n\nvar dom = require('../../utils/dom');\n\nvar element = document.createElement('div');\nelement.className = 'vjs-ads-label vjs-control vjs-label-hidden';\nelement.innerHTML = 'Advertisement';\n\nvar AdsLabelFactory = function(baseComponent) {\n return {\n /** @constructor */\n init: function init(player, options) {\n options.el = element;\n baseComponent.call(this, player, options);\n\n // We asynchronously reposition the ads label element\n setTimeout(function () {\n var currentTimeComp = player.controlBar &&( player.controlBar.getChild(\"timerControls\") || player.controlBar.getChild(\"currentTimeDisplay\") );\n if(currentTimeComp) {\n player.controlBar.el().insertBefore(element, currentTimeComp.el());\n }\n dom.removeClass(element, 'vjs-label-hidden');\n }, 0);\n },\n\n el: function getElement() {\n return element;\n }\n };\n};\n\nmodule.exports = AdsLabelFactory;","'use strict';\n\nvar baseVideoJsComponent = videojs.Component;\n\nvar AdsLabel = require('./ads-label')(baseVideoJsComponent);\n\nvideojs.AdsLabel = videojs.Component.extend(AdsLabel);\n","'use strict';\n\n/**\n * The component that shows a black screen until the ads plugin has decided if it can or it can not play the ad.\n *\n * Note: In case you wonder why instead of this black poster we don't just show the spinner loader.\n * IOS devices do not work well with animations and the browser chrashes from time to time That is why we chose to\n * have a secondary black poster.\n *\n * It also makes it much more easier for the users of the plugin since it does not change the default behaviour of the\n * spinner and the player works the same way with and without the plugin.\n *\n * @param {vjs.Player|Object} player\n * @param {Object=} options\n * @constructor\n */\nvar element = document.createElement('div');\n\nvar BlackPosterFactory = function(baseComponent) {\n return {\n /** @constructor */\n init: function init(player, options) {\n options.el = element;\n element.className = 'vjs-black-poster';\n baseComponent.call(this, player, options);\n\n var posterImg = player.getChild('posterImage');\n\n //We need to do it asynchronously to be sure that the black poster el is on the dom.\n setTimeout(function() {\n if(posterImg && player && player.el()) {\n player.el().insertBefore(element, posterImg.el());\n }\n }, 0);\n },\n el: function getElement() {\n return element;\n }\n };\n};\n\nmodule.exports = BlackPosterFactory;","'use strict';\n\nvar baseVideoJsComponent = videojs.Component;\n\nvar BlackPoster = require('./black-poster')(baseVideoJsComponent);\n\nvideojs.BlackPoster = videojs.Component.extend(BlackPoster);\n","'use strict';\n\nvar VASTClient = require('../ads/vast/VASTClient');\nvar VASTError = require('../ads/vast/VASTError');\nvar vastUtil = require('../ads/vast/vastUtil');\n\nvar VASTIntegrator = require('../ads/vast/VASTIntegrator');\nvar VPAIDIntegrator = require('../ads/vpaid/VPAIDIntegrator');\n\nvar async = require('../utils/async');\nvar dom = require('../utils/dom');\nvar playerUtils = require('../utils/playerUtils');\nvar utilities = require('../utils/utilityFunctions');\n\nmodule.exports = function VASTPlugin(options) {\n var snapshot;\n var player = this;\n var vast = new VASTClient();\n var adsCanceled = false;\n var defaultOpts = {\n // maximum amount of time in ms to wait to receive `adsready` from the ad\n // implementation after play has been requested. Ad implementations are\n // expected to load any dynamic libraries and make any requests to determine\n // ad policies for a video during this time.\n timeout: 500,\n\n //TODO:finish this IOS FIX\n //Whenever you play an add on IOS, the native player kicks in and we loose control of it. On very heavy pages the 'play' event\n // May occur after the video content has already started. This is wrong if you want to play a preroll ad that needs to happen before the user\n // starts watching the content. To prevent this usec\n iosPrerollCancelTimeout: 2000,\n\n // maximun amount of time for the ad to actually start playing. If this timeout gets\n // triggered the ads will be cancelled\n adCancelTimeout: 3000,\n\n // Boolean flag that configures the player to play a new ad before the user sees the video again\n // the current video\n playAdAlways: false,\n\n // Flag to enable or disable the ads by default.\n adsEnabled: true,\n\n // Boolean flag to enable or disable the resize with window.resize or orientationchange\n autoResize: true,\n\n // Path to the VPAID flash ad's loader\n vpaidFlashLoaderPath: '/VPAIDFlash.swf'\n };\n\n var settings = utilities.extend({}, defaultOpts, options || {});\n\n if(utilities.isUndefined(settings.adTagUrl) && utilities.isDefined(settings.url)){\n settings.adTagUrl = settings.url;\n }\n\n if (utilities.isString(settings.adTagUrl)) {\n settings.adTagUrl = utilities.echoFn(settings.adTagUrl);\n }\n\n if (utilities.isDefined(settings.adTagXML) && !utilities.isFunction(settings.adTagXML)) {\n return trackAdError(new VASTError('on VideoJS VAST plugin, the passed adTagXML option does not contain a function'));\n }\n\n if (!utilities.isDefined(settings.adTagUrl) && !utilities.isFunction(settings.adTagXML)) {\n return trackAdError(new VASTError('on VideoJS VAST plugin, missing adTagUrl on options object'));\n }\n\n vastUtil.runFlashSupportCheck(settings.vpaidFlashLoaderPath);// Necessary step for VPAIDFLASHClient to work.\n\n playerUtils.prepareForAds(player);\n\n if (settings.playAdAlways) {\n // No matter what happens we play a new ad before the user sees the video again.\n player.on('vast.contentEnd', function () {\n setTimeout(function () {\n player.trigger('vast.reset');\n }, 0);\n });\n }\n\n player.on('vast.firstPlay', tryToPlayPrerollAd);\n\n player.on('vast.reset', function () {\n //If we are reseting the plugin, we don't want to restore the content\n snapshot = null;\n cancelAds();\n });\n\n player.vast = {\n isEnabled: function () {\n return settings.adsEnabled;\n },\n\n enable: function () {\n settings.adsEnabled = true;\n },\n\n disable: function () {\n settings.adsEnabled = false;\n }\n };\n\n return player.vast;\n\n /**** Local functions ****/\n function tryToPlayPrerollAd() {\n //We remove the poster to prevent flickering whenever the content starts playing\n playerUtils.removeNativePoster(player);\n\n playerUtils.once(player, ['vast.adsCancel', 'vast.adEnd'], function () {\n removeAdUnit();\n restoreVideoContent();\n });\n\n async.waterfall([\n checkAdsEnabled,\n preparePlayerForAd,\n startAdCancelTimeout,\n playPrerollAd\n ], function (error, response) {\n if (error) {\n trackAdError(error, response);\n } else {\n player.trigger('vast.adEnd');\n }\n });\n\n /*** Local functions ***/\n\n function removeAdUnit() {\n if (player.vast && player.vast.adUnit) {\n player.vast.adUnit = null; //We remove the adUnit\n }\n }\n\n function restoreVideoContent() {\n setupContentEvents();\n if (snapshot) {\n playerUtils.restorePlayerSnapshot(player, snapshot);\n snapshot = null;\n }\n }\n\n function setupContentEvents() {\n playerUtils.once(player, ['playing', 'vast.reset', 'vast.firstPlay'], function (evt) {\n if (evt.type !== 'playing') {\n return;\n }\n\n player.trigger('vast.contentStart');\n\n playerUtils.once(player, ['ended', 'vast.reset', 'vast.firstPlay'], function (evt) {\n if (evt.type === 'ended') {\n player.trigger('vast.contentEnd');\n }\n });\n });\n }\n\n function checkAdsEnabled(next) {\n if (settings.adsEnabled) {\n return next(null);\n }\n next(new VASTError('Ads are not enabled'));\n }\n\n function preparePlayerForAd(next) {\n if (canPlayPrerollAd()) {\n snapshot = playerUtils.getPlayerSnapshot(player);\n player.pause();\n addSpinnerIcon();\n\n if(player.paused()) {\n next(null);\n } else {\n playerUtils.once(player, ['playing'], function() {\n player.pause();\n next(null);\n });\n }\n } else {\n next(new VASTError('video content has been playing before preroll ad'));\n }\n }\n\n function canPlayPrerollAd() {\n return !utilities.isIPhone() || player.currentTime() <= settings.iosPrerollCancelTimeout;\n }\n\n function startAdCancelTimeout(next) {\n var adCancelTimeoutId;\n adsCanceled = false;\n\n adCancelTimeoutId = setTimeout(function () {\n trackAdError(new VASTError('timeout while waiting for the video to start playing', 402));\n }, settings.adCancelTimeout);\n\n playerUtils.once(player, ['vast.adStart', 'vast.adsCancel'], clearAdCancelTimeout);\n\n /*** local functions ***/\n function clearAdCancelTimeout() {\n if (adCancelTimeoutId) {\n clearTimeout(adCancelTimeoutId);\n adCancelTimeoutId = null;\n }\n }\n\n next(null);\n }\n\n function addSpinnerIcon() {\n dom.addClass(player.el(), 'vjs-vast-ad-loading');\n playerUtils.once(player, ['vast.adStart', 'vast.adsCancel'], removeSpinnerIcon);\n }\n\n function removeSpinnerIcon() {\n //IMPORTANT NOTE: We remove the spinnerIcon asynchronously to give time to the browser to start the video.\n // If we remove it synchronously we see a flash of the content video before the ad starts playing.\n setTimeout(function () {\n dom.removeClass(player.el(), 'vjs-vast-ad-loading');\n }, 100);\n }\n\n }\n\n function cancelAds() {\n player.trigger('vast.adsCancel');\n adsCanceled = true;\n }\n\n function playPrerollAd(callback) {\n async.waterfall([\n getVastResponse,\n playAd\n ], callback);\n }\n\n function getVastResponse(callback) {\n vast.getVASTResponse(settings.adTagUrl ? settings.adTagUrl() : settings.adTagXML, callback);\n }\n\n function playAd(vastResponse, callback) {\n //TODO: Find a better way to stop the play. The 'playPrerollWaterfall' ends in an inconsistent situation\n //If the state is not 'preroll?' it means the ads were canceled therefore, we break the waterfall\n if (adsCanceled) {\n return;\n }\n\n var adIntegrator = isVPAID(vastResponse) ? new VPAIDIntegrator(player, settings) : new VASTIntegrator(player);\n var adFinished = false;\n\n playerUtils.once(player, ['vast.adStart', 'vast.adsCancel'], function (evt) {\n if (evt.type === 'vast.adStart') {\n addAdsLabel();\n }\n });\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeAdsLabel);\n\n if (utilities.isIDevice()) {\n preventManualProgress();\n }\n\n player.vast.vastResponse = vastResponse;\n player.vast.adUnit = adIntegrator.playAd(vastResponse, callback);\n\n /*** Local functions ****/\n function addAdsLabel() {\n if (adFinished || player.controlBar.getChild('AdsLabel')) {\n return;\n }\n\n player.controlBar.addChild('AdsLabel');\n }\n\n function removeAdsLabel() {\n player.controlBar.removeChild('AdsLabel');\n adFinished = true;\n }\n\n function preventManualProgress() {\n //IOS video clock is very unreliable and we need a 3 seconds threshold to ensure that the user forwarded/rewound the ad\n var PROGRESS_THRESHOLD = 3;\n var previousTime = 0;\n var skipad_attempts = 0;\n\n player.on('timeupdate', preventAdSeek);\n player.on('ended', preventAdSkip);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel', 'vast.adError'], stopPreventManualProgress);\n\n /*** Local functions ***/\n function preventAdSkip() {\n // Ignore ended event if the Ad time was not 'near' the end\n // and revert time to the previous 'valid' time\n if ((player.duration() - previousTime) > PROGRESS_THRESHOLD) {\n player.pause(true); // this reduce the video jitter if the IOS skip button is pressed\n player.play(true); // we need to trigger the play to put the video element back in a valid state\n player.currentTime(previousTime);\n }\n }\n\n function preventAdSeek() {\n var currentTime = player.currentTime();\n var progressDelta = Math.abs(currentTime - previousTime);\n if (progressDelta > PROGRESS_THRESHOLD) {\n skipad_attempts += 1;\n if (skipad_attempts >= 2) {\n player.pause(true);\n }\n player.currentTime(previousTime);\n } else {\n previousTime = currentTime;\n }\n }\n\n function stopPreventManualProgress() {\n player.off('timeupdate', preventAdSeek);\n player.off('ended', preventAdSkip);\n }\n }\n }\n\n function trackAdError(error, vastResponse) {\n player.trigger({type: 'vast.adError', error: error});\n cancelAds();\n if (console && console.log) {\n console.log('AD ERROR:', error.message, error, vastResponse);\n }\n }\n\n function isVPAID(vastResponse) {\n var i, len;\n var mediaFiles = vastResponse.mediaFiles;\n for (i = 0, len = mediaFiles.length; i < len; i++) {\n if (vastUtil.isVPAID(mediaFiles[i])) {\n return true;\n }\n }\n return false;\n }\n};\n","//Small subset of async\n\nvar utilities = require('./utilityFunctions');\n\nvar async = {};\n\nasync.setImmediate = function (fn) {\n setTimeout(fn, 0);\n};\n\nasync.iterator = function (tasks) {\n var makeCallback = function (index) {\n var fn = function () {\n if (tasks.length) {\n tasks[index].apply(null, arguments);\n }\n return fn.next();\n };\n fn.next = function () {\n return (index < tasks.length - 1) ? makeCallback(index + 1) : null;\n };\n return fn;\n };\n return makeCallback(0);\n};\n\n\nasync.waterfall = function (tasks, callback) {\n callback = callback || function () { };\n if (!utilities.isArray(tasks)) {\n var err = new Error('First argument to waterfall must be an array of functions');\n return callback(err);\n }\n if (!tasks.length) {\n return callback();\n }\n var wrapIterator = function (iterator) {\n return function (err) {\n if (err) {\n callback.apply(null, arguments);\n callback = function () {\n };\n }\n else {\n var args = Array.prototype.slice.call(arguments, 1);\n var next = iterator.next();\n if (next) {\n args.push(wrapIterator(next));\n }\n else {\n args.push(callback);\n }\n async.setImmediate(function () {\n iterator.apply(null, args);\n });\n }\n };\n };\n wrapIterator(async.iterator(tasks))();\n};\n\nasync.when = function (condition, callback) {\n if (!utilities.isFunction(callback)) {\n throw new Error(\"async.when error: missing callback argument\");\n }\n\n var isAllowed = utilities.isFunction(condition) ? condition : function () {\n return !!condition;\n };\n\n return function () {\n var args = utilities.arrayLikeObjToArray(arguments);\n var next = args.pop();\n\n if (isAllowed.apply(null, args)) {\n return callback.apply(this, arguments);\n }\n\n args.unshift(null);\n return next.apply(null, args);\n };\n};\n\nmodule.exports = async;\n\n","'use strict';\n\nvar utilities = require('./utilityFunctions');\n\nvar dom = {};\n\ndom.isVisible = function isVisible(el) {\n var style = window.getComputedStyle(el);\n return style.visibility !== 'hidden';\n};\n\ndom.isHidden = function isHidden(el) {\n var style = window.getComputedStyle(el);\n return style.display === 'none';\n};\n\ndom.isShown = function isShown(el) {\n return !dom.isHidden(el);\n};\n\ndom.hide = function hide(el) {\n el.__prev_style_display_ = el.style.display;\n el.style.display = 'none';\n};\n\ndom.show = function show(el) {\n if (dom.isHidden(el)) {\n el.style.display = el.__prev_style_display_;\n }\n el.__prev_style_display_ = undefined;\n};\n\ndom.hasClass = function hasClass(el, cssClass) {\n var classes, i, len;\n\n if (utilities.isNotEmptyString(cssClass)) {\n if (el.classList) {\n return el.classList.contains(cssClass);\n }\n\n classes = utilities.isString(el.getAttribute('class')) ? el.getAttribute('class').split(/\\s+/) : [];\n cssClass = (cssClass || '');\n\n for (i = 0, len = classes.length; i < len; i += 1) {\n if (classes[i] === cssClass) {\n return true;\n }\n }\n }\n return false;\n};\n\ndom.addClass = function (el, cssClass) {\n var classes;\n\n if (utilities.isNotEmptyString(cssClass)) {\n if (el.classList) {\n return el.classList.add(cssClass);\n }\n\n classes = utilities.isString(el.getAttribute('class')) ? el.getAttribute('class').split(/\\s+/) : [];\n if (utilities.isString(cssClass) && utilities.isNotEmptyString(cssClass.replace(/\\s+/, ''))) {\n classes.push(cssClass);\n el.setAttribute('class', classes.join(' '));\n }\n }\n};\n\ndom.removeClass = function (el, cssClass) {\n var classes;\n\n if (utilities.isNotEmptyString(cssClass)) {\n if (el.classList) {\n return el.classList.remove(cssClass);\n }\n\n classes = utilities.isString(el.getAttribute('class')) ? el.getAttribute('class').split(/\\s+/) : [];\n var newClasses = [];\n var i, len;\n if (utilities.isString(cssClass) && utilities.isNotEmptyString(cssClass.replace(/\\s+/, ''))) {\n\n for (i = 0, len = classes.length; i < len; i += 1) {\n if (cssClass !== classes[i]) {\n newClasses.push(classes[i]);\n }\n }\n el.setAttribute('class', newClasses.join(' '));\n }\n }\n};\n\ndom.addEventListener = function addEventListener(el, type, handler) {\n if(utilities.isArray(el)){\n utilities.forEach(el, function(e) {\n dom.addEventListener(e, type, handler);\n });\n return;\n }\n\n if(utilities.isArray(type)){\n utilities.forEach(type, function(t) {\n dom.addEventListener(el, t, handler);\n });\n return;\n }\n\n if (el.addEventListener) {\n el.addEventListener(type, handler, false);\n } else if (el.attachEvent) {\n // WARNING!!! this is a very naive implementation !\n // the event object that should be passed to the handler\n // would not be there for IE8\n // we should use \"window.event\" and then \"event.srcElement\"\n // instead of \"event.target\"\n el.attachEvent(\"on\" + type, handler);\n }\n};\n\ndom.removeEventListener = function removeEventListener(el, type, handler) {\n if(utilities.isArray(el)){\n utilities.forEach(el, function(e) {\n dom.removeEventListener(e, type, handler);\n });\n return;\n }\n\n if(utilities.isArray(type)){\n utilities.forEach(type, function(t) {\n dom.removeEventListener(el, t, handler);\n });\n return;\n }\n\n if (el.removeEventListener) {\n el.removeEventListener(type, handler, false);\n } else if (el.detachEvent) {\n el.detachEvent(\"on\" + type, handler);\n } else {\n el[\"on\" + type] = null;\n }\n};\n\ndom.dispatchEvent = function dispatchEvent(el, event) {\n if (el.dispatchEvent) {\n el.dispatchEvent(event);\n } else {\n el.fireEvent(\"on\" + event.eventType, event);\n }\n};\n\ndom.isDescendant = function isDescendant(parent, child) {\n var node = child.parentNode;\n while (node !== null) {\n if (node === parent) {\n return true;\n }\n node = node.parentNode;\n }\n return false;\n};\n\ndom.getTextContent = function getTextContent(el){\n return el.textContent || el.text;\n};\n\ndom.prependChild = function prependChild(parent, child) {\n if(child.parentNode){\n child.parentNode.removeChild(child);\n }\n return parent.insertBefore(child, parent.firstChild);\n};\n\ndom.remove = function removeNode(node){\n if(node && node.parentNode){\n node.parentNode.removeChild(node);\n }\n};\n\ndom.isDomElement = function isDomElement(o) {\n return o instanceof Element;\n};\n\ndom.click = function(el, handler) {\n dom.addEventListener(el, 'click', handler);\n};\n\ndom.once = function(el, type, handler) {\n function handlerWrap() {\n handler.apply(null, arguments);\n dom.removeEventListener(el, type, handlerWrap);\n }\n\n dom.addEventListener(el, type, handlerWrap);\n};\n\n//Note: there is no getBoundingClientRect on iPad so we need a fallback\ndom.getDimension = function getDimension(element) {\n var rect;\n\n //On IE9 and below getBoundingClientRect does not work consistently\n if(!utilities.isOldIE() && element.getBoundingClientRect) {\n rect = element.getBoundingClientRect();\n return {\n width: rect.width,\n height: rect.height\n };\n }\n\n return {\n width: element.offsetWidth,\n height: element.offsetHeight\n };\n};\n\nmodule.exports = dom;","'use strict';\n\nvar urlUtils = require('./urlUtils');\nvar utilities = require('./utilityFunctions');\n\nfunction HttpRequestError(message) {\n this.message = 'HttpRequest Error: ' + (message || '');\n}\nHttpRequestError.prototype = new Error();\nHttpRequestError.prototype.name = \"HttpRequest Error\";\n\nfunction HttpRequest(createXhr) {\n if (!utilities.isFunction(createXhr)) {\n throw new HttpRequestError('Missing XMLHttpRequest factory method');\n }\n\n this.createXhr = createXhr;\n}\n\nHttpRequest.prototype.run = function (method, url, callback, options) {\n sanityCheck(url, callback, options);\n var timeout, timeoutId;\n var xhr = this.createXhr();\n options = options || {};\n timeout = utilities.isNumber(options.timeout) ? options.timeout : 0;\n\n xhr.open(method, urlUtils.urlParts(url).href, true);\n\n if (options.headers) {\n setHeaders(xhr, options.headers);\n }\n\n if (options.withCredentials) {\n xhr.withCredentials = true;\n }\n\n xhr.onload = function () {\n var statusText, response, status;\n\n /**\n * The only way to do a secure request on IE8 and IE9 is with the XDomainRequest object. Unfortunately, microsoft is\n * so nice that decided that the status property and the 'getAllResponseHeaders' method where not needed so we have to\n * fake them. If the request gets done with an XDomainRequest instance, we will assume that there are no headers and\n * the status will always be 200. If you don't like it, DO NOT USE ANCIENT BROWSERS!!!\n *\n * For mor info go to: https://msdn.microsoft.com/en-us/library/cc288060(v=vs.85).aspx\n */\n if (!xhr.getAllResponseHeaders) {\n xhr.getAllResponseHeaders = function () {\n return null;\n };\n }\n\n if (!xhr.status) {\n xhr.status = 200;\n }\n\n if (utilities.isDefined(timeoutId)) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n\n statusText = xhr.statusText || '';\n\n // responseText is the old-school way of retrieving response (supported by IE8 & 9)\n // response/responseType properties were introduced in XHR Level2 spec (supported by IE10)\n response = ('response' in xhr) ? xhr.response : xhr.responseText;\n\n // normalize IE9 bug (http://bugs.jquery.com/ticket/1450)\n status = xhr.status === 1223 ? 204 : xhr.status;\n\n callback(\n status,\n response,\n xhr.getAllResponseHeaders(),\n statusText);\n };\n\n xhr.onerror = requestError;\n xhr.onabort = requestError;\n\n xhr.send();\n\n if (timeout > 0) {\n timeoutId = setTimeout(function () {\n xhr && xhr.abort();\n }, timeout);\n }\n\n function sanityCheck(url, callback, options) {\n if (!utilities.isString(url) || utilities.isEmptyString(url)) {\n throw new HttpRequestError(\"Invalid url '\" + url + \"'\");\n }\n\n if (!utilities.isFunction(callback)) {\n throw new HttpRequestError(\"Invalid handler '\" + callback + \"' for the http request\");\n }\n\n if (utilities.isDefined(options) && !utilities.isObject(options)) {\n throw new HttpRequestError(\"Invalid options map '\" + options + \"'\");\n }\n }\n\n function setHeaders(xhr, headers) {\n utilities.forEach(headers, function (value, key) {\n if (utilities.isDefined(value)) {\n xhr.setRequestHeader(key, value);\n }\n });\n }\n\n function requestError() {\n callback(-1, null, null, '');\n }\n};\n\nHttpRequest.prototype.get = function (url, callback, options) {\n this.run('GET', url, processResponse, options);\n\n function processResponse(status, response, headersString, statusText) {\n if (isSuccess(status)) {\n callback(null, response, status, headersString, statusText);\n } else {\n callback(new HttpRequestError(statusText), response, status, headersString, statusText);\n }\n }\n\n function isSuccess(status) {\n return 200 <= status && status < 300;\n }\n};\n\nfunction createXhr() {\n var xhr = new XMLHttpRequest();\n if (!(\"withCredentials\" in xhr)) {\n // XDomainRequest for IE.\n xhr = new XDomainRequest();\n }\n return xhr;\n}\n\nvar http = new HttpRequest(createXhr);\n\nmodule.exports = {\n http: http,\n HttpRequest: HttpRequest,\n HttpRequestError: HttpRequestError,\n createXhr: createXhr\n};\n","'use strict';\n\nvar dom = require('./dom');\nvar utilities = require('./utilityFunctions');\n\nvar playerUtils = {};\n\n/**\n * Returns an object that captures the portions of player state relevant to\n * video playback. The result of this function can be passed to\n * restorePlayerSnapshot with a player to return the player to the state it\n * was in when this function was invoked.\n * @param {object} player The videojs player object\n */\nplayerUtils.getPlayerSnapshot = function getPlayerSnapshot(player) {\n var tech = player.el().querySelector('.vjs-tech');\n\n var snapshot = {\n ended: player.ended(),\n src: player.currentSrc(),\n currentTime: player.currentTime(),\n type: player.currentType(),\n playing: !player.paused(),\n suppressedTracks: getSuppressedTracks(player)\n };\n\n if (tech) {\n snapshot.nativePoster = tech.poster;\n snapshot.style = tech.getAttribute('style');\n }\n return snapshot;\n\n /**** Local Functions ****/\n function getSuppressedTracks(player) {\n var tracks = player.remoteTextTracks ? player.remoteTextTracks() : [];\n\n if (tracks && utilities.isArray(tracks.tracks_)) {\n tracks = tracks.tracks_;\n }\n\n if (!utilities.isArray(tracks)) {\n tracks = [];\n }\n\n var suppressedTracks = [];\n tracks.forEach(function (track) {\n suppressedTracks.push({\n track: track,\n mode: track.mode\n });\n track.mode = 'disabled';\n });\n\n return suppressedTracks;\n }\n};\n\n/**\n * Attempts to modify the specified player so that its state is equivalent to\n * the state of the snapshot.\n * @param {object} snapshot - the player state to apply\n */\nplayerUtils.restorePlayerSnapshot = function restorePlayerSnapshot(player, snapshot) {\n var tech = player.el().querySelector('.vjs-tech');\n var attempts = 20; // the number of remaining attempts to restore the snapshot\n\n if (snapshot.nativePoster) {\n tech.poster = snapshot.nativePoster;\n }\n\n if ('style' in snapshot) {\n // overwrite all css style properties to restore state precisely\n tech.setAttribute('style', snapshot.style || '');\n }\n\n if (hasSrcChanged(player, snapshot)) {\n\n // on ios7, fiddling with textTracks too early will cause safari to crash\n player.one('contentloadedmetadata', restoreTracks);\n\n player.one('canplay', tryToResume);\n ensureCanplayEvtGetsFired();\n\n // if the src changed for ad playback, reset it\n player.src({src: snapshot.src, type: snapshot.type});\n\n // safari requires a call to `load` to pick up a changed source\n player.load();\n\n } else {\n restoreTracks();\n\n if (snapshot.playing) {\n player.play();\n }\n }\n\n /*** Local Functions ***/\n\n /**\n * Sometimes firefox does not trigger the 'canplay' evt.\n * This code ensure that it always gets triggered triggered.\n */\n function ensureCanplayEvtGetsFired() {\n var timeoutId = setTimeout(function() {\n player.trigger('canplay');\n }, 1000);\n\n player.one('canplay', function(){\n clearTimeout(timeoutId);\n });\n }\n\n /**\n * Determine whether the player needs to be restored to its state\n * before ad playback began. With a custom ad display or burned-in\n * ads, the content player state hasn't been modified and so no\n * restoration is required\n */\n function hasSrcChanged(player, snapshot) {\n if (player.src()) {\n return player.src() !== snapshot.src;\n }\n // the player was configured through source element children\n return player.currentSrc() !== snapshot.src;\n }\n\n function restoreTracks() {\n var suppressedTracks = snapshot.suppressedTracks;\n suppressedTracks.forEach(function (trackSnapshot) {\n trackSnapshot.track.mode = trackSnapshot.mode;\n });\n }\n\n /**\n * Determine if the video element has loaded enough of the snapshot source\n * to be ready to apply the rest of the state\n */\n function tryToResume() {\n\n // if some period of the video is seekable, resume playback\n // otherwise delay a bit and then check again unless we're out of attempts\n\n if (!playerUtils.isReadyToResume(player) && attempts--) {\n setTimeout(tryToResume, 50);\n } else {\n try {\n if(player.currentTime() !== snapshot.currentTime) {\n if (snapshot.playing) { // if needed restore playing status after seek completes\n player.one('seeked', function() {\n player.play();\n });\n }\n player.currentTime(snapshot.currentTime);\n\n } else if (snapshot.playing) {\n // if needed and no seek has been performed, restore playing status immediately\n player.play();\n }\n\n } catch (e) {\n videojs.log.warn('Failed to resume the content after an advertisement', e);\n }\n }\n }\n};\n\nplayerUtils.isReadyToResume = function (player) {\n\n if (player.readyState() > 1) {\n // some browsers and media aren't \"seekable\".\n // readyState greater than 1 allows for seeking without exceptions\n return true;\n }\n\n if (player.seekable() === undefined) {\n // if the player doesn't expose the seekable time ranges, try to\n // resume playback immediately\n return true;\n }\n\n if (player.seekable().length > 0) {\n // if some period of the video is seekable, resume playback\n return true;\n }\n\n return false;\n};\n\n/**\n * This function prepares the player to display ads.\n * Adding convenience events like the 'vast.firsPlay' that gets fired when the video is first played\n * and ads the blackPoster to the player to prevent content from being displayed before the preroll ad.\n *\n * @param player\n */\nplayerUtils.prepareForAds = function (player) {\n var blackPoster = player.addChild('blackPoster');\n var _firstPlay = true;\n var volumeSnapshot;\n\n\n monkeyPatchPlayerApi();\n\n player.on('play', tryToTriggerFirstPlay);\n player.on('vast.reset', resetFirstPlay);//Every time we change the sources we reset the first play.\n player.on('vast.firstPlay', restoreContentVolume);\n player.on('error', hideBlackPoster);//If there is an error in the player we remove the blackposter to show the err msg\n player.on('vast.adStart', hideBlackPoster);\n player.on('vast.adsCancel', hideBlackPoster);\n player.on('vast.adError', hideBlackPoster);\n player.on('vast.adStart', addStyles);\n player.on('vast.adEnd', removeStyles);\n player.on('vast.adsCancel', removeStyles);\n\n /*** Local Functions ***/\n\n /**\n What this function does is ugly and horrible and I should think twice before calling myself a good developer. With that said,\n it is the best solution I could find to mute the video until the 'play' event happens (on mobile devices) and the plugin can decide whether\n to play the ad or not.\n\n We also need this monkeypatch to be able to pause and resume an ad using the player's API\n\n If you have a better solution please do tell me.\n */\n function monkeyPatchPlayerApi() {\n\n /**\n * Monkey patch needed to handle firstPlay and resume of playing ad.\n *\n * @param callOrigPlay necessary flag to prevent infinite loop when you are restoring a VAST ad.\n * @returns {player}\n */\n var origPlay = player.play;\n player.play = function (callOrigPlay) {\n var that = this;\n\n if (isFirstPlay()) {\n firstPlay();\n } else {\n resume(callOrigPlay);\n }\n\n return this;\n\n /*** local functions ***/\n function firstPlay() {\n if (!utilities.isIPhone()) {\n volumeSnapshot = saveVolumeSnapshot();\n player.muted(true);\n }\n\n origPlay.apply(that, arguments);\n }\n\n function resume(callOrigPlay) {\n if (isAdPlaying() && !callOrigPlay) {\n player.vast.adUnit.resumeAd();\n } else {\n origPlay.apply(that, arguments);\n }\n }\n };\n\n\n /**\n * Needed monkey patch to handle pause of playing ad.\n *\n * @param callOrigPlay necessary flag to prevent infinite loop when you are pausing a VAST ad.\n * @returns {player}\n */\n var origPause = player.pause;\n player.pause = function (callOrigPause) {\n if (isAdPlaying() && !callOrigPause) {\n player.vast.adUnit.pauseAd();\n } else {\n origPause.apply(this, arguments);\n }\n return this;\n };\n\n\n /**\n * Needed monkey patch to handle paused state of the player when ads are playing.\n *\n * @param callOrigPlay necessary flag to prevent infinite loop when you are pausing a VAST ad.\n * @returns {player}\n */\n var origPaused = player.paused;\n player.paused = function (callOrigPaused) {\n if (isAdPlaying() && !callOrigPaused) {\n return player.vast.adUnit.isPaused();\n }\n return origPaused.apply(this, arguments);\n };\n }\n\n function isAdPlaying() {\n return player.vast && player.vast.adUnit;\n }\n\n function tryToTriggerFirstPlay() {\n if (isFirstPlay()) {\n _firstPlay = false;\n player.trigger('vast.firstPlay');\n }\n }\n\n function resetFirstPlay() {\n _firstPlay = true;\n blackPoster.show();\n restoreContentVolume();\n }\n\n function isFirstPlay() {\n return _firstPlay;\n }\n\n function saveVolumeSnapshot() {\n return {\n muted: player.muted(),\n volume: player.volume()\n };\n }\n\n function restoreContentVolume() {\n if (volumeSnapshot) {\n player.currentTime(0);\n restoreVolumeSnapshot(volumeSnapshot);\n volumeSnapshot = null;\n }\n }\n\n function restoreVolumeSnapshot(snapshot) {\n if (utilities.isObject(snapshot)) {\n player.volume(snapshot.volume);\n player.muted(snapshot.muted);\n }\n }\n\n function hideBlackPoster() {\n if (!dom.hasClass(blackPoster.el(), 'vjs-hidden')) {\n blackPoster.hide();\n }\n }\n\n function addStyles() {\n dom.addClass(player.el(), 'vjs-ad-playing');\n }\n\n function removeStyles() {\n dom.removeClass(player.el(), 'vjs-ad-playing');\n }\n};\n\n/**\n * Remove the poster attribute from the video element tech, if present. When\n * reusing a video element for multiple videos, the poster image will briefly\n * reappear while the new source loads. Removing the attribute ahead of time\n * prevents the poster from showing up between videos.\n * @param {object} player The videojs player object\n */\nplayerUtils.removeNativePoster = function (player) {\n var tech = player.el().querySelector('.vjs-tech');\n if (tech) {\n tech.removeAttribute('poster');\n }\n};\n\n/**\n * Helper function to listen to many events until one of them gets fired, then we\n * execute the handler and unsubscribe all the event listeners;\n *\n * @param player specific player from where to listen for the events\n * @param events array of events\n * @param handler function to execute once one of the events fires\n */\nplayerUtils.once = function once(player, events, handler) {\n function listener() {\n handler.apply(null, arguments);\n\n events.forEach(function (event) {\n player.off(event, listener);\n });\n }\n\n events.forEach(function (event) {\n player.on(event, listener);\n });\n};\n\n\nmodule.exports = playerUtils;","'use strict';\n\nvar utilities = require('./utilityFunctions');\n\n/**\n *\n * IMPORTANT NOTE: This function comes from angularJs and was originally called urlResolve\n * you can take a look at the original code here https://github.com/angular/angular.js/blob/master/src/ng/urlUtils.js\n *\n * Implementation Notes for non-IE browsers\n * ----------------------------------------\n * Assigning a URL to the href property of an anchor DOM node, even one attached to the DOM,\n * results both in the normalizing and parsing of the URL. Normalizing means that a relative\n * URL will be resolved into an absolute URL in the context of the application document.\n * Parsing means that the anchor node's host, hostname, protocol, port, pathname and related\n * properties are all populated to reflect the normalized URL. This approach has wide\n * compatibility - Safari 1+, Mozilla 1+, Opera 7+,e etc. See\n * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html\n *\n * Implementation Notes for IE\n * ---------------------------\n * IE >= 8 and <= 10 normalizes the URL when assigned to the anchor node similar to the other\n * browsers. However, the parsed components will not be set if the URL assigned did not specify\n * them. (e.g. if you assign a.href = \"foo\", then a.protocol, a.host, etc. will be empty.) We\n * work around that by performing the parsing in a 2nd step by taking a previously normalized\n * URL (e.g. by assigning to a.href) and assigning it a.href again. This correctly populates the\n * properties such as protocol, hostname, port, etc.\n *\n * IE7 does not normalize the URL when assigned to an anchor node. (Apparently, it does, if one\n * uses the inner HTML approach to assign the URL as part of an HTML snippet -\n * http://stackoverflow.com/a/472729) However, setting img[src] does normalize the URL.\n * Unfortunately, setting img[src] to something like \"javascript:foo\" on IE throws an exception.\n * Since the primary usage for normalizing URLs is to sanitize such URLs, we can't use that\n * method and IE < 8 is unsupported.\n *\n * References:\n * http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement\n * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html\n * http://url.spec.whatwg.org/#urlutils\n * https://github.com/angular/angular.js/pull/2902\n * http://james.padolsey.com/javascript/parsing-urls-with-the-dom/\n *\n * @kind function\n * @param {string} url The URL to be parsed.\n * @description Normalizes and parses a URL.\n * @returns {object} Returns the normalized URL as a dictionary.\n *\n * | member name | Description |\n * |---------------|----------------|\n * | href | A normalized version of the provided URL if it was not an absolute URL |\n * | protocol | The protocol including the trailing colon |\n * | host | The host and port (if the port is non-default) of the normalizedUrl |\n * | search | The search params, minus the question mark |\n * | hash | The hash string, minus the hash symbol\n * | hostname | The hostname\n * | port | The port, without \":\"\n * | pathname | The pathname, beginning with \"/\"\n *\n */\n\nvar urlParsingNode = document.createElement(\"a\");\n/**\n * documentMode is an IE-only property\n * http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx\n */\nvar msie = document.documentMode;\n\nfunction urlParts(url) {\n var href = url;\n\n if (msie) {\n // Normalize before parse. Refer Implementation Notes on why this is\n // done in two steps on IE.\n urlParsingNode.setAttribute(\"href\", href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: utilities.isNotEmptyString(urlParsingNode.port)? urlParsingNode.port: 80,\n pathname: (urlParsingNode.pathname.charAt(0) === '/')\n ? urlParsingNode.pathname\n : '/' + urlParsingNode.pathname\n };\n}\n\n\n/**\n * This function accepts a query string (search part of a url) and returns a dictionary with\n * the different key value pairs\n * @param {string} qs queryString\n */\nfunction queryStringToObj(qs, cond) {\n var pairs, qsObj;\n\n cond = utilities.isFunction(cond)? cond : function() {\n return true;\n };\n\n qs = qs.trim().replace(/^\\?/, '');\n pairs = qs.split('&');\n qsObj = {};\n\n utilities.forEach(pairs, function (pair) {\n var keyValue, key, value;\n if (pair !== '') {\n keyValue = pair.split('=');\n key = keyValue[0];\n value = keyValue[1];\n if(cond(key, value)){\n qsObj[key] = value;\n }\n }\n });\n\n return qsObj;\n}\n\n/**\n * This function accepts an object and serializes it into a query string without the leading '?'\n * @param obj\n * @returns {string}\n */\nfunction objToQueryString(obj) {\n var pairs = [];\n utilities.forEach(obj, function (value, key) {\n pairs.push(key + '=' + value);\n });\n return pairs.join('&');\n}\n\nmodule.exports = {\n urlParts: urlParts,\n queryStringToObj: queryStringToObj,\n objToQueryString: objToQueryString\n};\n","/*jshint unused:false */\n\"use strict\";\n\nvar NODE_TYPE_ELEMENT = 1;\nvar SNAKE_CASE_REGEXP = /[A-Z]/g;\nvar EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i;\n/*jslint maxlen: 500 */\nvar ISO8086_REGEXP = /^([\\+-]?\\d{4}(?!\\d{2}\\b))((-?)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))?|W([0-4]\\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6])))([T\\s]((([01]\\d|2[0-3])((:?)[0-5]\\d)?|24\\:?00)([\\.,]\\d+(?!:))?)?(\\17[0-5]\\d([\\.,]\\d+)?)?([zZ]|([\\+-])([01]\\d|2[0-3]):?([0-5]\\d)?)?)?)?$/;\n\n\nfunction noop(){ }\n\nfunction isNull(o) {\n return o === null;\n}\n\nfunction isDefined(o){\n return o !== undefined;\n}\n\nfunction isUndefined(o){\n return o === undefined;\n}\n\nfunction isObject(obj) {\n return typeof obj === 'object';\n}\n\nfunction isFunction(str){\n return typeof str === 'function';\n}\n\nfunction isNumber(num){\n return typeof num === 'number';\n}\n\nfunction isWindow(obj) {\n return utilities.isObject(obj) && obj.window === obj;\n}\n\nfunction isArray(array){\n return Object.prototype.toString.call( array ) === '[object Array]';\n}\n\nfunction isArrayLike(obj) {\n if (obj === null || utilities.isWindow(obj) || utilities.isFunction(obj) || utilities.isUndefined(obj)) {\n return false;\n }\n\n var length = obj.length;\n\n if (obj.nodeType === NODE_TYPE_ELEMENT && length) {\n return true;\n }\n\n return utilities.isString(obj) || utilities.isArray(obj) || length === 0 ||\n typeof length === 'number' && length > 0 && (length - 1) in obj;\n}\n\nfunction isString(str){\n return typeof str === 'string';\n}\n\nfunction isEmptyString(str) {\n return utilities.isString(str) && str.length === 0;\n}\n\nfunction isNotEmptyString(str) {\n return utilities.isString(str) && str.length !== 0;\n}\n\nfunction arrayLikeObjToArray(args) {\n return Array.prototype.slice.call(args);\n}\n\nfunction forEach(obj, iterator, context) {\n var key, length;\n if (obj) {\n if (isFunction(obj)) {\n for (key in obj) {\n // Need to check if hasOwnProperty exists,\n // as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function\n if (key !== 'prototype' && key !== 'length' && key !== 'name' && (!obj.hasOwnProperty || obj.hasOwnProperty(key))) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n } else if (isArray(obj)) {\n var isPrimitive = typeof obj !== 'object';\n for (key = 0, length = obj.length; key < length; key++) {\n if (isPrimitive || key in obj) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n } else if (obj.forEach && obj.forEach !== forEach) {\n obj.forEach(iterator, context, obj);\n } else {\n for (key in obj) {\n if (obj.hasOwnProperty(key)) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n }\n }\n return obj;\n}\n\nfunction snake_case(name, separator) {\n separator = separator || '_';\n return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n}\n\nfunction isValidEmail(email){\n if(!utilities.isString(email)){\n return false;\n }\n\n return EMAIL_REGEXP.test(email.trim());\n}\n\nfunction extend (obj) {\n var arg, i, k;\n for (i = 1; i < arguments.length; i++) {\n arg = arguments[i];\n for (k in arg) {\n if (arg.hasOwnProperty(k)) {\n if(isObject(obj[k]) && !isNull(obj[k]) && isObject(arg[k])){\n obj[k] = extend({}, obj[k], arg[k]);\n }else {\n obj[k] = arg[k];\n }\n }\n }\n }\n return obj;\n}\n\nfunction capitalize(s){\n return s.charAt(0).toUpperCase() + s.slice(1);\n}\n\nfunction decapitalize(s) {\n return s.charAt(0).toLowerCase() + s.slice(1);\n}\n\n/**\n * This method works the same way array.prototype.map works but if the transformer returns undefine, then\n * it won't be added to the transformed Array.\n */\nfunction transformArray(array, transformer) {\n var transformedArray = [];\n\n array.forEach(function(item, index){\n var transformedItem = transformer(item, index);\n if(utilities.isDefined(transformedItem)) {\n transformedArray.push(transformedItem);\n }\n });\n\n return transformedArray;\n}\n\nfunction toFixedDigits(num, digits) {\n var formattedNum = num + '';\n digits = utilities.isNumber(digits) ? digits : 0;\n num = utilities.isNumber(num) ? num : parseInt(num, 10);\n if(utilities.isNumber(num) && !isNaN(num)){\n formattedNum = num + '';\n while(formattedNum.length < digits) {\n formattedNum = '0' + formattedNum;\n }\n return formattedNum;\n }\n return NaN + '';\n}\n\nfunction throttle(callback, delay) {\n var previousCall = new Date().getTime() - (delay + 1);\n return function() {\n var time = new Date().getTime();\n if ((time - previousCall) >= delay) {\n previousCall = time;\n callback.apply(this, arguments);\n }\n };\n}\n\nfunction debounce (callback, wait) {\n var timeoutId;\n\n return function (){\n if(timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(function(){\n callback.apply(this, arguments);\n timeoutId = undefined;\n }, wait);\n };\n}\n\n// a function designed to blow up the stack in a naive way\n// but it is ok for videoJs children components\nfunction treeSearch(root, getChildren, found){\n var children = getChildren(root);\n for (var i = 0; i < children.length; i++){\n if (found(children[i])) {\n return children[i];\n }\n else {\n var el = treeSearch(children[i], getChildren, found);\n if (el){\n return el;\n }\n }\n }\n}\n\nfunction echoFn(val) {\n return function () {\n return val;\n };\n}\n\n//Note: Supported formats come from http://www.w3.org/TR/NOTE-datetime\n// and the iso8601 regex comes from http://www.pelagodesign.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/\nfunction isISO8601(value) {\n if(utilities.isNumber(value)){\n value = value + ''; //we make sure that we are working with strings\n }\n\n if(!utilities.isString(value)){\n return false;\n }\n\n return ISO8086_REGEXP.test(value.trim());\n}\n\n/**\n * Checks if the Browser is IE9 and below\n * @returns {boolean}\n */\nfunction isOldIE() {\n var version = utilities.getInternetExplorerVersion(navigator);\n if (version === -1) {\n return false;\n }\n\n return version < 10;\n}\n\n/**\n * Returns the version of Internet Explorer or a -1 (indicating the use of another browser).\n * Source: https://msdn.microsoft.com/en-us/library/ms537509(v=vs.85).aspx\n * @returns {number} the version of Internet Explorer or a -1 (indicating the use of another browser).\n */\nfunction getInternetExplorerVersion(navigator) {\n var rv = -1;\n\n if (navigator.appName == 'Microsoft Internet Explorer') {\n var ua = navigator.userAgent;\n var re = new RegExp(\"MSIE ([0-9]{1,}[\\.0-9]{0,})\");\n var res = re.exec(ua);\n if (res !== null) {\n rv = parseFloat(res[1]);\n }\n }\n\n return rv;\n}\n\n/*** Mobile Utility functions ***/\nfunction isIDevice() {\n return /iP(hone|ad)/.test(utilities._UA);\n}\n\nfunction isMobile() {\n return /iP(hone|ad|od)|Android|Windows Phone/.test(utilities._UA);\n}\n\nfunction isIPhone() {\n return /iP(hone|od)/.test(utilities._UA);\n}\n\nfunction isAndroid() {\n return /Android/.test(utilities._UA);\n}\n\nvar utilities = {\n _UA: navigator.userAgent,\n noop: noop,\n isNull: isNull,\n isDefined: isDefined,\n isUndefined: isUndefined,\n isObject: isObject,\n isFunction: isFunction,\n isNumber: isNumber,\n isWindow: isWindow,\n isArray: isArray,\n isArrayLike: isArrayLike,\n isString: isString,\n isEmptyString: isEmptyString,\n isNotEmptyString: isNotEmptyString,\n arrayLikeObjToArray: arrayLikeObjToArray,\n forEach: forEach,\n snake_case: snake_case,\n isValidEmail: isValidEmail,\n extend: extend,\n capitalize: capitalize,\n decapitalize: decapitalize,\n transformArray: transformArray,\n toFixedDigits: toFixedDigits,\n throttle: throttle,\n debounce: debounce,\n treeSearch: treeSearch,\n echoFn: echoFn,\n isISO8601: isISO8601,\n isOldIE: isOldIE,\n getInternetExplorerVersion: getInternetExplorerVersion,\n isIDevice: isIDevice,\n isMobile: isMobile,\n isIPhone: isIPhone,\n isAndroid: isAndroid\n};\n\nmodule.exports = utilities;","'use strict';\n\nvar utilities = require('./utilityFunctions');\n\nvar xml = {};\n\nxml.strToXMLDoc = function strToXMLDoc(stringContainingXMLSource){\n //IE 8\n if(typeof window.DOMParser === 'undefined'){\n var xmlDocument = new ActiveXObject('Microsoft.XMLDOM');\n xmlDocument.async = false;\n xmlDocument.loadXML(stringContainingXMLSource);\n return xmlDocument;\n }\n\n return parseString(stringContainingXMLSource);\n\n function parseString(stringContainingXMLSource){\n var parser = new DOMParser();\n var parsedDocument;\n\n //Note: This try catch is to deal with the fact that on IE parser.parseFromString does throw an error but the rest of the browsers don't.\n try {\n parsedDocument = parser.parseFromString(stringContainingXMLSource, \"application/xml\");\n\n if(isParseError(parsedDocument) || utilities.isEmptyString(stringContainingXMLSource)){\n throw new Error();\n }\n }catch(e){\n throw new Error(\"xml.strToXMLDOC: Error parsing the string: '\" + stringContainingXMLSource + \"'\");\n }\n\n return parsedDocument;\n }\n\n function isParseError(parsedDocument) {\n try { // parser and parsererrorNS could be cached on startup for efficiency\n var parser = new DOMParser(),\n erroneousParse = parser.parseFromString('INVALID', 'text/xml'),\n parsererrorNS = erroneousParse.getElementsByTagName(\"parsererror\")[0].namespaceURI;\n\n if (parsererrorNS === 'http://www.w3.org/1999/xhtml') {\n // In PhantomJS the parseerror element doesn't seem to have a special namespace, so we are just guessing here :(\n return parsedDocument.getElementsByTagName(\"parsererror\").length > 0;\n }\n\n return parsedDocument.getElementsByTagNameNS(parsererrorNS, 'parsererror').length > 0;\n } catch (e) {\n //Note on IE parseString throws an error by itself and it will never reach this code. Because it will have failed before\n }\n }\n};\n\nxml.parseText = function parseText (sValue) {\n if (/^\\s*$/.test(sValue)) { return null; }\n if (/^(?:true|false)$/i.test(sValue)) { return sValue.toLowerCase() === \"true\"; }\n if (isFinite(sValue)) { return parseFloat(sValue); }\n if (utilities.isISO8601(sValue)) { return new Date(sValue); }\n return sValue.trim();\n};\n\nxml.JXONTree = function JXONTree (oXMLParent) {\n var parseText = xml.parseText;\n\n //The document object is an especial object that it may miss some functions or attrs depending on the browser.\n //To prevent this problem with create the JXONTree using the root childNode which is a fully fleshed node on all supported\n //browsers.\n if(oXMLParent.documentElement){\n return new xml.JXONTree(oXMLParent.documentElement);\n }\n\n if (oXMLParent.hasChildNodes()) {\n var sCollectedTxt = \"\";\n for (var oNode, sProp, vContent, nItem = 0; nItem < oXMLParent.childNodes.length; nItem++) {\n oNode = oXMLParent.childNodes.item(nItem);\n /*jshint bitwise: false*/\n if ((oNode.nodeType - 1 | 1) === 3) { sCollectedTxt += oNode.nodeType === 3 ? oNode.nodeValue.trim() : oNode.nodeValue; }\n else if (oNode.nodeType === 1 && !oNode.prefix) {\n sProp = utilities.decapitalize(oNode.nodeName);\n vContent = new xml.JXONTree(oNode);\n if (this.hasOwnProperty(sProp)) {\n if (this[sProp].constructor !== Array) { this[sProp] = [this[sProp]]; }\n this[sProp].push(vContent);\n } else { this[sProp] = vContent; }\n }\n }\n if (sCollectedTxt) { this.keyValue = parseText(sCollectedTxt); }\n }\n\n //IE8 Stupid fix\n var hasAttr = typeof oXMLParent.hasAttributes === 'undefined'? oXMLParent.attributes.length > 0: oXMLParent.hasAttributes();\n if (hasAttr) {\n var oAttrib;\n for (var nAttrib = 0; nAttrib < oXMLParent.attributes.length; nAttrib++) {\n oAttrib = oXMLParent.attributes.item(nAttrib);\n this[\"@\" + utilities.decapitalize(oAttrib.name)] = parseText(oAttrib.value.trim());\n }\n }\n};\n\nxml.JXONTree.prototype.attr = function(attr) {\n return this['@' + utilities.decapitalize(attr)];\n};\n\nxml.toJXONTree = function toJXONTree(xmlString){\n var xmlDoc = xml.strToXMLDoc(xmlString);\n return new xml.JXONTree(xmlDoc);\n};\n\n/**\n * Helper function to extract the keyvalue of a JXONTree obj\n *\n * @param xmlObj {JXONTree}\n * return the key value or undefined;\n */\nxml.keyValue = function getKeyValue(xmlObj) {\n if(xmlObj){\n return xmlObj.keyValue;\n }\n return undefined;\n};\n\nxml.attr = function getAttrValue(xmlObj, attr) {\n if(xmlObj) {\n return xmlObj['@' + utilities.decapitalize(attr)];\n }\n return undefined;\n};\n\nxml.encode = function encodeXML(str) {\n return str.replace(/&/g, '&')\n .replace(//g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n};\n\nxml.decode = function decodeXML(str) {\n return str.replace(/'/g, \"'\")\n .replace(/"/g, '\"')\n .replace(/>/g, '>')\n .replace(/</g, '<')\n .replace(/&/g, '&');\n};\n\nmodule.exports = xml;","'use strict';\n\nrequire('./plugin/components/ads-label_4');\nrequire('./plugin/components/black-poster_4');\n\nvar videoJsVAST = require('./plugin/videojs.vast.vpaid');\n\nvideojs.plugin('vastClient', videoJsVAST);\n\n"],"sourceRoot":"/source/"} \ No newline at end of file +{"version":3,"sources":["node_modules/browserify/node_modules/browser-pack/_prelude.js","bower_components/VPAIDFLASHClient/js/IVPAIDAdUnit.js","videojs_4.vast.vpaid.js","bower_components/VPAIDFLASHClient/js/VPAIDAdUnit.js","bower_components/VPAIDFLASHClient/js/VPAIDFLASHClient.js","bower_components/VPAIDFLASHClient/js/flashTester.js","bower_components/VPAIDFLASHClient/js/jsFlashBridge.js","bower_components/VPAIDFLASHClient/js/jsFlashBridgeRegistry.js","bower_components/VPAIDFLASHClient/js/registry.js","bower_components/VPAIDFLASHClient/js/utils.js","bower_components/VPAIDHTML5Client/js/IVPAIDAdUnit.js","bower_components/VPAIDHTML5Client/js/VPAIDAdUnit.js","bower_components/VPAIDHTML5Client/js/VPAIDHTML5Client.js","bower_components/VPAIDHTML5Client/js/subscriber.js","bower_components/VPAIDHTML5Client/js/utils.js","src/scripts/ads/vast/Ad.js","src/scripts/ads/vast/Companion.js","src/scripts/ads/vast/Creative.js","src/scripts/ads/vast/InLine.js","src/scripts/ads/vast/Linear.js","src/scripts/ads/vast/MediaFile.js","src/scripts/ads/vast/TrackingEvent.js","src/scripts/ads/vast/VASTClient.js","src/scripts/ads/vast/VASTError.js","src/scripts/ads/vast/VASTIntegrator.js","src/scripts/ads/vast/VASTResponse.js","src/scripts/ads/vast/VASTTracker.js","src/scripts/ads/vast/VideoClicks.js","src/scripts/ads/vast/Wrapper.js","src/scripts/ads/vast/parsers.js","src/scripts/ads/vast/vastUtil.js","src/scripts/ads/vpaid/VPAIDAdUnitWrapper.js","src/scripts/ads/vpaid/VPAIDFlashTech.js","src/scripts/ads/vpaid/VPAIDHTML5Tech.js","src/scripts/ads/vpaid/VPAIDIntegrator.js","src/scripts/plugin/components/ads-label.js","src/scripts/plugin/components/ads-label_4.js","src/scripts/plugin/components/black-poster.js","src/scripts/plugin/components/black-poster_4.js","src/scripts/plugin/videojs.vast.vpaid.js","src/scripts/utils/async.js","src/scripts/utils/dom.js","src/scripts/utils/http.js","src/scripts/utils/playerUtils.js","src/scripts/utils/urlUtils.js","src/scripts/utils/utilityFunctions.js","src/scripts/utils/xml.js","src/scripts/videojs_4.vast.vpaid.js"],"names":["e","t","n","r","s","o","u","a","require","i","f","Error","code","l","exports","call","length",1,"module","Object","defineProperty","value","_createClass","defineProperties","target","props","descriptor","enumerable","configurable","writable","key","Constructor","protoProps","staticProps","prototype","_classCallCheck","instance","TypeError","IVPAIDAdUnit","this","handshakeVersion","playerVPAIDVersion","arguments","undefined","callback","initAd","width","height","viewMode","desiredBitrate","creativeData","AdParameters","environmentVars","flashVars","resizeAd","startAd","stopAd","pauseAd","resumeAd","expandAd","collapseAd","skipAd","getAdLinear","getAdWidth","getAdHeight","getAdExpanded","getAdSkippableState","getAdRemainingTime","getAdDuration","setAdVolume","soundVolume","getAdVolume","getAdCompanions","getAdIcons",2,"_typeof","Symbol","iterator","obj","constructor","_possibleConstructorReturn","self","ReferenceError","_inherits","subClass","superClass","create","setPrototypeOf","__proto__","ALL_VPAID_METHODS","getOwnPropertyNames","filter","property","indexOf","VPAIDAdUnit","_IVPAIDAdUnit","flash","_this","getPrototypeOf","_destroyed","_flash","_destroy","_this2","forEach","methodName","removeCallbackByMethodName","EVENTS","event","offEvent","isDestroyed","on","eventName","off","callFlashMethod","setSize","getWidth","getHeight","volume","./IVPAIDAdUnit",3,"JSFlashBridge","noop","callbackTimeout","isPositiveInt","createElementWithID","uniqueVPAID","unique","createFlashTester","ERROR","FLASH_VERSION","flashTester","isSupported","VPAIDFLASHClient","vpaidParentEl","swfConfig","data","params","wmode","salign","align","allowScriptAccess","scale","allowFullScreen","quality","vpaidOptions","debug","timeout","hasExternalDependencies","onError","_vpaidParentEl","_flashID","movie","FlashVars","VPAID_FLASH_HANDLER","el","swfobject","createSWF","handler","err","$loadPendedAdUnit","error","setTimeout","destroy","_destroyAdUnit","_loadLater","_adUnitLoad","removeCallback","_adUnit","loadAdUnit","adURL","$throwIfDestroyed","isReady","message","url","unloadAdUnit","getFlashID","getFlashURL","setStaticProperty","hasFlashPlayerVersion","window","document","body","propertyName","./VPAIDAdUnit","./flashTester.js","./jsFlashBridge","./utils",4,"FLASH_TEST","FLASH_TEST_EL","utils","MultipleValuesRegistry","FlashTester","parent","parentEl","hideFlashEl","_handlers","_isSupported","support","get","add","./registry",5,"stringEndsWith","SingleValueRegistry","registry","flashURL","flashID","loadHandShake","_el","_flashURL","_width","_height","_callbacks","_uniqueMethodIdentifier","_ready","_handShakeHandler","addInstance","remove","removeByKey","offAll","removeAll","args","callbackID","concat","$asyncCallback","_trigger","removeByValue","suffix","filterKeys","removeAllCallbacks","_callCallback","result","trigger","_handShake","getSize","newWidth","newHeight","setAttribute","setWidth","setHeight","removeInstanceByID","parentElement","removeChild","_this3","typeID","typeName","getInstanceByID","./jsFlashBridgeRegistry",6,"instances","JSFlashBridgeRegistry","id",7,"_registries","push","keys","findByValue","index","splice","old","map","size","_this4",8,"prefix","count","timer","onSuccess","onTimeout","clearTimeout","apply","cleanContent","nEl","createElement","innerHTML","appendChild","newVal","oldVal","isNaN","parseFloat","isFinite","endsWith","String","searchString","position","subjectString","toString","lastIndex","string","search","style","left","top",9,"METHODS","GETTERS","SETTERS","creative","video","VPAIDVersion","subscribe","context","unsubscribe","addStaticToInterface","VPAID1_METHODS","method","checkVPAIDInterface","every","Interface","name",10,"Subscriber","AD_CLICK","FILTERED_EVENTS","VPAIDCreative","iframe","_isValid","_creative","_videoEl","_iframe","_subscribers","$addEventsSubscribers","isValidVPAIDAd","ignores","ariaty","Array","slice","pop","callOrTriggerEvent","bind","extend","slot","videoSlot","getter","validate","unsubscribeAll","$trigger","$clickThruHook","documentElement","contentDocument","videoEl","addEventListener","click","playerHandles","triggerSync","subscribers","./subscriber",11,"defaultTemplate","AD_STOPPED","VPAIDHTML5Client","templateConfig","_id","_frameContainer","createElementInEl","_vpaidOptions","_templateConfig","template","extraOptions","$unloadPreviousAdUnit","that","frame","createIframeWithContent","iframeURL_JS","iframeID","getID","origin","getOrigin","_frame","_onLoad","onLoad","JSON","parse","adUnit","createAd","contentWindow","getVPAIDAd","adEl","querySelector","$adDestroyed","$destroyLoadListener","$removeEl","$removeAdElements","$destroyAdUnit","removeEventListener","clearCallbackTimeout","location","protocol","hostname","port",12,"isHandlerAttached","subscriber","some",13,"isValid","timeouts","func","tagName","createIframe","zIndex","setIframeContent","simpleTemplate","src","marginWidth","marginHeight","frameBorder","margin","padding","border","stringify","replace","RegExp","iframeEl","content","iframeDoc","write","toExtend","fromSource",14,"InLine","Wrapper","Ad","adJTree","initialize","attr","sequence","inLine","wrapper","./InLine","./Wrapper",15,"TrackingEvent","utilities","xml","Companion","companionJTree","creativeType","staticResource","keyValue","htmlResource","HTMLResource","hTMLResource","iframeResource","IFrameResource","iFrameresource","expandedWidth","expandedHeight","scalable","maintainAspectRatio","minSuggestedDuration","apiFramework","companionClickThrough","trackingEvents","parseTrackingEvents","tracking","trackings","isDefined","isArray","trackingData","../../utils/utilityFunctions","../../utils/xml","./TrackingEvent",16,"Linear","Creative","creativeJTree","adId","linear","companionAds","companions","companion","companionData","parseCreatives","creativesJTree","creatives","creativesData","./Companion","./Linear",17,"vastUtil","inlineJTree","adTitle","adSystem","impressions","parseImpressions","impression","description","advertiser","surveys","parseSurveys","survey","pricing","extensions","inlineSurveys","transformArray","isNotEmptyString","uri","type","len","./Creative","./vastUtil",18,"MediaFile","VideoClicks","parsers","linearJTree","duration","mediaFiles","parseMediaFiles","mediaFile","skipoffset","offset","videoClicks","adParameters","decode","mediaFilesJxonTree","mfData","./MediaFile","./VideoClicks","./parsers",19,"attributesList","mediaFileJTree","x","attribute","isVPAID","findSupportedVPAIDTech","isFlashSupported",20,"trackingJTree",21,"VASTError","VASTResponse","async","http","VASTClient","options","defaultOptions","WRAPPER_LIMIT","settings","errorURLMacros","getVASTResponse","adTagUrl","sanityCheck","isFunction","waterfall","_getVASTAd","buildVASTResponse","adsChain","cb","response","_buildVASTResponse","getAdWaterfall","vastTree","waterfallAds","ads","_trackError","getAd","shift","waterfallHandler","adChain","requestVastXML","_requestVASTXml","buildVastWaterfall","xmlStr","toJXONTree","ad","validateVASTTree","vastVersion","next","isString","requestVASTAd","buildAd","VASTAdTagURI","adJxonTree","validateAd","errMsgPrefix","requestVASTXml","requestHandler","withCredentials","status","errMsg","addAdsToResponse","validateResponse","addAd","progressEvents","progress","hasLinear","progressEvent","isNumber","addErrorUrlMacros","track","ERRORCODE","../../utils/async","../../utils/http","./Ad","./VASTError","./VASTResponse",22,23,"VASTTracker","dom","playerUtils","VASTIntegrator","player","playAd","vastResponse","_selectAdSource","_createVASTTracker","_addClickThrough","_addSkipButton","_setupEvents","_playSelectedAd","_src","pause","play","isPaused","paused","getSrc","selectAdSource","source","playerWidth","getDimension","sort","compareTo","b","deltaA","Math","abs","deltaB","selectSource","createVASTTracker","adMediaFile","setupEvents","tracker","previouslyMuted","trackFullscreenChange","trackImpressions","trackPause","trackProgress","trackVolumeChange","once","unbindEvents","evt","trackComplete","isFullscreen","trackFullscreen","trackExitFullscreen","currentTime","trackResume","currentTimeInMs","trackCreativeView","muted","trackMute","trackUnmute","addSkipButton","skipOffsetInSec","addSkipButtonToPlayer","skipOffset","skipButton","createSkipButton","updateSkipButton","updateSkipButtonState","removeSkipButton","addClass","onclick","hasClass","trackSkip","Event","stopPropagation","timeLeft","ceil","toFixedDigits","addClickThrough","blocker","createClickThroughBlocker","updateBlocker","updateBlockerURL","insertBefore","controlBar","removeBlocker","clickThroughMacro","clickThrough","href","generateClickThroughURL","trackClick","variables","ASSETURI","CONTENTPLAYHEAD","formatProgress","parseURLMacro","playSelectedAd","preload","proceed","trackError","../../utils/dom","../../utils/playerUtils","./VASTTracker",24,"InLine__A","_linearAdded","clickTrackings","customClicks","_addInLine","_addWrapper","_addErrorTrackUrl","errorURL","JXONTree","_addImpressions","appendToArray","_addClickTrackings","_addCustomClicks","_addTrackingEvents","eventsMap","trackingEvent","_addTitle","title","_addDuration","_addVideoClicks","_addMediaFiles","_addSkipoffset","_addAdParameters","_addLinear","array","items","item",25,"assetURI","quartiles","firstQuartile","tracked","time","round","midpoint","thirdQuartile","isEmptyString","trackURLs","urls","trackEvent","trackOnce","getEventUris","uris","newProgressInMs","events","ONCE","ALWAYS","addTrackEvent","hasRewound","addQuartileEvents","trackProgressEvents","trackEvents","currentProgress","newProgress","REWIND_THRESHOLD","canBeAdded","trackQuartile","quartileName","quartile","canBeTracked","quartileTime","pendingProgressEvts","capitalize","trackErrorWithCode","errorcode",26,"videoClickJTree","parseClickTrackings","clickTracking","customClick","clickTrackingData",27,"wrapperJTree","vASTAdTagURI","followAdditionalWrappers","allowMultipleAds","fallbackOnNoAd",28,"durationRegex","parseDuration","durationStr","match","durationInMs","parseHoursToMs","parseMinToMs","parseSecToMs","parseInt","hourStr","minStr","secStr","parseOffset","isPercentage","calculatePercentage","percentageRegex","test","percentStr","calcPercent","quantity","percent",29,"VPAIDHTML5Tech","VPAIDFlashTech","URLMacros","sources","parseURLMacros","trackImgs","img","Image","parseMacros","parsedURLs","random","URLMacro","_parseURLMacro","parseMacro","hours","minutes","seconds","milliseconds","floor","VPAID_techs","isVPAIDMediaFile","mimeType","VPAIDTech","supports","runFlashSupportCheck","vpaidFlashLoaderPath","runFlashTest","../vpaid/VPAIDFlashTech","../vpaid/VPAIDHTML5Tech","VPAIDFLASHClient/js/VPAIDFLASHClient",30,"VPAIDAdUnitWrapper","vpaidAdUnit","opts","isObject","responseTimeout","VPAIDInterfaceMethods","canSubscribeToEvents","canUnsubscribeFromEvents","adUnitAsyncCall","arrayLikeObjToArray","timeoutId","wrapCallback","evtName","waitForEvent","responseListener","unshift","version","adUnitData","getterName","../vast/VASTError",31,"containerEl","vpaidFlashClient","loadFlashCreative","objectEl","flashClientOpts","container","isDomElement","console","log",32,"vpaidHTMLClient","INVALID_MEDIA_FILE","isOldIE","INVALID_DOM_CONTAINER_EL","toLowerCase","MISSING_CALLBACK","PREFIX","INVALID_DOM_VIDEO_EL","VPAIDHTML5Client/js/VPAIDHTML5Client",33,"VPAIDIntegrator","VIEW_MODE","NORMAL","FULLSCREEN","THUMBNAIL","createVPAIDContainerEl","VPAID_VERSION","playVPaidAd","tech","_findSupportedTech","triggerVpaidAdEnd","one","removeAdUnit","_loadAdUnit","_playAdUnit","_finishPlaying","adComplete","_paused","removeClass","vpaidMediaFiles","_createVPAIDAdUnitWrapper","vjsTechEl","WrappedAdUnit","techClass","_handshake","_initAd","_linkPlayerControls","_startAd","handshake","isSupportedVersion","majorNum","major","parts","split","dimension","adUnitSrc","notifyPlayToPlayer","trackStart","notifyPauseToPlayer","trackFirstQuartile","trackMidpoint","trackThirdQuartile","clickThruUrl","open","trackAcceptInvitation","trackAcceptInvitationLinear","trackClose","trackCloseLinear","trackCollapse","lastVolume","currentVolume","updateViewSize","updateViewSizeThrottled","throttle","autoResize","pauseAdUnit","resumeAdUnit","isSkippable","linkVolumeControl","linkFullScreenControl","updateAdUnitVolume","updatePlayerVolume","vol","logError","finishPlayingAd","errorCode","MODE","../vast/VASTResponse","../vast/VASTTracker","../vast/vastUtil","./VPAIDAdUnitWrapper",34,"element","className","AdsLabelFactory","baseComponent","init","currentTimeComp","getChild","getElement",35,"baseVideoJsComponent","videojs","Component","AdsLabel","./ads-label",36,"BlackPosterFactory","posterImg",37,"BlackPoster","./black-poster",38,"VASTPlugin","snapshot","vast","adsCanceled","defaultOpts","iosPrerollCancelTimeout","adCancelTimeout","playAdAlways","adsEnabled","isUndefined","echoFn","adTagXML","trackAdError","prepareForAds","tryToPlayPrerollAd","cancelAds","isEnabled","enable","disable","removeNativePoster","restoreVideoContent","checkAdsEnabled","preparePlayerForAd","startAdCancelTimeout","playPrerollAd","setupContentEvents","restorePlayerSnapshot","canPlayPrerollAd","getPlayerSnapshot","addSpinnerIcon","isIPhone","adCancelTimeoutId","clearAdCancelTimeout","removeSpinnerIcon","getVastResponse","adIntegrator","adFinished","addAdsLabel","removeAdsLabel","isIDevice","preventManualProgress","addChild","PROGRESS_THRESHOLD","previousTime","skipad_attempts","preventAdSeek","preventAdSkip","stopPreventManualProgress","progressDelta","../ads/vast/VASTClient","../ads/vast/VASTError","../ads/vast/VASTIntegrator","../ads/vast/vastUtil","../ads/vpaid/VPAIDIntegrator","../utils/async","../utils/dom","../utils/playerUtils","../utils/utilityFunctions",39,"setImmediate","fn","tasks","makeCallback","wrapIterator","when","condition","isAllowed","./utilityFunctions",40,"isVisible","getComputedStyle","visibility","isHidden","display","isShown","hide","__prev_style_display_","show","cssClass","classes","classList","contains","getAttribute","join","newClasses","attachEvent","detachEvent","dispatchEvent","fireEvent","eventType","isDescendant","child","node","parentNode","getTextContent","textContent","text","prependChild","firstChild","removeNode","Element","handlerWrap","rect","getBoundingClientRect","offsetWidth","offsetHeight",41,"urlUtils","HttpRequestError","HttpRequest","createXhr","run","xhr","urlParts","headers","setHeaders","onload","statusText","getAllResponseHeaders","responseText","onerror","requestError","onabort","send","abort","setRequestHeader","processResponse","headersString","isSuccess","XMLHttpRequest","XDomainRequest","./urlUtils",42,"ended","currentSrc","currentType","playing","suppressedTracks","getSuppressedTracks","nativePoster","poster","tracks","remoteTextTracks","tracks_","mode","attempts","hasSrcChanged","restoreTracks","tryToResume","ensureCanplayEvtGetsFired","load","trackSnapshot","isReadyToResume","warn","readyState","seekable","blackPoster","_firstPlay","volumeSnapshot","monkeyPatchPlayerApi","tryToTriggerFirstPlay","resetFirstPlay","restoreContentVolume","hideBlackPoster","addStyles","removeStyles","origPlay","callOrigPlay","isFirstPlay","firstPlay","resume","saveVolumeSnapshot","isAdPlaying","origPause","callOrigPause","origPaused","callOrigPaused","restoreVolumeSnapshot","removeAttribute","listener","./dom",43,"urlParsingNode","msie","documentMode","host","hash","pathname","charAt","queryStringToObj","qs","cond","pairs","qsObj","trim","pair","objToQueryString",44,"NODE_TYPE_ELEMENT","SNAKE_CASE_REGEXP","EMAIL_REGEXP","ISO8086_REGEXP","isNull","str","num","isWindow","isArrayLike","nodeType","hasOwnProperty","isPrimitive","snake_case","separator","letter","pos","isValidEmail","email","arg","k","toUpperCase","decapitalize","transformer","transformedArray","transformedItem","digits","formattedNum","NaN","delay","previousCall","Date","getTime","debounce","wait","treeSearch","root","getChildren","found","children","val","isISO8601","getInternetExplorerVersion","navigator","rv","appName","ua","userAgent","re","res","exec","_UA","isMobile","isAndroid",45,"strToXMLDoc","stringContainingXMLSource","DOMParser","xmlDocument","ActiveXObject","loadXML","parseString","parser","parsedDocument","parseFromString","isParseError","erroneousParse","parsererrorNS","getElementsByTagName","namespaceURI","getElementsByTagNameNS","parseText","sValue","oXMLParent","hasChildNodes","sCollectedTxt","oNode","sProp","vContent","nItem","childNodes","nodeValue","nodeName","hasAttr","hasAttributes","attributes","oAttrib","nAttrib","xmlString","xmlDoc","getKeyValue","xmlObj","getAttrValue","encode","encodeXML","decodeXML",46,"videoJsVAST","plugin","./plugin/components/ads-label_4","./plugin/components/black-poster_4","./plugin/videojs.vast.vpaid"],"mappings":"CAAA,QAAAA,GAAAC,EAAAC,EAAAC,GAAA,QAAAC,GAAAC,EAAAC,GAAA,IA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AD,K7CiqNGE,kCAAkC,GAAGC,qCAAqC,GAAGC,8BAA8B,UAAU","file":"videojs_4.vast.vpaid.min.js","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o 0) {\n callback(event);\n }\n }, 0);\n }\n });\n }\n }, {\n key: '_callCallback',\n value: function _callCallback(methodName, callbackID, err, result) {\n\n var callback = this._callbacks.get(callbackID);\n\n //not all methods callback's are mandatory\n //but if there exist an error, fire the error event\n if (!callback) {\n if (err && callbackID === '') {\n this.trigger(ERROR, err);\n }\n return;\n }\n\n $asyncCallback.call(this, callbackID, err, result);\n }\n }, {\n key: '_handShake',\n value: function _handShake(err, data) {\n this._ready = true;\n if (this._handShakeHandler) {\n this._handShakeHandler(err, data);\n delete this._handShakeHandler;\n }\n }\n\n //methods like properties specific to this implementation of VPAID\n\n }, {\n key: 'getSize',\n value: function getSize() {\n return { width: this._width, height: this._height };\n }\n }, {\n key: 'setSize',\n value: function setSize(newWidth, newHeight) {\n this._width = isPositiveInt(newWidth, this._width);\n this._height = isPositiveInt(newHeight, this._height);\n this._el.setAttribute('width', this._width);\n this._el.setAttribute('height', this._height);\n }\n }, {\n key: 'getWidth',\n value: function getWidth() {\n return this._width;\n }\n }, {\n key: 'setWidth',\n value: function setWidth(newWidth) {\n this.setSize(newWidth, this._height);\n }\n }, {\n key: 'getHeight',\n value: function getHeight() {\n return this._height;\n }\n }, {\n key: 'setHeight',\n value: function setHeight(newHeight) {\n this.setSize(this._width, newHeight);\n }\n }, {\n key: 'getFlashID',\n value: function getFlashID() {\n return this._flashID;\n }\n }, {\n key: 'getFlashURL',\n value: function getFlashURL() {\n return this._flashURL;\n }\n }, {\n key: 'isReady',\n value: function isReady() {\n return this._ready;\n }\n }, {\n key: 'destroy',\n value: function destroy() {\n this.offAll();\n this.removeAllCallbacks();\n registry.removeInstanceByID(this._flashID);\n if (this._el.parentElement) {\n this._el.parentElement.removeChild(this._el);\n }\n }\n }]);\n\n return JSFlashBridge;\n}();\n\nfunction $asyncCallback(callbackID, err, result) {\n var _this3 = this;\n\n setTimeout(function () {\n var callback = _this3._callbacks.get(callbackID);\n if (callback) {\n _this3._callbacks.remove(callbackID);\n callback(err, result);\n }\n }, 0);\n}\n\nObject.defineProperty(JSFlashBridge, 'VPAID_FLASH_HANDLER', {\n writable: false,\n configurable: false,\n value: VPAID_FLASH_HANDLER\n});\n\n/**\n * External interface handler\n *\n * @param {string} flashID identifier of the flash who call this\n * @param {string} typeID what type of message is, can be 'event' or 'callback'\n * @param {string} typeName if the typeID is a event the typeName will be the eventName, if is a callback the typeID is the methodName that is related this callback\n * @param {string} callbackID only applies when the typeID is 'callback', identifier of the callback to call\n * @param {object} error error object\n * @param {object} data\n */\nwindow[VPAID_FLASH_HANDLER] = function (flashID, typeID, typeName, callbackID, error, data) {\n var instance = registry.getInstanceByID(flashID);\n if (!instance) return;\n if (typeName === 'handShake') {\n instance._handShake(error, data);\n } else {\n if (typeID !== 'event') {\n instance._callCallback(typeName, callbackID, error, data);\n } else {\n instance._trigger(typeName, data);\n }\n }\n};\n\n},{\"./jsFlashBridgeRegistry\":6,\"./registry\":7,\"./utils\":8}],6:[function(require,module,exports){\n'use strict';\n\nvar SingleValueRegistry = require('./registry').SingleValueRegistry;\nvar instances = new SingleValueRegistry();\n\nvar JSFlashBridgeRegistry = {};\nObject.defineProperty(JSFlashBridgeRegistry, 'addInstance', {\n writable: false,\n configurable: false,\n value: function value(id, instance) {\n instances.add(id, instance);\n }\n});\n\nObject.defineProperty(JSFlashBridgeRegistry, 'getInstanceByID', {\n writable: false,\n configurable: false,\n value: function value(id) {\n return instances.get(id);\n }\n});\n\nObject.defineProperty(JSFlashBridgeRegistry, 'removeInstanceByID', {\n writable: false,\n configurable: false,\n value: function value(id) {\n return instances.remove(id);\n }\n});\n\nmodule.exports = JSFlashBridgeRegistry;\n\n},{\"./registry\":7}],7:[function(require,module,exports){\n'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if (\"value\" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);\n }\n }return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;\n };\n}();\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nvar MultipleValuesRegistry = exports.MultipleValuesRegistry = function () {\n function MultipleValuesRegistry() {\n _classCallCheck(this, MultipleValuesRegistry);\n\n this._registries = {};\n }\n\n _createClass(MultipleValuesRegistry, [{\n key: 'add',\n value: function add(id, value) {\n if (!this._registries[id]) {\n this._registries[id] = [];\n }\n if (this._registries[id].indexOf(value) === -1) {\n this._registries[id].push(value);\n }\n }\n }, {\n key: 'get',\n value: function get(id) {\n return this._registries[id] || [];\n }\n }, {\n key: 'filterKeys',\n value: function filterKeys(handler) {\n return Object.keys(this._registries).filter(handler);\n }\n }, {\n key: 'findByValue',\n value: function findByValue(value) {\n var _this = this;\n\n var keys = Object.keys(this._registries).filter(function (key) {\n return _this._registries[key].indexOf(value) !== -1;\n });\n\n return keys;\n }\n }, {\n key: 'remove',\n value: function remove(key, value) {\n if (!this._registries[key]) {\n return;\n }\n\n var index = this._registries[key].indexOf(value);\n\n if (index < 0) {\n return;\n }\n return this._registries[key].splice(index, 1);\n }\n }, {\n key: 'removeByKey',\n value: function removeByKey(id) {\n var old = this._registries[id];\n delete this._registries[id];\n return old;\n }\n }, {\n key: 'removeByValue',\n value: function removeByValue(value) {\n var _this2 = this;\n\n var keys = this.findByValue(value);\n return keys.map(function (key) {\n return _this2.remove(key, value);\n });\n }\n }, {\n key: 'removeAll',\n value: function removeAll() {\n var old = this._registries;\n this._registries = {};\n return old;\n }\n }, {\n key: 'size',\n value: function size() {\n return Object.keys(this._registries).length;\n }\n }]);\n\n return MultipleValuesRegistry;\n}();\n\nvar SingleValueRegistry = exports.SingleValueRegistry = function () {\n function SingleValueRegistry() {\n _classCallCheck(this, SingleValueRegistry);\n\n this._registries = {};\n }\n\n _createClass(SingleValueRegistry, [{\n key: 'add',\n value: function add(id, value) {\n this._registries[id] = value;\n }\n }, {\n key: 'get',\n value: function get(id) {\n return this._registries[id];\n }\n }, {\n key: 'filterKeys',\n value: function filterKeys(handler) {\n return Object.keys(this._registries).filter(handler);\n }\n }, {\n key: 'findByValue',\n value: function findByValue(value) {\n var _this3 = this;\n\n var keys = Object.keys(this._registries).filter(function (key) {\n return _this3._registries[key] === value;\n });\n\n return keys;\n }\n }, {\n key: 'remove',\n value: function remove(id) {\n var old = this._registries[id];\n delete this._registries[id];\n return old;\n }\n }, {\n key: 'removeByValue',\n value: function removeByValue(value) {\n var _this4 = this;\n\n var keys = this.findByValue(value);\n return keys.map(function (key) {\n return _this4.remove(key);\n });\n }\n }, {\n key: 'removeAll',\n value: function removeAll() {\n var old = this._registries;\n this._registries = {};\n return old;\n }\n }, {\n key: 'size',\n value: function size() {\n return Object.keys(this._registries).length;\n }\n }]);\n\n return SingleValueRegistry;\n}();\n\n},{}],8:[function(require,module,exports){\n'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.unique = unique;\nexports.noop = noop;\nexports.callbackTimeout = callbackTimeout;\nexports.createElementWithID = createElementWithID;\nexports.isPositiveInt = isPositiveInt;\nexports.stringEndsWith = stringEndsWith;\nexports.hideFlashEl = hideFlashEl;\nfunction unique(prefix) {\n var count = -1;\n return function (f) {\n return prefix + '_' + ++count;\n };\n}\n\nfunction noop() {}\n\nfunction callbackTimeout(timer, onSuccess, onTimeout) {\n\n var timeout = setTimeout(function () {\n\n onSuccess = noop;\n onTimeout();\n }, timer);\n\n return function () {\n clearTimeout(timeout);\n onSuccess.apply(this, arguments);\n };\n}\n\nfunction createElementWithID(parent, id) {\n var cleanContent = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2];\n\n var nEl = document.createElement('div');\n nEl.id = id;\n if (cleanContent) {\n parent.innerHTML = '';\n }\n parent.appendChild(nEl);\n return nEl;\n}\n\nfunction isPositiveInt(newVal, oldVal) {\n return !isNaN(parseFloat(newVal)) && isFinite(newVal) && newVal > 0 ? newVal : oldVal;\n}\n\nvar endsWith = function () {\n if (String.prototype.endsWith) return String.prototype.endsWith;\n return function endsWith(searchString, position) {\n var subjectString = this.toString();\n if (position === undefined || position > subjectString.length) {\n position = subjectString.length;\n }\n position -= searchString.length;\n var lastIndex = subjectString.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n };\n}();\n\nfunction stringEndsWith(string, search) {\n return endsWith.call(string, search);\n}\n\nfunction hideFlashEl(el) {\n // can't use display none or visibility none because will block flash in some browsers\n el.style.position = 'absolute';\n el.style.left = '-1px';\n el.style.top = '-1px';\n el.style.width = '1px';\n el.style.height = '1px';\n}\n\n},{}],9:[function(require,module,exports){\n'use strict';\n\nvar METHODS = [\n 'handshakeVersion',\n 'initAd',\n 'startAd',\n 'stopAd',\n 'skipAd', // VPAID 2.0 new method\n 'resizeAd',\n 'pauseAd',\n 'resumeAd',\n 'expandAd',\n 'collapseAd',\n 'subscribe',\n 'unsubscribe'\n];\n\nvar EVENTS = [\n 'AdLoaded',\n 'AdStarted',\n 'AdStopped',\n 'AdSkipped',\n 'AdSkippableStateChange', // VPAID 2.0 new event\n 'AdSizeChange', // VPAID 2.0 new event\n 'AdLinearChange',\n 'AdDurationChange', // VPAID 2.0 new event\n 'AdExpandedChange',\n 'AdRemainingTimeChange', // [Deprecated in 2.0] but will be still fired for backwards compatibility\n 'AdVolumeChange',\n 'AdImpression',\n 'AdVideoStart',\n 'AdVideoFirstQuartile',\n 'AdVideoMidpoint',\n 'AdVideoThirdQuartile',\n 'AdVideoComplete',\n 'AdClickThru',\n 'AdInteraction', // VPAID 2.0 new event\n 'AdUserAcceptInvitation',\n 'AdUserMinimize',\n 'AdUserClose',\n 'AdPaused',\n 'AdPlaying',\n 'AdLog',\n 'AdError'\n];\n\nvar GETTERS = [\n 'getAdLinear',\n 'getAdWidth', // VPAID 2.0 new getter\n 'getAdHeight', // VPAID 2.0 new getter\n 'getAdExpanded',\n 'getAdSkippableState', // VPAID 2.0 new getter\n 'getAdRemainingTime',\n 'getAdDuration', // VPAID 2.0 new getter\n 'getAdVolume',\n 'getAdCompanions', // VPAID 2.0 new getter\n 'getAdIcons' // VPAID 2.0 new getter\n];\n\nvar SETTERS = [\n 'setAdVolume'\n];\n\n\n/**\n * This callback is displayed as global member. The callback use nodejs error-first callback style\n * @callback NodeStyleCallback\n * @param {string|null}\n * @param {undefined|object}\n */\n\n\n/**\n * IVPAIDAdUnit\n *\n * @class\n *\n * @param {object} creative\n * @param {HTMLElement} el\n * @param {HTMLVideoElement} video\n */\nfunction IVPAIDAdUnit(creative, el, video) {}\n\n\n/**\n * handshakeVersion\n *\n * @param {string} VPAIDVersion\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.handshakeVersion = function (VPAIDVersion, callback) {};\n\n/**\n * initAd\n *\n * @param {number} width\n * @param {number} height\n * @param {string} viewMode can be 'normal', 'thumbnail' or 'fullscreen'\n * @param {number} desiredBitrate indicates the desired bitrate in kbps\n * @param {object} [creativeData] used for additional initialization data\n * @param {object} [environmentVars] used for passing implementation-specific of js version\n * @param {NodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.initAd = function(width, height, viewMode, desiredBitrate, creativeData, environmentVars, callback) {};\n\n/**\n * startAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.startAd = function(callback) {};\n\n/**\n * stopAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.stopAd = function(callback) {};\n\n/**\n * skipAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.skipAd = function(callback) {};\n\n/**\n * resizeAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.resizeAd = function(width, height, viewMode, callback) {};\n\n/**\n * pauseAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.pauseAd = function(callback) {};\n\n/**\n * resumeAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.resumeAd = function(callback) {};\n\n/**\n * expandAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.expandAd = function(callback) {};\n\n/**\n * collapseAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.collapseAd = function(callback) {};\n\n/**\n * subscribe\n *\n * @param {string} event\n * @param {nodeStyleCallback} handler\n * @param {object} context\n */\nIVPAIDAdUnit.prototype.subscribe = function(event, handler, context) {};\n\n/**\n * startAd\n *\n * @param {string} event\n * @param {function} handler\n */\nIVPAIDAdUnit.prototype.unsubscribe = function(event, handler) {};\n\n\n\n/**\n * getAdLinear\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdLinear = function(callback) {};\n\n/**\n * getAdWidth\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdWidth = function(callback) {};\n\n/**\n * getAdHeight\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdHeight = function(callback) {};\n\n/**\n * getAdExpanded\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdExpanded = function(callback) {};\n\n/**\n * getAdSkippableState\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdSkippableState = function(callback) {};\n\n/**\n * getAdRemainingTime\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdRemainingTime = function(callback) {};\n\n/**\n * getAdDuration\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdDuration = function(callback) {};\n\n/**\n * getAdVolume\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdVolume = function(callback) {};\n\n/**\n * getAdCompanions\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdCompanions = function(callback) {};\n\n/**\n * getAdIcons\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdIcons = function(callback) {};\n\n/**\n * setAdVolume\n *\n * @param {number} volume\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.setAdVolume = function(volume, callback) {};\n\naddStaticToInterface(IVPAIDAdUnit, 'METHODS', METHODS);\naddStaticToInterface(IVPAIDAdUnit, 'GETTERS', GETTERS);\naddStaticToInterface(IVPAIDAdUnit, 'SETTERS', SETTERS);\naddStaticToInterface(IVPAIDAdUnit, 'EVENTS', EVENTS);\n\n\nvar VPAID1_METHODS = METHODS.filter(function(method) {\n return ['skipAd'].indexOf(method) === -1;\n});\n\naddStaticToInterface(IVPAIDAdUnit, 'checkVPAIDInterface', function checkVPAIDInterface (creative) {\n var result = VPAID1_METHODS.every(function(key) {\n return typeof creative[key] === 'function';\n });\n return result;\n});\n\nmodule.exports = IVPAIDAdUnit;\n\nfunction addStaticToInterface(Interface, name, value) {\n Object.defineProperty(Interface, name, {\n writable: false,\n configurable: false,\n value: value\n });\n}\n\n\n},{}],10:[function(require,module,exports){\n'use strict';\n\nvar IVPAIDAdUnit = require('./IVPAIDAdUnit');\nvar Subscriber = require('./subscriber');\nvar checkVPAIDInterface = IVPAIDAdUnit.checkVPAIDInterface;\nvar utils = require('./utils');\nvar METHODS = IVPAIDAdUnit.METHODS;\nvar ERROR = 'AdError';\nvar AD_CLICK = 'AdClickThru';\nvar FILTERED_EVENTS = IVPAIDAdUnit.EVENTS.filter(function (event) {\n return event != AD_CLICK;\n});\n\n/**\n * This callback is displayed as global member. The callback use nodejs error-first callback style\n * @callback NodeStyleCallback\n * @param {string|null}\n * @param {undefined|object}\n */\n\n\n/**\n * VPAIDAdUnit\n * @class\n *\n * @param VPAIDCreative\n * @param {HTMLElement} [el] this will be used in initAd environmentVars.slot if defined\n * @param {HTMLVideoElement} [video] this will be used in initAd environmentVars.videoSlot if defined\n */\nfunction VPAIDAdUnit(VPAIDCreative, el, video, iframe) {\n this._isValid = checkVPAIDInterface(VPAIDCreative);\n if (this._isValid) {\n this._creative = VPAIDCreative;\n this._el = el;\n this._videoEl = video;\n this._iframe = iframe;\n this._subscribers = new Subscriber();\n $addEventsSubscribers.call(this);\n }\n}\n\nVPAIDAdUnit.prototype = Object.create(IVPAIDAdUnit.prototype);\n\n/**\n * isValidVPAIDAd will return if the VPAIDCreative passed in constructor is valid or not\n *\n * @return {boolean}\n */\nVPAIDAdUnit.prototype.isValidVPAIDAd = function isValidVPAIDAd() {\n return this._isValid;\n};\n\nIVPAIDAdUnit.METHODS.forEach(function(method) {\n //NOTE: this methods arguments order are implemented differently from the spec\n var ignores = [\n 'subscribe',\n 'unsubscribe',\n 'initAd'\n ];\n\n if (ignores.indexOf(method) !== -1) return;\n\n VPAIDAdUnit.prototype[method] = function () {\n var ariaty = IVPAIDAdUnit.prototype[method].length;\n // TODO avoid leaking arguments\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n var args = Array.prototype.slice.call(arguments);\n var callback = (ariaty === args.length) ? args.pop() : undefined;\n\n setTimeout(function () {\n var result, error = null;\n try {\n result = this._creative[method].apply(this._creative, args);\n } catch(e) {\n error = e;\n }\n\n callOrTriggerEvent(callback, this._subscribers, error, result);\n }.bind(this), 0);\n };\n});\n\n\n/**\n * initAd concreate implementation\n *\n * @param {number} width\n * @param {number} height\n * @param {string} viewMode can be 'normal', 'thumbnail' or 'fullscreen'\n * @param {number} desiredBitrate indicates the desired bitrate in kbps\n * @param {object} [creativeData] used for additional initialization data\n * @param {object} [environmentVars] used for passing implementation-specific of js version, if el & video was used in constructor slot & videoSlot will be added to the object\n * @param {NodeStyleCallback} callback\n */\nVPAIDAdUnit.prototype.initAd = function initAd(width, height, viewMode, desiredBitrate, creativeData, environmentVars, callback) {\n creativeData = creativeData || {};\n environmentVars = utils.extend({\n slot: this._el,\n videoSlot: this._videoEl\n }, environmentVars || {});\n\n setTimeout(function () {\n var error;\n try {\n this._creative.initAd(width, height, viewMode, desiredBitrate, creativeData, environmentVars);\n } catch (e) {\n error = e;\n }\n\n callOrTriggerEvent(callback, this._subscribers, error);\n }.bind(this), 0);\n};\n\n/**\n * subscribe\n *\n * @param {string} event\n * @param {nodeStyleCallback} handler\n * @param {object} context\n */\nVPAIDAdUnit.prototype.subscribe = function subscribe(event, handler, context) {\n this._subscribers.subscribe(handler, event, context);\n};\n\n\n/**\n * unsubscribe\n *\n * @param {string} event\n * @param {nodeStyleCallback} handler\n */\nVPAIDAdUnit.prototype.unsubscribe = function unsubscribe(event, handler) {\n this._subscribers.unsubscribe(handler, event);\n};\n\n//alias\nVPAIDAdUnit.prototype.on = VPAIDAdUnit.prototype.subscribe;\nVPAIDAdUnit.prototype.off = VPAIDAdUnit.prototype.unsubscribe;\n\nIVPAIDAdUnit.GETTERS.forEach(function(getter) {\n VPAIDAdUnit.prototype[getter] = function (callback) {\n setTimeout(function () {\n\n var result, error = null;\n try {\n result = this._creative[getter]();\n } catch(e) {\n error = e;\n }\n\n callOrTriggerEvent(callback, this._subscribers, error, result);\n }.bind(this), 0);\n };\n});\n\n/**\n * setAdVolume\n *\n * @param volume\n * @param {nodeStyleCallback} callback\n */\nVPAIDAdUnit.prototype.setAdVolume = function setAdVolume(volume, callback) {\n setTimeout(function () {\n\n var result, error = null;\n try {\n this._creative.setAdVolume(volume);\n result = this._creative.getAdVolume();\n } catch(e) {\n error = e;\n }\n\n if (!error) {\n error = utils.validate(result === volume, 'failed to apply volume: ' + volume);\n }\n callOrTriggerEvent(callback, this._subscribers, error, result);\n }.bind(this), 0);\n};\n\nVPAIDAdUnit.prototype._destroy = function destroy() {\n this.stopAd();\n this._subscribers.unsubscribeAll();\n};\n\nfunction $addEventsSubscribers() {\n // some ads implement\n // so they only handle one subscriber\n // to handle this we create our one\n FILTERED_EVENTS.forEach(function (event) {\n this._creative.subscribe($trigger.bind(this, event), event);\n }.bind(this));\n\n // map the click event to be an object instead of depending of the order of the arguments\n // and to be consistent with the flash\n this._creative.subscribe($clickThruHook.bind(this), AD_CLICK);\n\n // because we are adding the element inside the iframe\n // the user is not able to click in the video\n if (this._videoEl) {\n var documentElement = this._iframe.contentDocument.documentElement;\n var videoEl = this._videoEl;\n documentElement.addEventListener('click', function(e) {\n if (e.target === documentElement) {\n videoEl.click();\n }\n });\n }\n}\n\nfunction $clickThruHook(url, id, playerHandles) {\n this._subscribers.triggerSync(AD_CLICK, {url: url, id: id, playerHandles: playerHandles});\n}\n\nfunction $trigger(event) {\n // TODO avoid leaking arguments\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n this._subscribers.trigger(event, Array.prototype.slice(arguments, 1));\n}\n\nfunction callOrTriggerEvent(callback, subscribers, error, result) {\n if (callback) {\n callback(error, result);\n } else if (error) {\n subscribers.trigger(ERROR, error);\n }\n}\n\nmodule.exports = VPAIDAdUnit;\n\n\n},{\"./IVPAIDAdUnit\":9,\"./subscriber\":12,\"./utils\":13}],11:[function(require,module,exports){\n'use strict';\n\nvar utils = require('./utils');\nvar unique = utils.unique('vpaidIframe');\nvar VPAIDAdUnit = require('./VPAIDAdUnit');\n\nvar defaultTemplate = '' +\n '' +\n '' +\n '
' +\n '' +\n '' +\n '' +\n '';\n\nvar AD_STOPPED = 'AdStopped';\n\n/**\n * This callback is displayed as global member. The callback use nodejs error-first callback style\n * @callback NodeStyleCallback\n * @param {string|null}\n * @param {undefined|object}\n */\n\n/**\n * VPAIDHTML5Client\n * @class\n *\n * @param {HTMLElement} el that will contain the iframe to load adUnit and a el to add to adUnit slot\n * @param {HTMLVideoElement} video default video element to be used by adUnit\n * @param {object} [templateConfig] template: html template to be used instead of the default, extraOptions: to be used when rendering the template\n * @param {object} [vpaidOptions] timeout: when loading adUnit\n */\nfunction VPAIDHTML5Client(el, video, templateConfig, vpaidOptions) {\n templateConfig = templateConfig || {};\n\n this._id = unique();\n this._destroyed = false;\n\n this._frameContainer = utils.createElementInEl(el, 'div');\n this._videoEl = video;\n this._vpaidOptions = vpaidOptions || {timeout: 10000};\n\n this._templateConfig = {\n template: templateConfig.template || defaultTemplate,\n extraOptions: templateConfig.extraOptions || {}\n };\n}\n\n/**\n * destroy\n *\n */\nVPAIDHTML5Client.prototype.destroy = function destroy() {\n if (this._destroyed) {\n return;\n }\n this._destroyed = true;\n $unloadPreviousAdUnit.call(this);\n};\n\n/**\n * isDestroyed\n *\n * @return {boolean}\n */\nVPAIDHTML5Client.prototype.isDestroyed = function isDestroyed() {\n return this._destroyed;\n};\n\n/**\n * loadAdUnit\n *\n * @param {string} adURL url of the js of the adUnit\n * @param {nodeStyleCallback} callback\n */\nVPAIDHTML5Client.prototype.loadAdUnit = function loadAdUnit(adURL, callback) {\n $throwIfDestroyed.call(this);\n $unloadPreviousAdUnit.call(this);\n var that = this;\n\n var frame = utils.createIframeWithContent(\n this._frameContainer,\n this._templateConfig.template,\n utils.extend({\n iframeURL_JS: adURL,\n iframeID: this.getID(),\n origin: getOrigin()\n }, this._templateConfig.extraOptions)\n );\n\n this._frame = frame;\n\n this._onLoad = utils.callbackTimeout(\n this._vpaidOptions.timeout,\n onLoad.bind(this),\n onTimeout.bind(this)\n );\n\n window.addEventListener('message', this._onLoad);\n\n function onLoad (e) {\n /*jshint validthis: false */\n //don't clear timeout\n if (e.origin !== getOrigin()) return;\n var result = JSON.parse(e.data);\n\n //don't clear timeout\n if (result.id !== that.getID()) return;\n\n var adUnit, error, createAd;\n if (!that._frame.contentWindow) {\n\n error = 'the iframe is not anymore in the DOM tree';\n\n } else {\n createAd = that._frame.contentWindow.getVPAIDAd;\n error = utils.validate(typeof createAd === 'function', 'the ad didn\\'t return a function to create an ad');\n }\n\n if (!error) {\n var adEl = that._frame.contentWindow.document.querySelector('.ad-element');\n adUnit = new VPAIDAdUnit(createAd(), adEl, that._videoEl, that._frame);\n adUnit.subscribe(AD_STOPPED, $adDestroyed.bind(that));\n error = utils.validate(adUnit.isValidVPAIDAd(), 'the add is not fully complaint with VPAID specification');\n }\n\n that._adUnit = adUnit;\n $destroyLoadListener.call(that);\n callback(error, error ? null : adUnit);\n\n //clear timeout\n return true;\n }\n\n function onTimeout() {\n callback('timeout', null);\n }\n};\n\n/**\n * unloadAdUnit\n *\n */\nVPAIDHTML5Client.prototype.unloadAdUnit = function unloadAdUnit() {\n $unloadPreviousAdUnit.call(this);\n};\n\n/**\n * getID will return the unique id\n *\n * @return {string}\n */\nVPAIDHTML5Client.prototype.getID = function () {\n return this._id;\n};\n\n\n/**\n * $removeEl\n *\n * @param {string} key\n */\nfunction $removeEl(key) {\n var el = this[key];\n if (el) {\n el.remove();\n delete this[key];\n }\n}\n\nfunction $adDestroyed() {\n $removeAdElements.call(this);\n delete this._adUnit;\n}\n\nfunction $unloadPreviousAdUnit() {\n $removeAdElements.call(this);\n $destroyAdUnit.call(this);\n}\n\nfunction $removeAdElements() {\n $removeEl.call(this, '_frame');\n $destroyLoadListener.call(this);\n}\n\n/**\n * $destroyLoadListener\n *\n */\nfunction $destroyLoadListener() {\n if (this._onLoad) {\n window.removeEventListener('message', this._onLoad);\n utils.clearCallbackTimeout(this._onLoad);\n delete this._onLoad;\n }\n}\n\n\nfunction $destroyAdUnit() {\n if (this._adUnit) {\n this._adUnit.stopAd();\n delete this._adUnit;\n }\n}\n\n/**\n * $throwIfDestroyed\n *\n */\nfunction $throwIfDestroyed() {\n if (this._destroyed) {\n throw new Error ('VPAIDHTML5Client already destroyed!');\n }\n}\n\nfunction getOrigin() {\n if( window.location.origin ) {\n return window.location.origin;\n }\n else {\n return window.location.protocol + \"//\" +\n window.location.hostname +\n (window.location.port ? ':' + window.location.port: '');\n }\n}\n\nmodule.exports = VPAIDHTML5Client;\nwindow.VPAIDHTML5Client = VPAIDHTML5Client;\n\n\n},{\"./VPAIDAdUnit\":10,\"./utils\":13}],12:[function(require,module,exports){\n'use strict';\n\nfunction Subscriber() {\n this._subscribers = {};\n}\n\nSubscriber.prototype.subscribe = function subscribe(handler, eventName, context) {\n if (!this.isHandlerAttached(handler, eventName)) {\n this.get(eventName).push({handler: handler, context: context, eventName: eventName});\n }\n};\n\nSubscriber.prototype.unsubscribe = function unsubscribe(handler, eventName) {\n this._subscribers[eventName] = this.get(eventName).filter(function (subscriber) {\n return handler !== subscriber.handler;\n });\n};\n\nSubscriber.prototype.unsubscribeAll = function unsubscribeAll() {\n this._subscribers = {};\n};\n\nSubscriber.prototype.trigger = function(eventName, data) {\n var that = this;\n var subscribers = this.get(eventName)\n .concat(this.get('*'));\n\n subscribers.forEach(function (subscriber) {\n setTimeout(function () {\n if (that.isHandlerAttached(subscriber.handler, subscriber.eventName)) {\n subscriber.handler.call(subscriber.context, data);\n }\n }, 0);\n });\n};\n\nSubscriber.prototype.triggerSync = function(eventName, data) {\n var subscribers = this.get(eventName)\n .concat(this.get('*'));\n\n subscribers.forEach(function (subscriber) {\n subscriber.handler.call(subscriber.context, data);\n });\n};\n\nSubscriber.prototype.get = function get(eventName) {\n if (!this._subscribers[eventName]) {\n this._subscribers[eventName] = [];\n }\n return this._subscribers[eventName];\n};\n\nSubscriber.prototype.isHandlerAttached = function isHandlerAttached(handler, eventName) {\n return this.get(eventName).some(function(subscriber) {\n return handler === subscriber.handler;\n })\n};\n\nmodule.exports = Subscriber;\n\n\n},{}],13:[function(require,module,exports){\n'use strict';\n\n/**\n * noop a empty function\n */\nfunction noop() {}\n\n/**\n * validate if is not validate will return an Error with the message\n *\n * @param {boolean} isValid\n * @param {string} message\n */\nfunction validate(isValid, message) {\n return isValid ? null : new Error(message);\n}\n\nvar timeouts = {};\n/**\n * clearCallbackTimeout\n *\n * @param {function} func handler to remove\n */\nfunction clearCallbackTimeout(func) {\n var timeout = timeouts[func];\n if (timeout) {\n clearTimeout(timeout);\n delete timeouts[func];\n }\n}\n\n/**\n * callbackTimeout if the onSuccess is not called and returns true in the timelimit then onTimeout will be called\n *\n * @param {number} timer\n * @param {function} onSuccess\n * @param {function} onTimeout\n */\nfunction callbackTimeout(timer, onSuccess, onTimeout) {\n var callback, timeout;\n\n timeout = setTimeout(function () {\n onSuccess = noop;\n delete timeout[callback];\n onTimeout();\n }, timer);\n\n callback = function () {\n // TODO avoid leaking arguments\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n if (onSuccess.apply(this, arguments)) {\n clearCallbackTimeout(callback);\n }\n };\n\n timeouts[callback] = timeout;\n\n return callback;\n}\n\n\n/**\n * createElementInEl\n *\n * @param {HTMLElement} parent\n * @param {string} tagName\n * @param {string} id\n */\nfunction createElementInEl(parent, tagName, id) {\n var nEl = document.createElement(tagName);\n if (id) nEl.id = id;\n parent.appendChild(nEl);\n return nEl;\n}\n\n/**\n * createIframeWithContent\n *\n * @param {HTMLElement} parent\n * @param {string} template simple template using {{var}}\n * @param {object} data\n */\nfunction createIframeWithContent(parent, template, data) {\n var iframe = createIframe(parent, null, data.zIndex);\n if (!setIframeContent(iframe, simpleTemplate(template, data))) return;\n return iframe;\n}\n\n/**\n * createIframe\n *\n * @param {HTMLElement} parent\n * @param {string} url\n */\nfunction createIframe(parent, url, zIndex) {\n var nEl = document.createElement('iframe');\n nEl.src = url || 'about:blank';\n nEl.marginWidth = '0';\n nEl.marginHeight = '0';\n nEl.frameBorder = '0';\n nEl.width = '100%';\n nEl.height = '100%';\n nEl.style.position = 'absolute';\n nEl.style.left = '0';\n nEl.style.top = '0';\n nEl.style.margin = '0px';\n nEl.style.padding = '0px';\n nEl.style.border = 'none';\n\n if(zIndex){\n nEl.style.zIndex = zIndex;\n }\n\n nEl.setAttribute('SCROLLING','NO');\n parent.innerHTML = '';\n parent.appendChild(nEl);\n return nEl;\n}\n\n/**\n * simpleTemplate\n *\n * @param {string} template\n * @param {object} data\n */\nfunction simpleTemplate(template, data) {\n Object.keys(data).forEach(function (key) {\n var value = (typeof value === 'object') ? JSON.stringify(data[key]) : data[key];\n template = template.replace(new RegExp('{{' + key + '}}', 'g'), value);\n });\n return template;\n}\n\n/**\n * setIframeContent\n *\n * @param {HTMLIframeElement} iframeEl\n * @param content\n */\nfunction setIframeContent(iframeEl, content) {\n var iframeDoc = iframeEl.contentWindow && iframeEl.contentWindow.document;\n if (!iframeDoc) return false;\n\n iframeDoc.write(content);\n\n return true;\n}\n\n\n/**\n * extend object with keys from another object\n *\n * @param {object} toExtend\n * @param {object} fromSource\n */\nfunction extend(toExtend, fromSource) {\n Object.keys(fromSource).forEach(function(key) {\n toExtend[key] = fromSource[key];\n });\n return toExtend;\n}\n\n\n/**\n * unique will create a unique string everytime is called, sequentially and prefixed\n *\n * @param {string} prefix\n */\nfunction unique(prefix) {\n var count = -1;\n return function () {\n return prefix + '_' + (++count);\n };\n}\n\nmodule.exports = {\n noop: noop,\n validate: validate,\n clearCallbackTimeout: clearCallbackTimeout,\n callbackTimeout: callbackTimeout,\n createElementInEl: createElementInEl,\n createIframeWithContent: createIframeWithContent,\n createIframe: createIframe,\n simpleTemplate: simpleTemplate,\n setIframeContent: setIframeContent,\n extend: extend,\n unique: unique\n};\n\n\n},{}],14:[function(require,module,exports){\n'use strict';\n\nvar InLine = require('./InLine');\nvar Wrapper = require('./Wrapper');\n\nfunction Ad(adJTree) {\n if (!(this instanceof Ad)) {\n return new Ad(adJTree);\n }\n this.initialize(adJTree);\n}\n\nAd.prototype.initialize = function(adJTree) {\n this.id = adJTree.attr('id');\n this.sequence = adJTree.attr('sequence');\n\n if(adJTree.inLine) {\n this.inLine = new InLine(adJTree.inLine);\n }\n\n if(adJTree.wrapper){\n this.wrapper = new Wrapper(adJTree.wrapper);\n }\n};\n\nmodule.exports = Ad;\n},{\"./InLine\":17,\"./Wrapper\":27}],15:[function(require,module,exports){\n'use strict';\n\nvar TrackingEvent = require('./TrackingEvent');\n\nvar utilities = require('../../utils/utilityFunctions');\n\nvar xml = require('../../utils/xml');\n\n\nfunction Companion(companionJTree) {\n if (!(this instanceof Companion)) {\n return new Companion(companionJTree);\n }\n\n //Required Elements\n this.creativeType = xml.attr(companionJTree.staticResource, 'creativeType');\n this.staticResource = xml.keyValue(companionJTree.staticResource);\n\n // Weird bug when the JXON tree is built it doesn't handle casing properly in this situation...\n var htmlResource = null;\n if (xml.keyValue(companionJTree.HTMLResource)) {\n htmlResource = xml.keyValue(companionJTree.HTMLResource);\n } else if (xml.keyValue(companionJTree.hTMLResource)) {\n htmlResource = xml.keyValue(companionJTree.hTMLResource);\n }\n this.htmlResource = htmlResource;\n\n var iframeResource = null;\n if (xml.keyValue(companionJTree.IFrameResource)) {\n iframeResource = xml.keyValue(companionJTree.IFrameResource);\n } else if (xml.keyValue(companionJTree.iFrameresource)) {\n iframeResource = xml.keyValue(companionJTree.iFrameresource);\n }\n this.iframeResource = iframeResource;\n\n //Optional fields\n this.id = xml.attr(companionJTree, 'id');\n this.width = xml.attr(companionJTree, 'width');\n this.height = xml.attr(companionJTree, 'height');\n this.expandedWidth = xml.attr(companionJTree, 'expandedWidth');\n this.expandedHeight = xml.attr(companionJTree, 'expandedHeight');\n this.scalable = xml.attr(companionJTree, 'scalable');\n this.maintainAspectRatio = xml.attr(companionJTree, 'maintainAspectRatio');\n this.minSuggestedDuration = xml.attr(companionJTree, 'minSuggestedDuration');\n this.apiFramework = xml.attr(companionJTree, 'apiFramework');\n this.companionClickThrough = xml.keyValue(companionJTree.companionClickThrough);\n this.trackingEvents = parseTrackingEvents(companionJTree.trackingEvents && companionJTree.trackingEvents.tracking);\n\n /*** Local functions ***/\n function parseTrackingEvents(trackingEvents) {\n var trackings = [];\n if (utilities.isDefined(trackingEvents)) {\n trackingEvents = utilities.isArray(trackingEvents) ? trackingEvents : [trackingEvents];\n trackingEvents.forEach(function (trackingData) {\n trackings.push(new TrackingEvent(trackingData));\n });\n }\n return trackings;\n }\n}\n\nmodule.exports = Companion;\n},{\"../../utils/utilityFunctions\":44,\"../../utils/xml\":45,\"./TrackingEvent\":20}],16:[function(require,module,exports){\n'use strict';\n\nvar Linear = require('./Linear');\nvar Companion = require('./Companion');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction Creative(creativeJTree) {\n if(!(this instanceof Creative)) {\n return new Creative(creativeJTree);\n }\n\n this.id = creativeJTree.attr('id');\n this.sequence = creativeJTree.attr('sequence');\n this.adId = creativeJTree.attr('adId');\n this.apiFramework = creativeJTree.attr('apiFramework');\n\n if(creativeJTree.linear) {\n this.linear = new Linear(creativeJTree.linear);\n }\n\n if (creativeJTree.companionAds) {\n var companions = [];\n var companionAds = creativeJTree.companionAds && creativeJTree.companionAds.companion;\n if (utilities.isDefined(companionAds)) {\n companionAds = utilities.isArray(companionAds) ? companionAds : [companionAds];\n companionAds.forEach(function (companionData) {\n companions.push(new Companion(companionData));\n });\n }\n this.companionAds = companions;\n }\n}\n\n/**\n * Returns true if the browser supports at the creative.\n */\nCreative.prototype.isSupported = function(){\n if(this.linear) {\n return this.linear.isSupported();\n }\n\n return true;\n};\n\nCreative.parseCreatives = function parseCreatives(creativesJTree) {\n var creatives = [];\n var creativesData;\n if (utilities.isDefined(creativesJTree) && utilities.isDefined(creativesJTree.creative)) {\n creativesData = utilities.isArray(creativesJTree.creative) ? creativesJTree.creative : [creativesJTree.creative];\n creativesData.forEach(function (creative) {\n creatives.push(new Creative(creative));\n });\n }\n return creatives;\n};\n\nmodule.exports = Creative;\n\n},{\"../../utils/utilityFunctions\":44,\"./Companion\":15,\"./Linear\":18}],17:[function(require,module,exports){\n'use strict';\n\nvar vastUtil = require('./vastUtil');\nvar Creative = require('./Creative');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nfunction InLine(inlineJTree) {\n if (!(this instanceof InLine)) {\n return new InLine(inlineJTree);\n }\n\n //Required Fields\n this.adTitle = xml.keyValue(inlineJTree.adTitle);\n this.adSystem = xml.keyValue(inlineJTree.adSystem);\n this.impressions = vastUtil.parseImpressions(inlineJTree.impression);\n this.creatives = Creative.parseCreatives(inlineJTree.creatives);\n\n //Optional Fields\n this.description = xml.keyValue(inlineJTree.description);\n this.advertiser = xml.keyValue(inlineJTree.advertiser);\n this.surveys = parseSurveys(inlineJTree.survey);\n this.error = xml.keyValue(inlineJTree.error);\n this.pricing = xml.keyValue(inlineJTree.pricing);\n this.extensions = inlineJTree.extensions;\n\n /*** Local Functions ***/\n function parseSurveys(inlineSurveys) {\n if (inlineSurveys) {\n return utilities.transformArray(utilities.isArray(inlineSurveys) ? inlineSurveys : [inlineSurveys], function (survey) {\n if(utilities.isNotEmptyString(survey.keyValue)){\n return {\n uri: survey.keyValue,\n type: survey.attr('type')\n };\n }\n\n return undefined;\n });\n }\n return [];\n }\n}\n\n\n/**\n * Returns true if the browser supports all the creatives.\n */\nInLine.prototype.isSupported = function(){\n var i,len;\n\n if(this.creatives.length === 0) {\n return false;\n }\n\n for(i = 0, len = this.creatives.length; i< len; i+=1){\n if(!this.creatives[i].isSupported()){\n return false;\n }\n }\n return true;\n};\n\nmodule.exports = InLine;\n\n},{\"../../utils/utilityFunctions\":44,\"../../utils/xml\":45,\"./Creative\":16,\"./vastUtil\":29}],18:[function(require,module,exports){\n'use strict';\n\nvar TrackingEvent = require('./TrackingEvent');\nvar MediaFile = require('./MediaFile');\nvar VideoClicks = require('./VideoClicks');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar parsers = require('./parsers');\n\nvar xml = require('../../utils/xml');\n\n\nfunction Linear(linearJTree) {\n if (!(this instanceof Linear)) {\n return new Linear(linearJTree);\n }\n\n //Required Elements\n this.duration = parsers.duration(xml.keyValue(linearJTree.duration));\n this.mediaFiles = parseMediaFiles(linearJTree.mediaFiles && linearJTree.mediaFiles.mediaFile);\n\n //Optional fields\n this.trackingEvents = parseTrackingEvents(linearJTree.trackingEvents && linearJTree.trackingEvents.tracking, this.duration);\n this.skipoffset = parsers.offset(xml.attr(linearJTree, 'skipoffset'), this.duration);\n\n if (linearJTree.videoClicks) {\n this.videoClicks = new VideoClicks(linearJTree.videoClicks);\n }\n\n if(linearJTree.adParameters) {\n this.adParameters = xml.keyValue(linearJTree.adParameters);\n\n if(xml.attr(linearJTree.adParameters, 'xmlEncoded')){\n this.adParameters = xml.decode(this.adParameters);\n }\n }\n\n /*** Local functions ***/\n function parseTrackingEvents(trackingEvents, duration) {\n var trackings = [];\n if (utilities.isDefined(trackingEvents)) {\n trackingEvents = utilities.isArray(trackingEvents) ? trackingEvents : [trackingEvents];\n trackingEvents.forEach(function (trackingData) {\n trackings.push(new TrackingEvent(trackingData, duration));\n });\n }\n return trackings;\n }\n\n function parseMediaFiles(mediaFilesJxonTree) {\n var mediaFiles = [];\n if (utilities.isDefined(mediaFilesJxonTree)) {\n mediaFilesJxonTree = utilities.isArray(mediaFilesJxonTree) ? mediaFilesJxonTree : [mediaFilesJxonTree];\n\n mediaFilesJxonTree.forEach(function (mfData) {\n mediaFiles.push(new MediaFile(mfData));\n });\n }\n return mediaFiles;\n }\n}\n\n/**\n * Must return true if at least one of the MediaFiles' type is supported\n */\nLinear.prototype.isSupported = function () {\n var i, len;\n for(i=0, len=this.mediaFiles.length; i 0) {\n getAd(waterfallAds.shift(),[], waterfallHandler);\n } else {\n callback(error, adChain);\n }\n } else {\n callback(null, adChain);\n }\n }\n });\n\n /*** Local functions ***/\n function getAdWaterfall(adTagUrl, callback) {\n var requestVastXML = that._requestVASTXml.bind(that, adTagUrl);\n async.waterfall([\n requestVastXML,\n buildVastWaterfall\n ], callback);\n }\n\n function buildVastWaterfall(xmlStr, callback) {\n var vastTree;\n try {\n vastTree = xml.toJXONTree(xmlStr);\n\n if(utilities.isArray(vastTree.ad)) {\n vastTree.ads = vastTree.ad;\n } else if(vastTree.ad){\n vastTree.ads = [vastTree.ad];\n } else {\n vastTree.ads = [];\n }\n callback(validateVASTTree(vastTree), vastTree);\n\n } catch (e) {\n callback(new VASTError(\"on VASTClient.getVASTAd.buildVastWaterfall, error parsing xml\", 100), null);\n }\n }\n\n function validateVASTTree(vastTree) {\n var vastVersion = xml.attr(vastTree, 'version');\n\n if (!vastTree.ad) {\n return new VASTError('on VASTClient.getVASTAd.validateVASTTree, no Ad in VAST tree', 303);\n }\n\n if (vastVersion && (vastVersion != 3 && vastVersion != 2)) {\n return new VASTError('on VASTClient.getVASTAd.validateVASTTree, not supported VAST version \"' + vastVersion + '\"', 102);\n }\n\n return null;\n }\n\n function getAd(adTagUrl, adChain, callback) {\n if (adChain.length >= that.WRAPPER_LIMIT) {\n return callback(new VASTError(\"on VASTClient.getVASTAd.getAd, players wrapper limit reached (the limit is \" + that.WRAPPER_LIMIT + \")\", 302), adChain);\n }\n\n async.waterfall([\n function (next) {\n if (utilities.isString(adTagUrl)) {\n requestVASTAd(adTagUrl, next);\n } else {\n next(null, adTagUrl);\n }\n },\n buildAd\n ], function (error, ad) {\n if (ad) {\n adChain.push(ad);\n }\n\n if (error) {\n return callback(error, adChain);\n }\n\n if (ad.wrapper) {\n return getAd(ad.wrapper.VASTAdTagURI, adChain, callback);\n }\n\n return callback(null, adChain);\n });\n }\n\n function buildAd(adJxonTree, callback) {\n try {\n var ad = new Ad(adJxonTree);\n callback(validateAd(ad), ad);\n } catch (e) {\n callback(new VASTError('on VASTClient.getVASTAd.buildAd, error parsing xml', 100), null);\n }\n }\n\n function validateAd(ad) {\n var wrapper = ad.wrapper;\n var inLine = ad.inLine;\n var errMsgPrefix = 'on VASTClient.getVASTAd.validateAd, ';\n\n if (inLine && wrapper) {\n return new VASTError(errMsgPrefix +\"InLine and Wrapper both found on the same Ad\", 101);\n }\n\n if (!inLine && !wrapper) {\n return new VASTError(errMsgPrefix + \"nor wrapper nor inline elements found on the Ad\", 101);\n }\n\n if (inLine && !inLine.isSupported()) {\n return new VASTError(errMsgPrefix + \"could not find MediaFile that is supported by this video player\", 403);\n }\n\n if (wrapper && !wrapper.VASTAdTagURI) {\n return new VASTError(errMsgPrefix + \"missing 'VASTAdTagURI' in wrapper\", 101);\n }\n\n return null;\n }\n\n function requestVASTAd(adTagUrl, callback) {\n that._requestVASTXml(adTagUrl, function (error, xmlStr) {\n if (error) {\n return callback(error);\n }\n try {\n var vastTree = xml.toJXONTree(xmlStr);\n callback(validateVASTTree(vastTree), vastTree.ad);\n } catch (e) {\n callback(new VASTError(\"on VASTClient.getVASTAd.requestVASTAd, error parsing xml\", 100));\n }\n });\n }\n};\n\nVASTClient.prototype._requestVASTXml = function requestVASTXml(adTagUrl, callback) {\n try {\n if (utilities.isFunction(adTagUrl)) {\n adTagUrl(requestHandler);\n } else {\n http.get(adTagUrl, requestHandler, {\n withCredentials: true\n });\n }\n } catch (e) {\n callback(e);\n }\n\n /*** Local functions ***/\n function requestHandler(error, response, status) {\n if (error) {\n var errMsg = utilities.isDefined(status) ?\n \"on VASTClient.requestVastXML, HTTP request error with status '\" + status + \"'\" :\n \"on VASTClient.requestVastXML, Error getting the the VAST XML with he passed adTagXML fn\";\n return callback(new VASTError(errMsg, 301), null);\n }\n\n callback(null, response);\n }\n};\n\nVASTClient.prototype._buildVASTResponse = function buildVASTResponse(adsChain) {\n var response = new VASTResponse();\n addAdsToResponse(response, adsChain);\n validateResponse(response);\n\n return response;\n\n //*** Local function ****\n function addAdsToResponse(response, ads) {\n ads.forEach(function (ad) {\n response.addAd(ad);\n });\n }\n\n function validateResponse(response) {\n var progressEvents = response.trackingEvents.progress;\n\n if (!response.hasLinear()) {\n throw new VASTError(\"on VASTClient._buildVASTResponse, Received an Ad type that is not supported\", 200);\n }\n\n if (response.duration === undefined) {\n throw new VASTError(\"on VASTClient._buildVASTResponse, Missing duration field in VAST response\", 101);\n }\n\n if (progressEvents) {\n progressEvents.forEach(function (progressEvent) {\n if (!utilities.isNumber(progressEvent.offset)) {\n throw new VASTError(\"on VASTClient._buildVASTResponse, missing or wrong offset attribute on progress tracking event\", 101);\n }\n });\n }\n }\n};\n\nVASTClient.prototype._trackError = function (error, adChain) {\n if (!utilities.isArray(adChain) || adChain.length === 0) { //There is nothing to track\n return;\n }\n\n var errorURLMacros = [];\n adChain.forEach(addErrorUrlMacros);\n vastUtil.track(errorURLMacros, {ERRORCODE: error.code || 900}); //900 <== Undefined error\n\n /*** Local functions ***/\n function addErrorUrlMacros(ad) {\n if (ad.wrapper && ad.wrapper.error) {\n errorURLMacros.push(ad.wrapper.error);\n }\n\n if (ad.inLine && ad.inLine.error) {\n errorURLMacros.push(ad.inLine.error);\n }\n }\n};\n\nmodule.exports = VASTClient;\n\n},{\"../../utils/async\":39,\"../../utils/http\":41,\"../../utils/utilityFunctions\":44,\"../../utils/xml\":45,\"./Ad\":14,\"./VASTError\":22,\"./VASTResponse\":24,\"./vastUtil\":29}],22:[function(require,module,exports){\n'use strict';\n\nfunction VASTError(message, code) {\n this.message = 'VAST Error: ' + (message || '');\n if (code) {\n this.code = code;\n }\n}\n\nVASTError.prototype = new Error();\nVASTError.prototype.name = \"VAST Error\";\n\nmodule.exports = VASTError;\n},{}],23:[function(require,module,exports){\n'use strict';\n\n/**\n * Inner helper class that deals with the logic of the individual steps needed to setup an ad in the player.\n *\n * @param player {object} instance of the player that will play the ad. It assumes that the videojs-contrib-ads plugin\n * has been initialized when you use its utility functions.\n *\n * @constructor\n */\n\nvar VASTResponse = require('./VASTResponse');\nvar VASTError = require('./VASTError');\nvar VASTTracker = require('./VASTTracker');\nvar vastUtil = require('./vastUtil');\n\nvar async = require('../../utils/async');\nvar dom = require('../../utils/dom');\nvar playerUtils = require('../../utils/playerUtils');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VASTIntegrator(player) {\n if (!(this instanceof VASTIntegrator)) {\n return new VASTIntegrator(player);\n }\n\n this.player = player;\n}\n\nVASTIntegrator.prototype.playAd = function playAd(vastResponse, callback) {\n var that = this;\n callback = callback || utilities.noop;\n\n if (!(vastResponse instanceof VASTResponse)) {\n return callback(new VASTError('On VASTIntegrator, missing required VASTResponse'));\n }\n\n async.waterfall([\n function (next) {\n next(null, vastResponse);\n },\n this._selectAdSource.bind(this),\n this._createVASTTracker.bind(this),\n this._addClickThrough.bind(this),\n this._addSkipButton.bind(this),\n this._setupEvents.bind(this),\n this._playSelectedAd.bind(this)\n ], function (error, response) {\n if (error && response) {\n that._trackError(error, response);\n }\n callback(error, response);\n });\n\n this._adUnit = {\n _src: null,\n type: 'VAST',\n pauseAd: function () {\n that.player.pause(true);\n },\n\n resumeAd: function () {\n that.player.play(true);\n },\n\n isPaused: function () {\n return that.player.paused(true);\n },\n\n getSrc: function () {\n return this._src;\n }\n };\n\n return this._adUnit;\n};\n\nVASTIntegrator.prototype._selectAdSource = function selectAdSource(response, callback) {\n var source;\n\n var playerWidth = dom.getDimension(this.player.el()).width;\n response.mediaFiles.sort(function compareTo(a, b) {\n var deltaA = Math.abs(playerWidth - a.width);\n var deltaB = Math.abs(playerWidth - b.width);\n return deltaA - deltaB;\n });\n\n source = this.player.selectSource(response.mediaFiles).source;\n\n if (source) {\n if (this._adUnit) {\n this._adUnit._src = source;\n }\n return callback(null, source, response);\n }\n\n // code 403 <== Couldn't find MediaFile that is supported by this video player\n callback(new VASTError(\"Could not find Ad mediafile supported by this player\", 403), response);\n};\n\nVASTIntegrator.prototype._createVASTTracker = function createVASTTracker(adMediaFile, response, callback) {\n try {\n callback(null, adMediaFile, new VASTTracker(adMediaFile.src, response), response);\n } catch (e) {\n callback(e, response);\n }\n};\n\nVASTIntegrator.prototype._setupEvents = function setupEvents(adMediaFile, tracker, response, callback) {\n var previouslyMuted;\n var player = this.player;\n player.on('fullscreenchange', trackFullscreenChange);\n player.on('vast.adStart', trackImpressions);\n player.on('pause', trackPause);\n player.on('timeupdate', trackProgress);\n player.on('volumechange', trackVolumeChange);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], unbindEvents);\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel', 'vast.adSkip'], function(evt){\n if(evt.type === 'vast.adEnd'){\n tracker.trackComplete();\n }\n });\n\n return callback(null, adMediaFile, response);\n\n /*** Local Functions ***/\n function unbindEvents() {\n player.off('fullscreenchange', trackFullscreenChange);\n player.off('vast.adStart', trackImpressions);\n player.off('pause', trackPause);\n player.off('timeupdate', trackProgress);\n player.off('volumechange', trackVolumeChange);\n }\n\n function trackFullscreenChange() {\n if (player.isFullscreen()) {\n tracker.trackFullscreen();\n } else {\n tracker.trackExitFullscreen();\n }\n }\n\n function trackPause() {\n //NOTE: whenever a video ends the video Element triggers a 'pause' event before the 'ended' event.\n // We should not track this pause event because it makes the VAST tracking confusing again we use a\n // Threshold of 2 seconds to prevent false positives on IOS.\n if (Math.abs(player.duration() - player.currentTime()) < 2) {\n return;\n }\n\n tracker.trackPause();\n playerUtils.once(player, ['play', 'vast.adEnd', 'vast.adsCancel'], function (evt) {\n if(evt.type === 'play'){\n tracker.trackResume();\n }\n });\n }\n\n function trackProgress() {\n var currentTimeInMs = player.currentTime() * 1000;\n tracker.trackProgress(currentTimeInMs);\n }\n\n function trackImpressions() {\n tracker.trackImpressions();\n tracker.trackCreativeView();\n }\n\n function trackVolumeChange() {\n var muted = player.muted();\n if (muted) {\n tracker.trackMute();\n } else if (previouslyMuted) {\n tracker.trackUnmute();\n }\n previouslyMuted = muted;\n }\n};\n\nVASTIntegrator.prototype._addSkipButton = function addSkipButton(source, tracker, response, callback) {\n var skipOffsetInSec;\n var that = this;\n\n if (utilities.isNumber(response.skipoffset)) {\n skipOffsetInSec = response.skipoffset / 1000;\n addSkipButtonToPlayer(this.player, skipOffsetInSec);\n }\n callback(null, source, tracker, response);\n\n /*** Local function ***/\n function addSkipButtonToPlayer(player, skipOffset) {\n var skipButton = createSkipButton(player);\n var updateSkipButton = updateSkipButtonState.bind(that, skipButton, skipOffset, player);\n\n player.el().appendChild(skipButton);\n player.on('timeupdate', updateSkipButton);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeSkipButton);\n\n function removeSkipButton() {\n player.off('timeupdate', updateSkipButton);\n dom.remove(skipButton);\n }\n }\n\n function createSkipButton(player) {\n var skipButton = window.document.createElement(\"div\");\n dom.addClass(skipButton, \"vast-skip-button\");\n\n skipButton.onclick = function (e) {\n if (dom.hasClass(skipButton, 'enabled')) {\n tracker.trackSkip();\n player.trigger('vast.adSkip');\n }\n\n //We prevent event propagation to avoid problems with the clickThrough and so on\n if (window.Event.prototype.stopPropagation !== undefined) {\n e.stopPropagation();\n } else {\n return false;\n }\n };\n\n return skipButton;\n }\n\n function updateSkipButtonState(skipButton, skipOffset, player) {\n var timeLeft = Math.ceil(skipOffset - player.currentTime());\n if (timeLeft > 0) {\n skipButton.innerHTML = \"Skip in \" + utilities.toFixedDigits(timeLeft, 2) + \"...\";\n } else {\n if (!dom.hasClass(skipButton, 'enabled')) {\n dom.addClass(skipButton, 'enabled');\n skipButton.innerHTML = \"Skip ad\";\n }\n }\n }\n};\n\nVASTIntegrator.prototype._addClickThrough = function addClickThrough(mediaFile, tracker, response, callback) {\n var player = this.player;\n var blocker = createClickThroughBlocker(player, tracker, response);\n var updateBlocker = updateBlockerURL.bind(this, blocker, response, player);\n\n player.el().insertBefore(blocker, player.controlBar.el());\n player.on('timeupdate', updateBlocker);\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeBlocker);\n\n return callback(null, mediaFile, tracker, response);\n\n /*** Local Functions ***/\n\n function createClickThroughBlocker(player, tracker, response) {\n var blocker = window.document.createElement(\"a\");\n var clickThroughMacro = response.clickThrough;\n\n dom.addClass(blocker, 'vast-blocker');\n blocker.href = generateClickThroughURL(clickThroughMacro, player);\n\n if (utilities.isString(clickThroughMacro)) {\n blocker.target = \"_blank\";\n }\n\n blocker.onclick = function (e) {\n if (player.paused()) {\n player.play();\n\n //We prevent event propagation to avoid problems with the player's normal pause mechanism\n if (window.Event.prototype.stopPropagation !== undefined) {\n e.stopPropagation();\n }\n return false;\n }\n\n player.pause();\n tracker.trackClick();\n };\n\n return blocker;\n }\n\n function updateBlockerURL(blocker, response, player) {\n blocker.href = generateClickThroughURL(response.clickThrough, player);\n }\n\n function generateClickThroughURL(clickThroughMacro, player) {\n var variables = {\n ASSETURI: mediaFile.src,\n CONTENTPLAYHEAD: vastUtil.formatProgress(player.currentTime() * 1000)\n };\n\n return clickThroughMacro ? vastUtil.parseURLMacro(clickThroughMacro, variables) : '#';\n }\n\n function removeBlocker() {\n player.off('timeupdate', updateBlocker);\n dom.remove(blocker);\n }\n};\n\nVASTIntegrator.prototype._playSelectedAd = function playSelectedAd(source, response, callback) {\n var player = this.player;\n\n player.preload(\"auto\"); //without preload=auto the durationchange event is never fired\n player.src(source);\n\n playerUtils.once(player, ['durationchange', 'error', 'vast.adsCancel'], function (evt) {\n if (evt.type === 'durationchange') {\n playAd();\n } else if(evt.type === 'error') {\n callback(new VASTError(\"on VASTIntegrator, Player is unable to play the Ad\", 400), response);\n }\n //NOTE: If the ads get canceled we do nothing/\n });\n\n /**** local functions ******/\n function playAd() {\n\n playerUtils.once(player, ['playing', 'vast.adsCancel'], function (evt) {\n if(evt.type === 'vast.adsCancel'){\n return;\n }\n\n player.trigger('vast.adStart');\n\n player.on('ended', proceed);\n player.on('vast.adsCancel', proceed);\n player.on('vast.adSkip', proceed);\n\n function proceed(evt) {\n\n if(evt.type === 'ended' && (player.duration() - player.currentTime()) > 3 ) {\n // Ignore ended event if the Ad time was not 'near' the end\n // avoids issues where IOS controls could skip the Ad\n return;\n }\n\n player.off('ended', proceed);\n player.off('vast.adsCancel', proceed);\n player.off('vast.adSkip', proceed);\n\n //NOTE: if the ads get cancel we do nothing apart removing the listners\n if(evt.type === 'ended' || evt.type === 'vast.adSkip'){\n callback(null, response);\n }\n }\n });\n\n player.play();\n }\n};\n\nVASTIntegrator.prototype._trackError = function trackError(error, response) {\n vastUtil.track(response.errorURLMacros, {ERRORCODE: error.code || 900});\n};\n\nmodule.exports = VASTIntegrator;\n},{\"../../utils/async\":39,\"../../utils/dom\":40,\"../../utils/playerUtils\":42,\"../../utils/utilityFunctions\":44,\"./VASTError\":22,\"./VASTResponse\":24,\"./VASTTracker\":25,\"./vastUtil\":29}],24:[function(require,module,exports){\n'use strict';\n\nvar Ad = require('./Ad');\nvar VideoClicks = require('./VideoClicks');\nvar Linear = require('./Linear');\nvar InLine = require('./InLine');\nvar Wrapper = require('./Wrapper');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nwindow.InLine__A = InLine;\nfunction VASTResponse() {\n if (!(this instanceof VASTResponse)) {\n return new VASTResponse();\n }\n\n this._linearAdded = false;\n this.ads = [];\n this.errorURLMacros = [];\n this.impressions = [];\n this.clickTrackings = [];\n this.customClicks = [];\n this.trackingEvents = {};\n this.mediaFiles = [];\n this.clickThrough = undefined;\n this.adTitle = '';\n this.duration = undefined;\n this.skipoffset = undefined;\n}\n\nVASTResponse.prototype.addAd = function (ad) {\n var inLine, wrapper;\n if (ad instanceof Ad) {\n inLine = ad.inLine;\n wrapper = ad.wrapper;\n\n this.ads.push(ad);\n\n if (inLine) {\n this._addInLine(inLine);\n }\n\n if (wrapper) {\n this._addWrapper(wrapper);\n }\n }\n};\n\nVASTResponse.prototype._addErrorTrackUrl = function (error) {\n var errorURL = error instanceof xml.JXONTree ? xml.keyValue(error) : error;\n if (errorURL) {\n this.errorURLMacros.push(errorURL);\n }\n};\n\nVASTResponse.prototype._addImpressions = function (impressions) {\n utilities.isArray(impressions) && appendToArray(this.impressions, impressions);\n};\n\nVASTResponse.prototype._addClickThrough = function (clickThrough) {\n if (utilities.isNotEmptyString(clickThrough)) {\n this.clickThrough = clickThrough;\n }\n};\n\nVASTResponse.prototype._addClickTrackings = function (clickTrackings) {\n utilities.isArray(clickTrackings) && appendToArray(this.clickTrackings, clickTrackings);\n};\n\nVASTResponse.prototype._addCustomClicks = function (customClicks) {\n utilities.isArray(customClicks) && appendToArray(this.customClicks, customClicks);\n};\n\nVASTResponse.prototype._addTrackingEvents = function (trackingEvents) {\n var eventsMap = this.trackingEvents;\n\n if (trackingEvents) {\n trackingEvents = utilities.isArray(trackingEvents) ? trackingEvents : [trackingEvents];\n trackingEvents.forEach(function (trackingEvent) {\n if (!eventsMap[trackingEvent.name]) {\n eventsMap[trackingEvent.name] = [];\n }\n eventsMap[trackingEvent.name].push(trackingEvent);\n });\n }\n};\n\nVASTResponse.prototype._addTitle = function (title) {\n if (utilities.isNotEmptyString(title)) {\n this.adTitle = title;\n }\n};\n\nVASTResponse.prototype._addDuration = function (duration) {\n if (utilities.isNumber(duration)) {\n this.duration = duration;\n }\n};\n\nVASTResponse.prototype._addVideoClicks = function (videoClicks) {\n if (videoClicks instanceof VideoClicks) {\n this._addClickThrough(videoClicks.clickThrough);\n this._addClickTrackings(videoClicks.clickTrackings);\n this._addCustomClicks(videoClicks.customClicks);\n }\n};\n\nVASTResponse.prototype._addMediaFiles = function (mediaFiles) {\n utilities.isArray(mediaFiles) && appendToArray(this.mediaFiles, mediaFiles);\n};\n\nVASTResponse.prototype._addSkipoffset = function (offset) {\n if (offset) {\n this.skipoffset = offset;\n }\n};\n\nVASTResponse.prototype._addAdParameters = function (adParameters) {\n if (adParameters) {\n this.adParameters = adParameters;\n }\n};\n\nVASTResponse.prototype._addLinear = function (linear) {\n if (linear instanceof Linear) {\n this._addDuration(linear.duration);\n this._addTrackingEvents(linear.trackingEvents);\n this._addVideoClicks(linear.videoClicks);\n this._addMediaFiles(linear.mediaFiles);\n this._addSkipoffset(linear.skipoffset);\n this._addAdParameters(linear.adParameters);\n this._linearAdded = true;\n }\n};\n\nVASTResponse.prototype._addInLine = function (inLine) {\n var that = this;\n\n if (inLine instanceof InLine) {\n this._addTitle(inLine.adTitle);\n this._addErrorTrackUrl(inLine.error);\n this._addImpressions(inLine.impressions);\n\n inLine.creatives.forEach(function (creative) {\n if (creative.linear) {\n that._addLinear(creative.linear);\n }\n });\n }\n};\n\nVASTResponse.prototype._addWrapper = function (wrapper) {\n var that = this;\n\n if (wrapper instanceof Wrapper) {\n this._addErrorTrackUrl(wrapper.error);\n this._addImpressions(wrapper.impressions);\n\n wrapper.creatives.forEach(function (creative) {\n var linear = creative.linear;\n if (linear) {\n that._addVideoClicks(linear.videoClicks);\n that.clickThrough = undefined;//We ensure that no clickThrough has been added\n that._addTrackingEvents(linear.trackingEvents);\n }\n });\n }\n};\n\nVASTResponse.prototype.hasLinear = function(){\n return this._linearAdded;\n};\n\nfunction appendToArray(array, items) {\n items.forEach(function (item) {\n array.push(item);\n });\n}\n\nmodule.exports = VASTResponse;\n\n\n},{\"../../utils/utilityFunctions\":44,\"../../utils/xml\":45,\"./Ad\":14,\"./InLine\":17,\"./Linear\":18,\"./VideoClicks\":26,\"./Wrapper\":27}],25:[function(require,module,exports){\n'use strict';\n\nvar VASTError = require('./VASTError');\nvar VASTResponse = require('./VASTResponse');\nvar vastUtil = require('./vastUtil');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VASTTracker(assetURI, vastResponse) {\n if (!(this instanceof VASTTracker)) {\n return new VASTTracker(assetURI, vastResponse);\n }\n\n this.sanityCheck(assetURI, vastResponse);\n this.initialize(assetURI, vastResponse);\n\n}\n\nVASTTracker.prototype.initialize = function(assetURI, vastResponse) {\n this.response = vastResponse;\n this.assetURI = assetURI;\n this.progress = 0;\n this.quartiles = {\n firstQuartile: {tracked: false, time: Math.round(25 * vastResponse.duration) / 100},\n midpoint: {tracked: false, time: Math.round(50 * vastResponse.duration) / 100},\n thirdQuartile: {tracked: false, time: Math.round(75 * vastResponse.duration) / 100}\n };\n};\n\nVASTTracker.prototype.sanityCheck = function(assetURI, vastResponse) {\n if (!utilities.isString(assetURI) || utilities.isEmptyString(assetURI)) {\n throw new VASTError('on VASTTracker constructor, missing required the URI of the ad asset being played');\n }\n\n if (!(vastResponse instanceof VASTResponse)) {\n throw new VASTError('on VASTTracker constructor, missing required VAST response');\n }\n};\n\nVASTTracker.prototype.trackURLs = function trackURLs(urls, variables) {\n if (utilities.isArray(urls) && urls.length > 0) {\n variables = utilities.extend({\n ASSETURI: this.assetURI,\n CONTENTPLAYHEAD: vastUtil.formatProgress(this.progress)\n }, variables || {});\n\n vastUtil.track(urls, variables);\n }\n};\n\nVASTTracker.prototype.trackEvent = function trackEvent(eventName, trackOnce) {\n this.trackURLs(getEventUris(this.response.trackingEvents[eventName]));\n if (trackOnce) {\n this.response.trackingEvents[eventName] = undefined;\n }\n\n /*** Local function ***/\n function getEventUris(trackingEvents) {\n var uris;\n\n if (trackingEvents) {\n uris = [];\n trackingEvents.forEach(function (event) {\n uris.push(event.uri);\n });\n }\n return uris;\n }\n};\n\nVASTTracker.prototype.trackProgress = function trackProgress(newProgressInMs) {\n var that = this;\n var events = [];\n var ONCE = true;\n var ALWAYS = false;\n var trackingEvents = this.response.trackingEvents;\n\n if (utilities.isNumber(newProgressInMs)) {\n addTrackEvent('start', ONCE, newProgressInMs > 0);\n addTrackEvent('rewind', ALWAYS, hasRewound(this.progress, newProgressInMs));\n addQuartileEvents(newProgressInMs);\n trackProgressEvents(newProgressInMs);\n trackEvents();\n this.progress = newProgressInMs;\n }\n\n /*** Local function ***/\n function hasRewound(currentProgress, newProgress) {\n var REWIND_THRESHOLD = 3000; //IOS video clock is very unreliable and we need a 3 seconds threshold to ensure that there was a rewind an that it was on purpose.\n return currentProgress > newProgressInMs && Math.abs(newProgress - currentProgress) > REWIND_THRESHOLD;\n }\n\n function addTrackEvent(eventName, trackOnce, canBeAdded) {\n if (trackingEvents[eventName] && canBeAdded) {\n events.push({\n name: eventName,\n trackOnce: !!trackOnce\n });\n }\n }\n\n function addQuartileEvents(progress) {\n var quartiles = that.quartiles;\n var firstQuartile = that.quartiles.firstQuartile;\n var midpoint = that.quartiles.midpoint;\n var thirdQuartile = that.quartiles.thirdQuartile;\n\n if (!firstQuartile.tracked) {\n trackQuartile('firstQuartile', progress);\n } else if (!midpoint.tracked) {\n trackQuartile('midpoint', progress);\n } else if (!thirdQuartile.tracked){\n trackQuartile('thirdQuartile', progress);\n }\n\n /*** Local function ***/\n function trackQuartile(quartileName, progress){\n var quartile = quartiles[quartileName];\n if(canBeTracked(quartile, progress)){\n quartile.tracked = true;\n addTrackEvent(quartileName, ONCE, true);\n }\n }\n }\n\n function canBeTracked(quartile, progress) {\n var quartileTime = quartile.time;\n //We only fire the quartile event if the progress is bigger than the quartile time by 5 seconds at most.\n return progress >= quartileTime && progress <= (quartileTime + 5000);\n }\n\n function trackProgressEvents(progress) {\n if (!utilities.isArray(trackingEvents.progress)) {\n return; //Nothing to track\n }\n\n var pendingProgressEvts = [];\n\n trackingEvents.progress.forEach(function (evt) {\n if (evt.offset <= progress) {\n that.trackURLs([evt.uri]);\n } else {\n pendingProgressEvts.push(evt);\n }\n });\n trackingEvents.progress = pendingProgressEvts;\n }\n\n function trackEvents() {\n events.forEach(function (event) {\n that.trackEvent(event.name, event.trackOnce);\n });\n }\n};\n\n[\n 'rewind',\n 'fullscreen',\n 'exitFullscreen',\n 'pause',\n 'resume',\n 'mute',\n 'unmute',\n 'acceptInvitation',\n 'acceptInvitationLinear',\n 'collapse',\n 'expand'\n].forEach(function (eventName) {\n VASTTracker.prototype['track' + utilities.capitalize(eventName)] = function () {\n this.trackEvent(eventName);\n };\n });\n\n[\n 'start',\n 'skip',\n 'close',\n 'closeLinear'\n].forEach(function (eventName) {\n VASTTracker.prototype['track' + utilities.capitalize(eventName)] = function () {\n this.trackEvent(eventName, true);\n };\n });\n\n[\n 'firstQuartile',\n 'midpoint',\n 'thirdQuartile'\n].forEach(function (quartile) {\n VASTTracker.prototype['track' + utilities.capitalize(quartile)] = function () {\n this.quartiles[quartile].tracked = true;\n this.trackEvent(quartile, true);\n };\n });\n\nVASTTracker.prototype.trackComplete = function () {\n if(this.quartiles.thirdQuartile.tracked){\n this.trackEvent('complete', true);\n }\n};\n\nVASTTracker.prototype.trackErrorWithCode = function trackErrorWithCode(errorcode) {\n if (utilities.isNumber(errorcode)) {\n this.trackURLs(this.response.errorURLMacros, {ERRORCODE: errorcode});\n }\n};\n\nVASTTracker.prototype.trackImpressions = function trackImpressions() {\n this.trackURLs(this.response.impressions);\n};\n\nVASTTracker.prototype.trackCreativeView = function trackCreativeView() {\n this.trackEvent('creativeView');\n};\n\nVASTTracker.prototype.trackClick = function trackClick() {\n this.trackURLs(this.response.clickTrackings);\n};\n\nmodule.exports = VASTTracker;\n\n},{\"../../utils/utilityFunctions\":44,\"./VASTError\":22,\"./VASTResponse\":24,\"./vastUtil\":29}],26:[function(require,module,exports){\n'use strict';\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nfunction VideoClicks(videoClickJTree) {\n if (!(this instanceof VideoClicks)) {\n return new VideoClicks(videoClickJTree);\n }\n\n this.clickThrough = xml.keyValue(videoClickJTree.clickThrough);\n this.clickTrackings = parseClickTrackings(videoClickJTree.clickTracking);\n this.customClicks = parseClickTrackings(videoClickJTree.customClick);\n\n /*** Local functions ***/\n function parseClickTrackings(trackingData) {\n var clickTrackings = [];\n if (trackingData) {\n trackingData = utilities.isArray(trackingData) ? trackingData : [trackingData];\n trackingData.forEach(function (clickTrackingData) {\n clickTrackings.push(xml.keyValue(clickTrackingData));\n });\n }\n return clickTrackings;\n }\n}\n\nmodule.exports = VideoClicks;\n},{\"../../utils/utilityFunctions\":44,\"../../utils/xml\":45}],27:[function(require,module,exports){\n'use strict';\n\nvar vastUtil = require('./vastUtil');\nvar Creative = require('./Creative');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nfunction Wrapper(wrapperJTree) {\n if(!(this instanceof Wrapper)) {\n return new Wrapper(wrapperJTree);\n }\n\n //Required elements\n this.adSystem = xml.keyValue(wrapperJTree.adSystem);\n this.impressions = vastUtil.parseImpressions(wrapperJTree.impression);\n this.VASTAdTagURI = xml.keyValue(wrapperJTree.vASTAdTagURI);\n\n //Optional elements\n this.creatives = Creative.parseCreatives(wrapperJTree.creatives);\n this.error = xml.keyValue(wrapperJTree.error);\n this.extensions = wrapperJTree.extensions;\n\n //Optional attrs\n this.followAdditionalWrappers = utilities.isDefined(xml.attr(wrapperJTree, 'followAdditionalWrappers'))? xml.attr(wrapperJTree, 'followAdditionalWrappers'): true;\n this.allowMultipleAds = xml.attr(wrapperJTree, 'allowMultipleAds');\n this.fallbackOnNoAd = xml.attr(wrapperJTree, 'fallbackOnNoAd');\n}\n\nmodule.exports = Wrapper;\n\n},{\"../../utils/utilityFunctions\":44,\"../../utils/xml\":45,\"./Creative\":16,\"./vastUtil\":29}],28:[function(require,module,exports){\n'use strict';\n\nvar utilities = require('../../utils/utilityFunctions');\n\nvar durationRegex = /(\\d\\d):(\\d\\d):(\\d\\d)(\\.(\\d\\d\\d))?/;\n\nvar parsers = {\n\n duration: function parseDuration(durationStr) {\n\n var match, durationInMs;\n\n if (utilities.isString(durationStr)) {\n match = durationStr.match(durationRegex);\n if (match) {\n durationInMs = parseHoursToMs(match[1]) + parseMinToMs(match[2]) + parseSecToMs(match[3]) + parseInt(match[5] || 0);\n }\n }\n\n return isNaN(durationInMs) ? null : durationInMs;\n\n /*** local functions ***/\n function parseHoursToMs(hourStr) {\n return parseInt(hourStr, 10) * 60 * 60 * 1000;\n }\n\n function parseMinToMs(minStr) {\n return parseInt(minStr, 10) * 60 * 1000;\n }\n\n function parseSecToMs(secStr) {\n return parseInt(secStr, 10) * 1000;\n }\n },\n\n offset: function parseOffset(offset, duration) {\n if(isPercentage(offset)){\n return calculatePercentage(offset, duration);\n }\n return parsers.duration(offset);\n\n /*** Local function ***/\n function isPercentage(offset) {\n var percentageRegex = /^\\d+(\\.\\d+)?%$/g;\n return percentageRegex.test(offset);\n }\n\n function calculatePercentage(percentStr, duration) {\n if(duration) {\n return calcPercent(duration, parseFloat(percentStr.replace('%', '')));\n }\n return null;\n }\n\n function calcPercent(quantity, percent){\n return quantity * percent / 100;\n }\n }\n\n};\n\n\nmodule.exports = parsers;\n},{\"../../utils/utilityFunctions\":44}],29:[function(require,module,exports){\n'use strict';\n\nvar utilities = require('../../utils/utilityFunctions');\nvar VPAIDHTML5Tech = require('../vpaid/VPAIDHTML5Tech');\nvar VPAIDFlashTech = require('../vpaid/VPAIDFlashTech');\nvar VPAIDFLASHClient = require('VPAIDFLASHClient/js/VPAIDFLASHClient');\n\nvar vastUtil = {\n\n track: function track(URLMacros, variables) {\n var sources = vastUtil.parseURLMacros(URLMacros, variables);\n var trackImgs = [];\n sources.forEach(function (src) {\n var img = new Image();\n img.src = src;\n trackImgs.push(img);\n });\n return trackImgs;\n },\n\n parseURLMacros: function parseMacros(URLMacros, variables) {\n var parsedURLs = [];\n\n variables = variables || {};\n\n if (!(variables[\"CACHEBUSTING\"])) {\n variables[\"CACHEBUSTING\"] = Math.round(Math.random() * 1.0e+10);\n }\n\n URLMacros.forEach(function (URLMacro) {\n parsedURLs.push(vastUtil._parseURLMacro(URLMacro, variables));\n });\n\n return parsedURLs;\n },\n\n parseURLMacro: function parseMacro(URLMacro, variables) {\n variables = variables || {};\n\n if (!(variables[\"CACHEBUSTING\"])) {\n variables[\"CACHEBUSTING\"] = Math.round(Math.random() * 1.0e+10);\n }\n\n return vastUtil._parseURLMacro(URLMacro, variables);\n },\n\n _parseURLMacro: function parseMacro(URLMacro, variables) {\n variables = variables || {};\n\n utilities.forEach(variables, function (value, key) {\n URLMacro = URLMacro.replace(new RegExp(\"\\\\[\" + key + \"\\\\\\]\", 'gm'), value);\n });\n\n return URLMacro;\n },\n\n parseDuration: function parseDuration(durationStr) {\n var durationRegex = /(\\d\\d):(\\d\\d):(\\d\\d)(\\.(\\d\\d\\d))?/;\n var match, durationInMs;\n\n if (utilities.isString(durationStr)) {\n match = durationStr.match(durationRegex);\n if (match) {\n durationInMs = parseHoursToMs(match[1]) + parseMinToMs(match[2]) + parseSecToMs(match[3]) + parseInt(match[5] || 0);\n }\n }\n\n return isNaN(durationInMs) ? null : durationInMs;\n\n /*** local functions ***/\n function parseHoursToMs(hourStr) {\n return parseInt(hourStr, 10) * 60 * 60 * 1000;\n }\n\n function parseMinToMs(minStr) {\n return parseInt(minStr, 10) * 60 * 1000;\n }\n\n function parseSecToMs(secStr) {\n return parseInt(secStr, 10) * 1000;\n }\n },\n\n parseImpressions: function parseImpressions(impressions) {\n if (impressions) {\n impressions = utilities.isArray(impressions) ? impressions : [impressions];\n return utilities.transformArray(impressions, function (impression) {\n if (utilities.isNotEmptyString(impression.keyValue)) {\n return impression.keyValue;\n }\n return undefined;\n });\n }\n return [];\n },\n\n\n //We assume that the progress is going to arrive in milliseconds\n formatProgress: function formatProgress(progress) {\n var hours, minutes, seconds, milliseconds;\n hours = progress / (60 * 60 * 1000);\n hours = Math.floor(hours);\n minutes = (progress / (60 * 1000)) % 60;\n minutes = Math.floor(minutes);\n seconds = (progress / 1000) % 60;\n seconds = Math.floor(seconds);\n milliseconds = progress % 1000;\n return utilities.toFixedDigits(hours, 2) + ':' + utilities.toFixedDigits(minutes, 2) + ':' + utilities.toFixedDigits(seconds, 2) + '.' + utilities.toFixedDigits(milliseconds, 3);\n },\n\n parseOffset: function parseOffset(offset, duration) {\n if (isPercentage(offset)) {\n return calculatePercentage(offset, duration);\n }\n return vastUtil.parseDuration(offset);\n\n /*** Local function ***/\n function isPercentage(offset) {\n var percentageRegex = /^\\d+(\\.\\d+)?%$/g;\n return percentageRegex.test(offset);\n }\n\n function calculatePercentage(percentStr, duration) {\n if (duration) {\n return calcPercent(duration, parseFloat(percentStr.replace('%', '')));\n }\n return null;\n }\n\n function calcPercent(quantity, percent) {\n return quantity * percent / 100;\n }\n },\n\n\n //List of supported VPAID technologies\n VPAID_techs: [\n VPAIDFlashTech,\n VPAIDHTML5Tech\n ],\n\n isVPAID: function isVPAIDMediaFile(mediaFile) {\n return !!mediaFile && mediaFile.apiFramework === 'VPAID';\n },\n\n findSupportedVPAIDTech: function findSupportedVPAIDTech(mimeType) {\n var i, len, VPAIDTech;\n\n for (i = 0, len = this.VPAID_techs.length; i < len; i += 1) {\n VPAIDTech = this.VPAID_techs[i];\n if (VPAIDTech.supports(mimeType)) {\n return VPAIDTech;\n }\n }\n return null;\n },\n\n isFlashSupported: function isFlashSupported() {\n return VPAIDFLASHClient.isSupported();\n },\n\n /**\n * Necessary step for VPAIDFLAShClient to know if flash is supported and not blocked.\n * IMPORTANT NOTE: This is an async test and needs to be run as soon as possible.\n *\n * @param vpaidFlashLoaderPath the path to the vpaidFlashLoader swf obj.\n */\n runFlashSupportCheck: function runFlashSupportCheck(vpaidFlashLoaderPath) {\n VPAIDFLASHClient.runFlashTest({data: vpaidFlashLoaderPath});\n }\n\n};\n\nmodule.exports = vastUtil;\n\n},{\"../../utils/utilityFunctions\":44,\"../vpaid/VPAIDFlashTech\":31,\"../vpaid/VPAIDHTML5Tech\":32,\"VPAIDFLASHClient/js/VPAIDFLASHClient\":3}],30:[function(require,module,exports){\n'use strict';\n\nvar VASTError = require('../vast/VASTError');\n\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VPAIDAdUnitWrapper(vpaidAdUnit, opts) {\n if (!(this instanceof VPAIDAdUnitWrapper)) {\n return new VPAIDAdUnitWrapper(vpaidAdUnit, opts);\n }\n sanityCheck(vpaidAdUnit, opts);\n\n this.options = utilities.extend({}, opts);\n\n this._adUnit = vpaidAdUnit;\n\n /*** Local Functions ***/\n function sanityCheck(adUnit, opts) {\n if (!adUnit || !VPAIDAdUnitWrapper.checkVPAIDInterface(adUnit)) {\n throw new VASTError('on VPAIDAdUnitWrapper, the passed VPAID adUnit does not fully implement the VPAID interface');\n }\n\n if (!utilities.isObject(opts)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper, expected options hash but got '\" + opts + \"'\");\n }\n\n if (!(\"responseTimeout\" in opts) || !utilities.isNumber(opts.responseTimeout) ){\n throw new VASTError(\"on VPAIDAdUnitWrapper, expected responseTimeout in options\");\n }\n }\n}\n\nVPAIDAdUnitWrapper.checkVPAIDInterface = function checkVPAIDInterface(VPAIDAdUnit) {\n //NOTE: skipAd is not part of the method list because it only appears in VPAID 2.0 and we support VPAID 1.0\n var VPAIDInterfaceMethods = [\n 'handshakeVersion', 'initAd', 'startAd', 'stopAd', 'resizeAd', 'pauseAd', 'expandAd', 'collapseAd'\n ];\n\n for (var i = 0, len = VPAIDInterfaceMethods.length; i < len; i++) {\n if (!VPAIDAdUnit || !utilities.isFunction(VPAIDAdUnit[VPAIDInterfaceMethods[i]])) {\n return false;\n }\n }\n\n\n return canSubscribeToEvents(VPAIDAdUnit) && canUnsubscribeFromEvents(VPAIDAdUnit);\n\n /*** Local Functions ***/\n\n function canSubscribeToEvents(adUnit) {\n return utilities.isFunction(adUnit.subscribe) || utilities.isFunction(adUnit.addEventListener) || utilities.isFunction(adUnit.on);\n }\n\n function canUnsubscribeFromEvents(adUnit) {\n return utilities.isFunction(adUnit.unsubscribe) || utilities.isFunction(adUnit.removeEventListener) || utilities.isFunction(adUnit.off);\n\n }\n};\n\nVPAIDAdUnitWrapper.prototype.adUnitAsyncCall = function () {\n var args = utilities.arrayLikeObjToArray(arguments);\n var method = args.shift();\n var cb = args.pop();\n var timeoutId;\n\n sanityCheck(method, cb, this._adUnit);\n args.push(wrapCallback());\n\n this._adUnit[method].apply(this._adUnit, args);\n timeoutId = setTimeout(function () {\n timeoutId = null;\n cb(new VASTError(\"on VPAIDAdUnitWrapper, timeout while waiting for a response on call '\" + method + \"'\"));\n cb = utilities.noop;\n }, this.options.responseTimeout);\n\n /*** Local functions ***/\n function sanityCheck(method, cb, adUnit) {\n if (!utilities.isString(method) || !utilities.isFunction(adUnit[method])) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.adUnitAsyncCall, invalid method name\");\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.adUnitAsyncCall, missing callback\");\n }\n }\n\n function wrapCallback() {\n return function () {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n cb.apply(this, arguments);\n };\n }\n};\n\nVPAIDAdUnitWrapper.prototype.on = function (evtName, handler) {\n var addEventListener = this._adUnit.addEventListener || this._adUnit.subscribe || this._adUnit.on;\n addEventListener.call(this._adUnit, evtName, handler);\n};\n\nVPAIDAdUnitWrapper.prototype.off = function (evtName, handler) {\n var removeEventListener = this._adUnit.removeEventListener || this._adUnit.unsubscribe || this._adUnit.off;\n removeEventListener.call(this._adUnit, evtName, handler);\n};\n\nVPAIDAdUnitWrapper.prototype.waitForEvent = function (evtName, cb, context) {\n var timeoutId;\n sanityCheck(evtName, cb);\n context = context || null;\n\n this.on(evtName, responseListener);\n\n timeoutId = setTimeout(function () {\n cb(new VASTError(\"on VPAIDAdUnitWrapper.waitForEvent, timeout while waiting for event '\" + evtName + \"'\"));\n timeoutId = null;\n cb = utilities.noop;\n }, this.options.responseTimeout);\n\n /*** Local functions ***/\n function sanityCheck(evtName, cb) {\n if (!utilities.isString(evtName)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.waitForEvent, missing evt name\");\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.waitForEvent, missing callback\");\n }\n }\n\n function responseListener() {\n var args = utilities.arrayLikeObjToArray(arguments);\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n\n args.unshift(null);\n cb.apply(context, args);\n }\n};\n\n// VPAID METHODS\nVPAIDAdUnitWrapper.prototype.handshakeVersion = function (version, cb) {\n this.adUnitAsyncCall('handshakeVersion', version, cb);\n};\n\n/* jshint maxparams:6 */\nVPAIDAdUnitWrapper.prototype.initAd = function (width, height, viewMode, desiredBitrate, adUnitData, cb) {\n this.waitForEvent('AdLoaded', cb);\n this._adUnit.initAd(width, height, viewMode, desiredBitrate, adUnitData);\n};\n\nVPAIDAdUnitWrapper.prototype.resizeAd = function (width, height, viewMode, cb) {\n // NOTE: AdSizeChange event is only supported on VPAID 2.0 so for the moment we are not going to use it\n // and will assume that everything is fine after the async call\n this.adUnitAsyncCall('resizeAd', width, height, viewMode, cb);\n};\n\nVPAIDAdUnitWrapper.prototype.startAd = function (cb) {\n this.waitForEvent('AdStarted', cb);\n this._adUnit.startAd();\n};\n\nVPAIDAdUnitWrapper.prototype.stopAd = function (cb) {\n this.waitForEvent('AdStopped', cb);\n this._adUnit.stopAd();\n};\n\nVPAIDAdUnitWrapper.prototype.pauseAd = function (cb) {\n this.waitForEvent('AdPaused', cb);\n this._adUnit.pauseAd();\n};\n\nVPAIDAdUnitWrapper.prototype.resumeAd = function (cb) {\n this.waitForEvent('AdPlaying', cb);\n this._adUnit.resumeAd();\n};\n\nVPAIDAdUnitWrapper.prototype.expandAd = function (cb) {\n this.waitForEvent('AdExpandedChange', cb);\n this._adUnit.expandAd();\n};\n\nVPAIDAdUnitWrapper.prototype.collapseAd = function (cb) {\n this.waitForEvent('AdExpandedChange', cb);\n this._adUnit.collapseAd();\n};\n\nVPAIDAdUnitWrapper.prototype.skipAd = function (cb) {\n this.waitForEvent('AdSkipped', cb);\n this._adUnit.skipAd();\n};\n\n//VPAID property getters\n[\n 'adLinear',\n 'adWidth',\n 'adHeight',\n 'adExpanded',\n 'adSkippableState',\n 'adRemainingTime',\n 'adDuration',\n 'adVolume',\n 'adCompanions',\n 'adIcons'\n].forEach(function (property) {\n var getterName = 'get' + utilities.capitalize(property);\n\n VPAIDAdUnitWrapper.prototype[getterName] = function (cb) {\n this.adUnitAsyncCall(getterName, cb);\n };\n});\n\n//VPAID property setters\nVPAIDAdUnitWrapper.prototype.setAdVolume = function(volume, cb){\n this.adUnitAsyncCall('setAdVolume',volume, cb);\n};\n\nmodule.exports = VPAIDAdUnitWrapper;\n\n},{\"../../utils/utilityFunctions\":44,\"../vast/VASTError\":22}],31:[function(require,module,exports){\n'use strict';\n\nvar VASTError = require('../vast/VASTError');\n\nvar VPAIDFLASHClient = require('VPAIDFLASHClient/js/VPAIDFLASHClient');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar dom = require('../../utils/dom');\n\nfunction VPAIDFlashTech(mediaFile, settings) {\n if (!(this instanceof VPAIDFlashTech)) {\n return new VPAIDFlashTech(mediaFile);\n }\n sanityCheck(mediaFile);\n this.name = 'vpaid-flash';\n this.mediaFile = mediaFile;\n this.containerEl = null;\n this.vpaidFlashClient = null;\n this.settings = settings;\n\n /*** local functions ***/\n function sanityCheck(mediaFile) {\n if (!mediaFile || !utilities.isString(mediaFile.src)) {\n throw new VASTError('on VPAIDFlashTech, invalid MediaFile');\n }\n }\n}\n\nVPAIDFlashTech.VPAIDFLASHClient = VPAIDFLASHClient;\n\nVPAIDFlashTech.supports = function (type) {\n return type === 'application/x-shockwave-flash' && VPAIDFlashTech.VPAIDFLASHClient.isSupported();\n};\n\nVPAIDFlashTech.prototype.loadAdUnit = function loadFlashCreative(containerEl, objectEl, callback) {\n var that = this;\n var flashClientOpts = this.settings && this.settings.vpaidFlashLoaderPath ? {data: this.settings.vpaidFlashLoaderPath} : undefined;\n sanityCheck(containerEl, callback);\n\n this.containerEl = containerEl;\n this.vpaidFlashClient = new VPAIDFlashTech.VPAIDFLASHClient(containerEl, function (error) {\n if (error) {\n return callback(error);\n }\n\n that.vpaidFlashClient.loadAdUnit(that.mediaFile.src, callback);\n }, flashClientOpts);\n\n /*** Local Functions ***/\n function sanityCheck(container, cb) {\n\n if (!dom.isDomElement(container)) {\n throw new VASTError('on VPAIDFlashTech.loadAdUnit, invalid dom container element');\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError('on VPAIDFlashTech.loadAdUnit, missing valid callback');\n }\n }\n};\n\nVPAIDFlashTech.prototype.unloadAdUnit = function () {\n if (this.vpaidFlashClient) {\n try{\n this.vpaidFlashClient.destroy();\n } catch(e){\n if(console && utilities.isFunction(console.log)){\n console.log('VAST ERROR: trying to unload the VPAID adunit');\n }\n }\n this.vpaidFlashClient = null;\n }\n\n if (this.containerEl) {\n dom.remove(this.containerEl);\n this.containerEl = null;\n }\n};\n\nmodule.exports = VPAIDFlashTech;\n\n},{\"../../utils/dom\":40,\"../../utils/utilityFunctions\":44,\"../vast/VASTError\":22,\"VPAIDFLASHClient/js/VPAIDFLASHClient\":3}],32:[function(require,module,exports){\n'use strict';\n\nvar VASTError = require('../vast/VASTError');\n\nvar VPAIDHTML5Client = require('VPAIDHTML5Client/js/VPAIDHTML5Client');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar dom = require('../../utils/dom');\n\nfunction VPAIDHTML5Tech(mediaFile) {\n\n if(!(this instanceof VPAIDHTML5Tech)) {\n return new VPAIDHTML5Tech(mediaFile);\n }\n\n sanityCheck(mediaFile);\n\n this.name = 'vpaid-html5';\n this.containerEl = null;\n this.videoEl = null;\n this.vpaidHTMLClient = null;\n\n this.mediaFile = mediaFile;\n\n function sanityCheck(mediaFile) {\n if (!mediaFile || !utilities.isString(mediaFile.src)) {\n throw new VASTError(VPAIDHTML5Tech.INVALID_MEDIA_FILE);\n }\n }\n}\n\nVPAIDHTML5Tech.VPAIDHTML5Client = VPAIDHTML5Client;\n\nVPAIDHTML5Tech.supports = function (type) {\n return !utilities.isOldIE() && type === 'application/javascript';\n};\n\nVPAIDHTML5Tech.prototype.loadAdUnit = function loadAdUnit(containerEl, videoEl, callback) {\n sanityCheck(containerEl, videoEl, callback);\n\n this.containerEl = containerEl;\n this.videoEl = videoEl;\n this.vpaidHTMLClient = new VPAIDHTML5Tech.VPAIDHTML5Client(containerEl, videoEl, {});\n this.vpaidHTMLClient.loadAdUnit(this.mediaFile.src, callback);\n\n function sanityCheck(container, video, cb) {\n if (!dom.isDomElement(container)) {\n throw new VASTError(VPAIDHTML5Tech.INVALID_DOM_CONTAINER_EL);\n }\n\n if (!dom.isDomElement(video) || video.tagName.toLowerCase() !== 'video') {\n throw new VASTError(VPAIDHTML5Tech.INVALID_DOM_CONTAINER_EL);\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError(VPAIDHTML5Tech.MISSING_CALLBACK);\n }\n }\n};\n\nVPAIDHTML5Tech.prototype.unloadAdUnit = function unloadAdUnit() {\n if (this.vpaidHTMLClient) {\n try {\n this.vpaidHTMLClient.destroy();\n } catch(e) {\n if (console && utilities.isFunction(console.log)) {\n console.log('VAST ERROR: trying to unload the VPAID adunit');\n }\n }\n\n this.vpaidHTMLClient = null;\n }\n\n if (this.containerEl) {\n dom.remove(this.containerEl);\n this.containerEl = null;\n }\n};\n\nvar PREFIX = 'on VPAIDHTML5Tech';\nVPAIDHTML5Tech.INVALID_MEDIA_FILE = PREFIX + ', invalid MediaFile';\nVPAIDHTML5Tech.INVALID_DOM_CONTAINER_EL = PREFIX + ', invalid container HtmlElement';\nVPAIDHTML5Tech.INVALID_DOM_VIDEO_EL = PREFIX + ', invalid HTMLVideoElement';\nVPAIDHTML5Tech.MISSING_CALLBACK = PREFIX + ', missing valid callback';\n\nmodule.exports = VPAIDHTML5Tech;\n},{\"../../utils/dom\":40,\"../../utils/utilityFunctions\":44,\"../vast/VASTError\":22,\"VPAIDHTML5Client/js/VPAIDHTML5Client\":11}],33:[function(require,module,exports){\n'use strict';\n\nvar VASTError = require('../vast/VASTError');\nvar VASTResponse = require('../vast/VASTResponse');\nvar VASTTracker = require('../vast/VASTTracker');\nvar vastUtil = require('../vast/vastUtil');\n\nvar VPAIDAdUnitWrapper = require('./VPAIDAdUnitWrapper');\n\nvar async = require('../../utils/async');\nvar dom = require('../../utils/dom');\nvar playerUtils = require('../../utils/playerUtils');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VPAIDIntegrator(player, settings) {\n if (!(this instanceof VPAIDIntegrator)) {\n return new VPAIDIntegrator(player);\n }\n\n this.VIEW_MODE = {\n NORMAL: 'normal',\n FULLSCREEN: \"fullscreen\",\n THUMBNAIL: \"thumbnail\"\n };\n this.player = player;\n this.containerEl = createVPAIDContainerEl(player);\n this.options = {\n responseTimeout: 5000,\n VPAID_VERSION: '2.0'\n };\n this.settings = settings;\n\n /*** Local functions ***/\n\n function createVPAIDContainerEl() {\n var containerEl = document.createElement('div');\n dom.addClass(containerEl, 'VPAID-container');\n player.el().insertBefore(containerEl, player.controlBar.el());\n return containerEl;\n\n }\n}\n\nVPAIDIntegrator.prototype.playAd = function playVPaidAd(vastResponse, callback) {\n if (!(vastResponse instanceof VASTResponse)) {\n return callback(new VASTError('on VASTIntegrator.playAd, missing required VASTResponse'));\n }\n\n var that = this;\n var player = this.player;\n var tech = this._findSupportedTech(vastResponse, this.settings);\n\n callback = callback || utilities.noop;\n\n this._adUnit = null;\n\n dom.addClass(player.el(), 'vjs-vpaid-ad');\n\n player.on('vast.adsCancel', triggerVpaidAdEnd);\n player.one('vpaid.adEnd', function(){\n player.off('vast.adsCancel', triggerVpaidAdEnd);\n removeAdUnit();\n });\n\n if (tech) {\n async.waterfall([\n function (next) {\n next(null, tech, vastResponse);\n },\n this._loadAdUnit.bind(this),\n this._playAdUnit.bind(this),\n this._finishPlaying.bind(this)\n\n ], adComplete);\n\n this._adUnit = {\n _paused: true,\n type: 'VPAID',\n pauseAd: function() {\n player.trigger('vpaid.pauseAd');\n player.pause(true);//we make sure that the video content gets stopped.\n },\n resumeAd: function() {\n player.trigger('vpaid.resumeAd');\n },\n isPaused: function() {\n return this._paused;\n },\n getSrc: function() {\n return tech.mediaFile;\n }\n };\n\n } else {\n var error = new VASTError('on VPAIDIntegrator.playAd, could not find a supported mediaFile', 403);\n adComplete(error, this._adUnit, vastResponse);\n }\n\n return this._adUnit;\n\n /*** Local functions ***/\n function adComplete(error, adUnit, vastResponse) {\n if (error && vastResponse) {\n that._trackError(vastResponse, error.code);\n }\n player.trigger('vpaid.adEnd');\n callback(error, vastResponse);\n }\n\n function triggerVpaidAdEnd(){\n player.trigger('vpaid.adEnd');\n }\n\n function removeAdUnit() {\n if (tech) {\n tech.unloadAdUnit();\n }\n dom.removeClass(player.el(), 'vjs-vpaid-ad');\n }\n};\n\nVPAIDIntegrator.prototype._findSupportedTech = function (vastResponse, settings) {\n if (!(vastResponse instanceof VASTResponse)) {\n return null;\n }\n\n var vpaidMediaFiles = vastResponse.mediaFiles.filter(vastUtil.isVPAID);\n var i, len, mediaFile, VPAIDTech;\n\n for (i = 0, len = vpaidMediaFiles.length; i < len; i += 1) {\n mediaFile = vpaidMediaFiles[i];\n VPAIDTech = vastUtil.findSupportedVPAIDTech(mediaFile.type);\n if (VPAIDTech) {\n return new VPAIDTech(mediaFile, settings);\n }\n }\n return null;\n};\n\nVPAIDIntegrator.prototype._createVPAIDAdUnitWrapper = function(adUnit, src, responseTimeout) {\n return new VPAIDAdUnitWrapper(adUnit, {src: src, responseTimeout: responseTimeout});\n};\n\nVPAIDIntegrator.prototype._loadAdUnit = function (tech, vastResponse, next) {\n var that = this;\n var player = this.player;\n var vjsTechEl = player.el().querySelector('.vjs-tech');\n var responseTimeout = this.settings.responseTimeout || this.options.responseTimeout;\n tech.loadAdUnit(this.containerEl, vjsTechEl, function (error, adUnit) {\n if (error) {\n return next(error, adUnit, vastResponse);\n }\n\n try {\n var WrappedAdUnit = that._createVPAIDAdUnitWrapper(adUnit, tech.mediaFile.src, responseTimeout);\n var techClass = 'vjs-' + tech.name + '-ad';\n dom.addClass(player.el(), techClass);\n player.one('vpaid.adEnd', function() {\n dom.removeClass(player.el(),techClass);\n });\n next(null, WrappedAdUnit, vastResponse);\n } catch (e) {\n next(e, adUnit, vastResponse);\n }\n });\n};\n\nVPAIDIntegrator.prototype._playAdUnit = function (adUnit, vastResponse, callback) {\n async.waterfall([\n function (next) {\n next(null, adUnit, vastResponse);\n },\n this._handshake.bind(this),\n this._initAd.bind(this),\n this._setupEvents.bind(this),\n this._addSkipButton.bind(this),\n this._linkPlayerControls.bind(this),\n this._startAd.bind(this)\n ], callback);\n};\n\nVPAIDIntegrator.prototype._handshake = function handshake(adUnit, vastResponse, next) {\n adUnit.handshakeVersion(this.options.VPAID_VERSION, function (error, version) {\n if (error) {\n return next(error, adUnit, vastResponse);\n }\n\n if (version && isSupportedVersion(version)) {\n return next(null, adUnit, vastResponse);\n }\n\n return next(new VASTError('on VPAIDIntegrator._handshake, unsupported version \"' + version + '\"'), adUnit, vastResponse);\n });\n\n function isSupportedVersion(version) {\n var majorNum = major(version);\n return majorNum >= 1 && majorNum <= 2;\n }\n\n function major(version) {\n var parts = version.split('.');\n return parseInt(parts[0], 10);\n }\n};\n\nVPAIDIntegrator.prototype._initAd = function (adUnit, vastResponse, next) {\n var tech = this.player.el().querySelector('.vjs-tech');\n var dimension = dom.getDimension(tech);\n adUnit.initAd(dimension.width, dimension.height, this.VIEW_MODE.NORMAL, -1, {AdParameters: vastResponse.adParameters || ''}, function (error) {\n next(error, adUnit, vastResponse);\n });\n};\n\nVPAIDIntegrator.prototype._createVASTTracker = function(adUnitSrc, vastResponse) {\n return new VASTTracker(adUnitSrc, vastResponse);\n};\n\nVPAIDIntegrator.prototype._setupEvents = function (adUnit, vastResponse, next) {\n var adUnitSrc = adUnit.options.src;\n var tracker = this._createVASTTracker(adUnitSrc, vastResponse);\n var player = this.player;\n var that = this;\n\n adUnit.on('AdSkipped', function () {\n player.trigger('vpaid.AdSkipped');\n tracker.trackSkip();\n });\n\n adUnit.on('AdImpression', function () {\n player.trigger('vpaid.AdImpression');\n tracker.trackImpressions();\n });\n\n adUnit.on('AdStarted', function () {\n player.trigger('vpaid.AdStarted');\n tracker.trackCreativeView();\n notifyPlayToPlayer();\n });\n\n adUnit.on('AdVideoStart', function () {\n player.trigger('vpaid.AdVideoStart');\n tracker.trackStart();\n notifyPlayToPlayer();\n });\n\n adUnit.on('AdPlaying', function () {\n player.trigger('vpaid.AdPlaying');\n tracker.trackResume();\n notifyPlayToPlayer();\n });\n\n adUnit.on('AdPaused', function () {\n player.trigger('vpaid.AdPaused');\n tracker.trackPause();\n notifyPauseToPlayer();\n });\n\n function notifyPlayToPlayer(){\n if(that._adUnit && that._adUnit.isPaused()){\n that._adUnit._paused = false;\n }\n player.trigger('play');\n\n }\n\n function notifyPauseToPlayer() {\n if(that._adUnit){\n that._adUnit._paused = true;\n }\n player.trigger('pause');\n }\n\n adUnit.on('AdVideoFirstQuartile', function () {\n player.trigger('vpaid.AdVideoFirstQuartile');\n tracker.trackFirstQuartile();\n });\n\n adUnit.on('AdVideoMidpoint', function () {\n player.trigger('vpaid.AdVideoMidpoint');\n tracker.trackMidpoint();\n });\n\n adUnit.on('AdVideoThirdQuartile', function () {\n player.trigger('vpaid.AdVideoThirdQuartile');\n tracker.trackThirdQuartile();\n });\n\n adUnit.on('AdVideoComplete', function () {\n player.trigger('vpaid.AdVideoComplete');\n tracker.trackComplete();\n });\n\n adUnit.on('AdClickThru', function (data) {\n player.trigger('vpaid.AdClickThru');\n var url = data.url;\n var playerHandles = data.playerHandles;\n var clickThruUrl = utilities.isNotEmptyString(url) ? url : generateClickThroughURL(vastResponse.clickThrough);\n\n tracker.trackClick();\n if (playerHandles && clickThruUrl) {\n window.open(clickThruUrl, '_blank');\n }\n\n function generateClickThroughURL(clickThroughMacro) {\n var variables = {\n ASSETURI: adUnit.options.src,\n CONTENTPLAYHEAD: 0 //In VPAID there is no method to know the current time from the adUnit\n };\n\n return clickThroughMacro ? vastUtil.parseURLMacro(clickThroughMacro, variables) : null;\n }\n });\n\n adUnit.on('AdUserAcceptInvitation', function () {\n player.trigger('vpaid.AdUserAcceptInvitation');\n tracker.trackAcceptInvitation();\n tracker.trackAcceptInvitationLinear();\n });\n\n adUnit.on('AdUserClose', function () {\n player.trigger('vpaid.AdUserClose');\n tracker.trackClose();\n tracker.trackCloseLinear();\n });\n\n adUnit.on('AdUserMinimize', function () {\n player.trigger('vpaid.AdUserMinimize');\n tracker.trackCollapse();\n });\n\n adUnit.on('AdError', function () {\n player.trigger('vpaid.AdError');\n //NOTE: we track errors code 901, as noted in VAST 3.0\n tracker.trackErrorWithCode(901);\n });\n\n adUnit.on('AdVolumeChange', function () {\n player.trigger('vpaid.AdVolumeChange');\n var lastVolume = player.volume();\n adUnit.getAdVolume(function (error, currentVolume) {\n if (currentVolume === 0 && lastVolume > 0) {\n tracker.trackMute();\n }\n\n if (currentVolume > 0 && lastVolume === 0) {\n tracker.trackUnmute();\n }\n\n player.volume(currentVolume);\n });\n });\n\n var updateViewSize = resizeAd.bind(this, player, adUnit, this.VIEW_MODE);\n var updateViewSizeThrottled = utilities.throttle(updateViewSize, 100);\n var autoResize = this.settings.autoResize;\n\n if (autoResize) {\n dom.addEventListener(window, 'resize', updateViewSizeThrottled);\n dom.addEventListener(window, 'orientationchange', updateViewSizeThrottled);\n }\n\n player.on('vast.resize', updateViewSize);\n player.on('vpaid.pauseAd', pauseAdUnit);\n player.on('vpaid.resumeAd', resumeAdUnit);\n\n player.one('vpaid.adEnd', function () {\n player.off('vast.resize', updateViewSize);\n player.off('vpaid.pauseAd', pauseAdUnit);\n player.off('vpaid.resumeAd', resumeAdUnit);\n\n if (autoResize) {\n dom.removeEventListener(window, 'resize', updateViewSizeThrottled);\n dom.removeEventListener(window, 'orientationchange', updateViewSizeThrottled);\n }\n });\n\n next(null, adUnit, vastResponse);\n\n /*** Local Functions ***/\n function pauseAdUnit() {\n adUnit.pauseAd(utilities.noop);\n }\n\n function resumeAdUnit() {\n adUnit.resumeAd(utilities.noop);\n }\n};\n\nVPAIDIntegrator.prototype._addSkipButton = function (adUnit, vastResponse, next) {\n var skipButton;\n var player = this.player;\n\n adUnit.on('AdSkippableStateChange', updateSkipButtonState);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeSkipButton);\n\n next(null, adUnit, vastResponse);\n\n /*** Local function ***/\n function updateSkipButtonState() {\n player.trigger('vpaid.AdSkippableStateChange');\n adUnit.getAdSkippableState(function (error, isSkippable) {\n if (isSkippable) {\n if (!skipButton) {\n addSkipButton(player);\n }\n } else {\n removeSkipButton(player);\n }\n });\n }\n\n function addSkipButton(player) {\n skipButton = createSkipButton(player);\n player.el().appendChild(skipButton);\n }\n\n function removeSkipButton() {\n dom.remove(skipButton);\n skipButton = null;\n }\n\n function createSkipButton() {\n var skipButton = window.document.createElement(\"div\");\n dom.addClass(skipButton, \"vast-skip-button\");\n dom.addClass(skipButton, \"enabled\");\n skipButton.innerHTML = \"Skip ad\";\n\n skipButton.onclick = function (e) {\n adUnit.skipAd(utilities.noop);//We skip the adUnit\n\n //We prevent event propagation to avoid problems with the clickThrough and so on\n if (window.Event.prototype.stopPropagation !== undefined) {\n e.stopPropagation();\n } else {\n return false;\n }\n };\n\n return skipButton;\n }\n};\n\nVPAIDIntegrator.prototype._linkPlayerControls = function (adUnit, vastResponse, next) {\n var that = this;\n linkVolumeControl(this.player, adUnit);\n linkFullScreenControl(this.player, adUnit, this.VIEW_MODE);\n\n next(null, adUnit, vastResponse);\n\n /*** Local functions ***/\n function linkVolumeControl(player, adUnit) {\n player.on('volumechange', updateAdUnitVolume);\n adUnit.on('AdVolumeChange', updatePlayerVolume);\n\n player.one('vpaid.adEnd', function () {\n player.off('volumechange', updateAdUnitVolume);\n });\n\n\n /*** local functions ***/\n function updateAdUnitVolume() {\n var vol = player.muted() ? 0 : player.volume();\n adUnit.setAdVolume(vol, logError);\n }\n\n function updatePlayerVolume() {\n player.trigger('vpaid.AdVolumeChange');\n adUnit.getAdVolume(function (error, vol) {\n if (error) {\n logError(error);\n } else {\n player.volume(vol);\n }\n });\n }\n }\n\n function linkFullScreenControl(player, adUnit, VIEW_MODE) {\n var updateViewSize = resizeAd.bind(that, player, adUnit, VIEW_MODE);\n\n player.on('fullscreenchange', updateViewSize);\n\n player.one('vpaid.adEnd', function () {\n player.off('fullscreenchange', updateViewSize);\n });\n }\n};\n\nVPAIDIntegrator.prototype._startAd = function (adUnit, vastResponse, next) {\n var player = this.player;\n\n adUnit.startAd(function (error) {\n if (!error) {\n player.trigger('vast.adStart');\n }\n next(error, adUnit, vastResponse);\n });\n};\n\nVPAIDIntegrator.prototype._finishPlaying = function (adUnit, vastResponse, next) {\n var player = this.player;\n adUnit.on('AdStopped', function () {\n player.trigger('vpaid.AdStopped');\n finishPlayingAd(null);\n });\n\n adUnit.on('AdError', function (error) {\n var errMsg = error? error.message : 'on VPAIDIntegrator, error while waiting for the adUnit to finish playing';\n finishPlayingAd(new VASTError(errMsg));\n });\n\n /*** local functions ***/\n function finishPlayingAd(error) {\n next(error, adUnit, vastResponse);\n }\n};\n\nVPAIDIntegrator.prototype._trackError = function trackError(response, errorCode) {\n vastUtil.track(response.errorURLMacros, {ERRORCODE: errorCode || 901});\n};\n\nfunction resizeAd(player, adUnit, VIEW_MODE) {\n var tech = player.el().querySelector('.vjs-tech');\n var dimension = dom.getDimension(tech);\n var MODE = player.isFullscreen() ? VIEW_MODE.FULLSCREEN : VIEW_MODE.NORMAL;\n adUnit.resizeAd(dimension.width, dimension.height, MODE, logError);\n}\n\nfunction logError(error) {\n if (error && console && console.log) {\n console.log('ERROR: ' + error.message, error);\n }\n}\n\nmodule.exports = VPAIDIntegrator;\n},{\"../../utils/async\":39,\"../../utils/dom\":40,\"../../utils/playerUtils\":42,\"../../utils/utilityFunctions\":44,\"../vast/VASTError\":22,\"../vast/VASTResponse\":24,\"../vast/VASTTracker\":25,\"../vast/vastUtil\":29,\"./VPAIDAdUnitWrapper\":30}],34:[function(require,module,exports){\n'use strict';\n\nvar dom = require('../../utils/dom');\n\nvar element = document.createElement('div');\nelement.className = 'vjs-ads-label vjs-control vjs-label-hidden';\nelement.innerHTML = 'Advertisement';\n\nvar AdsLabelFactory = function(baseComponent) {\n return {\n /** @constructor */\n init: function init(player, options) {\n options.el = element;\n baseComponent.call(this, player, options);\n\n // We asynchronously reposition the ads label element\n setTimeout(function () {\n var currentTimeComp = player.controlBar &&( player.controlBar.getChild(\"timerControls\") || player.controlBar.getChild(\"currentTimeDisplay\") );\n if(currentTimeComp) {\n player.controlBar.el().insertBefore(element, currentTimeComp.el());\n }\n dom.removeClass(element, 'vjs-label-hidden');\n }, 0);\n },\n\n el: function getElement() {\n return element;\n }\n };\n};\n\nmodule.exports = AdsLabelFactory;\n},{\"../../utils/dom\":40}],35:[function(require,module,exports){\n'use strict';\n\nvar baseVideoJsComponent = videojs.Component;\n\nvar AdsLabel = require('./ads-label')(baseVideoJsComponent);\n\nvideojs.AdsLabel = videojs.Component.extend(AdsLabel);\n\n},{\"./ads-label\":34}],36:[function(require,module,exports){\n'use strict';\n\n/**\n * The component that shows a black screen until the ads plugin has decided if it can or it can not play the ad.\n *\n * Note: In case you wonder why instead of this black poster we don't just show the spinner loader.\n * IOS devices do not work well with animations and the browser chrashes from time to time That is why we chose to\n * have a secondary black poster.\n *\n * It also makes it much more easier for the users of the plugin since it does not change the default behaviour of the\n * spinner and the player works the same way with and without the plugin.\n *\n * @param {vjs.Player|Object} player\n * @param {Object=} options\n * @constructor\n */\nvar element = document.createElement('div');\n\nvar BlackPosterFactory = function(baseComponent) {\n return {\n /** @constructor */\n init: function init(player, options) {\n options.el = element;\n element.className = 'vjs-black-poster';\n baseComponent.call(this, player, options);\n\n var posterImg = player.getChild('posterImage');\n\n //We need to do it asynchronously to be sure that the black poster el is on the dom.\n setTimeout(function() {\n if(posterImg && player && player.el()) {\n player.el().insertBefore(element, posterImg.el());\n }\n }, 0);\n },\n el: function getElement() {\n return element;\n }\n };\n};\n\nmodule.exports = BlackPosterFactory;\n},{}],37:[function(require,module,exports){\n'use strict';\n\nvar baseVideoJsComponent = videojs.Component;\n\nvar BlackPoster = require('./black-poster')(baseVideoJsComponent);\n\nvideojs.BlackPoster = videojs.Component.extend(BlackPoster);\n\n},{\"./black-poster\":36}],38:[function(require,module,exports){\n'use strict';\n\nvar VASTClient = require('../ads/vast/VASTClient');\nvar VASTError = require('../ads/vast/VASTError');\nvar vastUtil = require('../ads/vast/vastUtil');\n\nvar VASTIntegrator = require('../ads/vast/VASTIntegrator');\nvar VPAIDIntegrator = require('../ads/vpaid/VPAIDIntegrator');\n\nvar async = require('../utils/async');\nvar dom = require('../utils/dom');\nvar playerUtils = require('../utils/playerUtils');\nvar utilities = require('../utils/utilityFunctions');\n\nmodule.exports = function VASTPlugin(options) {\n var snapshot;\n var player = this;\n var vast = new VASTClient();\n var adsCanceled = false;\n var defaultOpts = {\n // maximum amount of time in ms to wait to receive `adsready` from the ad\n // implementation after play has been requested. Ad implementations are\n // expected to load any dynamic libraries and make any requests to determine\n // ad policies for a video during this time.\n timeout: 500,\n\n //TODO:finish this IOS FIX\n //Whenever you play an add on IOS, the native player kicks in and we loose control of it. On very heavy pages the 'play' event\n // May occur after the video content has already started. This is wrong if you want to play a preroll ad that needs to happen before the user\n // starts watching the content. To prevent this usec\n iosPrerollCancelTimeout: 2000,\n\n // maximun amount of time for the ad to actually start playing. If this timeout gets\n // triggered the ads will be cancelled\n adCancelTimeout: 3000,\n\n // Boolean flag that configures the player to play a new ad before the user sees the video again\n // the current video\n playAdAlways: false,\n\n // Flag to enable or disable the ads by default.\n adsEnabled: true,\n\n // Boolean flag to enable or disable the resize with window.resize or orientationchange\n autoResize: true,\n\n // Path to the VPAID flash ad's loader\n vpaidFlashLoaderPath: '/VPAIDFlash.swf'\n };\n\n var settings = utilities.extend({}, defaultOpts, options || {});\n\n if(utilities.isUndefined(settings.adTagUrl) && utilities.isDefined(settings.url)){\n settings.adTagUrl = settings.url;\n }\n\n if (utilities.isString(settings.adTagUrl)) {\n settings.adTagUrl = utilities.echoFn(settings.adTagUrl);\n }\n\n if (utilities.isDefined(settings.adTagXML) && !utilities.isFunction(settings.adTagXML)) {\n return trackAdError(new VASTError('on VideoJS VAST plugin, the passed adTagXML option does not contain a function'));\n }\n\n if (!utilities.isDefined(settings.adTagUrl) && !utilities.isFunction(settings.adTagXML)) {\n return trackAdError(new VASTError('on VideoJS VAST plugin, missing adTagUrl on options object'));\n }\n\n vastUtil.runFlashSupportCheck(settings.vpaidFlashLoaderPath);// Necessary step for VPAIDFLASHClient to work.\n\n playerUtils.prepareForAds(player);\n\n if (settings.playAdAlways) {\n // No matter what happens we play a new ad before the user sees the video again.\n player.on('vast.contentEnd', function () {\n setTimeout(function () {\n player.trigger('vast.reset');\n }, 0);\n });\n }\n\n player.on('vast.firstPlay', tryToPlayPrerollAd);\n\n player.on('vast.reset', function () {\n //If we are reseting the plugin, we don't want to restore the content\n snapshot = null;\n cancelAds();\n });\n\n player.vast = {\n isEnabled: function () {\n return settings.adsEnabled;\n },\n\n enable: function () {\n settings.adsEnabled = true;\n },\n\n disable: function () {\n settings.adsEnabled = false;\n }\n };\n\n return player.vast;\n\n /**** Local functions ****/\n function tryToPlayPrerollAd() {\n //We remove the poster to prevent flickering whenever the content starts playing\n playerUtils.removeNativePoster(player);\n\n playerUtils.once(player, ['vast.adsCancel', 'vast.adEnd'], function () {\n removeAdUnit();\n restoreVideoContent();\n });\n\n async.waterfall([\n checkAdsEnabled,\n preparePlayerForAd,\n startAdCancelTimeout,\n playPrerollAd\n ], function (error, response) {\n if (error) {\n trackAdError(error, response);\n } else {\n player.trigger('vast.adEnd');\n }\n });\n\n /*** Local functions ***/\n\n function removeAdUnit() {\n if (player.vast && player.vast.adUnit) {\n player.vast.adUnit = null; //We remove the adUnit\n }\n }\n\n function restoreVideoContent() {\n setupContentEvents();\n if (snapshot) {\n playerUtils.restorePlayerSnapshot(player, snapshot);\n snapshot = null;\n }\n }\n\n function setupContentEvents() {\n playerUtils.once(player, ['playing', 'vast.reset', 'vast.firstPlay'], function (evt) {\n if (evt.type !== 'playing') {\n return;\n }\n\n player.trigger('vast.contentStart');\n\n playerUtils.once(player, ['ended', 'vast.reset', 'vast.firstPlay'], function (evt) {\n if (evt.type === 'ended') {\n player.trigger('vast.contentEnd');\n }\n });\n });\n }\n\n function checkAdsEnabled(next) {\n if (settings.adsEnabled) {\n return next(null);\n }\n next(new VASTError('Ads are not enabled'));\n }\n\n function preparePlayerForAd(next) {\n if (canPlayPrerollAd()) {\n snapshot = playerUtils.getPlayerSnapshot(player);\n player.pause();\n addSpinnerIcon();\n\n if(player.paused()) {\n next(null);\n } else {\n playerUtils.once(player, ['playing'], function() {\n player.pause();\n next(null);\n });\n }\n } else {\n next(new VASTError('video content has been playing before preroll ad'));\n }\n }\n\n function canPlayPrerollAd() {\n return !utilities.isIPhone() || player.currentTime() <= settings.iosPrerollCancelTimeout;\n }\n\n function startAdCancelTimeout(next) {\n var adCancelTimeoutId;\n adsCanceled = false;\n\n adCancelTimeoutId = setTimeout(function () {\n trackAdError(new VASTError('timeout while waiting for the video to start playing', 402));\n }, settings.adCancelTimeout);\n\n playerUtils.once(player, ['vast.adStart', 'vast.adsCancel'], clearAdCancelTimeout);\n\n /*** local functions ***/\n function clearAdCancelTimeout() {\n if (adCancelTimeoutId) {\n clearTimeout(adCancelTimeoutId);\n adCancelTimeoutId = null;\n }\n }\n\n next(null);\n }\n\n function addSpinnerIcon() {\n dom.addClass(player.el(), 'vjs-vast-ad-loading');\n playerUtils.once(player, ['vast.adStart', 'vast.adsCancel'], removeSpinnerIcon);\n }\n\n function removeSpinnerIcon() {\n //IMPORTANT NOTE: We remove the spinnerIcon asynchronously to give time to the browser to start the video.\n // If we remove it synchronously we see a flash of the content video before the ad starts playing.\n setTimeout(function () {\n dom.removeClass(player.el(), 'vjs-vast-ad-loading');\n }, 100);\n }\n\n }\n\n function cancelAds() {\n player.trigger('vast.adsCancel');\n adsCanceled = true;\n }\n\n function playPrerollAd(callback) {\n async.waterfall([\n getVastResponse,\n playAd\n ], callback);\n }\n\n function getVastResponse(callback) {\n vast.getVASTResponse(settings.adTagUrl ? settings.adTagUrl() : settings.adTagXML, callback);\n }\n\n function playAd(vastResponse, callback) {\n //TODO: Find a better way to stop the play. The 'playPrerollWaterfall' ends in an inconsistent situation\n //If the state is not 'preroll?' it means the ads were canceled therefore, we break the waterfall\n if (adsCanceled) {\n return;\n }\n\n var adIntegrator = isVPAID(vastResponse) ? new VPAIDIntegrator(player, settings) : new VASTIntegrator(player);\n var adFinished = false;\n\n playerUtils.once(player, ['vast.adStart', 'vast.adsCancel'], function (evt) {\n if (evt.type === 'vast.adStart') {\n addAdsLabel();\n }\n });\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeAdsLabel);\n\n if (utilities.isIDevice()) {\n preventManualProgress();\n }\n\n player.vast.vastResponse = vastResponse;\n player.vast.adUnit = adIntegrator.playAd(vastResponse, callback);\n\n /*** Local functions ****/\n function addAdsLabel() {\n if (adFinished || player.controlBar.getChild('AdsLabel')) {\n return;\n }\n\n player.controlBar.addChild('AdsLabel');\n }\n\n function removeAdsLabel() {\n player.controlBar.removeChild('AdsLabel');\n adFinished = true;\n }\n\n function preventManualProgress() {\n //IOS video clock is very unreliable and we need a 3 seconds threshold to ensure that the user forwarded/rewound the ad\n var PROGRESS_THRESHOLD = 3;\n var previousTime = 0;\n var skipad_attempts = 0;\n\n player.on('timeupdate', preventAdSeek);\n player.on('ended', preventAdSkip);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel', 'vast.adError'], stopPreventManualProgress);\n\n /*** Local functions ***/\n function preventAdSkip() {\n // Ignore ended event if the Ad time was not 'near' the end\n // and revert time to the previous 'valid' time\n if ((player.duration() - previousTime) > PROGRESS_THRESHOLD) {\n player.pause(true); // this reduce the video jitter if the IOS skip button is pressed\n player.play(true); // we need to trigger the play to put the video element back in a valid state\n player.currentTime(previousTime);\n }\n }\n\n function preventAdSeek() {\n var currentTime = player.currentTime();\n var progressDelta = Math.abs(currentTime - previousTime);\n if (progressDelta > PROGRESS_THRESHOLD) {\n skipad_attempts += 1;\n if (skipad_attempts >= 2) {\n player.pause(true);\n }\n player.currentTime(previousTime);\n } else {\n previousTime = currentTime;\n }\n }\n\n function stopPreventManualProgress() {\n player.off('timeupdate', preventAdSeek);\n player.off('ended', preventAdSkip);\n }\n }\n }\n\n function trackAdError(error, vastResponse) {\n player.trigger({type: 'vast.adError', error: error});\n cancelAds();\n if (console && console.log) {\n console.log('AD ERROR:', error.message, error, vastResponse);\n }\n }\n\n function isVPAID(vastResponse) {\n var i, len;\n var mediaFiles = vastResponse.mediaFiles;\n for (i = 0, len = mediaFiles.length; i < len; i++) {\n if (vastUtil.isVPAID(mediaFiles[i])) {\n return true;\n }\n }\n return false;\n }\n};\n\n},{\"../ads/vast/VASTClient\":21,\"../ads/vast/VASTError\":22,\"../ads/vast/VASTIntegrator\":23,\"../ads/vast/vastUtil\":29,\"../ads/vpaid/VPAIDIntegrator\":33,\"../utils/async\":39,\"../utils/dom\":40,\"../utils/playerUtils\":42,\"../utils/utilityFunctions\":44}],39:[function(require,module,exports){\n//Small subset of async\n\nvar utilities = require('./utilityFunctions');\n\nvar async = {};\n\nasync.setImmediate = function (fn) {\n setTimeout(fn, 0);\n};\n\nasync.iterator = function (tasks) {\n var makeCallback = function (index) {\n var fn = function () {\n if (tasks.length) {\n tasks[index].apply(null, arguments);\n }\n return fn.next();\n };\n fn.next = function () {\n return (index < tasks.length - 1) ? makeCallback(index + 1) : null;\n };\n return fn;\n };\n return makeCallback(0);\n};\n\n\nasync.waterfall = function (tasks, callback) {\n callback = callback || function () { };\n if (!utilities.isArray(tasks)) {\n var err = new Error('First argument to waterfall must be an array of functions');\n return callback(err);\n }\n if (!tasks.length) {\n return callback();\n }\n var wrapIterator = function (iterator) {\n return function (err) {\n if (err) {\n callback.apply(null, arguments);\n callback = function () {\n };\n }\n else {\n var args = Array.prototype.slice.call(arguments, 1);\n var next = iterator.next();\n if (next) {\n args.push(wrapIterator(next));\n }\n else {\n args.push(callback);\n }\n async.setImmediate(function () {\n iterator.apply(null, args);\n });\n }\n };\n };\n wrapIterator(async.iterator(tasks))();\n};\n\nasync.when = function (condition, callback) {\n if (!utilities.isFunction(callback)) {\n throw new Error(\"async.when error: missing callback argument\");\n }\n\n var isAllowed = utilities.isFunction(condition) ? condition : function () {\n return !!condition;\n };\n\n return function () {\n var args = utilities.arrayLikeObjToArray(arguments);\n var next = args.pop();\n\n if (isAllowed.apply(null, args)) {\n return callback.apply(this, arguments);\n }\n\n args.unshift(null);\n return next.apply(null, args);\n };\n};\n\nmodule.exports = async;\n\n\n},{\"./utilityFunctions\":44}],40:[function(require,module,exports){\n'use strict';\n\nvar utilities = require('./utilityFunctions');\n\nvar dom = {};\n\ndom.isVisible = function isVisible(el) {\n var style = window.getComputedStyle(el);\n return style.visibility !== 'hidden';\n};\n\ndom.isHidden = function isHidden(el) {\n var style = window.getComputedStyle(el);\n return style.display === 'none';\n};\n\ndom.isShown = function isShown(el) {\n return !dom.isHidden(el);\n};\n\ndom.hide = function hide(el) {\n el.__prev_style_display_ = el.style.display;\n el.style.display = 'none';\n};\n\ndom.show = function show(el) {\n if (dom.isHidden(el)) {\n el.style.display = el.__prev_style_display_;\n }\n el.__prev_style_display_ = undefined;\n};\n\ndom.hasClass = function hasClass(el, cssClass) {\n var classes, i, len;\n\n if (utilities.isNotEmptyString(cssClass)) {\n if (el.classList) {\n return el.classList.contains(cssClass);\n }\n\n classes = utilities.isString(el.getAttribute('class')) ? el.getAttribute('class').split(/\\s+/) : [];\n cssClass = (cssClass || '');\n\n for (i = 0, len = classes.length; i < len; i += 1) {\n if (classes[i] === cssClass) {\n return true;\n }\n }\n }\n return false;\n};\n\ndom.addClass = function (el, cssClass) {\n var classes;\n\n if (utilities.isNotEmptyString(cssClass)) {\n if (el.classList) {\n return el.classList.add(cssClass);\n }\n\n classes = utilities.isString(el.getAttribute('class')) ? el.getAttribute('class').split(/\\s+/) : [];\n if (utilities.isString(cssClass) && utilities.isNotEmptyString(cssClass.replace(/\\s+/, ''))) {\n classes.push(cssClass);\n el.setAttribute('class', classes.join(' '));\n }\n }\n};\n\ndom.removeClass = function (el, cssClass) {\n var classes;\n\n if (utilities.isNotEmptyString(cssClass)) {\n if (el.classList) {\n return el.classList.remove(cssClass);\n }\n\n classes = utilities.isString(el.getAttribute('class')) ? el.getAttribute('class').split(/\\s+/) : [];\n var newClasses = [];\n var i, len;\n if (utilities.isString(cssClass) && utilities.isNotEmptyString(cssClass.replace(/\\s+/, ''))) {\n\n for (i = 0, len = classes.length; i < len; i += 1) {\n if (cssClass !== classes[i]) {\n newClasses.push(classes[i]);\n }\n }\n el.setAttribute('class', newClasses.join(' '));\n }\n }\n};\n\ndom.addEventListener = function addEventListener(el, type, handler) {\n if(utilities.isArray(el)){\n utilities.forEach(el, function(e) {\n dom.addEventListener(e, type, handler);\n });\n return;\n }\n\n if(utilities.isArray(type)){\n utilities.forEach(type, function(t) {\n dom.addEventListener(el, t, handler);\n });\n return;\n }\n\n if (el.addEventListener) {\n el.addEventListener(type, handler, false);\n } else if (el.attachEvent) {\n // WARNING!!! this is a very naive implementation !\n // the event object that should be passed to the handler\n // would not be there for IE8\n // we should use \"window.event\" and then \"event.srcElement\"\n // instead of \"event.target\"\n el.attachEvent(\"on\" + type, handler);\n }\n};\n\ndom.removeEventListener = function removeEventListener(el, type, handler) {\n if(utilities.isArray(el)){\n utilities.forEach(el, function(e) {\n dom.removeEventListener(e, type, handler);\n });\n return;\n }\n\n if(utilities.isArray(type)){\n utilities.forEach(type, function(t) {\n dom.removeEventListener(el, t, handler);\n });\n return;\n }\n\n if (el.removeEventListener) {\n el.removeEventListener(type, handler, false);\n } else if (el.detachEvent) {\n el.detachEvent(\"on\" + type, handler);\n } else {\n el[\"on\" + type] = null;\n }\n};\n\ndom.dispatchEvent = function dispatchEvent(el, event) {\n if (el.dispatchEvent) {\n el.dispatchEvent(event);\n } else {\n el.fireEvent(\"on\" + event.eventType, event);\n }\n};\n\ndom.isDescendant = function isDescendant(parent, child) {\n var node = child.parentNode;\n while (node !== null) {\n if (node === parent) {\n return true;\n }\n node = node.parentNode;\n }\n return false;\n};\n\ndom.getTextContent = function getTextContent(el){\n return el.textContent || el.text;\n};\n\ndom.prependChild = function prependChild(parent, child) {\n if(child.parentNode){\n child.parentNode.removeChild(child);\n }\n return parent.insertBefore(child, parent.firstChild);\n};\n\ndom.remove = function removeNode(node){\n if(node && node.parentNode){\n node.parentNode.removeChild(node);\n }\n};\n\ndom.isDomElement = function isDomElement(o) {\n return o instanceof Element;\n};\n\ndom.click = function(el, handler) {\n dom.addEventListener(el, 'click', handler);\n};\n\ndom.once = function(el, type, handler) {\n function handlerWrap() {\n handler.apply(null, arguments);\n dom.removeEventListener(el, type, handlerWrap);\n }\n\n dom.addEventListener(el, type, handlerWrap);\n};\n\n//Note: there is no getBoundingClientRect on iPad so we need a fallback\ndom.getDimension = function getDimension(element) {\n var rect;\n\n //On IE9 and below getBoundingClientRect does not work consistently\n if(!utilities.isOldIE() && element.getBoundingClientRect) {\n rect = element.getBoundingClientRect();\n return {\n width: rect.width,\n height: rect.height\n };\n }\n\n return {\n width: element.offsetWidth,\n height: element.offsetHeight\n };\n};\n\nmodule.exports = dom;\n},{\"./utilityFunctions\":44}],41:[function(require,module,exports){\n'use strict';\n\nvar urlUtils = require('./urlUtils');\nvar utilities = require('./utilityFunctions');\n\nfunction HttpRequestError(message) {\n this.message = 'HttpRequest Error: ' + (message || '');\n}\nHttpRequestError.prototype = new Error();\nHttpRequestError.prototype.name = \"HttpRequest Error\";\n\nfunction HttpRequest(createXhr) {\n if (!utilities.isFunction(createXhr)) {\n throw new HttpRequestError('Missing XMLHttpRequest factory method');\n }\n\n this.createXhr = createXhr;\n}\n\nHttpRequest.prototype.run = function (method, url, callback, options) {\n sanityCheck(url, callback, options);\n var timeout, timeoutId;\n var xhr = this.createXhr();\n options = options || {};\n timeout = utilities.isNumber(options.timeout) ? options.timeout : 0;\n\n xhr.open(method, urlUtils.urlParts(url).href, true);\n\n if (options.headers) {\n setHeaders(xhr, options.headers);\n }\n\n if (options.withCredentials) {\n xhr.withCredentials = true;\n }\n\n xhr.onload = function () {\n var statusText, response, status;\n\n /**\n * The only way to do a secure request on IE8 and IE9 is with the XDomainRequest object. Unfortunately, microsoft is\n * so nice that decided that the status property and the 'getAllResponseHeaders' method where not needed so we have to\n * fake them. If the request gets done with an XDomainRequest instance, we will assume that there are no headers and\n * the status will always be 200. If you don't like it, DO NOT USE ANCIENT BROWSERS!!!\n *\n * For mor info go to: https://msdn.microsoft.com/en-us/library/cc288060(v=vs.85).aspx\n */\n if (!xhr.getAllResponseHeaders) {\n xhr.getAllResponseHeaders = function () {\n return null;\n };\n }\n\n if (!xhr.status) {\n xhr.status = 200;\n }\n\n if (utilities.isDefined(timeoutId)) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n\n statusText = xhr.statusText || '';\n\n // responseText is the old-school way of retrieving response (supported by IE8 & 9)\n // response/responseType properties were introduced in XHR Level2 spec (supported by IE10)\n response = ('response' in xhr) ? xhr.response : xhr.responseText;\n\n // normalize IE9 bug (http://bugs.jquery.com/ticket/1450)\n status = xhr.status === 1223 ? 204 : xhr.status;\n\n callback(\n status,\n response,\n xhr.getAllResponseHeaders(),\n statusText);\n };\n\n xhr.onerror = requestError;\n xhr.onabort = requestError;\n\n xhr.send();\n\n if (timeout > 0) {\n timeoutId = setTimeout(function () {\n xhr && xhr.abort();\n }, timeout);\n }\n\n function sanityCheck(url, callback, options) {\n if (!utilities.isString(url) || utilities.isEmptyString(url)) {\n throw new HttpRequestError(\"Invalid url '\" + url + \"'\");\n }\n\n if (!utilities.isFunction(callback)) {\n throw new HttpRequestError(\"Invalid handler '\" + callback + \"' for the http request\");\n }\n\n if (utilities.isDefined(options) && !utilities.isObject(options)) {\n throw new HttpRequestError(\"Invalid options map '\" + options + \"'\");\n }\n }\n\n function setHeaders(xhr, headers) {\n utilities.forEach(headers, function (value, key) {\n if (utilities.isDefined(value)) {\n xhr.setRequestHeader(key, value);\n }\n });\n }\n\n function requestError() {\n callback(-1, null, null, '');\n }\n};\n\nHttpRequest.prototype.get = function (url, callback, options) {\n this.run('GET', url, processResponse, options);\n\n function processResponse(status, response, headersString, statusText) {\n if (isSuccess(status)) {\n callback(null, response, status, headersString, statusText);\n } else {\n callback(new HttpRequestError(statusText), response, status, headersString, statusText);\n }\n }\n\n function isSuccess(status) {\n return 200 <= status && status < 300;\n }\n};\n\nfunction createXhr() {\n var xhr = new XMLHttpRequest();\n if (!(\"withCredentials\" in xhr)) {\n // XDomainRequest for IE.\n xhr = new XDomainRequest();\n }\n return xhr;\n}\n\nvar http = new HttpRequest(createXhr);\n\nmodule.exports = {\n http: http,\n HttpRequest: HttpRequest,\n HttpRequestError: HttpRequestError,\n createXhr: createXhr\n};\n\n},{\"./urlUtils\":43,\"./utilityFunctions\":44}],42:[function(require,module,exports){\n'use strict';\n\nvar dom = require('./dom');\nvar utilities = require('./utilityFunctions');\n\nvar playerUtils = {};\n\n/**\n * Returns an object that captures the portions of player state relevant to\n * video playback. The result of this function can be passed to\n * restorePlayerSnapshot with a player to return the player to the state it\n * was in when this function was invoked.\n * @param {object} player The videojs player object\n */\nplayerUtils.getPlayerSnapshot = function getPlayerSnapshot(player) {\n var tech = player.el().querySelector('.vjs-tech');\n\n var snapshot = {\n ended: player.ended(),\n src: player.currentSrc(),\n currentTime: player.currentTime(),\n type: player.currentType(),\n playing: !player.paused(),\n suppressedTracks: getSuppressedTracks(player)\n };\n\n if (tech) {\n snapshot.nativePoster = tech.poster;\n snapshot.style = tech.getAttribute('style');\n }\n return snapshot;\n\n /**** Local Functions ****/\n function getSuppressedTracks(player) {\n var tracks = player.remoteTextTracks ? player.remoteTextTracks() : [];\n\n if (tracks && utilities.isArray(tracks.tracks_)) {\n tracks = tracks.tracks_;\n }\n\n if (!utilities.isArray(tracks)) {\n tracks = [];\n }\n\n var suppressedTracks = [];\n tracks.forEach(function (track) {\n suppressedTracks.push({\n track: track,\n mode: track.mode\n });\n track.mode = 'disabled';\n });\n\n return suppressedTracks;\n }\n};\n\n/**\n * Attempts to modify the specified player so that its state is equivalent to\n * the state of the snapshot.\n * @param {object} snapshot - the player state to apply\n */\nplayerUtils.restorePlayerSnapshot = function restorePlayerSnapshot(player, snapshot) {\n var tech = player.el().querySelector('.vjs-tech');\n var attempts = 20; // the number of remaining attempts to restore the snapshot\n\n if (snapshot.nativePoster) {\n tech.poster = snapshot.nativePoster;\n }\n\n if ('style' in snapshot) {\n // overwrite all css style properties to restore state precisely\n tech.setAttribute('style', snapshot.style || '');\n }\n\n if (hasSrcChanged(player, snapshot)) {\n\n // on ios7, fiddling with textTracks too early will cause safari to crash\n player.one('contentloadedmetadata', restoreTracks);\n\n player.one('canplay', tryToResume);\n ensureCanplayEvtGetsFired();\n\n // if the src changed for ad playback, reset it\n player.src({src: snapshot.src, type: snapshot.type});\n\n // safari requires a call to `load` to pick up a changed source\n player.load();\n\n } else {\n restoreTracks();\n\n if (snapshot.playing) {\n player.play();\n }\n }\n\n /*** Local Functions ***/\n\n /**\n * Sometimes firefox does not trigger the 'canplay' evt.\n * This code ensure that it always gets triggered triggered.\n */\n function ensureCanplayEvtGetsFired() {\n var timeoutId = setTimeout(function() {\n player.trigger('canplay');\n }, 1000);\n\n player.one('canplay', function(){\n clearTimeout(timeoutId);\n });\n }\n\n /**\n * Determine whether the player needs to be restored to its state\n * before ad playback began. With a custom ad display or burned-in\n * ads, the content player state hasn't been modified and so no\n * restoration is required\n */\n function hasSrcChanged(player, snapshot) {\n if (player.src()) {\n return player.src() !== snapshot.src;\n }\n // the player was configured through source element children\n return player.currentSrc() !== snapshot.src;\n }\n\n function restoreTracks() {\n var suppressedTracks = snapshot.suppressedTracks;\n suppressedTracks.forEach(function (trackSnapshot) {\n trackSnapshot.track.mode = trackSnapshot.mode;\n });\n }\n\n /**\n * Determine if the video element has loaded enough of the snapshot source\n * to be ready to apply the rest of the state\n */\n function tryToResume() {\n\n // if some period of the video is seekable, resume playback\n // otherwise delay a bit and then check again unless we're out of attempts\n\n if (!playerUtils.isReadyToResume(player) && attempts--) {\n setTimeout(tryToResume, 50);\n } else {\n try {\n if(player.currentTime() !== snapshot.currentTime) {\n if (snapshot.playing) { // if needed restore playing status after seek completes\n player.one('seeked', function() {\n player.play();\n });\n }\n player.currentTime(snapshot.currentTime);\n\n } else if (snapshot.playing) {\n // if needed and no seek has been performed, restore playing status immediately\n player.play();\n }\n\n } catch (e) {\n videojs.log.warn('Failed to resume the content after an advertisement', e);\n }\n }\n }\n};\n\nplayerUtils.isReadyToResume = function (player) {\n\n if (player.readyState() > 1) {\n // some browsers and media aren't \"seekable\".\n // readyState greater than 1 allows for seeking without exceptions\n return true;\n }\n\n if (player.seekable() === undefined) {\n // if the player doesn't expose the seekable time ranges, try to\n // resume playback immediately\n return true;\n }\n\n if (player.seekable().length > 0) {\n // if some period of the video is seekable, resume playback\n return true;\n }\n\n return false;\n};\n\n/**\n * This function prepares the player to display ads.\n * Adding convenience events like the 'vast.firsPlay' that gets fired when the video is first played\n * and ads the blackPoster to the player to prevent content from being displayed before the preroll ad.\n *\n * @param player\n */\nplayerUtils.prepareForAds = function (player) {\n var blackPoster = player.addChild('blackPoster');\n var _firstPlay = true;\n var volumeSnapshot;\n\n\n monkeyPatchPlayerApi();\n\n player.on('play', tryToTriggerFirstPlay);\n player.on('vast.reset', resetFirstPlay);//Every time we change the sources we reset the first play.\n player.on('vast.firstPlay', restoreContentVolume);\n player.on('error', hideBlackPoster);//If there is an error in the player we remove the blackposter to show the err msg\n player.on('vast.adStart', hideBlackPoster);\n player.on('vast.adsCancel', hideBlackPoster);\n player.on('vast.adError', hideBlackPoster);\n player.on('vast.adStart', addStyles);\n player.on('vast.adEnd', removeStyles);\n player.on('vast.adsCancel', removeStyles);\n\n /*** Local Functions ***/\n\n /**\n What this function does is ugly and horrible and I should think twice before calling myself a good developer. With that said,\n it is the best solution I could find to mute the video until the 'play' event happens (on mobile devices) and the plugin can decide whether\n to play the ad or not.\n\n We also need this monkeypatch to be able to pause and resume an ad using the player's API\n\n If you have a better solution please do tell me.\n */\n function monkeyPatchPlayerApi() {\n\n /**\n * Monkey patch needed to handle firstPlay and resume of playing ad.\n *\n * @param callOrigPlay necessary flag to prevent infinite loop when you are restoring a VAST ad.\n * @returns {player}\n */\n var origPlay = player.play;\n player.play = function (callOrigPlay) {\n var that = this;\n\n if (isFirstPlay()) {\n firstPlay();\n } else {\n resume(callOrigPlay);\n }\n\n return this;\n\n /*** local functions ***/\n function firstPlay() {\n if (!utilities.isIPhone()) {\n volumeSnapshot = saveVolumeSnapshot();\n player.muted(true);\n }\n\n origPlay.apply(that, arguments);\n }\n\n function resume(callOrigPlay) {\n if (isAdPlaying() && !callOrigPlay) {\n player.vast.adUnit.resumeAd();\n } else {\n origPlay.apply(that, arguments);\n }\n }\n };\n\n\n /**\n * Needed monkey patch to handle pause of playing ad.\n *\n * @param callOrigPlay necessary flag to prevent infinite loop when you are pausing a VAST ad.\n * @returns {player}\n */\n var origPause = player.pause;\n player.pause = function (callOrigPause) {\n if (isAdPlaying() && !callOrigPause) {\n player.vast.adUnit.pauseAd();\n } else {\n origPause.apply(this, arguments);\n }\n return this;\n };\n\n\n /**\n * Needed monkey patch to handle paused state of the player when ads are playing.\n *\n * @param callOrigPlay necessary flag to prevent infinite loop when you are pausing a VAST ad.\n * @returns {player}\n */\n var origPaused = player.paused;\n player.paused = function (callOrigPaused) {\n if (isAdPlaying() && !callOrigPaused) {\n return player.vast.adUnit.isPaused();\n }\n return origPaused.apply(this, arguments);\n };\n }\n\n function isAdPlaying() {\n return player.vast && player.vast.adUnit;\n }\n\n function tryToTriggerFirstPlay() {\n if (isFirstPlay()) {\n _firstPlay = false;\n player.trigger('vast.firstPlay');\n }\n }\n\n function resetFirstPlay() {\n _firstPlay = true;\n blackPoster.show();\n restoreContentVolume();\n }\n\n function isFirstPlay() {\n return _firstPlay;\n }\n\n function saveVolumeSnapshot() {\n return {\n muted: player.muted(),\n volume: player.volume()\n };\n }\n\n function restoreContentVolume() {\n if (volumeSnapshot) {\n player.currentTime(0);\n restoreVolumeSnapshot(volumeSnapshot);\n volumeSnapshot = null;\n }\n }\n\n function restoreVolumeSnapshot(snapshot) {\n if (utilities.isObject(snapshot)) {\n player.volume(snapshot.volume);\n player.muted(snapshot.muted);\n }\n }\n\n function hideBlackPoster() {\n if (!dom.hasClass(blackPoster.el(), 'vjs-hidden')) {\n blackPoster.hide();\n }\n }\n\n function addStyles() {\n dom.addClass(player.el(), 'vjs-ad-playing');\n }\n\n function removeStyles() {\n dom.removeClass(player.el(), 'vjs-ad-playing');\n }\n};\n\n/**\n * Remove the poster attribute from the video element tech, if present. When\n * reusing a video element for multiple videos, the poster image will briefly\n * reappear while the new source loads. Removing the attribute ahead of time\n * prevents the poster from showing up between videos.\n * @param {object} player The videojs player object\n */\nplayerUtils.removeNativePoster = function (player) {\n var tech = player.el().querySelector('.vjs-tech');\n if (tech) {\n tech.removeAttribute('poster');\n }\n};\n\n/**\n * Helper function to listen to many events until one of them gets fired, then we\n * execute the handler and unsubscribe all the event listeners;\n *\n * @param player specific player from where to listen for the events\n * @param events array of events\n * @param handler function to execute once one of the events fires\n */\nplayerUtils.once = function once(player, events, handler) {\n function listener() {\n handler.apply(null, arguments);\n\n events.forEach(function (event) {\n player.off(event, listener);\n });\n }\n\n events.forEach(function (event) {\n player.on(event, listener);\n });\n};\n\n\nmodule.exports = playerUtils;\n},{\"./dom\":40,\"./utilityFunctions\":44}],43:[function(require,module,exports){\n'use strict';\n\nvar utilities = require('./utilityFunctions');\n\n/**\n *\n * IMPORTANT NOTE: This function comes from angularJs and was originally called urlResolve\n * you can take a look at the original code here https://github.com/angular/angular.js/blob/master/src/ng/urlUtils.js\n *\n * Implementation Notes for non-IE browsers\n * ----------------------------------------\n * Assigning a URL to the href property of an anchor DOM node, even one attached to the DOM,\n * results both in the normalizing and parsing of the URL. Normalizing means that a relative\n * URL will be resolved into an absolute URL in the context of the application document.\n * Parsing means that the anchor node's host, hostname, protocol, port, pathname and related\n * properties are all populated to reflect the normalized URL. This approach has wide\n * compatibility - Safari 1+, Mozilla 1+, Opera 7+,e etc. See\n * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html\n *\n * Implementation Notes for IE\n * ---------------------------\n * IE >= 8 and <= 10 normalizes the URL when assigned to the anchor node similar to the other\n * browsers. However, the parsed components will not be set if the URL assigned did not specify\n * them. (e.g. if you assign a.href = \"foo\", then a.protocol, a.host, etc. will be empty.) We\n * work around that by performing the parsing in a 2nd step by taking a previously normalized\n * URL (e.g. by assigning to a.href) and assigning it a.href again. This correctly populates the\n * properties such as protocol, hostname, port, etc.\n *\n * IE7 does not normalize the URL when assigned to an anchor node. (Apparently, it does, if one\n * uses the inner HTML approach to assign the URL as part of an HTML snippet -\n * http://stackoverflow.com/a/472729) However, setting img[src] does normalize the URL.\n * Unfortunately, setting img[src] to something like \"javascript:foo\" on IE throws an exception.\n * Since the primary usage for normalizing URLs is to sanitize such URLs, we can't use that\n * method and IE < 8 is unsupported.\n *\n * References:\n * http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement\n * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html\n * http://url.spec.whatwg.org/#urlutils\n * https://github.com/angular/angular.js/pull/2902\n * http://james.padolsey.com/javascript/parsing-urls-with-the-dom/\n *\n * @kind function\n * @param {string} url The URL to be parsed.\n * @description Normalizes and parses a URL.\n * @returns {object} Returns the normalized URL as a dictionary.\n *\n * | member name | Description |\n * |---------------|----------------|\n * | href | A normalized version of the provided URL if it was not an absolute URL |\n * | protocol | The protocol including the trailing colon |\n * | host | The host and port (if the port is non-default) of the normalizedUrl |\n * | search | The search params, minus the question mark |\n * | hash | The hash string, minus the hash symbol\n * | hostname | The hostname\n * | port | The port, without \":\"\n * | pathname | The pathname, beginning with \"/\"\n *\n */\n\nvar urlParsingNode = document.createElement(\"a\");\n/**\n * documentMode is an IE-only property\n * http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx\n */\nvar msie = document.documentMode;\n\nfunction urlParts(url) {\n var href = url;\n\n if (msie) {\n // Normalize before parse. Refer Implementation Notes on why this is\n // done in two steps on IE.\n urlParsingNode.setAttribute(\"href\", href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: utilities.isNotEmptyString(urlParsingNode.port)? urlParsingNode.port: 80,\n pathname: (urlParsingNode.pathname.charAt(0) === '/')\n ? urlParsingNode.pathname\n : '/' + urlParsingNode.pathname\n };\n}\n\n\n/**\n * This function accepts a query string (search part of a url) and returns a dictionary with\n * the different key value pairs\n * @param {string} qs queryString\n */\nfunction queryStringToObj(qs, cond) {\n var pairs, qsObj;\n\n cond = utilities.isFunction(cond)? cond : function() {\n return true;\n };\n\n qs = qs.trim().replace(/^\\?/, '');\n pairs = qs.split('&');\n qsObj = {};\n\n utilities.forEach(pairs, function (pair) {\n var keyValue, key, value;\n if (pair !== '') {\n keyValue = pair.split('=');\n key = keyValue[0];\n value = keyValue[1];\n if(cond(key, value)){\n qsObj[key] = value;\n }\n }\n });\n\n return qsObj;\n}\n\n/**\n * This function accepts an object and serializes it into a query string without the leading '?'\n * @param obj\n * @returns {string}\n */\nfunction objToQueryString(obj) {\n var pairs = [];\n utilities.forEach(obj, function (value, key) {\n pairs.push(key + '=' + value);\n });\n return pairs.join('&');\n}\n\nmodule.exports = {\n urlParts: urlParts,\n queryStringToObj: queryStringToObj,\n objToQueryString: objToQueryString\n};\n\n},{\"./utilityFunctions\":44}],44:[function(require,module,exports){\n/*jshint unused:false */\n\"use strict\";\n\nvar NODE_TYPE_ELEMENT = 1;\nvar SNAKE_CASE_REGEXP = /[A-Z]/g;\nvar EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i;\n/*jslint maxlen: 500 */\nvar ISO8086_REGEXP = /^([\\+-]?\\d{4}(?!\\d{2}\\b))((-?)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))?|W([0-4]\\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6])))([T\\s]((([01]\\d|2[0-3])((:?)[0-5]\\d)?|24\\:?00)([\\.,]\\d+(?!:))?)?(\\17[0-5]\\d([\\.,]\\d+)?)?([zZ]|([\\+-])([01]\\d|2[0-3]):?([0-5]\\d)?)?)?)?$/;\n\n\nfunction noop(){ }\n\nfunction isNull(o) {\n return o === null;\n}\n\nfunction isDefined(o){\n return o !== undefined;\n}\n\nfunction isUndefined(o){\n return o === undefined;\n}\n\nfunction isObject(obj) {\n return typeof obj === 'object';\n}\n\nfunction isFunction(str){\n return typeof str === 'function';\n}\n\nfunction isNumber(num){\n return typeof num === 'number';\n}\n\nfunction isWindow(obj) {\n return utilities.isObject(obj) && obj.window === obj;\n}\n\nfunction isArray(array){\n return Object.prototype.toString.call( array ) === '[object Array]';\n}\n\nfunction isArrayLike(obj) {\n if (obj === null || utilities.isWindow(obj) || utilities.isFunction(obj) || utilities.isUndefined(obj)) {\n return false;\n }\n\n var length = obj.length;\n\n if (obj.nodeType === NODE_TYPE_ELEMENT && length) {\n return true;\n }\n\n return utilities.isString(obj) || utilities.isArray(obj) || length === 0 ||\n typeof length === 'number' && length > 0 && (length - 1) in obj;\n}\n\nfunction isString(str){\n return typeof str === 'string';\n}\n\nfunction isEmptyString(str) {\n return utilities.isString(str) && str.length === 0;\n}\n\nfunction isNotEmptyString(str) {\n return utilities.isString(str) && str.length !== 0;\n}\n\nfunction arrayLikeObjToArray(args) {\n return Array.prototype.slice.call(args);\n}\n\nfunction forEach(obj, iterator, context) {\n var key, length;\n if (obj) {\n if (isFunction(obj)) {\n for (key in obj) {\n // Need to check if hasOwnProperty exists,\n // as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function\n if (key !== 'prototype' && key !== 'length' && key !== 'name' && (!obj.hasOwnProperty || obj.hasOwnProperty(key))) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n } else if (isArray(obj)) {\n var isPrimitive = typeof obj !== 'object';\n for (key = 0, length = obj.length; key < length; key++) {\n if (isPrimitive || key in obj) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n } else if (obj.forEach && obj.forEach !== forEach) {\n obj.forEach(iterator, context, obj);\n } else {\n for (key in obj) {\n if (obj.hasOwnProperty(key)) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n }\n }\n return obj;\n}\n\nfunction snake_case(name, separator) {\n separator = separator || '_';\n return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n}\n\nfunction isValidEmail(email){\n if(!utilities.isString(email)){\n return false;\n }\n\n return EMAIL_REGEXP.test(email.trim());\n}\n\nfunction extend (obj) {\n var arg, i, k;\n for (i = 1; i < arguments.length; i++) {\n arg = arguments[i];\n for (k in arg) {\n if (arg.hasOwnProperty(k)) {\n if(isObject(obj[k]) && !isNull(obj[k]) && isObject(arg[k])){\n obj[k] = extend({}, obj[k], arg[k]);\n }else {\n obj[k] = arg[k];\n }\n }\n }\n }\n return obj;\n}\n\nfunction capitalize(s){\n return s.charAt(0).toUpperCase() + s.slice(1);\n}\n\nfunction decapitalize(s) {\n return s.charAt(0).toLowerCase() + s.slice(1);\n}\n\n/**\n * This method works the same way array.prototype.map works but if the transformer returns undefine, then\n * it won't be added to the transformed Array.\n */\nfunction transformArray(array, transformer) {\n var transformedArray = [];\n\n array.forEach(function(item, index){\n var transformedItem = transformer(item, index);\n if(utilities.isDefined(transformedItem)) {\n transformedArray.push(transformedItem);\n }\n });\n\n return transformedArray;\n}\n\nfunction toFixedDigits(num, digits) {\n var formattedNum = num + '';\n digits = utilities.isNumber(digits) ? digits : 0;\n num = utilities.isNumber(num) ? num : parseInt(num, 10);\n if(utilities.isNumber(num) && !isNaN(num)){\n formattedNum = num + '';\n while(formattedNum.length < digits) {\n formattedNum = '0' + formattedNum;\n }\n return formattedNum;\n }\n return NaN + '';\n}\n\nfunction throttle(callback, delay) {\n var previousCall = new Date().getTime() - (delay + 1);\n return function() {\n var time = new Date().getTime();\n if ((time - previousCall) >= delay) {\n previousCall = time;\n callback.apply(this, arguments);\n }\n };\n}\n\nfunction debounce (callback, wait) {\n var timeoutId;\n\n return function (){\n if(timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(function(){\n callback.apply(this, arguments);\n timeoutId = undefined;\n }, wait);\n };\n}\n\n// a function designed to blow up the stack in a naive way\n// but it is ok for videoJs children components\nfunction treeSearch(root, getChildren, found){\n var children = getChildren(root);\n for (var i = 0; i < children.length; i++){\n if (found(children[i])) {\n return children[i];\n }\n else {\n var el = treeSearch(children[i], getChildren, found);\n if (el){\n return el;\n }\n }\n }\n}\n\nfunction echoFn(val) {\n return function () {\n return val;\n };\n}\n\n//Note: Supported formats come from http://www.w3.org/TR/NOTE-datetime\n// and the iso8601 regex comes from http://www.pelagodesign.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/\nfunction isISO8601(value) {\n if(utilities.isNumber(value)){\n value = value + ''; //we make sure that we are working with strings\n }\n\n if(!utilities.isString(value)){\n return false;\n }\n\n return ISO8086_REGEXP.test(value.trim());\n}\n\n/**\n * Checks if the Browser is IE9 and below\n * @returns {boolean}\n */\nfunction isOldIE() {\n var version = utilities.getInternetExplorerVersion(navigator);\n if (version === -1) {\n return false;\n }\n\n return version < 10;\n}\n\n/**\n * Returns the version of Internet Explorer or a -1 (indicating the use of another browser).\n * Source: https://msdn.microsoft.com/en-us/library/ms537509(v=vs.85).aspx\n * @returns {number} the version of Internet Explorer or a -1 (indicating the use of another browser).\n */\nfunction getInternetExplorerVersion(navigator) {\n var rv = -1;\n\n if (navigator.appName == 'Microsoft Internet Explorer') {\n var ua = navigator.userAgent;\n var re = new RegExp(\"MSIE ([0-9]{1,}[\\.0-9]{0,})\");\n var res = re.exec(ua);\n if (res !== null) {\n rv = parseFloat(res[1]);\n }\n }\n\n return rv;\n}\n\n/*** Mobile Utility functions ***/\nfunction isIDevice() {\n return /iP(hone|ad)/.test(utilities._UA);\n}\n\nfunction isMobile() {\n return /iP(hone|ad|od)|Android|Windows Phone/.test(utilities._UA);\n}\n\nfunction isIPhone() {\n return /iP(hone|od)/.test(utilities._UA);\n}\n\nfunction isAndroid() {\n return /Android/.test(utilities._UA);\n}\n\nvar utilities = {\n _UA: navigator.userAgent,\n noop: noop,\n isNull: isNull,\n isDefined: isDefined,\n isUndefined: isUndefined,\n isObject: isObject,\n isFunction: isFunction,\n isNumber: isNumber,\n isWindow: isWindow,\n isArray: isArray,\n isArrayLike: isArrayLike,\n isString: isString,\n isEmptyString: isEmptyString,\n isNotEmptyString: isNotEmptyString,\n arrayLikeObjToArray: arrayLikeObjToArray,\n forEach: forEach,\n snake_case: snake_case,\n isValidEmail: isValidEmail,\n extend: extend,\n capitalize: capitalize,\n decapitalize: decapitalize,\n transformArray: transformArray,\n toFixedDigits: toFixedDigits,\n throttle: throttle,\n debounce: debounce,\n treeSearch: treeSearch,\n echoFn: echoFn,\n isISO8601: isISO8601,\n isOldIE: isOldIE,\n getInternetExplorerVersion: getInternetExplorerVersion,\n isIDevice: isIDevice,\n isMobile: isMobile,\n isIPhone: isIPhone,\n isAndroid: isAndroid\n};\n\nmodule.exports = utilities;\n},{}],45:[function(require,module,exports){\n'use strict';\n\nvar utilities = require('./utilityFunctions');\n\nvar xml = {};\n\nxml.strToXMLDoc = function strToXMLDoc(stringContainingXMLSource){\n //IE 8\n if(typeof window.DOMParser === 'undefined'){\n var xmlDocument = new ActiveXObject('Microsoft.XMLDOM');\n xmlDocument.async = false;\n xmlDocument.loadXML(stringContainingXMLSource);\n return xmlDocument;\n }\n\n return parseString(stringContainingXMLSource);\n\n function parseString(stringContainingXMLSource){\n var parser = new DOMParser();\n var parsedDocument;\n\n //Note: This try catch is to deal with the fact that on IE parser.parseFromString does throw an error but the rest of the browsers don't.\n try {\n parsedDocument = parser.parseFromString(stringContainingXMLSource, \"application/xml\");\n\n if(isParseError(parsedDocument) || utilities.isEmptyString(stringContainingXMLSource)){\n throw new Error();\n }\n }catch(e){\n throw new Error(\"xml.strToXMLDOC: Error parsing the string: '\" + stringContainingXMLSource + \"'\");\n }\n\n return parsedDocument;\n }\n\n function isParseError(parsedDocument) {\n try { // parser and parsererrorNS could be cached on startup for efficiency\n var parser = new DOMParser(),\n erroneousParse = parser.parseFromString('INVALID', 'text/xml'),\n parsererrorNS = erroneousParse.getElementsByTagName(\"parsererror\")[0].namespaceURI;\n\n if (parsererrorNS === 'http://www.w3.org/1999/xhtml') {\n // In PhantomJS the parseerror element doesn't seem to have a special namespace, so we are just guessing here :(\n return parsedDocument.getElementsByTagName(\"parsererror\").length > 0;\n }\n\n return parsedDocument.getElementsByTagNameNS(parsererrorNS, 'parsererror').length > 0;\n } catch (e) {\n //Note on IE parseString throws an error by itself and it will never reach this code. Because it will have failed before\n }\n }\n};\n\nxml.parseText = function parseText (sValue) {\n if (/^\\s*$/.test(sValue)) { return null; }\n if (/^(?:true|false)$/i.test(sValue)) { return sValue.toLowerCase() === \"true\"; }\n if (isFinite(sValue)) { return parseFloat(sValue); }\n if (utilities.isISO8601(sValue)) { return new Date(sValue); }\n return sValue.trim();\n};\n\nxml.JXONTree = function JXONTree (oXMLParent) {\n var parseText = xml.parseText;\n\n //The document object is an especial object that it may miss some functions or attrs depending on the browser.\n //To prevent this problem with create the JXONTree using the root childNode which is a fully fleshed node on all supported\n //browsers.\n if(oXMLParent.documentElement){\n return new xml.JXONTree(oXMLParent.documentElement);\n }\n\n if (oXMLParent.hasChildNodes()) {\n var sCollectedTxt = \"\";\n for (var oNode, sProp, vContent, nItem = 0; nItem < oXMLParent.childNodes.length; nItem++) {\n oNode = oXMLParent.childNodes.item(nItem);\n /*jshint bitwise: false*/\n if ((oNode.nodeType - 1 | 1) === 3) { sCollectedTxt += oNode.nodeType === 3 ? oNode.nodeValue.trim() : oNode.nodeValue; }\n else if (oNode.nodeType === 1 && !oNode.prefix) {\n sProp = utilities.decapitalize(oNode.nodeName);\n vContent = new xml.JXONTree(oNode);\n if (this.hasOwnProperty(sProp)) {\n if (this[sProp].constructor !== Array) { this[sProp] = [this[sProp]]; }\n this[sProp].push(vContent);\n } else { this[sProp] = vContent; }\n }\n }\n if (sCollectedTxt) { this.keyValue = parseText(sCollectedTxt); }\n }\n\n //IE8 Stupid fix\n var hasAttr = typeof oXMLParent.hasAttributes === 'undefined'? oXMLParent.attributes.length > 0: oXMLParent.hasAttributes();\n if (hasAttr) {\n var oAttrib;\n for (var nAttrib = 0; nAttrib < oXMLParent.attributes.length; nAttrib++) {\n oAttrib = oXMLParent.attributes.item(nAttrib);\n this[\"@\" + utilities.decapitalize(oAttrib.name)] = parseText(oAttrib.value.trim());\n }\n }\n};\n\nxml.JXONTree.prototype.attr = function(attr) {\n return this['@' + utilities.decapitalize(attr)];\n};\n\nxml.toJXONTree = function toJXONTree(xmlString){\n var xmlDoc = xml.strToXMLDoc(xmlString);\n return new xml.JXONTree(xmlDoc);\n};\n\n/**\n * Helper function to extract the keyvalue of a JXONTree obj\n *\n * @param xmlObj {JXONTree}\n * return the key value or undefined;\n */\nxml.keyValue = function getKeyValue(xmlObj) {\n if(xmlObj){\n return xmlObj.keyValue;\n }\n return undefined;\n};\n\nxml.attr = function getAttrValue(xmlObj, attr) {\n if(xmlObj) {\n return xmlObj['@' + utilities.decapitalize(attr)];\n }\n return undefined;\n};\n\nxml.encode = function encodeXML(str) {\n return str.replace(/&/g, '&')\n .replace(//g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n};\n\nxml.decode = function decodeXML(str) {\n return str.replace(/'/g, \"'\")\n .replace(/"/g, '\"')\n .replace(/>/g, '>')\n .replace(/</g, '<')\n .replace(/&/g, '&');\n};\n\nmodule.exports = xml;\n},{\"./utilityFunctions\":44}],46:[function(require,module,exports){\n'use strict';\n\nrequire('./plugin/components/ads-label_4');\nrequire('./plugin/components/black-poster_4');\n\nvar videoJsVAST = require('./plugin/videojs.vast.vpaid');\n\nvideojs.plugin('vastClient', videoJsVAST);\n\n\n},{\"./plugin/components/ads-label_4\":35,\"./plugin/components/black-poster_4\":37,\"./plugin/videojs.vast.vpaid\":38}]},{},[46])\n\n","'use strict';\n\nlet IVPAIDAdUnit = require('./IVPAIDAdUnit').IVPAIDAdUnit;\nlet ALL_VPAID_METHODS = Object.getOwnPropertyNames(IVPAIDAdUnit.prototype).filter(function (property) {\n return ['constructor'].indexOf(property) === -1;\n});\n\nexport class VPAIDAdUnit extends IVPAIDAdUnit {\n constructor (flash) {\n super();\n this._destroyed = false;\n this._flash = flash;\n }\n\n _destroy() {\n this._destroyed = true;\n ALL_VPAID_METHODS.forEach((methodName) => {\n this._flash.removeCallbackByMethodName(methodName);\n });\n IVPAIDAdUnit.EVENTS.forEach((event) => {\n this._flash.offEvent(event);\n });\n\n this._flash = null;\n }\n\n isDestroyed () {\n return this._destroyed;\n }\n\n on(eventName, callback) {\n this._flash.on(eventName, callback);\n }\n\n off(eventName, callback) {\n this._flash.off(eventName, callback);\n }\n\n //VPAID interface\n handshakeVersion(playerVPAIDVersion = '2.0', callback = undefined) {\n this._flash.callFlashMethod('handshakeVersion', [playerVPAIDVersion], callback);\n }\n initAd (width, height, viewMode, desiredBitrate, creativeData = {AdParameters: ''}, environmentVars = {flashVars: ''}, callback = undefined) {\n //resize element that has the flash object\n this._flash.setSize(width, height);\n creativeData = creativeData || {AdParameters: ''};\n environmentVars = environmentVars || {flashVars: ''};\n\n this._flash.callFlashMethod('initAd', [this._flash.getWidth(), this._flash.getHeight(), viewMode, desiredBitrate, creativeData.AdParameters || '', environmentVars.flashVars || ''], callback);\n }\n resizeAd(width, height, viewMode, callback = undefined) {\n //resize element that has the flash object\n this._flash.setSize(width, height);\n\n //resize ad inside the flash\n this._flash.callFlashMethod('resizeAd', [this._flash.getWidth(), this._flash.getHeight(), viewMode], callback);\n }\n startAd(callback = undefined) {\n this._flash.callFlashMethod('startAd', [], callback);\n }\n stopAd(callback = undefined) {\n this._flash.callFlashMethod('stopAd', [], callback);\n }\n pauseAd(callback = undefined) {\n this._flash.callFlashMethod('pauseAd', [], callback);\n }\n resumeAd(callback = undefined) {\n this._flash.callFlashMethod('resumeAd', [], callback);\n }\n expandAd(callback = undefined) {\n this._flash.callFlashMethod('expandAd', [], callback);\n }\n collapseAd(callback = undefined) {\n this._flash.callFlashMethod('collapseAd', [], callback);\n }\n skipAd(callback = undefined) {\n this._flash.callFlashMethod('skipAd', [], callback);\n }\n\n //properties that will be treat as async methods\n getAdLinear(callback) {\n this._flash.callFlashMethod('getAdLinear', [], callback);\n }\n getAdWidth(callback) {\n this._flash.callFlashMethod('getAdWidth', [], callback);\n }\n getAdHeight(callback) {\n this._flash.callFlashMethod('getAdHeight', [], callback);\n }\n getAdExpanded(callback) {\n this._flash.callFlashMethod('getAdExpanded', [], callback);\n }\n getAdSkippableState(callback) {\n this._flash.callFlashMethod('getAdSkippableState', [], callback);\n }\n getAdRemainingTime(callback) {\n this._flash.callFlashMethod('getAdRemainingTime', [], callback);\n }\n getAdDuration(callback) {\n this._flash.callFlashMethod('getAdDuration', [], callback);\n }\n setAdVolume(volume, callback = undefined) {\n this._flash.callFlashMethod('setAdVolume', [volume], callback);\n }\n getAdVolume(callback) {\n this._flash.callFlashMethod('getAdVolume', [], callback);\n }\n getAdCompanions(callback) {\n this._flash.callFlashMethod('getAdCompanions', [], callback);\n }\n getAdIcons(callback) {\n this._flash.callFlashMethod('getAdIcons', [], callback);\n }\n}\n\n","'use strict';\n\nconst JSFlashBridge = require('./jsFlashBridge').JSFlashBridge;\nconst VPAIDAdUnit = require('./VPAIDAdUnit').VPAIDAdUnit;\n\nconst noop = require('./utils').noop;\nconst callbackTimeout = require('./utils').callbackTimeout;\nconst isPositiveInt = require('./utils').isPositiveInt;\nconst createElementWithID = require('./utils').createElementWithID;\nconst uniqueVPAID = require('./utils').unique('vpaid');\nconst createFlashTester = require('./flashTester.js').createFlashTester;\n\nconst ERROR = 'error';\nconst FLASH_VERSION = '10.1.0';\n\nlet flashTester = {isSupported: ()=> true}; // if the runFlashTest is not run the flashTester will always return true\n\nclass VPAIDFLASHClient {\n constructor (vpaidParentEl, callback, swfConfig = {data: 'VPAIDFlash.swf', width: 800, height: 400}, params = { wmode: 'transparent', salign: 'tl', align: 'left', allowScriptAccess: 'always', scale: 'noScale', allowFullScreen: 'true', quality: 'high'}, vpaidOptions = { debug: false, timeout: 10000 }) {\n\n if (!VPAIDFLASHClient.hasExternalDependencies()) {\n return onError('no swfobject in global scope. check: https://github.com/swfobject/swfobject or https://code.google.com/p/swfobject/');\n }\n\n this._vpaidParentEl = vpaidParentEl;\n this._flashID = uniqueVPAID();\n this._destroyed = false;\n callback = callback || noop;\n\n swfConfig.width = isPositiveInt(swfConfig.width, 800);\n swfConfig.height = isPositiveInt(swfConfig.height, 400);\n\n createElementWithID(vpaidParentEl, this._flashID, true);\n\n params.movie = swfConfig.data;\n params.FlashVars = `flashid=${this._flashID}&handler=${JSFlashBridge.VPAID_FLASH_HANDLER}&debug=${vpaidOptions.debug}&salign=${params.salign}`;\n\n if (!VPAIDFLASHClient.isSupported()) {\n return onError('user don\\'t support flash or doesn\\'t have the minimum required version of flash ' + FLASH_VERSION);\n }\n\n this.el = swfobject.createSWF(swfConfig, params, this._flashID);\n\n if (!this.el) {\n return onError( 'swfobject failed to create object in element' );\n }\n\n var handler = callbackTimeout(vpaidOptions.timeout,\n (err, data) => {\n $loadPendedAdUnit.call(this);\n callback(err, data);\n }, () => {\n callback('vpaid flash load timeout ' + vpaidOptions.timeout);\n }\n );\n\n this._flash = new JSFlashBridge(this.el, swfConfig.data, this._flashID, swfConfig.width, swfConfig.height, handler);\n\n function onError(error) {\n setTimeout(() => {\n callback(new Error(error));\n }, 0);\n return this;\n }\n\n }\n\n destroy () {\n this._destroyAdUnit();\n\n if (this._flash) {\n this._flash.destroy();\n this._flash = null;\n }\n this.el = null;\n this._destroyed = true;\n }\n\n isDestroyed () {\n return this._destroyed;\n }\n\n _destroyAdUnit() {\n delete this._loadLater;\n\n if (this._adUnitLoad) {\n this._adUnitLoad = null;\n this._flash.removeCallback(this._adUnitLoad);\n }\n\n if (this._adUnit) {\n this._adUnit._destroy();\n this._adUnit = null;\n }\n }\n\n loadAdUnit(adURL, callback) {\n $throwIfDestroyed.call(this);\n\n if (this._adUnit) {\n this._destroyAdUnit();\n }\n\n if (this._flash.isReady()) {\n this._adUnitLoad = (err, message) => {\n if (!err) {\n this._adUnit = new VPAIDAdUnit(this._flash);\n }\n this._adUnitLoad = null;\n callback(err, this._adUnit);\n };\n\n this._flash.callFlashMethod('loadAdUnit', [adURL], this._adUnitLoad);\n }else {\n this._loadLater = {url: adURL, callback};\n }\n }\n\n unloadAdUnit(callback = undefined) {\n $throwIfDestroyed.call(this);\n\n this._destroyAdUnit();\n this._flash.callFlashMethod('unloadAdUnit', [], callback);\n }\n getFlashID() {\n $throwIfDestroyed.call(this);\n return this._flash.getFlashID();\n }\n getFlashURL() {\n $throwIfDestroyed.call(this);\n return this._flash.getFlashURL();\n }\n}\n\nsetStaticProperty('isSupported', () => {\n return VPAIDFLASHClient.hasExternalDependencies() && swfobject.hasFlashPlayerVersion(FLASH_VERSION) && flashTester.isSupported();\n}, true);\n\nsetStaticProperty('hasExternalDependencies', () => {\n return !!window.swfobject;\n});\n\nsetStaticProperty('runFlashTest', (swfConfig) => {\n flashTester = createFlashTester(document.body, swfConfig);\n});\n\nfunction $throwIfDestroyed() {\n if(this._destroyed) {\n throw new Error('VPAIDFlashToJS is destroyed!');\n }\n}\n\nfunction $loadPendedAdUnit() {\n if (this._loadLater) {\n this.loadAdUnit(this._loadLater.url, this._loadLater.callback);\n delete this._loadLater;\n }\n}\n\nfunction setStaticProperty(propertyName, value, writable = false) {\n Object.defineProperty(VPAIDFLASHClient, propertyName, {\n writable: writable,\n configurable: false,\n value: value\n });\n}\n\nmodule.exports = VPAIDFLASHClient;\n","'use strict';\n\nconst FLASH_TEST = 'vpaid_video_flash_tester';\nconst FLASH_TEST_EL = 'vpaid_video_flash_tester_el';\nconst JSFlashBridge = require('./jsFlashBridge').JSFlashBridge;\nconst utils = require('./utils');\nconst MultipleValuesRegistry = require('./registry').MultipleValuesRegistry;\n\nclass FlashTester {\n constructor(parent, swfConfig = {data: 'VPAIDFlash.swf', width: 800, height: 400}) {\n this.parentEl = utils.createElementWithID(parent, FLASH_TEST_EL); // some browsers create global variables using the element id http://stackoverflow.com/questions/3434278/do-dom-tree-elements-with-ids-become-global-variables\n utils.hideFlashEl(this.parentEl);\n var params = {};\n params.movie = swfConfig.data;\n params.FlashVars = `flashid=${FLASH_TEST_EL}&handler=${JSFlashBridge.VPAID_FLASH_HANDLER}`;\n\n this.el = swfobject.createSWF(swfConfig, params, FLASH_TEST_EL);\n this._handlers = new MultipleValuesRegistry();\n this._isSupported = false;\n if (this.el) {\n utils.hideFlashEl(this.el);\n this._flash = new JSFlashBridge(this.el, swfConfig.data, FLASH_TEST_EL, 400, 400, ()=> {\n const support = true;\n this._isSupported = support;\n this._handlers.get('change').forEach((callback) => {\n setTimeout(()=> {\n callback('change', support);\n }, 0);\n });\n });\n }\n }\n isSupported() {\n return this._isSupported;\n }\n on(eventName, callback) {\n this._handlers.add(eventName, callback);\n }\n}\n\nexport var createFlashTester = function createFlashTester(el, swfConfig) {\n if (!window[FLASH_TEST]) {\n window[FLASH_TEST] = new FlashTester(el, swfConfig);\n }\n return window[FLASH_TEST];\n};\n","'use strict';\n\nlet unique = require('./utils').unique;\nlet isPositiveInt = require('./utils').isPositiveInt;\nlet stringEndsWith = require('./utils').stringEndsWith;\nlet SingleValueRegistry = require('./registry').SingleValueRegistry;\nlet MultipleValuesRegistry = require('./registry').MultipleValuesRegistry;\nconst registry = require('./jsFlashBridgeRegistry');\nconst VPAID_FLASH_HANDLER = 'vpaid_video_flash_handler';\nconst ERROR = 'AdError';\n\nexport class JSFlashBridge {\n constructor (el, flashURL, flashID, width, height, loadHandShake) {\n this._el = el;\n this._flashID = flashID;\n this._flashURL = flashURL;\n this._width = width;\n this._height = height;\n this._handlers = new MultipleValuesRegistry();\n this._callbacks = new SingleValueRegistry();\n this._uniqueMethodIdentifier = unique(this._flashID);\n this._ready = false;\n this._handShakeHandler = loadHandShake;\n\n registry.addInstance(this._flashID, this);\n }\n\n on(eventName, callback) {\n this._handlers.add(eventName, callback);\n }\n\n off(eventName, callback) {\n return this._handlers.remove(eventName, callback);\n }\n\n offEvent(eventName) {\n return this._handlers.removeByKey(eventName);\n }\n\n offAll() {\n return this._handlers.removeAll();\n }\n\n callFlashMethod(methodName, args = [], callback = undefined) {\n var callbackID = '';\n // if no callback, some methods the return is void so they don't need callback\n if (callback) {\n callbackID = `${this._uniqueMethodIdentifier()}_${methodName}`;\n this._callbacks.add(callbackID, callback);\n }\n\n\n try {\n //methods are created by ExternalInterface.addCallback in as3 code, if for some reason it failed\n //this code will throw an error\n this._el[methodName]([callbackID].concat(args));\n\n } catch (e) {\n if (callback) {\n $asyncCallback.call(this, callbackID, e);\n } else {\n\n //if there isn't any callback to return error use error event handler\n this._trigger(ERROR, e);\n }\n }\n }\n\n removeCallback(callback) {\n return this._callbacks.removeByValue(callback);\n }\n\n removeCallbackByMethodName(suffix) {\n this._callbacks.filterKeys((key) => {\n return stringEndsWith(key, suffix);\n }).forEach((key) => {\n this._callbacks.remove(key);\n });\n }\n\n removeAllCallbacks() {\n return this._callbacks.removeAll();\n }\n\n _trigger(eventName, event) {\n this._handlers.get(eventName).forEach((callback) => {\n //clickThru has to be sync, if not will be block by the popupblocker\n if (eventName === 'AdClickThru') {\n callback(event);\n } else {\n setTimeout(() => {\n if (this._handlers.get(eventName).length > 0) {\n callback(event);\n }\n }, 0);\n }\n });\n }\n\n _callCallback(methodName, callbackID, err, result) {\n\n let callback = this._callbacks.get(callbackID);\n\n //not all methods callback's are mandatory\n //but if there exist an error, fire the error event\n if (!callback) {\n if (err && callbackID === '') {\n this.trigger(ERROR, err);\n }\n return;\n }\n\n $asyncCallback.call(this, callbackID, err, result);\n\n }\n\n _handShake(err, data) {\n this._ready = true;\n if (this._handShakeHandler) {\n this._handShakeHandler(err, data);\n delete this._handShakeHandler;\n }\n }\n\n //methods like properties specific to this implementation of VPAID\n getSize() {\n return {width: this._width, height: this._height};\n }\n setSize(newWidth, newHeight) {\n this._width = isPositiveInt(newWidth, this._width);\n this._height = isPositiveInt(newHeight, this._height);\n this._el.setAttribute('width', this._width);\n this._el.setAttribute('height', this._height);\n }\n getWidth() {\n return this._width;\n }\n setWidth(newWidth) {\n this.setSize(newWidth, this._height);\n }\n getHeight() {\n return this._height;\n }\n setHeight(newHeight) {\n this.setSize(this._width, newHeight);\n }\n getFlashID() {\n return this._flashID;\n }\n getFlashURL() {\n return this._flashURL;\n }\n isReady() {\n return this._ready;\n }\n destroy() {\n this.offAll();\n this.removeAllCallbacks();\n registry.removeInstanceByID(this._flashID);\n if (this._el.parentElement) {\n this._el.parentElement.removeChild(this._el);\n }\n }\n}\n\nfunction $asyncCallback(callbackID, err, result) {\n setTimeout(() => {\n let callback = this._callbacks.get(callbackID);\n if (callback) {\n this._callbacks.remove(callbackID);\n callback(err, result);\n }\n }, 0);\n}\n\nObject.defineProperty(JSFlashBridge, 'VPAID_FLASH_HANDLER', {\n writable: false,\n configurable: false,\n value: VPAID_FLASH_HANDLER\n});\n\n/**\n * External interface handler\n *\n * @param {string} flashID identifier of the flash who call this\n * @param {string} typeID what type of message is, can be 'event' or 'callback'\n * @param {string} typeName if the typeID is a event the typeName will be the eventName, if is a callback the typeID is the methodName that is related this callback\n * @param {string} callbackID only applies when the typeID is 'callback', identifier of the callback to call\n * @param {object} error error object\n * @param {object} data\n */\nwindow[VPAID_FLASH_HANDLER] = (flashID, typeID, typeName, callbackID, error, data) => {\n let instance = registry.getInstanceByID(flashID);\n if (!instance) return;\n if (typeName === 'handShake') {\n instance._handShake(error, data);\n } else {\n if (typeID !== 'event') {\n instance._callCallback(typeName, callbackID, error, data);\n } else {\n instance._trigger(typeName, data);\n }\n }\n};\n\n","'use strict';\n\nlet SingleValueRegistry = require('./registry').SingleValueRegistry;\nlet instances = new SingleValueRegistry();\n\nconst JSFlashBridgeRegistry = {};\nObject.defineProperty(JSFlashBridgeRegistry, 'addInstance', {\n writable: false,\n configurable: false,\n value: function (id, instance) {\n instances.add(id, instance);\n }\n});\n\nObject.defineProperty(JSFlashBridgeRegistry, 'getInstanceByID', {\n writable: false,\n configurable: false,\n value: function (id) {\n return instances.get(id);\n }\n});\n\nObject.defineProperty(JSFlashBridgeRegistry, 'removeInstanceByID', {\n writable: false,\n configurable: false,\n value: function (id) {\n return instances.remove(id);\n }\n});\n\nmodule.exports = JSFlashBridgeRegistry;\n\n","'use strict';\n\nexport class MultipleValuesRegistry {\n constructor () {\n this._registries = {};\n }\n add (id, value) {\n if (!this._registries[id]) {\n this._registries[id] = [];\n }\n if (this._registries[id].indexOf(value) === -1) {\n this._registries[id].push(value);\n }\n }\n get (id) {\n return this._registries[id] || [];\n }\n filterKeys (handler) {\n return Object.keys(this._registries).filter(handler);\n }\n findByValue (value) {\n var keys = Object.keys(this._registries).filter((key) => {\n return this._registries[key].indexOf(value) !== -1;\n });\n\n return keys;\n }\n remove(key, value) {\n if (!this._registries[key]) { return; }\n\n var index = this._registries[key].indexOf(value);\n\n if (index < 0) { return; }\n return this._registries[key].splice(index, 1);\n }\n removeByKey (id) {\n let old = this._registries[id];\n delete this._registries[id];\n return old;\n }\n removeByValue (value) {\n let keys = this.findByValue(value);\n return keys.map((key) => {\n return this.remove(key, value);\n });\n }\n removeAll() {\n let old = this._registries;\n this._registries = {};\n return old;\n }\n size() {\n return Object.keys(this._registries).length;\n }\n}\n\nexport class SingleValueRegistry {\n constructor () {\n this._registries = {};\n }\n add (id, value) {\n this._registries[id] = value;\n }\n get (id) {\n return this._registries[id];\n }\n filterKeys (handler) {\n return Object.keys(this._registries).filter(handler);\n }\n findByValue (value) {\n var keys = Object.keys(this._registries).filter((key) => {\n return this._registries[key] === value;\n });\n\n return keys;\n }\n remove (id) {\n let old = this._registries[id];\n delete this._registries[id];\n return old;\n }\n removeByValue (value) {\n let keys = this.findByValue(value);\n return keys.map((key) => {\n return this.remove(key);\n });\n }\n removeAll() {\n let old = this._registries;\n this._registries = {};\n return old;\n }\n size() {\n return Object.keys(this._registries).length;\n }\n}\n\n","'use strict';\n\nexport function unique(prefix) {\n let count = -1;\n return f => {\n return `${prefix}_${++count}`;\n };\n}\n\nexport function noop() {\n}\n\n\nexport function callbackTimeout(timer, onSuccess, onTimeout) {\n\n let timeout = setTimeout(() => {\n\n onSuccess = noop;\n onTimeout();\n\n }, timer);\n\n return function () {\n clearTimeout(timeout);\n onSuccess.apply(this, arguments);\n };\n}\n\n\nexport function createElementWithID(parent, id, cleanContent = false) {\n var nEl = document.createElement('div');\n nEl.id = id;\n if (cleanContent) {\n parent.innerHTML = '';\n }\n parent.appendChild(nEl);\n return nEl;\n}\n\nexport function isPositiveInt(newVal, oldVal) {\n return !isNaN(parseFloat(newVal)) && isFinite(newVal) && newVal > 0 ? newVal : oldVal;\n}\n\nlet endsWith = (function () {\n if (String.prototype.endsWith) return String.prototype.endsWith;\n return function endsWith (searchString, position) {\n var subjectString = this.toString();\n if (position === undefined || position > subjectString.length) {\n position = subjectString.length;\n }\n position -= searchString.length;\n var lastIndex = subjectString.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n };\n})();\n\nexport function stringEndsWith(string, search) {\n return endsWith.call(string, search);\n}\n\nexport function hideFlashEl(el) {\n // can't use display none or visibility none because will block flash in some browsers\n el.style.position = 'absolute';\n el.style.left = '-1px';\n el.style.top = '-1px';\n el.style.width = '1px';\n el.style.height = '1px';\n}\n","'use strict';\n\nvar METHODS = [\n 'handshakeVersion',\n 'initAd',\n 'startAd',\n 'stopAd',\n 'skipAd', // VPAID 2.0 new method\n 'resizeAd',\n 'pauseAd',\n 'resumeAd',\n 'expandAd',\n 'collapseAd',\n 'subscribe',\n 'unsubscribe'\n];\n\nvar EVENTS = [\n 'AdLoaded',\n 'AdStarted',\n 'AdStopped',\n 'AdSkipped',\n 'AdSkippableStateChange', // VPAID 2.0 new event\n 'AdSizeChange', // VPAID 2.0 new event\n 'AdLinearChange',\n 'AdDurationChange', // VPAID 2.0 new event\n 'AdExpandedChange',\n 'AdRemainingTimeChange', // [Deprecated in 2.0] but will be still fired for backwards compatibility\n 'AdVolumeChange',\n 'AdImpression',\n 'AdVideoStart',\n 'AdVideoFirstQuartile',\n 'AdVideoMidpoint',\n 'AdVideoThirdQuartile',\n 'AdVideoComplete',\n 'AdClickThru',\n 'AdInteraction', // VPAID 2.0 new event\n 'AdUserAcceptInvitation',\n 'AdUserMinimize',\n 'AdUserClose',\n 'AdPaused',\n 'AdPlaying',\n 'AdLog',\n 'AdError'\n];\n\nvar GETTERS = [\n 'getAdLinear',\n 'getAdWidth', // VPAID 2.0 new getter\n 'getAdHeight', // VPAID 2.0 new getter\n 'getAdExpanded',\n 'getAdSkippableState', // VPAID 2.0 new getter\n 'getAdRemainingTime',\n 'getAdDuration', // VPAID 2.0 new getter\n 'getAdVolume',\n 'getAdCompanions', // VPAID 2.0 new getter\n 'getAdIcons' // VPAID 2.0 new getter\n];\n\nvar SETTERS = [\n 'setAdVolume'\n];\n\n\n/**\n * This callback is displayed as global member. The callback use nodejs error-first callback style\n * @callback NodeStyleCallback\n * @param {string|null}\n * @param {undefined|object}\n */\n\n\n/**\n * IVPAIDAdUnit\n *\n * @class\n *\n * @param {object} creative\n * @param {HTMLElement} el\n * @param {HTMLVideoElement} video\n */\nfunction IVPAIDAdUnit(creative, el, video) {}\n\n\n/**\n * handshakeVersion\n *\n * @param {string} VPAIDVersion\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.handshakeVersion = function (VPAIDVersion, callback) {};\n\n/**\n * initAd\n *\n * @param {number} width\n * @param {number} height\n * @param {string} viewMode can be 'normal', 'thumbnail' or 'fullscreen'\n * @param {number} desiredBitrate indicates the desired bitrate in kbps\n * @param {object} [creativeData] used for additional initialization data\n * @param {object} [environmentVars] used for passing implementation-specific of js version\n * @param {NodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.initAd = function(width, height, viewMode, desiredBitrate, creativeData, environmentVars, callback) {};\n\n/**\n * startAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.startAd = function(callback) {};\n\n/**\n * stopAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.stopAd = function(callback) {};\n\n/**\n * skipAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.skipAd = function(callback) {};\n\n/**\n * resizeAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.resizeAd = function(width, height, viewMode, callback) {};\n\n/**\n * pauseAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.pauseAd = function(callback) {};\n\n/**\n * resumeAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.resumeAd = function(callback) {};\n\n/**\n * expandAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.expandAd = function(callback) {};\n\n/**\n * collapseAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.collapseAd = function(callback) {};\n\n/**\n * subscribe\n *\n * @param {string} event\n * @param {nodeStyleCallback} handler\n * @param {object} context\n */\nIVPAIDAdUnit.prototype.subscribe = function(event, handler, context) {};\n\n/**\n * startAd\n *\n * @param {string} event\n * @param {function} handler\n */\nIVPAIDAdUnit.prototype.unsubscribe = function(event, handler) {};\n\n\n\n/**\n * getAdLinear\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdLinear = function(callback) {};\n\n/**\n * getAdWidth\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdWidth = function(callback) {};\n\n/**\n * getAdHeight\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdHeight = function(callback) {};\n\n/**\n * getAdExpanded\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdExpanded = function(callback) {};\n\n/**\n * getAdSkippableState\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdSkippableState = function(callback) {};\n\n/**\n * getAdRemainingTime\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdRemainingTime = function(callback) {};\n\n/**\n * getAdDuration\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdDuration = function(callback) {};\n\n/**\n * getAdVolume\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdVolume = function(callback) {};\n\n/**\n * getAdCompanions\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdCompanions = function(callback) {};\n\n/**\n * getAdIcons\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdIcons = function(callback) {};\n\n/**\n * setAdVolume\n *\n * @param {number} volume\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.setAdVolume = function(volume, callback) {};\n\naddStaticToInterface(IVPAIDAdUnit, 'METHODS', METHODS);\naddStaticToInterface(IVPAIDAdUnit, 'GETTERS', GETTERS);\naddStaticToInterface(IVPAIDAdUnit, 'SETTERS', SETTERS);\naddStaticToInterface(IVPAIDAdUnit, 'EVENTS', EVENTS);\n\n\nvar VPAID1_METHODS = METHODS.filter(function(method) {\n return ['skipAd'].indexOf(method) === -1;\n});\n\naddStaticToInterface(IVPAIDAdUnit, 'checkVPAIDInterface', function checkVPAIDInterface (creative) {\n var result = VPAID1_METHODS.every(function(key) {\n return typeof creative[key] === 'function';\n });\n return result;\n});\n\nmodule.exports = IVPAIDAdUnit;\n\nfunction addStaticToInterface(Interface, name, value) {\n Object.defineProperty(Interface, name, {\n writable: false,\n configurable: false,\n value: value\n });\n}\n\n","'use strict';\n\nvar IVPAIDAdUnit = require('./IVPAIDAdUnit');\nvar Subscriber = require('./subscriber');\nvar checkVPAIDInterface = IVPAIDAdUnit.checkVPAIDInterface;\nvar utils = require('./utils');\nvar METHODS = IVPAIDAdUnit.METHODS;\nvar ERROR = 'AdError';\nvar AD_CLICK = 'AdClickThru';\nvar FILTERED_EVENTS = IVPAIDAdUnit.EVENTS.filter(function (event) {\n return event != AD_CLICK;\n});\n\n/**\n * This callback is displayed as global member. The callback use nodejs error-first callback style\n * @callback NodeStyleCallback\n * @param {string|null}\n * @param {undefined|object}\n */\n\n\n/**\n * VPAIDAdUnit\n * @class\n *\n * @param VPAIDCreative\n * @param {HTMLElement} [el] this will be used in initAd environmentVars.slot if defined\n * @param {HTMLVideoElement} [video] this will be used in initAd environmentVars.videoSlot if defined\n */\nfunction VPAIDAdUnit(VPAIDCreative, el, video, iframe) {\n this._isValid = checkVPAIDInterface(VPAIDCreative);\n if (this._isValid) {\n this._creative = VPAIDCreative;\n this._el = el;\n this._videoEl = video;\n this._iframe = iframe;\n this._subscribers = new Subscriber();\n $addEventsSubscribers.call(this);\n }\n}\n\nVPAIDAdUnit.prototype = Object.create(IVPAIDAdUnit.prototype);\n\n/**\n * isValidVPAIDAd will return if the VPAIDCreative passed in constructor is valid or not\n *\n * @return {boolean}\n */\nVPAIDAdUnit.prototype.isValidVPAIDAd = function isValidVPAIDAd() {\n return this._isValid;\n};\n\nIVPAIDAdUnit.METHODS.forEach(function(method) {\n //NOTE: this methods arguments order are implemented differently from the spec\n var ignores = [\n 'subscribe',\n 'unsubscribe',\n 'initAd'\n ];\n\n if (ignores.indexOf(method) !== -1) return;\n\n VPAIDAdUnit.prototype[method] = function () {\n var ariaty = IVPAIDAdUnit.prototype[method].length;\n // TODO avoid leaking arguments\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n var args = Array.prototype.slice.call(arguments);\n var callback = (ariaty === args.length) ? args.pop() : undefined;\n\n setTimeout(function () {\n var result, error = null;\n try {\n result = this._creative[method].apply(this._creative, args);\n } catch(e) {\n error = e;\n }\n\n callOrTriggerEvent(callback, this._subscribers, error, result);\n }.bind(this), 0);\n };\n});\n\n\n/**\n * initAd concreate implementation\n *\n * @param {number} width\n * @param {number} height\n * @param {string} viewMode can be 'normal', 'thumbnail' or 'fullscreen'\n * @param {number} desiredBitrate indicates the desired bitrate in kbps\n * @param {object} [creativeData] used for additional initialization data\n * @param {object} [environmentVars] used for passing implementation-specific of js version, if el & video was used in constructor slot & videoSlot will be added to the object\n * @param {NodeStyleCallback} callback\n */\nVPAIDAdUnit.prototype.initAd = function initAd(width, height, viewMode, desiredBitrate, creativeData, environmentVars, callback) {\n creativeData = creativeData || {};\n environmentVars = utils.extend({\n slot: this._el,\n videoSlot: this._videoEl\n }, environmentVars || {});\n\n setTimeout(function () {\n var error;\n try {\n this._creative.initAd(width, height, viewMode, desiredBitrate, creativeData, environmentVars);\n } catch (e) {\n error = e;\n }\n\n callOrTriggerEvent(callback, this._subscribers, error);\n }.bind(this), 0);\n};\n\n/**\n * subscribe\n *\n * @param {string} event\n * @param {nodeStyleCallback} handler\n * @param {object} context\n */\nVPAIDAdUnit.prototype.subscribe = function subscribe(event, handler, context) {\n this._subscribers.subscribe(handler, event, context);\n};\n\n\n/**\n * unsubscribe\n *\n * @param {string} event\n * @param {nodeStyleCallback} handler\n */\nVPAIDAdUnit.prototype.unsubscribe = function unsubscribe(event, handler) {\n this._subscribers.unsubscribe(handler, event);\n};\n\n//alias\nVPAIDAdUnit.prototype.on = VPAIDAdUnit.prototype.subscribe;\nVPAIDAdUnit.prototype.off = VPAIDAdUnit.prototype.unsubscribe;\n\nIVPAIDAdUnit.GETTERS.forEach(function(getter) {\n VPAIDAdUnit.prototype[getter] = function (callback) {\n setTimeout(function () {\n\n var result, error = null;\n try {\n result = this._creative[getter]();\n } catch(e) {\n error = e;\n }\n\n callOrTriggerEvent(callback, this._subscribers, error, result);\n }.bind(this), 0);\n };\n});\n\n/**\n * setAdVolume\n *\n * @param volume\n * @param {nodeStyleCallback} callback\n */\nVPAIDAdUnit.prototype.setAdVolume = function setAdVolume(volume, callback) {\n setTimeout(function () {\n\n var result, error = null;\n try {\n this._creative.setAdVolume(volume);\n result = this._creative.getAdVolume();\n } catch(e) {\n error = e;\n }\n\n if (!error) {\n error = utils.validate(result === volume, 'failed to apply volume: ' + volume);\n }\n callOrTriggerEvent(callback, this._subscribers, error, result);\n }.bind(this), 0);\n};\n\nVPAIDAdUnit.prototype._destroy = function destroy() {\n this.stopAd();\n this._subscribers.unsubscribeAll();\n};\n\nfunction $addEventsSubscribers() {\n // some ads implement\n // so they only handle one subscriber\n // to handle this we create our one\n FILTERED_EVENTS.forEach(function (event) {\n this._creative.subscribe($trigger.bind(this, event), event);\n }.bind(this));\n\n // map the click event to be an object instead of depending of the order of the arguments\n // and to be consistent with the flash\n this._creative.subscribe($clickThruHook.bind(this), AD_CLICK);\n\n // because we are adding the element inside the iframe\n // the user is not able to click in the video\n if (this._videoEl) {\n var documentElement = this._iframe.contentDocument.documentElement;\n var videoEl = this._videoEl;\n documentElement.addEventListener('click', function(e) {\n if (e.target === documentElement) {\n videoEl.click();\n }\n });\n }\n}\n\nfunction $clickThruHook(url, id, playerHandles) {\n this._subscribers.triggerSync(AD_CLICK, {url: url, id: id, playerHandles: playerHandles});\n}\n\nfunction $trigger(event) {\n // TODO avoid leaking arguments\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n this._subscribers.trigger(event, Array.prototype.slice(arguments, 1));\n}\n\nfunction callOrTriggerEvent(callback, subscribers, error, result) {\n if (callback) {\n callback(error, result);\n } else if (error) {\n subscribers.trigger(ERROR, error);\n }\n}\n\nmodule.exports = VPAIDAdUnit;\n\n","'use strict';\n\nvar utils = require('./utils');\nvar unique = utils.unique('vpaidIframe');\nvar VPAIDAdUnit = require('./VPAIDAdUnit');\n\nvar defaultTemplate = '' +\n '' +\n '' +\n '
' +\n '' +\n '' +\n '' +\n '';\n\nvar AD_STOPPED = 'AdStopped';\n\n/**\n * This callback is displayed as global member. The callback use nodejs error-first callback style\n * @callback NodeStyleCallback\n * @param {string|null}\n * @param {undefined|object}\n */\n\n/**\n * VPAIDHTML5Client\n * @class\n *\n * @param {HTMLElement} el that will contain the iframe to load adUnit and a el to add to adUnit slot\n * @param {HTMLVideoElement} video default video element to be used by adUnit\n * @param {object} [templateConfig] template: html template to be used instead of the default, extraOptions: to be used when rendering the template\n * @param {object} [vpaidOptions] timeout: when loading adUnit\n */\nfunction VPAIDHTML5Client(el, video, templateConfig, vpaidOptions) {\n templateConfig = templateConfig || {};\n\n this._id = unique();\n this._destroyed = false;\n\n this._frameContainer = utils.createElementInEl(el, 'div');\n this._videoEl = video;\n this._vpaidOptions = vpaidOptions || {timeout: 10000};\n\n this._templateConfig = {\n template: templateConfig.template || defaultTemplate,\n extraOptions: templateConfig.extraOptions || {}\n };\n}\n\n/**\n * destroy\n *\n */\nVPAIDHTML5Client.prototype.destroy = function destroy() {\n if (this._destroyed) {\n return;\n }\n this._destroyed = true;\n $unloadPreviousAdUnit.call(this);\n};\n\n/**\n * isDestroyed\n *\n * @return {boolean}\n */\nVPAIDHTML5Client.prototype.isDestroyed = function isDestroyed() {\n return this._destroyed;\n};\n\n/**\n * loadAdUnit\n *\n * @param {string} adURL url of the js of the adUnit\n * @param {nodeStyleCallback} callback\n */\nVPAIDHTML5Client.prototype.loadAdUnit = function loadAdUnit(adURL, callback) {\n $throwIfDestroyed.call(this);\n $unloadPreviousAdUnit.call(this);\n var that = this;\n\n var frame = utils.createIframeWithContent(\n this._frameContainer,\n this._templateConfig.template,\n utils.extend({\n iframeURL_JS: adURL,\n iframeID: this.getID(),\n origin: getOrigin()\n }, this._templateConfig.extraOptions)\n );\n\n this._frame = frame;\n\n this._onLoad = utils.callbackTimeout(\n this._vpaidOptions.timeout,\n onLoad.bind(this),\n onTimeout.bind(this)\n );\n\n window.addEventListener('message', this._onLoad);\n\n function onLoad (e) {\n /*jshint validthis: false */\n //don't clear timeout\n if (e.origin !== getOrigin()) return;\n var result = JSON.parse(e.data);\n\n //don't clear timeout\n if (result.id !== that.getID()) return;\n\n var adUnit, error, createAd;\n if (!that._frame.contentWindow) {\n\n error = 'the iframe is not anymore in the DOM tree';\n\n } else {\n createAd = that._frame.contentWindow.getVPAIDAd;\n error = utils.validate(typeof createAd === 'function', 'the ad didn\\'t return a function to create an ad');\n }\n\n if (!error) {\n var adEl = that._frame.contentWindow.document.querySelector('.ad-element');\n adUnit = new VPAIDAdUnit(createAd(), adEl, that._videoEl, that._frame);\n adUnit.subscribe(AD_STOPPED, $adDestroyed.bind(that));\n error = utils.validate(adUnit.isValidVPAIDAd(), 'the add is not fully complaint with VPAID specification');\n }\n\n that._adUnit = adUnit;\n $destroyLoadListener.call(that);\n callback(error, error ? null : adUnit);\n\n //clear timeout\n return true;\n }\n\n function onTimeout() {\n callback('timeout', null);\n }\n};\n\n/**\n * unloadAdUnit\n *\n */\nVPAIDHTML5Client.prototype.unloadAdUnit = function unloadAdUnit() {\n $unloadPreviousAdUnit.call(this);\n};\n\n/**\n * getID will return the unique id\n *\n * @return {string}\n */\nVPAIDHTML5Client.prototype.getID = function () {\n return this._id;\n};\n\n\n/**\n * $removeEl\n *\n * @param {string} key\n */\nfunction $removeEl(key) {\n var el = this[key];\n if (el) {\n el.remove();\n delete this[key];\n }\n}\n\nfunction $adDestroyed() {\n $removeAdElements.call(this);\n delete this._adUnit;\n}\n\nfunction $unloadPreviousAdUnit() {\n $removeAdElements.call(this);\n $destroyAdUnit.call(this);\n}\n\nfunction $removeAdElements() {\n $removeEl.call(this, '_frame');\n $destroyLoadListener.call(this);\n}\n\n/**\n * $destroyLoadListener\n *\n */\nfunction $destroyLoadListener() {\n if (this._onLoad) {\n window.removeEventListener('message', this._onLoad);\n utils.clearCallbackTimeout(this._onLoad);\n delete this._onLoad;\n }\n}\n\n\nfunction $destroyAdUnit() {\n if (this._adUnit) {\n this._adUnit.stopAd();\n delete this._adUnit;\n }\n}\n\n/**\n * $throwIfDestroyed\n *\n */\nfunction $throwIfDestroyed() {\n if (this._destroyed) {\n throw new Error ('VPAIDHTML5Client already destroyed!');\n }\n}\n\nfunction getOrigin() {\n if( window.location.origin ) {\n return window.location.origin;\n }\n else {\n return window.location.protocol + \"//\" +\n window.location.hostname +\n (window.location.port ? ':' + window.location.port: '');\n }\n}\n\nmodule.exports = VPAIDHTML5Client;\nwindow.VPAIDHTML5Client = VPAIDHTML5Client;\n\n","'use strict';\n\nfunction Subscriber() {\n this._subscribers = {};\n}\n\nSubscriber.prototype.subscribe = function subscribe(handler, eventName, context) {\n if (!this.isHandlerAttached(handler, eventName)) {\n this.get(eventName).push({handler: handler, context: context, eventName: eventName});\n }\n};\n\nSubscriber.prototype.unsubscribe = function unsubscribe(handler, eventName) {\n this._subscribers[eventName] = this.get(eventName).filter(function (subscriber) {\n return handler !== subscriber.handler;\n });\n};\n\nSubscriber.prototype.unsubscribeAll = function unsubscribeAll() {\n this._subscribers = {};\n};\n\nSubscriber.prototype.trigger = function(eventName, data) {\n var that = this;\n var subscribers = this.get(eventName)\n .concat(this.get('*'));\n\n subscribers.forEach(function (subscriber) {\n setTimeout(function () {\n if (that.isHandlerAttached(subscriber.handler, subscriber.eventName)) {\n subscriber.handler.call(subscriber.context, data);\n }\n }, 0);\n });\n};\n\nSubscriber.prototype.triggerSync = function(eventName, data) {\n var subscribers = this.get(eventName)\n .concat(this.get('*'));\n\n subscribers.forEach(function (subscriber) {\n subscriber.handler.call(subscriber.context, data);\n });\n};\n\nSubscriber.prototype.get = function get(eventName) {\n if (!this._subscribers[eventName]) {\n this._subscribers[eventName] = [];\n }\n return this._subscribers[eventName];\n};\n\nSubscriber.prototype.isHandlerAttached = function isHandlerAttached(handler, eventName) {\n return this.get(eventName).some(function(subscriber) {\n return handler === subscriber.handler;\n })\n};\n\nmodule.exports = Subscriber;\n\n","'use strict';\n\n/**\n * noop a empty function\n */\nfunction noop() {}\n\n/**\n * validate if is not validate will return an Error with the message\n *\n * @param {boolean} isValid\n * @param {string} message\n */\nfunction validate(isValid, message) {\n return isValid ? null : new Error(message);\n}\n\nvar timeouts = {};\n/**\n * clearCallbackTimeout\n *\n * @param {function} func handler to remove\n */\nfunction clearCallbackTimeout(func) {\n var timeout = timeouts[func];\n if (timeout) {\n clearTimeout(timeout);\n delete timeouts[func];\n }\n}\n\n/**\n * callbackTimeout if the onSuccess is not called and returns true in the timelimit then onTimeout will be called\n *\n * @param {number} timer\n * @param {function} onSuccess\n * @param {function} onTimeout\n */\nfunction callbackTimeout(timer, onSuccess, onTimeout) {\n var callback, timeout;\n\n timeout = setTimeout(function () {\n onSuccess = noop;\n delete timeout[callback];\n onTimeout();\n }, timer);\n\n callback = function () {\n // TODO avoid leaking arguments\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n if (onSuccess.apply(this, arguments)) {\n clearCallbackTimeout(callback);\n }\n };\n\n timeouts[callback] = timeout;\n\n return callback;\n}\n\n\n/**\n * createElementInEl\n *\n * @param {HTMLElement} parent\n * @param {string} tagName\n * @param {string} id\n */\nfunction createElementInEl(parent, tagName, id) {\n var nEl = document.createElement(tagName);\n if (id) nEl.id = id;\n parent.appendChild(nEl);\n return nEl;\n}\n\n/**\n * createIframeWithContent\n *\n * @param {HTMLElement} parent\n * @param {string} template simple template using {{var}}\n * @param {object} data\n */\nfunction createIframeWithContent(parent, template, data) {\n var iframe = createIframe(parent, null, data.zIndex);\n if (!setIframeContent(iframe, simpleTemplate(template, data))) return;\n return iframe;\n}\n\n/**\n * createIframe\n *\n * @param {HTMLElement} parent\n * @param {string} url\n */\nfunction createIframe(parent, url, zIndex) {\n var nEl = document.createElement('iframe');\n nEl.src = url || 'about:blank';\n nEl.marginWidth = '0';\n nEl.marginHeight = '0';\n nEl.frameBorder = '0';\n nEl.width = '100%';\n nEl.height = '100%';\n nEl.style.position = 'absolute';\n nEl.style.left = '0';\n nEl.style.top = '0';\n nEl.style.margin = '0px';\n nEl.style.padding = '0px';\n nEl.style.border = 'none';\n\n if(zIndex){\n nEl.style.zIndex = zIndex;\n }\n\n nEl.setAttribute('SCROLLING','NO');\n parent.innerHTML = '';\n parent.appendChild(nEl);\n return nEl;\n}\n\n/**\n * simpleTemplate\n *\n * @param {string} template\n * @param {object} data\n */\nfunction simpleTemplate(template, data) {\n Object.keys(data).forEach(function (key) {\n var value = (typeof value === 'object') ? JSON.stringify(data[key]) : data[key];\n template = template.replace(new RegExp('{{' + key + '}}', 'g'), value);\n });\n return template;\n}\n\n/**\n * setIframeContent\n *\n * @param {HTMLIframeElement} iframeEl\n * @param content\n */\nfunction setIframeContent(iframeEl, content) {\n var iframeDoc = iframeEl.contentWindow && iframeEl.contentWindow.document;\n if (!iframeDoc) return false;\n\n iframeDoc.write(content);\n\n return true;\n}\n\n\n/**\n * extend object with keys from another object\n *\n * @param {object} toExtend\n * @param {object} fromSource\n */\nfunction extend(toExtend, fromSource) {\n Object.keys(fromSource).forEach(function(key) {\n toExtend[key] = fromSource[key];\n });\n return toExtend;\n}\n\n\n/**\n * unique will create a unique string everytime is called, sequentially and prefixed\n *\n * @param {string} prefix\n */\nfunction unique(prefix) {\n var count = -1;\n return function () {\n return prefix + '_' + (++count);\n };\n}\n\nmodule.exports = {\n noop: noop,\n validate: validate,\n clearCallbackTimeout: clearCallbackTimeout,\n callbackTimeout: callbackTimeout,\n createElementInEl: createElementInEl,\n createIframeWithContent: createIframeWithContent,\n createIframe: createIframe,\n simpleTemplate: simpleTemplate,\n setIframeContent: setIframeContent,\n extend: extend,\n unique: unique\n};\n\n","'use strict';\n\nvar InLine = require('./InLine');\nvar Wrapper = require('./Wrapper');\n\nfunction Ad(adJTree) {\n if (!(this instanceof Ad)) {\n return new Ad(adJTree);\n }\n this.initialize(adJTree);\n}\n\nAd.prototype.initialize = function(adJTree) {\n this.id = adJTree.attr('id');\n this.sequence = adJTree.attr('sequence');\n\n if(adJTree.inLine) {\n this.inLine = new InLine(adJTree.inLine);\n }\n\n if(adJTree.wrapper){\n this.wrapper = new Wrapper(adJTree.wrapper);\n }\n};\n\nmodule.exports = Ad;","'use strict';\n\nvar TrackingEvent = require('./TrackingEvent');\n\nvar utilities = require('../../utils/utilityFunctions');\n\nvar xml = require('../../utils/xml');\n\n\nfunction Companion(companionJTree) {\n if (!(this instanceof Companion)) {\n return new Companion(companionJTree);\n }\n\n //Required Elements\n this.creativeType = xml.attr(companionJTree.staticResource, 'creativeType');\n this.staticResource = xml.keyValue(companionJTree.staticResource);\n\n // Weird bug when the JXON tree is built it doesn't handle casing properly in this situation...\n var htmlResource = null;\n if (xml.keyValue(companionJTree.HTMLResource)) {\n htmlResource = xml.keyValue(companionJTree.HTMLResource);\n } else if (xml.keyValue(companionJTree.hTMLResource)) {\n htmlResource = xml.keyValue(companionJTree.hTMLResource);\n }\n this.htmlResource = htmlResource;\n\n var iframeResource = null;\n if (xml.keyValue(companionJTree.IFrameResource)) {\n iframeResource = xml.keyValue(companionJTree.IFrameResource);\n } else if (xml.keyValue(companionJTree.iFrameresource)) {\n iframeResource = xml.keyValue(companionJTree.iFrameresource);\n }\n this.iframeResource = iframeResource;\n\n //Optional fields\n this.id = xml.attr(companionJTree, 'id');\n this.width = xml.attr(companionJTree, 'width');\n this.height = xml.attr(companionJTree, 'height');\n this.expandedWidth = xml.attr(companionJTree, 'expandedWidth');\n this.expandedHeight = xml.attr(companionJTree, 'expandedHeight');\n this.scalable = xml.attr(companionJTree, 'scalable');\n this.maintainAspectRatio = xml.attr(companionJTree, 'maintainAspectRatio');\n this.minSuggestedDuration = xml.attr(companionJTree, 'minSuggestedDuration');\n this.apiFramework = xml.attr(companionJTree, 'apiFramework');\n this.companionClickThrough = xml.keyValue(companionJTree.companionClickThrough);\n this.trackingEvents = parseTrackingEvents(companionJTree.trackingEvents && companionJTree.trackingEvents.tracking);\n\n /*** Local functions ***/\n function parseTrackingEvents(trackingEvents) {\n var trackings = [];\n if (utilities.isDefined(trackingEvents)) {\n trackingEvents = utilities.isArray(trackingEvents) ? trackingEvents : [trackingEvents];\n trackingEvents.forEach(function (trackingData) {\n trackings.push(new TrackingEvent(trackingData));\n });\n }\n return trackings;\n }\n}\n\nmodule.exports = Companion;","'use strict';\n\nvar Linear = require('./Linear');\nvar Companion = require('./Companion');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction Creative(creativeJTree) {\n if(!(this instanceof Creative)) {\n return new Creative(creativeJTree);\n }\n\n this.id = creativeJTree.attr('id');\n this.sequence = creativeJTree.attr('sequence');\n this.adId = creativeJTree.attr('adId');\n this.apiFramework = creativeJTree.attr('apiFramework');\n\n if(creativeJTree.linear) {\n this.linear = new Linear(creativeJTree.linear);\n }\n\n if (creativeJTree.companionAds) {\n var companions = [];\n var companionAds = creativeJTree.companionAds && creativeJTree.companionAds.companion;\n if (utilities.isDefined(companionAds)) {\n companionAds = utilities.isArray(companionAds) ? companionAds : [companionAds];\n companionAds.forEach(function (companionData) {\n companions.push(new Companion(companionData));\n });\n }\n this.companionAds = companions;\n }\n}\n\n/**\n * Returns true if the browser supports at the creative.\n */\nCreative.prototype.isSupported = function(){\n if(this.linear) {\n return this.linear.isSupported();\n }\n\n return true;\n};\n\nCreative.parseCreatives = function parseCreatives(creativesJTree) {\n var creatives = [];\n var creativesData;\n if (utilities.isDefined(creativesJTree) && utilities.isDefined(creativesJTree.creative)) {\n creativesData = utilities.isArray(creativesJTree.creative) ? creativesJTree.creative : [creativesJTree.creative];\n creativesData.forEach(function (creative) {\n creatives.push(new Creative(creative));\n });\n }\n return creatives;\n};\n\nmodule.exports = Creative;\n","'use strict';\n\nvar vastUtil = require('./vastUtil');\nvar Creative = require('./Creative');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nfunction InLine(inlineJTree) {\n if (!(this instanceof InLine)) {\n return new InLine(inlineJTree);\n }\n\n //Required Fields\n this.adTitle = xml.keyValue(inlineJTree.adTitle);\n this.adSystem = xml.keyValue(inlineJTree.adSystem);\n this.impressions = vastUtil.parseImpressions(inlineJTree.impression);\n this.creatives = Creative.parseCreatives(inlineJTree.creatives);\n\n //Optional Fields\n this.description = xml.keyValue(inlineJTree.description);\n this.advertiser = xml.keyValue(inlineJTree.advertiser);\n this.surveys = parseSurveys(inlineJTree.survey);\n this.error = xml.keyValue(inlineJTree.error);\n this.pricing = xml.keyValue(inlineJTree.pricing);\n this.extensions = inlineJTree.extensions;\n\n /*** Local Functions ***/\n function parseSurveys(inlineSurveys) {\n if (inlineSurveys) {\n return utilities.transformArray(utilities.isArray(inlineSurveys) ? inlineSurveys : [inlineSurveys], function (survey) {\n if(utilities.isNotEmptyString(survey.keyValue)){\n return {\n uri: survey.keyValue,\n type: survey.attr('type')\n };\n }\n\n return undefined;\n });\n }\n return [];\n }\n}\n\n\n/**\n * Returns true if the browser supports all the creatives.\n */\nInLine.prototype.isSupported = function(){\n var i,len;\n\n if(this.creatives.length === 0) {\n return false;\n }\n\n for(i = 0, len = this.creatives.length; i< len; i+=1){\n if(!this.creatives[i].isSupported()){\n return false;\n }\n }\n return true;\n};\n\nmodule.exports = InLine;\n","'use strict';\n\nvar TrackingEvent = require('./TrackingEvent');\nvar MediaFile = require('./MediaFile');\nvar VideoClicks = require('./VideoClicks');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar parsers = require('./parsers');\n\nvar xml = require('../../utils/xml');\n\n\nfunction Linear(linearJTree) {\n if (!(this instanceof Linear)) {\n return new Linear(linearJTree);\n }\n\n //Required Elements\n this.duration = parsers.duration(xml.keyValue(linearJTree.duration));\n this.mediaFiles = parseMediaFiles(linearJTree.mediaFiles && linearJTree.mediaFiles.mediaFile);\n\n //Optional fields\n this.trackingEvents = parseTrackingEvents(linearJTree.trackingEvents && linearJTree.trackingEvents.tracking, this.duration);\n this.skipoffset = parsers.offset(xml.attr(linearJTree, 'skipoffset'), this.duration);\n\n if (linearJTree.videoClicks) {\n this.videoClicks = new VideoClicks(linearJTree.videoClicks);\n }\n\n if(linearJTree.adParameters) {\n this.adParameters = xml.keyValue(linearJTree.adParameters);\n\n if(xml.attr(linearJTree.adParameters, 'xmlEncoded')){\n this.adParameters = xml.decode(this.adParameters);\n }\n }\n\n /*** Local functions ***/\n function parseTrackingEvents(trackingEvents, duration) {\n var trackings = [];\n if (utilities.isDefined(trackingEvents)) {\n trackingEvents = utilities.isArray(trackingEvents) ? trackingEvents : [trackingEvents];\n trackingEvents.forEach(function (trackingData) {\n trackings.push(new TrackingEvent(trackingData, duration));\n });\n }\n return trackings;\n }\n\n function parseMediaFiles(mediaFilesJxonTree) {\n var mediaFiles = [];\n if (utilities.isDefined(mediaFilesJxonTree)) {\n mediaFilesJxonTree = utilities.isArray(mediaFilesJxonTree) ? mediaFilesJxonTree : [mediaFilesJxonTree];\n\n mediaFilesJxonTree.forEach(function (mfData) {\n mediaFiles.push(new MediaFile(mfData));\n });\n }\n return mediaFiles;\n }\n}\n\n/**\n * Must return true if at least one of the MediaFiles' type is supported\n */\nLinear.prototype.isSupported = function () {\n var i, len;\n for(i=0, len=this.mediaFiles.length; i 0) {\n getAd(waterfallAds.shift(),[], waterfallHandler);\n } else {\n callback(error, adChain);\n }\n } else {\n callback(null, adChain);\n }\n }\n });\n\n /*** Local functions ***/\n function getAdWaterfall(adTagUrl, callback) {\n var requestVastXML = that._requestVASTXml.bind(that, adTagUrl);\n async.waterfall([\n requestVastXML,\n buildVastWaterfall\n ], callback);\n }\n\n function buildVastWaterfall(xmlStr, callback) {\n var vastTree;\n try {\n vastTree = xml.toJXONTree(xmlStr);\n\n if(utilities.isArray(vastTree.ad)) {\n vastTree.ads = vastTree.ad;\n } else if(vastTree.ad){\n vastTree.ads = [vastTree.ad];\n } else {\n vastTree.ads = [];\n }\n callback(validateVASTTree(vastTree), vastTree);\n\n } catch (e) {\n callback(new VASTError(\"on VASTClient.getVASTAd.buildVastWaterfall, error parsing xml\", 100), null);\n }\n }\n\n function validateVASTTree(vastTree) {\n var vastVersion = xml.attr(vastTree, 'version');\n\n if (!vastTree.ad) {\n return new VASTError('on VASTClient.getVASTAd.validateVASTTree, no Ad in VAST tree', 303);\n }\n\n if (vastVersion && (vastVersion != 3 && vastVersion != 2)) {\n return new VASTError('on VASTClient.getVASTAd.validateVASTTree, not supported VAST version \"' + vastVersion + '\"', 102);\n }\n\n return null;\n }\n\n function getAd(adTagUrl, adChain, callback) {\n if (adChain.length >= that.WRAPPER_LIMIT) {\n return callback(new VASTError(\"on VASTClient.getVASTAd.getAd, players wrapper limit reached (the limit is \" + that.WRAPPER_LIMIT + \")\", 302), adChain);\n }\n\n async.waterfall([\n function (next) {\n if (utilities.isString(adTagUrl)) {\n requestVASTAd(adTagUrl, next);\n } else {\n next(null, adTagUrl);\n }\n },\n buildAd\n ], function (error, ad) {\n if (ad) {\n adChain.push(ad);\n }\n\n if (error) {\n return callback(error, adChain);\n }\n\n if (ad.wrapper) {\n return getAd(ad.wrapper.VASTAdTagURI, adChain, callback);\n }\n\n return callback(null, adChain);\n });\n }\n\n function buildAd(adJxonTree, callback) {\n try {\n var ad = new Ad(adJxonTree);\n callback(validateAd(ad), ad);\n } catch (e) {\n callback(new VASTError('on VASTClient.getVASTAd.buildAd, error parsing xml', 100), null);\n }\n }\n\n function validateAd(ad) {\n var wrapper = ad.wrapper;\n var inLine = ad.inLine;\n var errMsgPrefix = 'on VASTClient.getVASTAd.validateAd, ';\n\n if (inLine && wrapper) {\n return new VASTError(errMsgPrefix +\"InLine and Wrapper both found on the same Ad\", 101);\n }\n\n if (!inLine && !wrapper) {\n return new VASTError(errMsgPrefix + \"nor wrapper nor inline elements found on the Ad\", 101);\n }\n\n if (inLine && !inLine.isSupported()) {\n return new VASTError(errMsgPrefix + \"could not find MediaFile that is supported by this video player\", 403);\n }\n\n if (wrapper && !wrapper.VASTAdTagURI) {\n return new VASTError(errMsgPrefix + \"missing 'VASTAdTagURI' in wrapper\", 101);\n }\n\n return null;\n }\n\n function requestVASTAd(adTagUrl, callback) {\n that._requestVASTXml(adTagUrl, function (error, xmlStr) {\n if (error) {\n return callback(error);\n }\n try {\n var vastTree = xml.toJXONTree(xmlStr);\n callback(validateVASTTree(vastTree), vastTree.ad);\n } catch (e) {\n callback(new VASTError(\"on VASTClient.getVASTAd.requestVASTAd, error parsing xml\", 100));\n }\n });\n }\n};\n\nVASTClient.prototype._requestVASTXml = function requestVASTXml(adTagUrl, callback) {\n try {\n if (utilities.isFunction(adTagUrl)) {\n adTagUrl(requestHandler);\n } else {\n http.get(adTagUrl, requestHandler, {\n withCredentials: true\n });\n }\n } catch (e) {\n callback(e);\n }\n\n /*** Local functions ***/\n function requestHandler(error, response, status) {\n if (error) {\n var errMsg = utilities.isDefined(status) ?\n \"on VASTClient.requestVastXML, HTTP request error with status '\" + status + \"'\" :\n \"on VASTClient.requestVastXML, Error getting the the VAST XML with he passed adTagXML fn\";\n return callback(new VASTError(errMsg, 301), null);\n }\n\n callback(null, response);\n }\n};\n\nVASTClient.prototype._buildVASTResponse = function buildVASTResponse(adsChain) {\n var response = new VASTResponse();\n addAdsToResponse(response, adsChain);\n validateResponse(response);\n\n return response;\n\n //*** Local function ****\n function addAdsToResponse(response, ads) {\n ads.forEach(function (ad) {\n response.addAd(ad);\n });\n }\n\n function validateResponse(response) {\n var progressEvents = response.trackingEvents.progress;\n\n if (!response.hasLinear()) {\n throw new VASTError(\"on VASTClient._buildVASTResponse, Received an Ad type that is not supported\", 200);\n }\n\n if (response.duration === undefined) {\n throw new VASTError(\"on VASTClient._buildVASTResponse, Missing duration field in VAST response\", 101);\n }\n\n if (progressEvents) {\n progressEvents.forEach(function (progressEvent) {\n if (!utilities.isNumber(progressEvent.offset)) {\n throw new VASTError(\"on VASTClient._buildVASTResponse, missing or wrong offset attribute on progress tracking event\", 101);\n }\n });\n }\n }\n};\n\nVASTClient.prototype._trackError = function (error, adChain) {\n if (!utilities.isArray(adChain) || adChain.length === 0) { //There is nothing to track\n return;\n }\n\n var errorURLMacros = [];\n adChain.forEach(addErrorUrlMacros);\n vastUtil.track(errorURLMacros, {ERRORCODE: error.code || 900}); //900 <== Undefined error\n\n /*** Local functions ***/\n function addErrorUrlMacros(ad) {\n if (ad.wrapper && ad.wrapper.error) {\n errorURLMacros.push(ad.wrapper.error);\n }\n\n if (ad.inLine && ad.inLine.error) {\n errorURLMacros.push(ad.inLine.error);\n }\n }\n};\n\nmodule.exports = VASTClient;\n","'use strict';\n\nfunction VASTError(message, code) {\n this.message = 'VAST Error: ' + (message || '');\n if (code) {\n this.code = code;\n }\n}\n\nVASTError.prototype = new Error();\nVASTError.prototype.name = \"VAST Error\";\n\nmodule.exports = VASTError;","'use strict';\n\n/**\n * Inner helper class that deals with the logic of the individual steps needed to setup an ad in the player.\n *\n * @param player {object} instance of the player that will play the ad. It assumes that the videojs-contrib-ads plugin\n * has been initialized when you use its utility functions.\n *\n * @constructor\n */\n\nvar VASTResponse = require('./VASTResponse');\nvar VASTError = require('./VASTError');\nvar VASTTracker = require('./VASTTracker');\nvar vastUtil = require('./vastUtil');\n\nvar async = require('../../utils/async');\nvar dom = require('../../utils/dom');\nvar playerUtils = require('../../utils/playerUtils');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VASTIntegrator(player) {\n if (!(this instanceof VASTIntegrator)) {\n return new VASTIntegrator(player);\n }\n\n this.player = player;\n}\n\nVASTIntegrator.prototype.playAd = function playAd(vastResponse, callback) {\n var that = this;\n callback = callback || utilities.noop;\n\n if (!(vastResponse instanceof VASTResponse)) {\n return callback(new VASTError('On VASTIntegrator, missing required VASTResponse'));\n }\n\n async.waterfall([\n function (next) {\n next(null, vastResponse);\n },\n this._selectAdSource.bind(this),\n this._createVASTTracker.bind(this),\n this._addClickThrough.bind(this),\n this._addSkipButton.bind(this),\n this._setupEvents.bind(this),\n this._playSelectedAd.bind(this)\n ], function (error, response) {\n if (error && response) {\n that._trackError(error, response);\n }\n callback(error, response);\n });\n\n this._adUnit = {\n _src: null,\n type: 'VAST',\n pauseAd: function () {\n that.player.pause(true);\n },\n\n resumeAd: function () {\n that.player.play(true);\n },\n\n isPaused: function () {\n return that.player.paused(true);\n },\n\n getSrc: function () {\n return this._src;\n }\n };\n\n return this._adUnit;\n};\n\nVASTIntegrator.prototype._selectAdSource = function selectAdSource(response, callback) {\n var source;\n\n var playerWidth = dom.getDimension(this.player.el()).width;\n response.mediaFiles.sort(function compareTo(a, b) {\n var deltaA = Math.abs(playerWidth - a.width);\n var deltaB = Math.abs(playerWidth - b.width);\n return deltaA - deltaB;\n });\n\n source = this.player.selectSource(response.mediaFiles).source;\n\n if (source) {\n if (this._adUnit) {\n this._adUnit._src = source;\n }\n return callback(null, source, response);\n }\n\n // code 403 <== Couldn't find MediaFile that is supported by this video player\n callback(new VASTError(\"Could not find Ad mediafile supported by this player\", 403), response);\n};\n\nVASTIntegrator.prototype._createVASTTracker = function createVASTTracker(adMediaFile, response, callback) {\n try {\n callback(null, adMediaFile, new VASTTracker(adMediaFile.src, response), response);\n } catch (e) {\n callback(e, response);\n }\n};\n\nVASTIntegrator.prototype._setupEvents = function setupEvents(adMediaFile, tracker, response, callback) {\n var previouslyMuted;\n var player = this.player;\n player.on('fullscreenchange', trackFullscreenChange);\n player.on('vast.adStart', trackImpressions);\n player.on('pause', trackPause);\n player.on('timeupdate', trackProgress);\n player.on('volumechange', trackVolumeChange);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], unbindEvents);\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel', 'vast.adSkip'], function(evt){\n if(evt.type === 'vast.adEnd'){\n tracker.trackComplete();\n }\n });\n\n return callback(null, adMediaFile, response);\n\n /*** Local Functions ***/\n function unbindEvents() {\n player.off('fullscreenchange', trackFullscreenChange);\n player.off('vast.adStart', trackImpressions);\n player.off('pause', trackPause);\n player.off('timeupdate', trackProgress);\n player.off('volumechange', trackVolumeChange);\n }\n\n function trackFullscreenChange() {\n if (player.isFullscreen()) {\n tracker.trackFullscreen();\n } else {\n tracker.trackExitFullscreen();\n }\n }\n\n function trackPause() {\n //NOTE: whenever a video ends the video Element triggers a 'pause' event before the 'ended' event.\n // We should not track this pause event because it makes the VAST tracking confusing again we use a\n // Threshold of 2 seconds to prevent false positives on IOS.\n if (Math.abs(player.duration() - player.currentTime()) < 2) {\n return;\n }\n\n tracker.trackPause();\n playerUtils.once(player, ['play', 'vast.adEnd', 'vast.adsCancel'], function (evt) {\n if(evt.type === 'play'){\n tracker.trackResume();\n }\n });\n }\n\n function trackProgress() {\n var currentTimeInMs = player.currentTime() * 1000;\n tracker.trackProgress(currentTimeInMs);\n }\n\n function trackImpressions() {\n tracker.trackImpressions();\n tracker.trackCreativeView();\n }\n\n function trackVolumeChange() {\n var muted = player.muted();\n if (muted) {\n tracker.trackMute();\n } else if (previouslyMuted) {\n tracker.trackUnmute();\n }\n previouslyMuted = muted;\n }\n};\n\nVASTIntegrator.prototype._addSkipButton = function addSkipButton(source, tracker, response, callback) {\n var skipOffsetInSec;\n var that = this;\n\n if (utilities.isNumber(response.skipoffset)) {\n skipOffsetInSec = response.skipoffset / 1000;\n addSkipButtonToPlayer(this.player, skipOffsetInSec);\n }\n callback(null, source, tracker, response);\n\n /*** Local function ***/\n function addSkipButtonToPlayer(player, skipOffset) {\n var skipButton = createSkipButton(player);\n var updateSkipButton = updateSkipButtonState.bind(that, skipButton, skipOffset, player);\n\n player.el().appendChild(skipButton);\n player.on('timeupdate', updateSkipButton);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeSkipButton);\n\n function removeSkipButton() {\n player.off('timeupdate', updateSkipButton);\n dom.remove(skipButton);\n }\n }\n\n function createSkipButton(player) {\n var skipButton = window.document.createElement(\"div\");\n dom.addClass(skipButton, \"vast-skip-button\");\n\n skipButton.onclick = function (e) {\n if (dom.hasClass(skipButton, 'enabled')) {\n tracker.trackSkip();\n player.trigger('vast.adSkip');\n }\n\n //We prevent event propagation to avoid problems with the clickThrough and so on\n if (window.Event.prototype.stopPropagation !== undefined) {\n e.stopPropagation();\n } else {\n return false;\n }\n };\n\n return skipButton;\n }\n\n function updateSkipButtonState(skipButton, skipOffset, player) {\n var timeLeft = Math.ceil(skipOffset - player.currentTime());\n if (timeLeft > 0) {\n skipButton.innerHTML = \"Skip in \" + utilities.toFixedDigits(timeLeft, 2) + \"...\";\n } else {\n if (!dom.hasClass(skipButton, 'enabled')) {\n dom.addClass(skipButton, 'enabled');\n skipButton.innerHTML = \"Skip ad\";\n }\n }\n }\n};\n\nVASTIntegrator.prototype._addClickThrough = function addClickThrough(mediaFile, tracker, response, callback) {\n var player = this.player;\n var blocker = createClickThroughBlocker(player, tracker, response);\n var updateBlocker = updateBlockerURL.bind(this, blocker, response, player);\n\n player.el().insertBefore(blocker, player.controlBar.el());\n player.on('timeupdate', updateBlocker);\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeBlocker);\n\n return callback(null, mediaFile, tracker, response);\n\n /*** Local Functions ***/\n\n function createClickThroughBlocker(player, tracker, response) {\n var blocker = window.document.createElement(\"a\");\n var clickThroughMacro = response.clickThrough;\n\n dom.addClass(blocker, 'vast-blocker');\n blocker.href = generateClickThroughURL(clickThroughMacro, player);\n\n if (utilities.isString(clickThroughMacro)) {\n blocker.target = \"_blank\";\n }\n\n blocker.onclick = function (e) {\n if (player.paused()) {\n player.play();\n\n //We prevent event propagation to avoid problems with the player's normal pause mechanism\n if (window.Event.prototype.stopPropagation !== undefined) {\n e.stopPropagation();\n }\n return false;\n }\n\n player.pause();\n tracker.trackClick();\n };\n\n return blocker;\n }\n\n function updateBlockerURL(blocker, response, player) {\n blocker.href = generateClickThroughURL(response.clickThrough, player);\n }\n\n function generateClickThroughURL(clickThroughMacro, player) {\n var variables = {\n ASSETURI: mediaFile.src,\n CONTENTPLAYHEAD: vastUtil.formatProgress(player.currentTime() * 1000)\n };\n\n return clickThroughMacro ? vastUtil.parseURLMacro(clickThroughMacro, variables) : '#';\n }\n\n function removeBlocker() {\n player.off('timeupdate', updateBlocker);\n dom.remove(blocker);\n }\n};\n\nVASTIntegrator.prototype._playSelectedAd = function playSelectedAd(source, response, callback) {\n var player = this.player;\n\n player.preload(\"auto\"); //without preload=auto the durationchange event is never fired\n player.src(source);\n\n playerUtils.once(player, ['durationchange', 'error', 'vast.adsCancel'], function (evt) {\n if (evt.type === 'durationchange') {\n playAd();\n } else if(evt.type === 'error') {\n callback(new VASTError(\"on VASTIntegrator, Player is unable to play the Ad\", 400), response);\n }\n //NOTE: If the ads get canceled we do nothing/\n });\n\n /**** local functions ******/\n function playAd() {\n\n playerUtils.once(player, ['playing', 'vast.adsCancel'], function (evt) {\n if(evt.type === 'vast.adsCancel'){\n return;\n }\n\n player.trigger('vast.adStart');\n\n player.on('ended', proceed);\n player.on('vast.adsCancel', proceed);\n player.on('vast.adSkip', proceed);\n\n function proceed(evt) {\n\n if(evt.type === 'ended' && (player.duration() - player.currentTime()) > 3 ) {\n // Ignore ended event if the Ad time was not 'near' the end\n // avoids issues where IOS controls could skip the Ad\n return;\n }\n\n player.off('ended', proceed);\n player.off('vast.adsCancel', proceed);\n player.off('vast.adSkip', proceed);\n\n //NOTE: if the ads get cancel we do nothing apart removing the listners\n if(evt.type === 'ended' || evt.type === 'vast.adSkip'){\n callback(null, response);\n }\n }\n });\n\n player.play();\n }\n};\n\nVASTIntegrator.prototype._trackError = function trackError(error, response) {\n vastUtil.track(response.errorURLMacros, {ERRORCODE: error.code || 900});\n};\n\nmodule.exports = VASTIntegrator;","'use strict';\n\nvar Ad = require('./Ad');\nvar VideoClicks = require('./VideoClicks');\nvar Linear = require('./Linear');\nvar InLine = require('./InLine');\nvar Wrapper = require('./Wrapper');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nwindow.InLine__A = InLine;\nfunction VASTResponse() {\n if (!(this instanceof VASTResponse)) {\n return new VASTResponse();\n }\n\n this._linearAdded = false;\n this.ads = [];\n this.errorURLMacros = [];\n this.impressions = [];\n this.clickTrackings = [];\n this.customClicks = [];\n this.trackingEvents = {};\n this.mediaFiles = [];\n this.clickThrough = undefined;\n this.adTitle = '';\n this.duration = undefined;\n this.skipoffset = undefined;\n}\n\nVASTResponse.prototype.addAd = function (ad) {\n var inLine, wrapper;\n if (ad instanceof Ad) {\n inLine = ad.inLine;\n wrapper = ad.wrapper;\n\n this.ads.push(ad);\n\n if (inLine) {\n this._addInLine(inLine);\n }\n\n if (wrapper) {\n this._addWrapper(wrapper);\n }\n }\n};\n\nVASTResponse.prototype._addErrorTrackUrl = function (error) {\n var errorURL = error instanceof xml.JXONTree ? xml.keyValue(error) : error;\n if (errorURL) {\n this.errorURLMacros.push(errorURL);\n }\n};\n\nVASTResponse.prototype._addImpressions = function (impressions) {\n utilities.isArray(impressions) && appendToArray(this.impressions, impressions);\n};\n\nVASTResponse.prototype._addClickThrough = function (clickThrough) {\n if (utilities.isNotEmptyString(clickThrough)) {\n this.clickThrough = clickThrough;\n }\n};\n\nVASTResponse.prototype._addClickTrackings = function (clickTrackings) {\n utilities.isArray(clickTrackings) && appendToArray(this.clickTrackings, clickTrackings);\n};\n\nVASTResponse.prototype._addCustomClicks = function (customClicks) {\n utilities.isArray(customClicks) && appendToArray(this.customClicks, customClicks);\n};\n\nVASTResponse.prototype._addTrackingEvents = function (trackingEvents) {\n var eventsMap = this.trackingEvents;\n\n if (trackingEvents) {\n trackingEvents = utilities.isArray(trackingEvents) ? trackingEvents : [trackingEvents];\n trackingEvents.forEach(function (trackingEvent) {\n if (!eventsMap[trackingEvent.name]) {\n eventsMap[trackingEvent.name] = [];\n }\n eventsMap[trackingEvent.name].push(trackingEvent);\n });\n }\n};\n\nVASTResponse.prototype._addTitle = function (title) {\n if (utilities.isNotEmptyString(title)) {\n this.adTitle = title;\n }\n};\n\nVASTResponse.prototype._addDuration = function (duration) {\n if (utilities.isNumber(duration)) {\n this.duration = duration;\n }\n};\n\nVASTResponse.prototype._addVideoClicks = function (videoClicks) {\n if (videoClicks instanceof VideoClicks) {\n this._addClickThrough(videoClicks.clickThrough);\n this._addClickTrackings(videoClicks.clickTrackings);\n this._addCustomClicks(videoClicks.customClicks);\n }\n};\n\nVASTResponse.prototype._addMediaFiles = function (mediaFiles) {\n utilities.isArray(mediaFiles) && appendToArray(this.mediaFiles, mediaFiles);\n};\n\nVASTResponse.prototype._addSkipoffset = function (offset) {\n if (offset) {\n this.skipoffset = offset;\n }\n};\n\nVASTResponse.prototype._addAdParameters = function (adParameters) {\n if (adParameters) {\n this.adParameters = adParameters;\n }\n};\n\nVASTResponse.prototype._addLinear = function (linear) {\n if (linear instanceof Linear) {\n this._addDuration(linear.duration);\n this._addTrackingEvents(linear.trackingEvents);\n this._addVideoClicks(linear.videoClicks);\n this._addMediaFiles(linear.mediaFiles);\n this._addSkipoffset(linear.skipoffset);\n this._addAdParameters(linear.adParameters);\n this._linearAdded = true;\n }\n};\n\nVASTResponse.prototype._addInLine = function (inLine) {\n var that = this;\n\n if (inLine instanceof InLine) {\n this._addTitle(inLine.adTitle);\n this._addErrorTrackUrl(inLine.error);\n this._addImpressions(inLine.impressions);\n\n inLine.creatives.forEach(function (creative) {\n if (creative.linear) {\n that._addLinear(creative.linear);\n }\n });\n }\n};\n\nVASTResponse.prototype._addWrapper = function (wrapper) {\n var that = this;\n\n if (wrapper instanceof Wrapper) {\n this._addErrorTrackUrl(wrapper.error);\n this._addImpressions(wrapper.impressions);\n\n wrapper.creatives.forEach(function (creative) {\n var linear = creative.linear;\n if (linear) {\n that._addVideoClicks(linear.videoClicks);\n that.clickThrough = undefined;//We ensure that no clickThrough has been added\n that._addTrackingEvents(linear.trackingEvents);\n }\n });\n }\n};\n\nVASTResponse.prototype.hasLinear = function(){\n return this._linearAdded;\n};\n\nfunction appendToArray(array, items) {\n items.forEach(function (item) {\n array.push(item);\n });\n}\n\nmodule.exports = VASTResponse;\n\n","'use strict';\n\nvar VASTError = require('./VASTError');\nvar VASTResponse = require('./VASTResponse');\nvar vastUtil = require('./vastUtil');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VASTTracker(assetURI, vastResponse) {\n if (!(this instanceof VASTTracker)) {\n return new VASTTracker(assetURI, vastResponse);\n }\n\n this.sanityCheck(assetURI, vastResponse);\n this.initialize(assetURI, vastResponse);\n\n}\n\nVASTTracker.prototype.initialize = function(assetURI, vastResponse) {\n this.response = vastResponse;\n this.assetURI = assetURI;\n this.progress = 0;\n this.quartiles = {\n firstQuartile: {tracked: false, time: Math.round(25 * vastResponse.duration) / 100},\n midpoint: {tracked: false, time: Math.round(50 * vastResponse.duration) / 100},\n thirdQuartile: {tracked: false, time: Math.round(75 * vastResponse.duration) / 100}\n };\n};\n\nVASTTracker.prototype.sanityCheck = function(assetURI, vastResponse) {\n if (!utilities.isString(assetURI) || utilities.isEmptyString(assetURI)) {\n throw new VASTError('on VASTTracker constructor, missing required the URI of the ad asset being played');\n }\n\n if (!(vastResponse instanceof VASTResponse)) {\n throw new VASTError('on VASTTracker constructor, missing required VAST response');\n }\n};\n\nVASTTracker.prototype.trackURLs = function trackURLs(urls, variables) {\n if (utilities.isArray(urls) && urls.length > 0) {\n variables = utilities.extend({\n ASSETURI: this.assetURI,\n CONTENTPLAYHEAD: vastUtil.formatProgress(this.progress)\n }, variables || {});\n\n vastUtil.track(urls, variables);\n }\n};\n\nVASTTracker.prototype.trackEvent = function trackEvent(eventName, trackOnce) {\n this.trackURLs(getEventUris(this.response.trackingEvents[eventName]));\n if (trackOnce) {\n this.response.trackingEvents[eventName] = undefined;\n }\n\n /*** Local function ***/\n function getEventUris(trackingEvents) {\n var uris;\n\n if (trackingEvents) {\n uris = [];\n trackingEvents.forEach(function (event) {\n uris.push(event.uri);\n });\n }\n return uris;\n }\n};\n\nVASTTracker.prototype.trackProgress = function trackProgress(newProgressInMs) {\n var that = this;\n var events = [];\n var ONCE = true;\n var ALWAYS = false;\n var trackingEvents = this.response.trackingEvents;\n\n if (utilities.isNumber(newProgressInMs)) {\n addTrackEvent('start', ONCE, newProgressInMs > 0);\n addTrackEvent('rewind', ALWAYS, hasRewound(this.progress, newProgressInMs));\n addQuartileEvents(newProgressInMs);\n trackProgressEvents(newProgressInMs);\n trackEvents();\n this.progress = newProgressInMs;\n }\n\n /*** Local function ***/\n function hasRewound(currentProgress, newProgress) {\n var REWIND_THRESHOLD = 3000; //IOS video clock is very unreliable and we need a 3 seconds threshold to ensure that there was a rewind an that it was on purpose.\n return currentProgress > newProgressInMs && Math.abs(newProgress - currentProgress) > REWIND_THRESHOLD;\n }\n\n function addTrackEvent(eventName, trackOnce, canBeAdded) {\n if (trackingEvents[eventName] && canBeAdded) {\n events.push({\n name: eventName,\n trackOnce: !!trackOnce\n });\n }\n }\n\n function addQuartileEvents(progress) {\n var quartiles = that.quartiles;\n var firstQuartile = that.quartiles.firstQuartile;\n var midpoint = that.quartiles.midpoint;\n var thirdQuartile = that.quartiles.thirdQuartile;\n\n if (!firstQuartile.tracked) {\n trackQuartile('firstQuartile', progress);\n } else if (!midpoint.tracked) {\n trackQuartile('midpoint', progress);\n } else if (!thirdQuartile.tracked){\n trackQuartile('thirdQuartile', progress);\n }\n\n /*** Local function ***/\n function trackQuartile(quartileName, progress){\n var quartile = quartiles[quartileName];\n if(canBeTracked(quartile, progress)){\n quartile.tracked = true;\n addTrackEvent(quartileName, ONCE, true);\n }\n }\n }\n\n function canBeTracked(quartile, progress) {\n var quartileTime = quartile.time;\n //We only fire the quartile event if the progress is bigger than the quartile time by 5 seconds at most.\n return progress >= quartileTime && progress <= (quartileTime + 5000);\n }\n\n function trackProgressEvents(progress) {\n if (!utilities.isArray(trackingEvents.progress)) {\n return; //Nothing to track\n }\n\n var pendingProgressEvts = [];\n\n trackingEvents.progress.forEach(function (evt) {\n if (evt.offset <= progress) {\n that.trackURLs([evt.uri]);\n } else {\n pendingProgressEvts.push(evt);\n }\n });\n trackingEvents.progress = pendingProgressEvts;\n }\n\n function trackEvents() {\n events.forEach(function (event) {\n that.trackEvent(event.name, event.trackOnce);\n });\n }\n};\n\n[\n 'rewind',\n 'fullscreen',\n 'exitFullscreen',\n 'pause',\n 'resume',\n 'mute',\n 'unmute',\n 'acceptInvitation',\n 'acceptInvitationLinear',\n 'collapse',\n 'expand'\n].forEach(function (eventName) {\n VASTTracker.prototype['track' + utilities.capitalize(eventName)] = function () {\n this.trackEvent(eventName);\n };\n });\n\n[\n 'start',\n 'skip',\n 'close',\n 'closeLinear'\n].forEach(function (eventName) {\n VASTTracker.prototype['track' + utilities.capitalize(eventName)] = function () {\n this.trackEvent(eventName, true);\n };\n });\n\n[\n 'firstQuartile',\n 'midpoint',\n 'thirdQuartile'\n].forEach(function (quartile) {\n VASTTracker.prototype['track' + utilities.capitalize(quartile)] = function () {\n this.quartiles[quartile].tracked = true;\n this.trackEvent(quartile, true);\n };\n });\n\nVASTTracker.prototype.trackComplete = function () {\n if(this.quartiles.thirdQuartile.tracked){\n this.trackEvent('complete', true);\n }\n};\n\nVASTTracker.prototype.trackErrorWithCode = function trackErrorWithCode(errorcode) {\n if (utilities.isNumber(errorcode)) {\n this.trackURLs(this.response.errorURLMacros, {ERRORCODE: errorcode});\n }\n};\n\nVASTTracker.prototype.trackImpressions = function trackImpressions() {\n this.trackURLs(this.response.impressions);\n};\n\nVASTTracker.prototype.trackCreativeView = function trackCreativeView() {\n this.trackEvent('creativeView');\n};\n\nVASTTracker.prototype.trackClick = function trackClick() {\n this.trackURLs(this.response.clickTrackings);\n};\n\nmodule.exports = VASTTracker;\n","'use strict';\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nfunction VideoClicks(videoClickJTree) {\n if (!(this instanceof VideoClicks)) {\n return new VideoClicks(videoClickJTree);\n }\n\n this.clickThrough = xml.keyValue(videoClickJTree.clickThrough);\n this.clickTrackings = parseClickTrackings(videoClickJTree.clickTracking);\n this.customClicks = parseClickTrackings(videoClickJTree.customClick);\n\n /*** Local functions ***/\n function parseClickTrackings(trackingData) {\n var clickTrackings = [];\n if (trackingData) {\n trackingData = utilities.isArray(trackingData) ? trackingData : [trackingData];\n trackingData.forEach(function (clickTrackingData) {\n clickTrackings.push(xml.keyValue(clickTrackingData));\n });\n }\n return clickTrackings;\n }\n}\n\nmodule.exports = VideoClicks;","'use strict';\n\nvar vastUtil = require('./vastUtil');\nvar Creative = require('./Creative');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nfunction Wrapper(wrapperJTree) {\n if(!(this instanceof Wrapper)) {\n return new Wrapper(wrapperJTree);\n }\n\n //Required elements\n this.adSystem = xml.keyValue(wrapperJTree.adSystem);\n this.impressions = vastUtil.parseImpressions(wrapperJTree.impression);\n this.VASTAdTagURI = xml.keyValue(wrapperJTree.vASTAdTagURI);\n\n //Optional elements\n this.creatives = Creative.parseCreatives(wrapperJTree.creatives);\n this.error = xml.keyValue(wrapperJTree.error);\n this.extensions = wrapperJTree.extensions;\n\n //Optional attrs\n this.followAdditionalWrappers = utilities.isDefined(xml.attr(wrapperJTree, 'followAdditionalWrappers'))? xml.attr(wrapperJTree, 'followAdditionalWrappers'): true;\n this.allowMultipleAds = xml.attr(wrapperJTree, 'allowMultipleAds');\n this.fallbackOnNoAd = xml.attr(wrapperJTree, 'fallbackOnNoAd');\n}\n\nmodule.exports = Wrapper;\n","'use strict';\n\nvar utilities = require('../../utils/utilityFunctions');\n\nvar durationRegex = /(\\d\\d):(\\d\\d):(\\d\\d)(\\.(\\d\\d\\d))?/;\n\nvar parsers = {\n\n duration: function parseDuration(durationStr) {\n\n var match, durationInMs;\n\n if (utilities.isString(durationStr)) {\n match = durationStr.match(durationRegex);\n if (match) {\n durationInMs = parseHoursToMs(match[1]) + parseMinToMs(match[2]) + parseSecToMs(match[3]) + parseInt(match[5] || 0);\n }\n }\n\n return isNaN(durationInMs) ? null : durationInMs;\n\n /*** local functions ***/\n function parseHoursToMs(hourStr) {\n return parseInt(hourStr, 10) * 60 * 60 * 1000;\n }\n\n function parseMinToMs(minStr) {\n return parseInt(minStr, 10) * 60 * 1000;\n }\n\n function parseSecToMs(secStr) {\n return parseInt(secStr, 10) * 1000;\n }\n },\n\n offset: function parseOffset(offset, duration) {\n if(isPercentage(offset)){\n return calculatePercentage(offset, duration);\n }\n return parsers.duration(offset);\n\n /*** Local function ***/\n function isPercentage(offset) {\n var percentageRegex = /^\\d+(\\.\\d+)?%$/g;\n return percentageRegex.test(offset);\n }\n\n function calculatePercentage(percentStr, duration) {\n if(duration) {\n return calcPercent(duration, parseFloat(percentStr.replace('%', '')));\n }\n return null;\n }\n\n function calcPercent(quantity, percent){\n return quantity * percent / 100;\n }\n }\n\n};\n\n\nmodule.exports = parsers;","'use strict';\n\nvar utilities = require('../../utils/utilityFunctions');\nvar VPAIDHTML5Tech = require('../vpaid/VPAIDHTML5Tech');\nvar VPAIDFlashTech = require('../vpaid/VPAIDFlashTech');\nvar VPAIDFLASHClient = require('VPAIDFLASHClient/js/VPAIDFLASHClient');\n\nvar vastUtil = {\n\n track: function track(URLMacros, variables) {\n var sources = vastUtil.parseURLMacros(URLMacros, variables);\n var trackImgs = [];\n sources.forEach(function (src) {\n var img = new Image();\n img.src = src;\n trackImgs.push(img);\n });\n return trackImgs;\n },\n\n parseURLMacros: function parseMacros(URLMacros, variables) {\n var parsedURLs = [];\n\n variables = variables || {};\n\n if (!(variables[\"CACHEBUSTING\"])) {\n variables[\"CACHEBUSTING\"] = Math.round(Math.random() * 1.0e+10);\n }\n\n URLMacros.forEach(function (URLMacro) {\n parsedURLs.push(vastUtil._parseURLMacro(URLMacro, variables));\n });\n\n return parsedURLs;\n },\n\n parseURLMacro: function parseMacro(URLMacro, variables) {\n variables = variables || {};\n\n if (!(variables[\"CACHEBUSTING\"])) {\n variables[\"CACHEBUSTING\"] = Math.round(Math.random() * 1.0e+10);\n }\n\n return vastUtil._parseURLMacro(URLMacro, variables);\n },\n\n _parseURLMacro: function parseMacro(URLMacro, variables) {\n variables = variables || {};\n\n utilities.forEach(variables, function (value, key) {\n URLMacro = URLMacro.replace(new RegExp(\"\\\\[\" + key + \"\\\\\\]\", 'gm'), value);\n });\n\n return URLMacro;\n },\n\n parseDuration: function parseDuration(durationStr) {\n var durationRegex = /(\\d\\d):(\\d\\d):(\\d\\d)(\\.(\\d\\d\\d))?/;\n var match, durationInMs;\n\n if (utilities.isString(durationStr)) {\n match = durationStr.match(durationRegex);\n if (match) {\n durationInMs = parseHoursToMs(match[1]) + parseMinToMs(match[2]) + parseSecToMs(match[3]) + parseInt(match[5] || 0);\n }\n }\n\n return isNaN(durationInMs) ? null : durationInMs;\n\n /*** local functions ***/\n function parseHoursToMs(hourStr) {\n return parseInt(hourStr, 10) * 60 * 60 * 1000;\n }\n\n function parseMinToMs(minStr) {\n return parseInt(minStr, 10) * 60 * 1000;\n }\n\n function parseSecToMs(secStr) {\n return parseInt(secStr, 10) * 1000;\n }\n },\n\n parseImpressions: function parseImpressions(impressions) {\n if (impressions) {\n impressions = utilities.isArray(impressions) ? impressions : [impressions];\n return utilities.transformArray(impressions, function (impression) {\n if (utilities.isNotEmptyString(impression.keyValue)) {\n return impression.keyValue;\n }\n return undefined;\n });\n }\n return [];\n },\n\n\n //We assume that the progress is going to arrive in milliseconds\n formatProgress: function formatProgress(progress) {\n var hours, minutes, seconds, milliseconds;\n hours = progress / (60 * 60 * 1000);\n hours = Math.floor(hours);\n minutes = (progress / (60 * 1000)) % 60;\n minutes = Math.floor(minutes);\n seconds = (progress / 1000) % 60;\n seconds = Math.floor(seconds);\n milliseconds = progress % 1000;\n return utilities.toFixedDigits(hours, 2) + ':' + utilities.toFixedDigits(minutes, 2) + ':' + utilities.toFixedDigits(seconds, 2) + '.' + utilities.toFixedDigits(milliseconds, 3);\n },\n\n parseOffset: function parseOffset(offset, duration) {\n if (isPercentage(offset)) {\n return calculatePercentage(offset, duration);\n }\n return vastUtil.parseDuration(offset);\n\n /*** Local function ***/\n function isPercentage(offset) {\n var percentageRegex = /^\\d+(\\.\\d+)?%$/g;\n return percentageRegex.test(offset);\n }\n\n function calculatePercentage(percentStr, duration) {\n if (duration) {\n return calcPercent(duration, parseFloat(percentStr.replace('%', '')));\n }\n return null;\n }\n\n function calcPercent(quantity, percent) {\n return quantity * percent / 100;\n }\n },\n\n\n //List of supported VPAID technologies\n VPAID_techs: [\n VPAIDFlashTech,\n VPAIDHTML5Tech\n ],\n\n isVPAID: function isVPAIDMediaFile(mediaFile) {\n return !!mediaFile && mediaFile.apiFramework === 'VPAID';\n },\n\n findSupportedVPAIDTech: function findSupportedVPAIDTech(mimeType) {\n var i, len, VPAIDTech;\n\n for (i = 0, len = this.VPAID_techs.length; i < len; i += 1) {\n VPAIDTech = this.VPAID_techs[i];\n if (VPAIDTech.supports(mimeType)) {\n return VPAIDTech;\n }\n }\n return null;\n },\n\n isFlashSupported: function isFlashSupported() {\n return VPAIDFLASHClient.isSupported();\n },\n\n /**\n * Necessary step for VPAIDFLAShClient to know if flash is supported and not blocked.\n * IMPORTANT NOTE: This is an async test and needs to be run as soon as possible.\n *\n * @param vpaidFlashLoaderPath the path to the vpaidFlashLoader swf obj.\n */\n runFlashSupportCheck: function runFlashSupportCheck(vpaidFlashLoaderPath) {\n VPAIDFLASHClient.runFlashTest({data: vpaidFlashLoaderPath});\n }\n\n};\n\nmodule.exports = vastUtil;\n","'use strict';\n\nvar VASTError = require('../vast/VASTError');\n\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VPAIDAdUnitWrapper(vpaidAdUnit, opts) {\n if (!(this instanceof VPAIDAdUnitWrapper)) {\n return new VPAIDAdUnitWrapper(vpaidAdUnit, opts);\n }\n sanityCheck(vpaidAdUnit, opts);\n\n this.options = utilities.extend({}, opts);\n\n this._adUnit = vpaidAdUnit;\n\n /*** Local Functions ***/\n function sanityCheck(adUnit, opts) {\n if (!adUnit || !VPAIDAdUnitWrapper.checkVPAIDInterface(adUnit)) {\n throw new VASTError('on VPAIDAdUnitWrapper, the passed VPAID adUnit does not fully implement the VPAID interface');\n }\n\n if (!utilities.isObject(opts)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper, expected options hash but got '\" + opts + \"'\");\n }\n\n if (!(\"responseTimeout\" in opts) || !utilities.isNumber(opts.responseTimeout) ){\n throw new VASTError(\"on VPAIDAdUnitWrapper, expected responseTimeout in options\");\n }\n }\n}\n\nVPAIDAdUnitWrapper.checkVPAIDInterface = function checkVPAIDInterface(VPAIDAdUnit) {\n //NOTE: skipAd is not part of the method list because it only appears in VPAID 2.0 and we support VPAID 1.0\n var VPAIDInterfaceMethods = [\n 'handshakeVersion', 'initAd', 'startAd', 'stopAd', 'resizeAd', 'pauseAd', 'expandAd', 'collapseAd'\n ];\n\n for (var i = 0, len = VPAIDInterfaceMethods.length; i < len; i++) {\n if (!VPAIDAdUnit || !utilities.isFunction(VPAIDAdUnit[VPAIDInterfaceMethods[i]])) {\n return false;\n }\n }\n\n\n return canSubscribeToEvents(VPAIDAdUnit) && canUnsubscribeFromEvents(VPAIDAdUnit);\n\n /*** Local Functions ***/\n\n function canSubscribeToEvents(adUnit) {\n return utilities.isFunction(adUnit.subscribe) || utilities.isFunction(adUnit.addEventListener) || utilities.isFunction(adUnit.on);\n }\n\n function canUnsubscribeFromEvents(adUnit) {\n return utilities.isFunction(adUnit.unsubscribe) || utilities.isFunction(adUnit.removeEventListener) || utilities.isFunction(adUnit.off);\n\n }\n};\n\nVPAIDAdUnitWrapper.prototype.adUnitAsyncCall = function () {\n var args = utilities.arrayLikeObjToArray(arguments);\n var method = args.shift();\n var cb = args.pop();\n var timeoutId;\n\n sanityCheck(method, cb, this._adUnit);\n args.push(wrapCallback());\n\n this._adUnit[method].apply(this._adUnit, args);\n timeoutId = setTimeout(function () {\n timeoutId = null;\n cb(new VASTError(\"on VPAIDAdUnitWrapper, timeout while waiting for a response on call '\" + method + \"'\"));\n cb = utilities.noop;\n }, this.options.responseTimeout);\n\n /*** Local functions ***/\n function sanityCheck(method, cb, adUnit) {\n if (!utilities.isString(method) || !utilities.isFunction(adUnit[method])) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.adUnitAsyncCall, invalid method name\");\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.adUnitAsyncCall, missing callback\");\n }\n }\n\n function wrapCallback() {\n return function () {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n cb.apply(this, arguments);\n };\n }\n};\n\nVPAIDAdUnitWrapper.prototype.on = function (evtName, handler) {\n var addEventListener = this._adUnit.addEventListener || this._adUnit.subscribe || this._adUnit.on;\n addEventListener.call(this._adUnit, evtName, handler);\n};\n\nVPAIDAdUnitWrapper.prototype.off = function (evtName, handler) {\n var removeEventListener = this._adUnit.removeEventListener || this._adUnit.unsubscribe || this._adUnit.off;\n removeEventListener.call(this._adUnit, evtName, handler);\n};\n\nVPAIDAdUnitWrapper.prototype.waitForEvent = function (evtName, cb, context) {\n var timeoutId;\n sanityCheck(evtName, cb);\n context = context || null;\n\n this.on(evtName, responseListener);\n\n timeoutId = setTimeout(function () {\n cb(new VASTError(\"on VPAIDAdUnitWrapper.waitForEvent, timeout while waiting for event '\" + evtName + \"'\"));\n timeoutId = null;\n cb = utilities.noop;\n }, this.options.responseTimeout);\n\n /*** Local functions ***/\n function sanityCheck(evtName, cb) {\n if (!utilities.isString(evtName)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.waitForEvent, missing evt name\");\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.waitForEvent, missing callback\");\n }\n }\n\n function responseListener() {\n var args = utilities.arrayLikeObjToArray(arguments);\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n\n args.unshift(null);\n cb.apply(context, args);\n }\n};\n\n// VPAID METHODS\nVPAIDAdUnitWrapper.prototype.handshakeVersion = function (version, cb) {\n this.adUnitAsyncCall('handshakeVersion', version, cb);\n};\n\n/* jshint maxparams:6 */\nVPAIDAdUnitWrapper.prototype.initAd = function (width, height, viewMode, desiredBitrate, adUnitData, cb) {\n this.waitForEvent('AdLoaded', cb);\n this._adUnit.initAd(width, height, viewMode, desiredBitrate, adUnitData);\n};\n\nVPAIDAdUnitWrapper.prototype.resizeAd = function (width, height, viewMode, cb) {\n // NOTE: AdSizeChange event is only supported on VPAID 2.0 so for the moment we are not going to use it\n // and will assume that everything is fine after the async call\n this.adUnitAsyncCall('resizeAd', width, height, viewMode, cb);\n};\n\nVPAIDAdUnitWrapper.prototype.startAd = function (cb) {\n this.waitForEvent('AdStarted', cb);\n this._adUnit.startAd();\n};\n\nVPAIDAdUnitWrapper.prototype.stopAd = function (cb) {\n this.waitForEvent('AdStopped', cb);\n this._adUnit.stopAd();\n};\n\nVPAIDAdUnitWrapper.prototype.pauseAd = function (cb) {\n this.waitForEvent('AdPaused', cb);\n this._adUnit.pauseAd();\n};\n\nVPAIDAdUnitWrapper.prototype.resumeAd = function (cb) {\n this.waitForEvent('AdPlaying', cb);\n this._adUnit.resumeAd();\n};\n\nVPAIDAdUnitWrapper.prototype.expandAd = function (cb) {\n this.waitForEvent('AdExpandedChange', cb);\n this._adUnit.expandAd();\n};\n\nVPAIDAdUnitWrapper.prototype.collapseAd = function (cb) {\n this.waitForEvent('AdExpandedChange', cb);\n this._adUnit.collapseAd();\n};\n\nVPAIDAdUnitWrapper.prototype.skipAd = function (cb) {\n this.waitForEvent('AdSkipped', cb);\n this._adUnit.skipAd();\n};\n\n//VPAID property getters\n[\n 'adLinear',\n 'adWidth',\n 'adHeight',\n 'adExpanded',\n 'adSkippableState',\n 'adRemainingTime',\n 'adDuration',\n 'adVolume',\n 'adCompanions',\n 'adIcons'\n].forEach(function (property) {\n var getterName = 'get' + utilities.capitalize(property);\n\n VPAIDAdUnitWrapper.prototype[getterName] = function (cb) {\n this.adUnitAsyncCall(getterName, cb);\n };\n});\n\n//VPAID property setters\nVPAIDAdUnitWrapper.prototype.setAdVolume = function(volume, cb){\n this.adUnitAsyncCall('setAdVolume',volume, cb);\n};\n\nmodule.exports = VPAIDAdUnitWrapper;\n","'use strict';\n\nvar VASTError = require('../vast/VASTError');\n\nvar VPAIDFLASHClient = require('VPAIDFLASHClient/js/VPAIDFLASHClient');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar dom = require('../../utils/dom');\n\nfunction VPAIDFlashTech(mediaFile, settings) {\n if (!(this instanceof VPAIDFlashTech)) {\n return new VPAIDFlashTech(mediaFile);\n }\n sanityCheck(mediaFile);\n this.name = 'vpaid-flash';\n this.mediaFile = mediaFile;\n this.containerEl = null;\n this.vpaidFlashClient = null;\n this.settings = settings;\n\n /*** local functions ***/\n function sanityCheck(mediaFile) {\n if (!mediaFile || !utilities.isString(mediaFile.src)) {\n throw new VASTError('on VPAIDFlashTech, invalid MediaFile');\n }\n }\n}\n\nVPAIDFlashTech.VPAIDFLASHClient = VPAIDFLASHClient;\n\nVPAIDFlashTech.supports = function (type) {\n return type === 'application/x-shockwave-flash' && VPAIDFlashTech.VPAIDFLASHClient.isSupported();\n};\n\nVPAIDFlashTech.prototype.loadAdUnit = function loadFlashCreative(containerEl, objectEl, callback) {\n var that = this;\n var flashClientOpts = this.settings && this.settings.vpaidFlashLoaderPath ? {data: this.settings.vpaidFlashLoaderPath} : undefined;\n sanityCheck(containerEl, callback);\n\n this.containerEl = containerEl;\n this.vpaidFlashClient = new VPAIDFlashTech.VPAIDFLASHClient(containerEl, function (error) {\n if (error) {\n return callback(error);\n }\n\n that.vpaidFlashClient.loadAdUnit(that.mediaFile.src, callback);\n }, flashClientOpts);\n\n /*** Local Functions ***/\n function sanityCheck(container, cb) {\n\n if (!dom.isDomElement(container)) {\n throw new VASTError('on VPAIDFlashTech.loadAdUnit, invalid dom container element');\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError('on VPAIDFlashTech.loadAdUnit, missing valid callback');\n }\n }\n};\n\nVPAIDFlashTech.prototype.unloadAdUnit = function () {\n if (this.vpaidFlashClient) {\n try{\n this.vpaidFlashClient.destroy();\n } catch(e){\n if(console && utilities.isFunction(console.log)){\n console.log('VAST ERROR: trying to unload the VPAID adunit');\n }\n }\n this.vpaidFlashClient = null;\n }\n\n if (this.containerEl) {\n dom.remove(this.containerEl);\n this.containerEl = null;\n }\n};\n\nmodule.exports = VPAIDFlashTech;\n","'use strict';\n\nvar VASTError = require('../vast/VASTError');\n\nvar VPAIDHTML5Client = require('VPAIDHTML5Client/js/VPAIDHTML5Client');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar dom = require('../../utils/dom');\n\nfunction VPAIDHTML5Tech(mediaFile) {\n\n if(!(this instanceof VPAIDHTML5Tech)) {\n return new VPAIDHTML5Tech(mediaFile);\n }\n\n sanityCheck(mediaFile);\n\n this.name = 'vpaid-html5';\n this.containerEl = null;\n this.videoEl = null;\n this.vpaidHTMLClient = null;\n\n this.mediaFile = mediaFile;\n\n function sanityCheck(mediaFile) {\n if (!mediaFile || !utilities.isString(mediaFile.src)) {\n throw new VASTError(VPAIDHTML5Tech.INVALID_MEDIA_FILE);\n }\n }\n}\n\nVPAIDHTML5Tech.VPAIDHTML5Client = VPAIDHTML5Client;\n\nVPAIDHTML5Tech.supports = function (type) {\n return !utilities.isOldIE() && type === 'application/javascript';\n};\n\nVPAIDHTML5Tech.prototype.loadAdUnit = function loadAdUnit(containerEl, videoEl, callback) {\n sanityCheck(containerEl, videoEl, callback);\n\n this.containerEl = containerEl;\n this.videoEl = videoEl;\n this.vpaidHTMLClient = new VPAIDHTML5Tech.VPAIDHTML5Client(containerEl, videoEl, {});\n this.vpaidHTMLClient.loadAdUnit(this.mediaFile.src, callback);\n\n function sanityCheck(container, video, cb) {\n if (!dom.isDomElement(container)) {\n throw new VASTError(VPAIDHTML5Tech.INVALID_DOM_CONTAINER_EL);\n }\n\n if (!dom.isDomElement(video) || video.tagName.toLowerCase() !== 'video') {\n throw new VASTError(VPAIDHTML5Tech.INVALID_DOM_CONTAINER_EL);\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError(VPAIDHTML5Tech.MISSING_CALLBACK);\n }\n }\n};\n\nVPAIDHTML5Tech.prototype.unloadAdUnit = function unloadAdUnit() {\n if (this.vpaidHTMLClient) {\n try {\n this.vpaidHTMLClient.destroy();\n } catch(e) {\n if (console && utilities.isFunction(console.log)) {\n console.log('VAST ERROR: trying to unload the VPAID adunit');\n }\n }\n\n this.vpaidHTMLClient = null;\n }\n\n if (this.containerEl) {\n dom.remove(this.containerEl);\n this.containerEl = null;\n }\n};\n\nvar PREFIX = 'on VPAIDHTML5Tech';\nVPAIDHTML5Tech.INVALID_MEDIA_FILE = PREFIX + ', invalid MediaFile';\nVPAIDHTML5Tech.INVALID_DOM_CONTAINER_EL = PREFIX + ', invalid container HtmlElement';\nVPAIDHTML5Tech.INVALID_DOM_VIDEO_EL = PREFIX + ', invalid HTMLVideoElement';\nVPAIDHTML5Tech.MISSING_CALLBACK = PREFIX + ', missing valid callback';\n\nmodule.exports = VPAIDHTML5Tech;","'use strict';\n\nvar VASTError = require('../vast/VASTError');\nvar VASTResponse = require('../vast/VASTResponse');\nvar VASTTracker = require('../vast/VASTTracker');\nvar vastUtil = require('../vast/vastUtil');\n\nvar VPAIDAdUnitWrapper = require('./VPAIDAdUnitWrapper');\n\nvar async = require('../../utils/async');\nvar dom = require('../../utils/dom');\nvar playerUtils = require('../../utils/playerUtils');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VPAIDIntegrator(player, settings) {\n if (!(this instanceof VPAIDIntegrator)) {\n return new VPAIDIntegrator(player);\n }\n\n this.VIEW_MODE = {\n NORMAL: 'normal',\n FULLSCREEN: \"fullscreen\",\n THUMBNAIL: \"thumbnail\"\n };\n this.player = player;\n this.containerEl = createVPAIDContainerEl(player);\n this.options = {\n responseTimeout: 5000,\n VPAID_VERSION: '2.0'\n };\n this.settings = settings;\n\n /*** Local functions ***/\n\n function createVPAIDContainerEl() {\n var containerEl = document.createElement('div');\n dom.addClass(containerEl, 'VPAID-container');\n player.el().insertBefore(containerEl, player.controlBar.el());\n return containerEl;\n\n }\n}\n\nVPAIDIntegrator.prototype.playAd = function playVPaidAd(vastResponse, callback) {\n if (!(vastResponse instanceof VASTResponse)) {\n return callback(new VASTError('on VASTIntegrator.playAd, missing required VASTResponse'));\n }\n\n var that = this;\n var player = this.player;\n var tech = this._findSupportedTech(vastResponse, this.settings);\n\n callback = callback || utilities.noop;\n\n this._adUnit = null;\n\n dom.addClass(player.el(), 'vjs-vpaid-ad');\n\n player.on('vast.adsCancel', triggerVpaidAdEnd);\n player.one('vpaid.adEnd', function(){\n player.off('vast.adsCancel', triggerVpaidAdEnd);\n removeAdUnit();\n });\n\n if (tech) {\n async.waterfall([\n function (next) {\n next(null, tech, vastResponse);\n },\n this._loadAdUnit.bind(this),\n this._playAdUnit.bind(this),\n this._finishPlaying.bind(this)\n\n ], adComplete);\n\n this._adUnit = {\n _paused: true,\n type: 'VPAID',\n pauseAd: function() {\n player.trigger('vpaid.pauseAd');\n player.pause(true);//we make sure that the video content gets stopped.\n },\n resumeAd: function() {\n player.trigger('vpaid.resumeAd');\n },\n isPaused: function() {\n return this._paused;\n },\n getSrc: function() {\n return tech.mediaFile;\n }\n };\n\n } else {\n var error = new VASTError('on VPAIDIntegrator.playAd, could not find a supported mediaFile', 403);\n adComplete(error, this._adUnit, vastResponse);\n }\n\n return this._adUnit;\n\n /*** Local functions ***/\n function adComplete(error, adUnit, vastResponse) {\n if (error && vastResponse) {\n that._trackError(vastResponse, error.code);\n }\n player.trigger('vpaid.adEnd');\n callback(error, vastResponse);\n }\n\n function triggerVpaidAdEnd(){\n player.trigger('vpaid.adEnd');\n }\n\n function removeAdUnit() {\n if (tech) {\n tech.unloadAdUnit();\n }\n dom.removeClass(player.el(), 'vjs-vpaid-ad');\n }\n};\n\nVPAIDIntegrator.prototype._findSupportedTech = function (vastResponse, settings) {\n if (!(vastResponse instanceof VASTResponse)) {\n return null;\n }\n\n var vpaidMediaFiles = vastResponse.mediaFiles.filter(vastUtil.isVPAID);\n var i, len, mediaFile, VPAIDTech;\n\n for (i = 0, len = vpaidMediaFiles.length; i < len; i += 1) {\n mediaFile = vpaidMediaFiles[i];\n VPAIDTech = vastUtil.findSupportedVPAIDTech(mediaFile.type);\n if (VPAIDTech) {\n return new VPAIDTech(mediaFile, settings);\n }\n }\n return null;\n};\n\nVPAIDIntegrator.prototype._createVPAIDAdUnitWrapper = function(adUnit, src, responseTimeout) {\n return new VPAIDAdUnitWrapper(adUnit, {src: src, responseTimeout: responseTimeout});\n};\n\nVPAIDIntegrator.prototype._loadAdUnit = function (tech, vastResponse, next) {\n var that = this;\n var player = this.player;\n var vjsTechEl = player.el().querySelector('.vjs-tech');\n var responseTimeout = this.settings.responseTimeout || this.options.responseTimeout;\n tech.loadAdUnit(this.containerEl, vjsTechEl, function (error, adUnit) {\n if (error) {\n return next(error, adUnit, vastResponse);\n }\n\n try {\n var WrappedAdUnit = that._createVPAIDAdUnitWrapper(adUnit, tech.mediaFile.src, responseTimeout);\n var techClass = 'vjs-' + tech.name + '-ad';\n dom.addClass(player.el(), techClass);\n player.one('vpaid.adEnd', function() {\n dom.removeClass(player.el(),techClass);\n });\n next(null, WrappedAdUnit, vastResponse);\n } catch (e) {\n next(e, adUnit, vastResponse);\n }\n });\n};\n\nVPAIDIntegrator.prototype._playAdUnit = function (adUnit, vastResponse, callback) {\n async.waterfall([\n function (next) {\n next(null, adUnit, vastResponse);\n },\n this._handshake.bind(this),\n this._initAd.bind(this),\n this._setupEvents.bind(this),\n this._addSkipButton.bind(this),\n this._linkPlayerControls.bind(this),\n this._startAd.bind(this)\n ], callback);\n};\n\nVPAIDIntegrator.prototype._handshake = function handshake(adUnit, vastResponse, next) {\n adUnit.handshakeVersion(this.options.VPAID_VERSION, function (error, version) {\n if (error) {\n return next(error, adUnit, vastResponse);\n }\n\n if (version && isSupportedVersion(version)) {\n return next(null, adUnit, vastResponse);\n }\n\n return next(new VASTError('on VPAIDIntegrator._handshake, unsupported version \"' + version + '\"'), adUnit, vastResponse);\n });\n\n function isSupportedVersion(version) {\n var majorNum = major(version);\n return majorNum >= 1 && majorNum <= 2;\n }\n\n function major(version) {\n var parts = version.split('.');\n return parseInt(parts[0], 10);\n }\n};\n\nVPAIDIntegrator.prototype._initAd = function (adUnit, vastResponse, next) {\n var tech = this.player.el().querySelector('.vjs-tech');\n var dimension = dom.getDimension(tech);\n adUnit.initAd(dimension.width, dimension.height, this.VIEW_MODE.NORMAL, -1, {AdParameters: vastResponse.adParameters || ''}, function (error) {\n next(error, adUnit, vastResponse);\n });\n};\n\nVPAIDIntegrator.prototype._createVASTTracker = function(adUnitSrc, vastResponse) {\n return new VASTTracker(adUnitSrc, vastResponse);\n};\n\nVPAIDIntegrator.prototype._setupEvents = function (adUnit, vastResponse, next) {\n var adUnitSrc = adUnit.options.src;\n var tracker = this._createVASTTracker(adUnitSrc, vastResponse);\n var player = this.player;\n var that = this;\n\n adUnit.on('AdSkipped', function () {\n player.trigger('vpaid.AdSkipped');\n tracker.trackSkip();\n });\n\n adUnit.on('AdImpression', function () {\n player.trigger('vpaid.AdImpression');\n tracker.trackImpressions();\n });\n\n adUnit.on('AdStarted', function () {\n player.trigger('vpaid.AdStarted');\n tracker.trackCreativeView();\n notifyPlayToPlayer();\n });\n\n adUnit.on('AdVideoStart', function () {\n player.trigger('vpaid.AdVideoStart');\n tracker.trackStart();\n notifyPlayToPlayer();\n });\n\n adUnit.on('AdPlaying', function () {\n player.trigger('vpaid.AdPlaying');\n tracker.trackResume();\n notifyPlayToPlayer();\n });\n\n adUnit.on('AdPaused', function () {\n player.trigger('vpaid.AdPaused');\n tracker.trackPause();\n notifyPauseToPlayer();\n });\n\n function notifyPlayToPlayer(){\n if(that._adUnit && that._adUnit.isPaused()){\n that._adUnit._paused = false;\n }\n player.trigger('play');\n\n }\n\n function notifyPauseToPlayer() {\n if(that._adUnit){\n that._adUnit._paused = true;\n }\n player.trigger('pause');\n }\n\n adUnit.on('AdVideoFirstQuartile', function () {\n player.trigger('vpaid.AdVideoFirstQuartile');\n tracker.trackFirstQuartile();\n });\n\n adUnit.on('AdVideoMidpoint', function () {\n player.trigger('vpaid.AdVideoMidpoint');\n tracker.trackMidpoint();\n });\n\n adUnit.on('AdVideoThirdQuartile', function () {\n player.trigger('vpaid.AdVideoThirdQuartile');\n tracker.trackThirdQuartile();\n });\n\n adUnit.on('AdVideoComplete', function () {\n player.trigger('vpaid.AdVideoComplete');\n tracker.trackComplete();\n });\n\n adUnit.on('AdClickThru', function (data) {\n player.trigger('vpaid.AdClickThru');\n var url = data.url;\n var playerHandles = data.playerHandles;\n var clickThruUrl = utilities.isNotEmptyString(url) ? url : generateClickThroughURL(vastResponse.clickThrough);\n\n tracker.trackClick();\n if (playerHandles && clickThruUrl) {\n window.open(clickThruUrl, '_blank');\n }\n\n function generateClickThroughURL(clickThroughMacro) {\n var variables = {\n ASSETURI: adUnit.options.src,\n CONTENTPLAYHEAD: 0 //In VPAID there is no method to know the current time from the adUnit\n };\n\n return clickThroughMacro ? vastUtil.parseURLMacro(clickThroughMacro, variables) : null;\n }\n });\n\n adUnit.on('AdUserAcceptInvitation', function () {\n player.trigger('vpaid.AdUserAcceptInvitation');\n tracker.trackAcceptInvitation();\n tracker.trackAcceptInvitationLinear();\n });\n\n adUnit.on('AdUserClose', function () {\n player.trigger('vpaid.AdUserClose');\n tracker.trackClose();\n tracker.trackCloseLinear();\n });\n\n adUnit.on('AdUserMinimize', function () {\n player.trigger('vpaid.AdUserMinimize');\n tracker.trackCollapse();\n });\n\n adUnit.on('AdError', function () {\n player.trigger('vpaid.AdError');\n //NOTE: we track errors code 901, as noted in VAST 3.0\n tracker.trackErrorWithCode(901);\n });\n\n adUnit.on('AdVolumeChange', function () {\n player.trigger('vpaid.AdVolumeChange');\n var lastVolume = player.volume();\n adUnit.getAdVolume(function (error, currentVolume) {\n if (currentVolume === 0 && lastVolume > 0) {\n tracker.trackMute();\n }\n\n if (currentVolume > 0 && lastVolume === 0) {\n tracker.trackUnmute();\n }\n\n player.volume(currentVolume);\n });\n });\n\n var updateViewSize = resizeAd.bind(this, player, adUnit, this.VIEW_MODE);\n var updateViewSizeThrottled = utilities.throttle(updateViewSize, 100);\n var autoResize = this.settings.autoResize;\n\n if (autoResize) {\n dom.addEventListener(window, 'resize', updateViewSizeThrottled);\n dom.addEventListener(window, 'orientationchange', updateViewSizeThrottled);\n }\n\n player.on('vast.resize', updateViewSize);\n player.on('vpaid.pauseAd', pauseAdUnit);\n player.on('vpaid.resumeAd', resumeAdUnit);\n\n player.one('vpaid.adEnd', function () {\n player.off('vast.resize', updateViewSize);\n player.off('vpaid.pauseAd', pauseAdUnit);\n player.off('vpaid.resumeAd', resumeAdUnit);\n\n if (autoResize) {\n dom.removeEventListener(window, 'resize', updateViewSizeThrottled);\n dom.removeEventListener(window, 'orientationchange', updateViewSizeThrottled);\n }\n });\n\n next(null, adUnit, vastResponse);\n\n /*** Local Functions ***/\n function pauseAdUnit() {\n adUnit.pauseAd(utilities.noop);\n }\n\n function resumeAdUnit() {\n adUnit.resumeAd(utilities.noop);\n }\n};\n\nVPAIDIntegrator.prototype._addSkipButton = function (adUnit, vastResponse, next) {\n var skipButton;\n var player = this.player;\n\n adUnit.on('AdSkippableStateChange', updateSkipButtonState);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeSkipButton);\n\n next(null, adUnit, vastResponse);\n\n /*** Local function ***/\n function updateSkipButtonState() {\n player.trigger('vpaid.AdSkippableStateChange');\n adUnit.getAdSkippableState(function (error, isSkippable) {\n if (isSkippable) {\n if (!skipButton) {\n addSkipButton(player);\n }\n } else {\n removeSkipButton(player);\n }\n });\n }\n\n function addSkipButton(player) {\n skipButton = createSkipButton(player);\n player.el().appendChild(skipButton);\n }\n\n function removeSkipButton() {\n dom.remove(skipButton);\n skipButton = null;\n }\n\n function createSkipButton() {\n var skipButton = window.document.createElement(\"div\");\n dom.addClass(skipButton, \"vast-skip-button\");\n dom.addClass(skipButton, \"enabled\");\n skipButton.innerHTML = \"Skip ad\";\n\n skipButton.onclick = function (e) {\n adUnit.skipAd(utilities.noop);//We skip the adUnit\n\n //We prevent event propagation to avoid problems with the clickThrough and so on\n if (window.Event.prototype.stopPropagation !== undefined) {\n e.stopPropagation();\n } else {\n return false;\n }\n };\n\n return skipButton;\n }\n};\n\nVPAIDIntegrator.prototype._linkPlayerControls = function (adUnit, vastResponse, next) {\n var that = this;\n linkVolumeControl(this.player, adUnit);\n linkFullScreenControl(this.player, adUnit, this.VIEW_MODE);\n\n next(null, adUnit, vastResponse);\n\n /*** Local functions ***/\n function linkVolumeControl(player, adUnit) {\n player.on('volumechange', updateAdUnitVolume);\n adUnit.on('AdVolumeChange', updatePlayerVolume);\n\n player.one('vpaid.adEnd', function () {\n player.off('volumechange', updateAdUnitVolume);\n });\n\n\n /*** local functions ***/\n function updateAdUnitVolume() {\n var vol = player.muted() ? 0 : player.volume();\n adUnit.setAdVolume(vol, logError);\n }\n\n function updatePlayerVolume() {\n player.trigger('vpaid.AdVolumeChange');\n adUnit.getAdVolume(function (error, vol) {\n if (error) {\n logError(error);\n } else {\n player.volume(vol);\n }\n });\n }\n }\n\n function linkFullScreenControl(player, adUnit, VIEW_MODE) {\n var updateViewSize = resizeAd.bind(that, player, adUnit, VIEW_MODE);\n\n player.on('fullscreenchange', updateViewSize);\n\n player.one('vpaid.adEnd', function () {\n player.off('fullscreenchange', updateViewSize);\n });\n }\n};\n\nVPAIDIntegrator.prototype._startAd = function (adUnit, vastResponse, next) {\n var player = this.player;\n\n adUnit.startAd(function (error) {\n if (!error) {\n player.trigger('vast.adStart');\n }\n next(error, adUnit, vastResponse);\n });\n};\n\nVPAIDIntegrator.prototype._finishPlaying = function (adUnit, vastResponse, next) {\n var player = this.player;\n adUnit.on('AdStopped', function () {\n player.trigger('vpaid.AdStopped');\n finishPlayingAd(null);\n });\n\n adUnit.on('AdError', function (error) {\n var errMsg = error? error.message : 'on VPAIDIntegrator, error while waiting for the adUnit to finish playing';\n finishPlayingAd(new VASTError(errMsg));\n });\n\n /*** local functions ***/\n function finishPlayingAd(error) {\n next(error, adUnit, vastResponse);\n }\n};\n\nVPAIDIntegrator.prototype._trackError = function trackError(response, errorCode) {\n vastUtil.track(response.errorURLMacros, {ERRORCODE: errorCode || 901});\n};\n\nfunction resizeAd(player, adUnit, VIEW_MODE) {\n var tech = player.el().querySelector('.vjs-tech');\n var dimension = dom.getDimension(tech);\n var MODE = player.isFullscreen() ? VIEW_MODE.FULLSCREEN : VIEW_MODE.NORMAL;\n adUnit.resizeAd(dimension.width, dimension.height, MODE, logError);\n}\n\nfunction logError(error) {\n if (error && console && console.log) {\n console.log('ERROR: ' + error.message, error);\n }\n}\n\nmodule.exports = VPAIDIntegrator;","'use strict';\n\nvar dom = require('../../utils/dom');\n\nvar element = document.createElement('div');\nelement.className = 'vjs-ads-label vjs-control vjs-label-hidden';\nelement.innerHTML = 'Advertisement';\n\nvar AdsLabelFactory = function(baseComponent) {\n return {\n /** @constructor */\n init: function init(player, options) {\n options.el = element;\n baseComponent.call(this, player, options);\n\n // We asynchronously reposition the ads label element\n setTimeout(function () {\n var currentTimeComp = player.controlBar &&( player.controlBar.getChild(\"timerControls\") || player.controlBar.getChild(\"currentTimeDisplay\") );\n if(currentTimeComp) {\n player.controlBar.el().insertBefore(element, currentTimeComp.el());\n }\n dom.removeClass(element, 'vjs-label-hidden');\n }, 0);\n },\n\n el: function getElement() {\n return element;\n }\n };\n};\n\nmodule.exports = AdsLabelFactory;","'use strict';\n\nvar baseVideoJsComponent = videojs.Component;\n\nvar AdsLabel = require('./ads-label')(baseVideoJsComponent);\n\nvideojs.AdsLabel = videojs.Component.extend(AdsLabel);\n","'use strict';\n\n/**\n * The component that shows a black screen until the ads plugin has decided if it can or it can not play the ad.\n *\n * Note: In case you wonder why instead of this black poster we don't just show the spinner loader.\n * IOS devices do not work well with animations and the browser chrashes from time to time That is why we chose to\n * have a secondary black poster.\n *\n * It also makes it much more easier for the users of the plugin since it does not change the default behaviour of the\n * spinner and the player works the same way with and without the plugin.\n *\n * @param {vjs.Player|Object} player\n * @param {Object=} options\n * @constructor\n */\nvar element = document.createElement('div');\n\nvar BlackPosterFactory = function(baseComponent) {\n return {\n /** @constructor */\n init: function init(player, options) {\n options.el = element;\n element.className = 'vjs-black-poster';\n baseComponent.call(this, player, options);\n\n var posterImg = player.getChild('posterImage');\n\n //We need to do it asynchronously to be sure that the black poster el is on the dom.\n setTimeout(function() {\n if(posterImg && player && player.el()) {\n player.el().insertBefore(element, posterImg.el());\n }\n }, 0);\n },\n el: function getElement() {\n return element;\n }\n };\n};\n\nmodule.exports = BlackPosterFactory;","'use strict';\n\nvar baseVideoJsComponent = videojs.Component;\n\nvar BlackPoster = require('./black-poster')(baseVideoJsComponent);\n\nvideojs.BlackPoster = videojs.Component.extend(BlackPoster);\n","'use strict';\n\nvar VASTClient = require('../ads/vast/VASTClient');\nvar VASTError = require('../ads/vast/VASTError');\nvar vastUtil = require('../ads/vast/vastUtil');\n\nvar VASTIntegrator = require('../ads/vast/VASTIntegrator');\nvar VPAIDIntegrator = require('../ads/vpaid/VPAIDIntegrator');\n\nvar async = require('../utils/async');\nvar dom = require('../utils/dom');\nvar playerUtils = require('../utils/playerUtils');\nvar utilities = require('../utils/utilityFunctions');\n\nmodule.exports = function VASTPlugin(options) {\n var snapshot;\n var player = this;\n var vast = new VASTClient();\n var adsCanceled = false;\n var defaultOpts = {\n // maximum amount of time in ms to wait to receive `adsready` from the ad\n // implementation after play has been requested. Ad implementations are\n // expected to load any dynamic libraries and make any requests to determine\n // ad policies for a video during this time.\n timeout: 500,\n\n //TODO:finish this IOS FIX\n //Whenever you play an add on IOS, the native player kicks in and we loose control of it. On very heavy pages the 'play' event\n // May occur after the video content has already started. This is wrong if you want to play a preroll ad that needs to happen before the user\n // starts watching the content. To prevent this usec\n iosPrerollCancelTimeout: 2000,\n\n // maximun amount of time for the ad to actually start playing. If this timeout gets\n // triggered the ads will be cancelled\n adCancelTimeout: 3000,\n\n // Boolean flag that configures the player to play a new ad before the user sees the video again\n // the current video\n playAdAlways: false,\n\n // Flag to enable or disable the ads by default.\n adsEnabled: true,\n\n // Boolean flag to enable or disable the resize with window.resize or orientationchange\n autoResize: true,\n\n // Path to the VPAID flash ad's loader\n vpaidFlashLoaderPath: '/VPAIDFlash.swf'\n };\n\n var settings = utilities.extend({}, defaultOpts, options || {});\n\n if(utilities.isUndefined(settings.adTagUrl) && utilities.isDefined(settings.url)){\n settings.adTagUrl = settings.url;\n }\n\n if (utilities.isString(settings.adTagUrl)) {\n settings.adTagUrl = utilities.echoFn(settings.adTagUrl);\n }\n\n if (utilities.isDefined(settings.adTagXML) && !utilities.isFunction(settings.adTagXML)) {\n return trackAdError(new VASTError('on VideoJS VAST plugin, the passed adTagXML option does not contain a function'));\n }\n\n if (!utilities.isDefined(settings.adTagUrl) && !utilities.isFunction(settings.adTagXML)) {\n return trackAdError(new VASTError('on VideoJS VAST plugin, missing adTagUrl on options object'));\n }\n\n vastUtil.runFlashSupportCheck(settings.vpaidFlashLoaderPath);// Necessary step for VPAIDFLASHClient to work.\n\n playerUtils.prepareForAds(player);\n\n if (settings.playAdAlways) {\n // No matter what happens we play a new ad before the user sees the video again.\n player.on('vast.contentEnd', function () {\n setTimeout(function () {\n player.trigger('vast.reset');\n }, 0);\n });\n }\n\n player.on('vast.firstPlay', tryToPlayPrerollAd);\n\n player.on('vast.reset', function () {\n //If we are reseting the plugin, we don't want to restore the content\n snapshot = null;\n cancelAds();\n });\n\n player.vast = {\n isEnabled: function () {\n return settings.adsEnabled;\n },\n\n enable: function () {\n settings.adsEnabled = true;\n },\n\n disable: function () {\n settings.adsEnabled = false;\n }\n };\n\n return player.vast;\n\n /**** Local functions ****/\n function tryToPlayPrerollAd() {\n //We remove the poster to prevent flickering whenever the content starts playing\n playerUtils.removeNativePoster(player);\n\n playerUtils.once(player, ['vast.adsCancel', 'vast.adEnd'], function () {\n removeAdUnit();\n restoreVideoContent();\n });\n\n async.waterfall([\n checkAdsEnabled,\n preparePlayerForAd,\n startAdCancelTimeout,\n playPrerollAd\n ], function (error, response) {\n if (error) {\n trackAdError(error, response);\n } else {\n player.trigger('vast.adEnd');\n }\n });\n\n /*** Local functions ***/\n\n function removeAdUnit() {\n if (player.vast && player.vast.adUnit) {\n player.vast.adUnit = null; //We remove the adUnit\n }\n }\n\n function restoreVideoContent() {\n setupContentEvents();\n if (snapshot) {\n playerUtils.restorePlayerSnapshot(player, snapshot);\n snapshot = null;\n }\n }\n\n function setupContentEvents() {\n playerUtils.once(player, ['playing', 'vast.reset', 'vast.firstPlay'], function (evt) {\n if (evt.type !== 'playing') {\n return;\n }\n\n player.trigger('vast.contentStart');\n\n playerUtils.once(player, ['ended', 'vast.reset', 'vast.firstPlay'], function (evt) {\n if (evt.type === 'ended') {\n player.trigger('vast.contentEnd');\n }\n });\n });\n }\n\n function checkAdsEnabled(next) {\n if (settings.adsEnabled) {\n return next(null);\n }\n next(new VASTError('Ads are not enabled'));\n }\n\n function preparePlayerForAd(next) {\n if (canPlayPrerollAd()) {\n snapshot = playerUtils.getPlayerSnapshot(player);\n player.pause();\n addSpinnerIcon();\n\n if(player.paused()) {\n next(null);\n } else {\n playerUtils.once(player, ['playing'], function() {\n player.pause();\n next(null);\n });\n }\n } else {\n next(new VASTError('video content has been playing before preroll ad'));\n }\n }\n\n function canPlayPrerollAd() {\n return !utilities.isIPhone() || player.currentTime() <= settings.iosPrerollCancelTimeout;\n }\n\n function startAdCancelTimeout(next) {\n var adCancelTimeoutId;\n adsCanceled = false;\n\n adCancelTimeoutId = setTimeout(function () {\n trackAdError(new VASTError('timeout while waiting for the video to start playing', 402));\n }, settings.adCancelTimeout);\n\n playerUtils.once(player, ['vast.adStart', 'vast.adsCancel'], clearAdCancelTimeout);\n\n /*** local functions ***/\n function clearAdCancelTimeout() {\n if (adCancelTimeoutId) {\n clearTimeout(adCancelTimeoutId);\n adCancelTimeoutId = null;\n }\n }\n\n next(null);\n }\n\n function addSpinnerIcon() {\n dom.addClass(player.el(), 'vjs-vast-ad-loading');\n playerUtils.once(player, ['vast.adStart', 'vast.adsCancel'], removeSpinnerIcon);\n }\n\n function removeSpinnerIcon() {\n //IMPORTANT NOTE: We remove the spinnerIcon asynchronously to give time to the browser to start the video.\n // If we remove it synchronously we see a flash of the content video before the ad starts playing.\n setTimeout(function () {\n dom.removeClass(player.el(), 'vjs-vast-ad-loading');\n }, 100);\n }\n\n }\n\n function cancelAds() {\n player.trigger('vast.adsCancel');\n adsCanceled = true;\n }\n\n function playPrerollAd(callback) {\n async.waterfall([\n getVastResponse,\n playAd\n ], callback);\n }\n\n function getVastResponse(callback) {\n vast.getVASTResponse(settings.adTagUrl ? settings.adTagUrl() : settings.adTagXML, callback);\n }\n\n function playAd(vastResponse, callback) {\n //TODO: Find a better way to stop the play. The 'playPrerollWaterfall' ends in an inconsistent situation\n //If the state is not 'preroll?' it means the ads were canceled therefore, we break the waterfall\n if (adsCanceled) {\n return;\n }\n\n var adIntegrator = isVPAID(vastResponse) ? new VPAIDIntegrator(player, settings) : new VASTIntegrator(player);\n var adFinished = false;\n\n playerUtils.once(player, ['vast.adStart', 'vast.adsCancel'], function (evt) {\n if (evt.type === 'vast.adStart') {\n addAdsLabel();\n }\n });\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeAdsLabel);\n\n if (utilities.isIDevice()) {\n preventManualProgress();\n }\n\n player.vast.vastResponse = vastResponse;\n player.vast.adUnit = adIntegrator.playAd(vastResponse, callback);\n\n /*** Local functions ****/\n function addAdsLabel() {\n if (adFinished || player.controlBar.getChild('AdsLabel')) {\n return;\n }\n\n player.controlBar.addChild('AdsLabel');\n }\n\n function removeAdsLabel() {\n player.controlBar.removeChild('AdsLabel');\n adFinished = true;\n }\n\n function preventManualProgress() {\n //IOS video clock is very unreliable and we need a 3 seconds threshold to ensure that the user forwarded/rewound the ad\n var PROGRESS_THRESHOLD = 3;\n var previousTime = 0;\n var skipad_attempts = 0;\n\n player.on('timeupdate', preventAdSeek);\n player.on('ended', preventAdSkip);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel', 'vast.adError'], stopPreventManualProgress);\n\n /*** Local functions ***/\n function preventAdSkip() {\n // Ignore ended event if the Ad time was not 'near' the end\n // and revert time to the previous 'valid' time\n if ((player.duration() - previousTime) > PROGRESS_THRESHOLD) {\n player.pause(true); // this reduce the video jitter if the IOS skip button is pressed\n player.play(true); // we need to trigger the play to put the video element back in a valid state\n player.currentTime(previousTime);\n }\n }\n\n function preventAdSeek() {\n var currentTime = player.currentTime();\n var progressDelta = Math.abs(currentTime - previousTime);\n if (progressDelta > PROGRESS_THRESHOLD) {\n skipad_attempts += 1;\n if (skipad_attempts >= 2) {\n player.pause(true);\n }\n player.currentTime(previousTime);\n } else {\n previousTime = currentTime;\n }\n }\n\n function stopPreventManualProgress() {\n player.off('timeupdate', preventAdSeek);\n player.off('ended', preventAdSkip);\n }\n }\n }\n\n function trackAdError(error, vastResponse) {\n player.trigger({type: 'vast.adError', error: error});\n cancelAds();\n if (console && console.log) {\n console.log('AD ERROR:', error.message, error, vastResponse);\n }\n }\n\n function isVPAID(vastResponse) {\n var i, len;\n var mediaFiles = vastResponse.mediaFiles;\n for (i = 0, len = mediaFiles.length; i < len; i++) {\n if (vastUtil.isVPAID(mediaFiles[i])) {\n return true;\n }\n }\n return false;\n }\n};\n","//Small subset of async\n\nvar utilities = require('./utilityFunctions');\n\nvar async = {};\n\nasync.setImmediate = function (fn) {\n setTimeout(fn, 0);\n};\n\nasync.iterator = function (tasks) {\n var makeCallback = function (index) {\n var fn = function () {\n if (tasks.length) {\n tasks[index].apply(null, arguments);\n }\n return fn.next();\n };\n fn.next = function () {\n return (index < tasks.length - 1) ? makeCallback(index + 1) : null;\n };\n return fn;\n };\n return makeCallback(0);\n};\n\n\nasync.waterfall = function (tasks, callback) {\n callback = callback || function () { };\n if (!utilities.isArray(tasks)) {\n var err = new Error('First argument to waterfall must be an array of functions');\n return callback(err);\n }\n if (!tasks.length) {\n return callback();\n }\n var wrapIterator = function (iterator) {\n return function (err) {\n if (err) {\n callback.apply(null, arguments);\n callback = function () {\n };\n }\n else {\n var args = Array.prototype.slice.call(arguments, 1);\n var next = iterator.next();\n if (next) {\n args.push(wrapIterator(next));\n }\n else {\n args.push(callback);\n }\n async.setImmediate(function () {\n iterator.apply(null, args);\n });\n }\n };\n };\n wrapIterator(async.iterator(tasks))();\n};\n\nasync.when = function (condition, callback) {\n if (!utilities.isFunction(callback)) {\n throw new Error(\"async.when error: missing callback argument\");\n }\n\n var isAllowed = utilities.isFunction(condition) ? condition : function () {\n return !!condition;\n };\n\n return function () {\n var args = utilities.arrayLikeObjToArray(arguments);\n var next = args.pop();\n\n if (isAllowed.apply(null, args)) {\n return callback.apply(this, arguments);\n }\n\n args.unshift(null);\n return next.apply(null, args);\n };\n};\n\nmodule.exports = async;\n\n","'use strict';\n\nvar utilities = require('./utilityFunctions');\n\nvar dom = {};\n\ndom.isVisible = function isVisible(el) {\n var style = window.getComputedStyle(el);\n return style.visibility !== 'hidden';\n};\n\ndom.isHidden = function isHidden(el) {\n var style = window.getComputedStyle(el);\n return style.display === 'none';\n};\n\ndom.isShown = function isShown(el) {\n return !dom.isHidden(el);\n};\n\ndom.hide = function hide(el) {\n el.__prev_style_display_ = el.style.display;\n el.style.display = 'none';\n};\n\ndom.show = function show(el) {\n if (dom.isHidden(el)) {\n el.style.display = el.__prev_style_display_;\n }\n el.__prev_style_display_ = undefined;\n};\n\ndom.hasClass = function hasClass(el, cssClass) {\n var classes, i, len;\n\n if (utilities.isNotEmptyString(cssClass)) {\n if (el.classList) {\n return el.classList.contains(cssClass);\n }\n\n classes = utilities.isString(el.getAttribute('class')) ? el.getAttribute('class').split(/\\s+/) : [];\n cssClass = (cssClass || '');\n\n for (i = 0, len = classes.length; i < len; i += 1) {\n if (classes[i] === cssClass) {\n return true;\n }\n }\n }\n return false;\n};\n\ndom.addClass = function (el, cssClass) {\n var classes;\n\n if (utilities.isNotEmptyString(cssClass)) {\n if (el.classList) {\n return el.classList.add(cssClass);\n }\n\n classes = utilities.isString(el.getAttribute('class')) ? el.getAttribute('class').split(/\\s+/) : [];\n if (utilities.isString(cssClass) && utilities.isNotEmptyString(cssClass.replace(/\\s+/, ''))) {\n classes.push(cssClass);\n el.setAttribute('class', classes.join(' '));\n }\n }\n};\n\ndom.removeClass = function (el, cssClass) {\n var classes;\n\n if (utilities.isNotEmptyString(cssClass)) {\n if (el.classList) {\n return el.classList.remove(cssClass);\n }\n\n classes = utilities.isString(el.getAttribute('class')) ? el.getAttribute('class').split(/\\s+/) : [];\n var newClasses = [];\n var i, len;\n if (utilities.isString(cssClass) && utilities.isNotEmptyString(cssClass.replace(/\\s+/, ''))) {\n\n for (i = 0, len = classes.length; i < len; i += 1) {\n if (cssClass !== classes[i]) {\n newClasses.push(classes[i]);\n }\n }\n el.setAttribute('class', newClasses.join(' '));\n }\n }\n};\n\ndom.addEventListener = function addEventListener(el, type, handler) {\n if(utilities.isArray(el)){\n utilities.forEach(el, function(e) {\n dom.addEventListener(e, type, handler);\n });\n return;\n }\n\n if(utilities.isArray(type)){\n utilities.forEach(type, function(t) {\n dom.addEventListener(el, t, handler);\n });\n return;\n }\n\n if (el.addEventListener) {\n el.addEventListener(type, handler, false);\n } else if (el.attachEvent) {\n // WARNING!!! this is a very naive implementation !\n // the event object that should be passed to the handler\n // would not be there for IE8\n // we should use \"window.event\" and then \"event.srcElement\"\n // instead of \"event.target\"\n el.attachEvent(\"on\" + type, handler);\n }\n};\n\ndom.removeEventListener = function removeEventListener(el, type, handler) {\n if(utilities.isArray(el)){\n utilities.forEach(el, function(e) {\n dom.removeEventListener(e, type, handler);\n });\n return;\n }\n\n if(utilities.isArray(type)){\n utilities.forEach(type, function(t) {\n dom.removeEventListener(el, t, handler);\n });\n return;\n }\n\n if (el.removeEventListener) {\n el.removeEventListener(type, handler, false);\n } else if (el.detachEvent) {\n el.detachEvent(\"on\" + type, handler);\n } else {\n el[\"on\" + type] = null;\n }\n};\n\ndom.dispatchEvent = function dispatchEvent(el, event) {\n if (el.dispatchEvent) {\n el.dispatchEvent(event);\n } else {\n el.fireEvent(\"on\" + event.eventType, event);\n }\n};\n\ndom.isDescendant = function isDescendant(parent, child) {\n var node = child.parentNode;\n while (node !== null) {\n if (node === parent) {\n return true;\n }\n node = node.parentNode;\n }\n return false;\n};\n\ndom.getTextContent = function getTextContent(el){\n return el.textContent || el.text;\n};\n\ndom.prependChild = function prependChild(parent, child) {\n if(child.parentNode){\n child.parentNode.removeChild(child);\n }\n return parent.insertBefore(child, parent.firstChild);\n};\n\ndom.remove = function removeNode(node){\n if(node && node.parentNode){\n node.parentNode.removeChild(node);\n }\n};\n\ndom.isDomElement = function isDomElement(o) {\n return o instanceof Element;\n};\n\ndom.click = function(el, handler) {\n dom.addEventListener(el, 'click', handler);\n};\n\ndom.once = function(el, type, handler) {\n function handlerWrap() {\n handler.apply(null, arguments);\n dom.removeEventListener(el, type, handlerWrap);\n }\n\n dom.addEventListener(el, type, handlerWrap);\n};\n\n//Note: there is no getBoundingClientRect on iPad so we need a fallback\ndom.getDimension = function getDimension(element) {\n var rect;\n\n //On IE9 and below getBoundingClientRect does not work consistently\n if(!utilities.isOldIE() && element.getBoundingClientRect) {\n rect = element.getBoundingClientRect();\n return {\n width: rect.width,\n height: rect.height\n };\n }\n\n return {\n width: element.offsetWidth,\n height: element.offsetHeight\n };\n};\n\nmodule.exports = dom;","'use strict';\n\nvar urlUtils = require('./urlUtils');\nvar utilities = require('./utilityFunctions');\n\nfunction HttpRequestError(message) {\n this.message = 'HttpRequest Error: ' + (message || '');\n}\nHttpRequestError.prototype = new Error();\nHttpRequestError.prototype.name = \"HttpRequest Error\";\n\nfunction HttpRequest(createXhr) {\n if (!utilities.isFunction(createXhr)) {\n throw new HttpRequestError('Missing XMLHttpRequest factory method');\n }\n\n this.createXhr = createXhr;\n}\n\nHttpRequest.prototype.run = function (method, url, callback, options) {\n sanityCheck(url, callback, options);\n var timeout, timeoutId;\n var xhr = this.createXhr();\n options = options || {};\n timeout = utilities.isNumber(options.timeout) ? options.timeout : 0;\n\n xhr.open(method, urlUtils.urlParts(url).href, true);\n\n if (options.headers) {\n setHeaders(xhr, options.headers);\n }\n\n if (options.withCredentials) {\n xhr.withCredentials = true;\n }\n\n xhr.onload = function () {\n var statusText, response, status;\n\n /**\n * The only way to do a secure request on IE8 and IE9 is with the XDomainRequest object. Unfortunately, microsoft is\n * so nice that decided that the status property and the 'getAllResponseHeaders' method where not needed so we have to\n * fake them. If the request gets done with an XDomainRequest instance, we will assume that there are no headers and\n * the status will always be 200. If you don't like it, DO NOT USE ANCIENT BROWSERS!!!\n *\n * For mor info go to: https://msdn.microsoft.com/en-us/library/cc288060(v=vs.85).aspx\n */\n if (!xhr.getAllResponseHeaders) {\n xhr.getAllResponseHeaders = function () {\n return null;\n };\n }\n\n if (!xhr.status) {\n xhr.status = 200;\n }\n\n if (utilities.isDefined(timeoutId)) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n\n statusText = xhr.statusText || '';\n\n // responseText is the old-school way of retrieving response (supported by IE8 & 9)\n // response/responseType properties were introduced in XHR Level2 spec (supported by IE10)\n response = ('response' in xhr) ? xhr.response : xhr.responseText;\n\n // normalize IE9 bug (http://bugs.jquery.com/ticket/1450)\n status = xhr.status === 1223 ? 204 : xhr.status;\n\n callback(\n status,\n response,\n xhr.getAllResponseHeaders(),\n statusText);\n };\n\n xhr.onerror = requestError;\n xhr.onabort = requestError;\n\n xhr.send();\n\n if (timeout > 0) {\n timeoutId = setTimeout(function () {\n xhr && xhr.abort();\n }, timeout);\n }\n\n function sanityCheck(url, callback, options) {\n if (!utilities.isString(url) || utilities.isEmptyString(url)) {\n throw new HttpRequestError(\"Invalid url '\" + url + \"'\");\n }\n\n if (!utilities.isFunction(callback)) {\n throw new HttpRequestError(\"Invalid handler '\" + callback + \"' for the http request\");\n }\n\n if (utilities.isDefined(options) && !utilities.isObject(options)) {\n throw new HttpRequestError(\"Invalid options map '\" + options + \"'\");\n }\n }\n\n function setHeaders(xhr, headers) {\n utilities.forEach(headers, function (value, key) {\n if (utilities.isDefined(value)) {\n xhr.setRequestHeader(key, value);\n }\n });\n }\n\n function requestError() {\n callback(-1, null, null, '');\n }\n};\n\nHttpRequest.prototype.get = function (url, callback, options) {\n this.run('GET', url, processResponse, options);\n\n function processResponse(status, response, headersString, statusText) {\n if (isSuccess(status)) {\n callback(null, response, status, headersString, statusText);\n } else {\n callback(new HttpRequestError(statusText), response, status, headersString, statusText);\n }\n }\n\n function isSuccess(status) {\n return 200 <= status && status < 300;\n }\n};\n\nfunction createXhr() {\n var xhr = new XMLHttpRequest();\n if (!(\"withCredentials\" in xhr)) {\n // XDomainRequest for IE.\n xhr = new XDomainRequest();\n }\n return xhr;\n}\n\nvar http = new HttpRequest(createXhr);\n\nmodule.exports = {\n http: http,\n HttpRequest: HttpRequest,\n HttpRequestError: HttpRequestError,\n createXhr: createXhr\n};\n","'use strict';\n\nvar dom = require('./dom');\nvar utilities = require('./utilityFunctions');\n\nvar playerUtils = {};\n\n/**\n * Returns an object that captures the portions of player state relevant to\n * video playback. The result of this function can be passed to\n * restorePlayerSnapshot with a player to return the player to the state it\n * was in when this function was invoked.\n * @param {object} player The videojs player object\n */\nplayerUtils.getPlayerSnapshot = function getPlayerSnapshot(player) {\n var tech = player.el().querySelector('.vjs-tech');\n\n var snapshot = {\n ended: player.ended(),\n src: player.currentSrc(),\n currentTime: player.currentTime(),\n type: player.currentType(),\n playing: !player.paused(),\n suppressedTracks: getSuppressedTracks(player)\n };\n\n if (tech) {\n snapshot.nativePoster = tech.poster;\n snapshot.style = tech.getAttribute('style');\n }\n return snapshot;\n\n /**** Local Functions ****/\n function getSuppressedTracks(player) {\n var tracks = player.remoteTextTracks ? player.remoteTextTracks() : [];\n\n if (tracks && utilities.isArray(tracks.tracks_)) {\n tracks = tracks.tracks_;\n }\n\n if (!utilities.isArray(tracks)) {\n tracks = [];\n }\n\n var suppressedTracks = [];\n tracks.forEach(function (track) {\n suppressedTracks.push({\n track: track,\n mode: track.mode\n });\n track.mode = 'disabled';\n });\n\n return suppressedTracks;\n }\n};\n\n/**\n * Attempts to modify the specified player so that its state is equivalent to\n * the state of the snapshot.\n * @param {object} snapshot - the player state to apply\n */\nplayerUtils.restorePlayerSnapshot = function restorePlayerSnapshot(player, snapshot) {\n var tech = player.el().querySelector('.vjs-tech');\n var attempts = 20; // the number of remaining attempts to restore the snapshot\n\n if (snapshot.nativePoster) {\n tech.poster = snapshot.nativePoster;\n }\n\n if ('style' in snapshot) {\n // overwrite all css style properties to restore state precisely\n tech.setAttribute('style', snapshot.style || '');\n }\n\n if (hasSrcChanged(player, snapshot)) {\n\n // on ios7, fiddling with textTracks too early will cause safari to crash\n player.one('contentloadedmetadata', restoreTracks);\n\n player.one('canplay', tryToResume);\n ensureCanplayEvtGetsFired();\n\n // if the src changed for ad playback, reset it\n player.src({src: snapshot.src, type: snapshot.type});\n\n // safari requires a call to `load` to pick up a changed source\n player.load();\n\n } else {\n restoreTracks();\n\n if (snapshot.playing) {\n player.play();\n }\n }\n\n /*** Local Functions ***/\n\n /**\n * Sometimes firefox does not trigger the 'canplay' evt.\n * This code ensure that it always gets triggered triggered.\n */\n function ensureCanplayEvtGetsFired() {\n var timeoutId = setTimeout(function() {\n player.trigger('canplay');\n }, 1000);\n\n player.one('canplay', function(){\n clearTimeout(timeoutId);\n });\n }\n\n /**\n * Determine whether the player needs to be restored to its state\n * before ad playback began. With a custom ad display or burned-in\n * ads, the content player state hasn't been modified and so no\n * restoration is required\n */\n function hasSrcChanged(player, snapshot) {\n if (player.src()) {\n return player.src() !== snapshot.src;\n }\n // the player was configured through source element children\n return player.currentSrc() !== snapshot.src;\n }\n\n function restoreTracks() {\n var suppressedTracks = snapshot.suppressedTracks;\n suppressedTracks.forEach(function (trackSnapshot) {\n trackSnapshot.track.mode = trackSnapshot.mode;\n });\n }\n\n /**\n * Determine if the video element has loaded enough of the snapshot source\n * to be ready to apply the rest of the state\n */\n function tryToResume() {\n\n // if some period of the video is seekable, resume playback\n // otherwise delay a bit and then check again unless we're out of attempts\n\n if (!playerUtils.isReadyToResume(player) && attempts--) {\n setTimeout(tryToResume, 50);\n } else {\n try {\n if(player.currentTime() !== snapshot.currentTime) {\n if (snapshot.playing) { // if needed restore playing status after seek completes\n player.one('seeked', function() {\n player.play();\n });\n }\n player.currentTime(snapshot.currentTime);\n\n } else if (snapshot.playing) {\n // if needed and no seek has been performed, restore playing status immediately\n player.play();\n }\n\n } catch (e) {\n videojs.log.warn('Failed to resume the content after an advertisement', e);\n }\n }\n }\n};\n\nplayerUtils.isReadyToResume = function (player) {\n\n if (player.readyState() > 1) {\n // some browsers and media aren't \"seekable\".\n // readyState greater than 1 allows for seeking without exceptions\n return true;\n }\n\n if (player.seekable() === undefined) {\n // if the player doesn't expose the seekable time ranges, try to\n // resume playback immediately\n return true;\n }\n\n if (player.seekable().length > 0) {\n // if some period of the video is seekable, resume playback\n return true;\n }\n\n return false;\n};\n\n/**\n * This function prepares the player to display ads.\n * Adding convenience events like the 'vast.firsPlay' that gets fired when the video is first played\n * and ads the blackPoster to the player to prevent content from being displayed before the preroll ad.\n *\n * @param player\n */\nplayerUtils.prepareForAds = function (player) {\n var blackPoster = player.addChild('blackPoster');\n var _firstPlay = true;\n var volumeSnapshot;\n\n\n monkeyPatchPlayerApi();\n\n player.on('play', tryToTriggerFirstPlay);\n player.on('vast.reset', resetFirstPlay);//Every time we change the sources we reset the first play.\n player.on('vast.firstPlay', restoreContentVolume);\n player.on('error', hideBlackPoster);//If there is an error in the player we remove the blackposter to show the err msg\n player.on('vast.adStart', hideBlackPoster);\n player.on('vast.adsCancel', hideBlackPoster);\n player.on('vast.adError', hideBlackPoster);\n player.on('vast.adStart', addStyles);\n player.on('vast.adEnd', removeStyles);\n player.on('vast.adsCancel', removeStyles);\n\n /*** Local Functions ***/\n\n /**\n What this function does is ugly and horrible and I should think twice before calling myself a good developer. With that said,\n it is the best solution I could find to mute the video until the 'play' event happens (on mobile devices) and the plugin can decide whether\n to play the ad or not.\n\n We also need this monkeypatch to be able to pause and resume an ad using the player's API\n\n If you have a better solution please do tell me.\n */\n function monkeyPatchPlayerApi() {\n\n /**\n * Monkey patch needed to handle firstPlay and resume of playing ad.\n *\n * @param callOrigPlay necessary flag to prevent infinite loop when you are restoring a VAST ad.\n * @returns {player}\n */\n var origPlay = player.play;\n player.play = function (callOrigPlay) {\n var that = this;\n\n if (isFirstPlay()) {\n firstPlay();\n } else {\n resume(callOrigPlay);\n }\n\n return this;\n\n /*** local functions ***/\n function firstPlay() {\n if (!utilities.isIPhone()) {\n volumeSnapshot = saveVolumeSnapshot();\n player.muted(true);\n }\n\n origPlay.apply(that, arguments);\n }\n\n function resume(callOrigPlay) {\n if (isAdPlaying() && !callOrigPlay) {\n player.vast.adUnit.resumeAd();\n } else {\n origPlay.apply(that, arguments);\n }\n }\n };\n\n\n /**\n * Needed monkey patch to handle pause of playing ad.\n *\n * @param callOrigPlay necessary flag to prevent infinite loop when you are pausing a VAST ad.\n * @returns {player}\n */\n var origPause = player.pause;\n player.pause = function (callOrigPause) {\n if (isAdPlaying() && !callOrigPause) {\n player.vast.adUnit.pauseAd();\n } else {\n origPause.apply(this, arguments);\n }\n return this;\n };\n\n\n /**\n * Needed monkey patch to handle paused state of the player when ads are playing.\n *\n * @param callOrigPlay necessary flag to prevent infinite loop when you are pausing a VAST ad.\n * @returns {player}\n */\n var origPaused = player.paused;\n player.paused = function (callOrigPaused) {\n if (isAdPlaying() && !callOrigPaused) {\n return player.vast.adUnit.isPaused();\n }\n return origPaused.apply(this, arguments);\n };\n }\n\n function isAdPlaying() {\n return player.vast && player.vast.adUnit;\n }\n\n function tryToTriggerFirstPlay() {\n if (isFirstPlay()) {\n _firstPlay = false;\n player.trigger('vast.firstPlay');\n }\n }\n\n function resetFirstPlay() {\n _firstPlay = true;\n blackPoster.show();\n restoreContentVolume();\n }\n\n function isFirstPlay() {\n return _firstPlay;\n }\n\n function saveVolumeSnapshot() {\n return {\n muted: player.muted(),\n volume: player.volume()\n };\n }\n\n function restoreContentVolume() {\n if (volumeSnapshot) {\n player.currentTime(0);\n restoreVolumeSnapshot(volumeSnapshot);\n volumeSnapshot = null;\n }\n }\n\n function restoreVolumeSnapshot(snapshot) {\n if (utilities.isObject(snapshot)) {\n player.volume(snapshot.volume);\n player.muted(snapshot.muted);\n }\n }\n\n function hideBlackPoster() {\n if (!dom.hasClass(blackPoster.el(), 'vjs-hidden')) {\n blackPoster.hide();\n }\n }\n\n function addStyles() {\n dom.addClass(player.el(), 'vjs-ad-playing');\n }\n\n function removeStyles() {\n dom.removeClass(player.el(), 'vjs-ad-playing');\n }\n};\n\n/**\n * Remove the poster attribute from the video element tech, if present. When\n * reusing a video element for multiple videos, the poster image will briefly\n * reappear while the new source loads. Removing the attribute ahead of time\n * prevents the poster from showing up between videos.\n * @param {object} player The videojs player object\n */\nplayerUtils.removeNativePoster = function (player) {\n var tech = player.el().querySelector('.vjs-tech');\n if (tech) {\n tech.removeAttribute('poster');\n }\n};\n\n/**\n * Helper function to listen to many events until one of them gets fired, then we\n * execute the handler and unsubscribe all the event listeners;\n *\n * @param player specific player from where to listen for the events\n * @param events array of events\n * @param handler function to execute once one of the events fires\n */\nplayerUtils.once = function once(player, events, handler) {\n function listener() {\n handler.apply(null, arguments);\n\n events.forEach(function (event) {\n player.off(event, listener);\n });\n }\n\n events.forEach(function (event) {\n player.on(event, listener);\n });\n};\n\n\nmodule.exports = playerUtils;","'use strict';\n\nvar utilities = require('./utilityFunctions');\n\n/**\n *\n * IMPORTANT NOTE: This function comes from angularJs and was originally called urlResolve\n * you can take a look at the original code here https://github.com/angular/angular.js/blob/master/src/ng/urlUtils.js\n *\n * Implementation Notes for non-IE browsers\n * ----------------------------------------\n * Assigning a URL to the href property of an anchor DOM node, even one attached to the DOM,\n * results both in the normalizing and parsing of the URL. Normalizing means that a relative\n * URL will be resolved into an absolute URL in the context of the application document.\n * Parsing means that the anchor node's host, hostname, protocol, port, pathname and related\n * properties are all populated to reflect the normalized URL. This approach has wide\n * compatibility - Safari 1+, Mozilla 1+, Opera 7+,e etc. See\n * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html\n *\n * Implementation Notes for IE\n * ---------------------------\n * IE >= 8 and <= 10 normalizes the URL when assigned to the anchor node similar to the other\n * browsers. However, the parsed components will not be set if the URL assigned did not specify\n * them. (e.g. if you assign a.href = \"foo\", then a.protocol, a.host, etc. will be empty.) We\n * work around that by performing the parsing in a 2nd step by taking a previously normalized\n * URL (e.g. by assigning to a.href) and assigning it a.href again. This correctly populates the\n * properties such as protocol, hostname, port, etc.\n *\n * IE7 does not normalize the URL when assigned to an anchor node. (Apparently, it does, if one\n * uses the inner HTML approach to assign the URL as part of an HTML snippet -\n * http://stackoverflow.com/a/472729) However, setting img[src] does normalize the URL.\n * Unfortunately, setting img[src] to something like \"javascript:foo\" on IE throws an exception.\n * Since the primary usage for normalizing URLs is to sanitize such URLs, we can't use that\n * method and IE < 8 is unsupported.\n *\n * References:\n * http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement\n * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html\n * http://url.spec.whatwg.org/#urlutils\n * https://github.com/angular/angular.js/pull/2902\n * http://james.padolsey.com/javascript/parsing-urls-with-the-dom/\n *\n * @kind function\n * @param {string} url The URL to be parsed.\n * @description Normalizes and parses a URL.\n * @returns {object} Returns the normalized URL as a dictionary.\n *\n * | member name | Description |\n * |---------------|----------------|\n * | href | A normalized version of the provided URL if it was not an absolute URL |\n * | protocol | The protocol including the trailing colon |\n * | host | The host and port (if the port is non-default) of the normalizedUrl |\n * | search | The search params, minus the question mark |\n * | hash | The hash string, minus the hash symbol\n * | hostname | The hostname\n * | port | The port, without \":\"\n * | pathname | The pathname, beginning with \"/\"\n *\n */\n\nvar urlParsingNode = document.createElement(\"a\");\n/**\n * documentMode is an IE-only property\n * http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx\n */\nvar msie = document.documentMode;\n\nfunction urlParts(url) {\n var href = url;\n\n if (msie) {\n // Normalize before parse. Refer Implementation Notes on why this is\n // done in two steps on IE.\n urlParsingNode.setAttribute(\"href\", href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: utilities.isNotEmptyString(urlParsingNode.port)? urlParsingNode.port: 80,\n pathname: (urlParsingNode.pathname.charAt(0) === '/')\n ? urlParsingNode.pathname\n : '/' + urlParsingNode.pathname\n };\n}\n\n\n/**\n * This function accepts a query string (search part of a url) and returns a dictionary with\n * the different key value pairs\n * @param {string} qs queryString\n */\nfunction queryStringToObj(qs, cond) {\n var pairs, qsObj;\n\n cond = utilities.isFunction(cond)? cond : function() {\n return true;\n };\n\n qs = qs.trim().replace(/^\\?/, '');\n pairs = qs.split('&');\n qsObj = {};\n\n utilities.forEach(pairs, function (pair) {\n var keyValue, key, value;\n if (pair !== '') {\n keyValue = pair.split('=');\n key = keyValue[0];\n value = keyValue[1];\n if(cond(key, value)){\n qsObj[key] = value;\n }\n }\n });\n\n return qsObj;\n}\n\n/**\n * This function accepts an object and serializes it into a query string without the leading '?'\n * @param obj\n * @returns {string}\n */\nfunction objToQueryString(obj) {\n var pairs = [];\n utilities.forEach(obj, function (value, key) {\n pairs.push(key + '=' + value);\n });\n return pairs.join('&');\n}\n\nmodule.exports = {\n urlParts: urlParts,\n queryStringToObj: queryStringToObj,\n objToQueryString: objToQueryString\n};\n","/*jshint unused:false */\n\"use strict\";\n\nvar NODE_TYPE_ELEMENT = 1;\nvar SNAKE_CASE_REGEXP = /[A-Z]/g;\nvar EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i;\n/*jslint maxlen: 500 */\nvar ISO8086_REGEXP = /^([\\+-]?\\d{4}(?!\\d{2}\\b))((-?)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))?|W([0-4]\\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6])))([T\\s]((([01]\\d|2[0-3])((:?)[0-5]\\d)?|24\\:?00)([\\.,]\\d+(?!:))?)?(\\17[0-5]\\d([\\.,]\\d+)?)?([zZ]|([\\+-])([01]\\d|2[0-3]):?([0-5]\\d)?)?)?)?$/;\n\n\nfunction noop(){ }\n\nfunction isNull(o) {\n return o === null;\n}\n\nfunction isDefined(o){\n return o !== undefined;\n}\n\nfunction isUndefined(o){\n return o === undefined;\n}\n\nfunction isObject(obj) {\n return typeof obj === 'object';\n}\n\nfunction isFunction(str){\n return typeof str === 'function';\n}\n\nfunction isNumber(num){\n return typeof num === 'number';\n}\n\nfunction isWindow(obj) {\n return utilities.isObject(obj) && obj.window === obj;\n}\n\nfunction isArray(array){\n return Object.prototype.toString.call( array ) === '[object Array]';\n}\n\nfunction isArrayLike(obj) {\n if (obj === null || utilities.isWindow(obj) || utilities.isFunction(obj) || utilities.isUndefined(obj)) {\n return false;\n }\n\n var length = obj.length;\n\n if (obj.nodeType === NODE_TYPE_ELEMENT && length) {\n return true;\n }\n\n return utilities.isString(obj) || utilities.isArray(obj) || length === 0 ||\n typeof length === 'number' && length > 0 && (length - 1) in obj;\n}\n\nfunction isString(str){\n return typeof str === 'string';\n}\n\nfunction isEmptyString(str) {\n return utilities.isString(str) && str.length === 0;\n}\n\nfunction isNotEmptyString(str) {\n return utilities.isString(str) && str.length !== 0;\n}\n\nfunction arrayLikeObjToArray(args) {\n return Array.prototype.slice.call(args);\n}\n\nfunction forEach(obj, iterator, context) {\n var key, length;\n if (obj) {\n if (isFunction(obj)) {\n for (key in obj) {\n // Need to check if hasOwnProperty exists,\n // as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function\n if (key !== 'prototype' && key !== 'length' && key !== 'name' && (!obj.hasOwnProperty || obj.hasOwnProperty(key))) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n } else if (isArray(obj)) {\n var isPrimitive = typeof obj !== 'object';\n for (key = 0, length = obj.length; key < length; key++) {\n if (isPrimitive || key in obj) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n } else if (obj.forEach && obj.forEach !== forEach) {\n obj.forEach(iterator, context, obj);\n } else {\n for (key in obj) {\n if (obj.hasOwnProperty(key)) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n }\n }\n return obj;\n}\n\nfunction snake_case(name, separator) {\n separator = separator || '_';\n return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n}\n\nfunction isValidEmail(email){\n if(!utilities.isString(email)){\n return false;\n }\n\n return EMAIL_REGEXP.test(email.trim());\n}\n\nfunction extend (obj) {\n var arg, i, k;\n for (i = 1; i < arguments.length; i++) {\n arg = arguments[i];\n for (k in arg) {\n if (arg.hasOwnProperty(k)) {\n if(isObject(obj[k]) && !isNull(obj[k]) && isObject(arg[k])){\n obj[k] = extend({}, obj[k], arg[k]);\n }else {\n obj[k] = arg[k];\n }\n }\n }\n }\n return obj;\n}\n\nfunction capitalize(s){\n return s.charAt(0).toUpperCase() + s.slice(1);\n}\n\nfunction decapitalize(s) {\n return s.charAt(0).toLowerCase() + s.slice(1);\n}\n\n/**\n * This method works the same way array.prototype.map works but if the transformer returns undefine, then\n * it won't be added to the transformed Array.\n */\nfunction transformArray(array, transformer) {\n var transformedArray = [];\n\n array.forEach(function(item, index){\n var transformedItem = transformer(item, index);\n if(utilities.isDefined(transformedItem)) {\n transformedArray.push(transformedItem);\n }\n });\n\n return transformedArray;\n}\n\nfunction toFixedDigits(num, digits) {\n var formattedNum = num + '';\n digits = utilities.isNumber(digits) ? digits : 0;\n num = utilities.isNumber(num) ? num : parseInt(num, 10);\n if(utilities.isNumber(num) && !isNaN(num)){\n formattedNum = num + '';\n while(formattedNum.length < digits) {\n formattedNum = '0' + formattedNum;\n }\n return formattedNum;\n }\n return NaN + '';\n}\n\nfunction throttle(callback, delay) {\n var previousCall = new Date().getTime() - (delay + 1);\n return function() {\n var time = new Date().getTime();\n if ((time - previousCall) >= delay) {\n previousCall = time;\n callback.apply(this, arguments);\n }\n };\n}\n\nfunction debounce (callback, wait) {\n var timeoutId;\n\n return function (){\n if(timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(function(){\n callback.apply(this, arguments);\n timeoutId = undefined;\n }, wait);\n };\n}\n\n// a function designed to blow up the stack in a naive way\n// but it is ok for videoJs children components\nfunction treeSearch(root, getChildren, found){\n var children = getChildren(root);\n for (var i = 0; i < children.length; i++){\n if (found(children[i])) {\n return children[i];\n }\n else {\n var el = treeSearch(children[i], getChildren, found);\n if (el){\n return el;\n }\n }\n }\n}\n\nfunction echoFn(val) {\n return function () {\n return val;\n };\n}\n\n//Note: Supported formats come from http://www.w3.org/TR/NOTE-datetime\n// and the iso8601 regex comes from http://www.pelagodesign.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/\nfunction isISO8601(value) {\n if(utilities.isNumber(value)){\n value = value + ''; //we make sure that we are working with strings\n }\n\n if(!utilities.isString(value)){\n return false;\n }\n\n return ISO8086_REGEXP.test(value.trim());\n}\n\n/**\n * Checks if the Browser is IE9 and below\n * @returns {boolean}\n */\nfunction isOldIE() {\n var version = utilities.getInternetExplorerVersion(navigator);\n if (version === -1) {\n return false;\n }\n\n return version < 10;\n}\n\n/**\n * Returns the version of Internet Explorer or a -1 (indicating the use of another browser).\n * Source: https://msdn.microsoft.com/en-us/library/ms537509(v=vs.85).aspx\n * @returns {number} the version of Internet Explorer or a -1 (indicating the use of another browser).\n */\nfunction getInternetExplorerVersion(navigator) {\n var rv = -1;\n\n if (navigator.appName == 'Microsoft Internet Explorer') {\n var ua = navigator.userAgent;\n var re = new RegExp(\"MSIE ([0-9]{1,}[\\.0-9]{0,})\");\n var res = re.exec(ua);\n if (res !== null) {\n rv = parseFloat(res[1]);\n }\n }\n\n return rv;\n}\n\n/*** Mobile Utility functions ***/\nfunction isIDevice() {\n return /iP(hone|ad)/.test(utilities._UA);\n}\n\nfunction isMobile() {\n return /iP(hone|ad|od)|Android|Windows Phone/.test(utilities._UA);\n}\n\nfunction isIPhone() {\n return /iP(hone|od)/.test(utilities._UA);\n}\n\nfunction isAndroid() {\n return /Android/.test(utilities._UA);\n}\n\nvar utilities = {\n _UA: navigator.userAgent,\n noop: noop,\n isNull: isNull,\n isDefined: isDefined,\n isUndefined: isUndefined,\n isObject: isObject,\n isFunction: isFunction,\n isNumber: isNumber,\n isWindow: isWindow,\n isArray: isArray,\n isArrayLike: isArrayLike,\n isString: isString,\n isEmptyString: isEmptyString,\n isNotEmptyString: isNotEmptyString,\n arrayLikeObjToArray: arrayLikeObjToArray,\n forEach: forEach,\n snake_case: snake_case,\n isValidEmail: isValidEmail,\n extend: extend,\n capitalize: capitalize,\n decapitalize: decapitalize,\n transformArray: transformArray,\n toFixedDigits: toFixedDigits,\n throttle: throttle,\n debounce: debounce,\n treeSearch: treeSearch,\n echoFn: echoFn,\n isISO8601: isISO8601,\n isOldIE: isOldIE,\n getInternetExplorerVersion: getInternetExplorerVersion,\n isIDevice: isIDevice,\n isMobile: isMobile,\n isIPhone: isIPhone,\n isAndroid: isAndroid\n};\n\nmodule.exports = utilities;","'use strict';\n\nvar utilities = require('./utilityFunctions');\n\nvar xml = {};\n\nxml.strToXMLDoc = function strToXMLDoc(stringContainingXMLSource){\n //IE 8\n if(typeof window.DOMParser === 'undefined'){\n var xmlDocument = new ActiveXObject('Microsoft.XMLDOM');\n xmlDocument.async = false;\n xmlDocument.loadXML(stringContainingXMLSource);\n return xmlDocument;\n }\n\n return parseString(stringContainingXMLSource);\n\n function parseString(stringContainingXMLSource){\n var parser = new DOMParser();\n var parsedDocument;\n\n //Note: This try catch is to deal with the fact that on IE parser.parseFromString does throw an error but the rest of the browsers don't.\n try {\n parsedDocument = parser.parseFromString(stringContainingXMLSource, \"application/xml\");\n\n if(isParseError(parsedDocument) || utilities.isEmptyString(stringContainingXMLSource)){\n throw new Error();\n }\n }catch(e){\n throw new Error(\"xml.strToXMLDOC: Error parsing the string: '\" + stringContainingXMLSource + \"'\");\n }\n\n return parsedDocument;\n }\n\n function isParseError(parsedDocument) {\n try { // parser and parsererrorNS could be cached on startup for efficiency\n var parser = new DOMParser(),\n erroneousParse = parser.parseFromString('INVALID', 'text/xml'),\n parsererrorNS = erroneousParse.getElementsByTagName(\"parsererror\")[0].namespaceURI;\n\n if (parsererrorNS === 'http://www.w3.org/1999/xhtml') {\n // In PhantomJS the parseerror element doesn't seem to have a special namespace, so we are just guessing here :(\n return parsedDocument.getElementsByTagName(\"parsererror\").length > 0;\n }\n\n return parsedDocument.getElementsByTagNameNS(parsererrorNS, 'parsererror').length > 0;\n } catch (e) {\n //Note on IE parseString throws an error by itself and it will never reach this code. Because it will have failed before\n }\n }\n};\n\nxml.parseText = function parseText (sValue) {\n if (/^\\s*$/.test(sValue)) { return null; }\n if (/^(?:true|false)$/i.test(sValue)) { return sValue.toLowerCase() === \"true\"; }\n if (isFinite(sValue)) { return parseFloat(sValue); }\n if (utilities.isISO8601(sValue)) { return new Date(sValue); }\n return sValue.trim();\n};\n\nxml.JXONTree = function JXONTree (oXMLParent) {\n var parseText = xml.parseText;\n\n //The document object is an especial object that it may miss some functions or attrs depending on the browser.\n //To prevent this problem with create the JXONTree using the root childNode which is a fully fleshed node on all supported\n //browsers.\n if(oXMLParent.documentElement){\n return new xml.JXONTree(oXMLParent.documentElement);\n }\n\n if (oXMLParent.hasChildNodes()) {\n var sCollectedTxt = \"\";\n for (var oNode, sProp, vContent, nItem = 0; nItem < oXMLParent.childNodes.length; nItem++) {\n oNode = oXMLParent.childNodes.item(nItem);\n /*jshint bitwise: false*/\n if ((oNode.nodeType - 1 | 1) === 3) { sCollectedTxt += oNode.nodeType === 3 ? oNode.nodeValue.trim() : oNode.nodeValue; }\n else if (oNode.nodeType === 1 && !oNode.prefix) {\n sProp = utilities.decapitalize(oNode.nodeName);\n vContent = new xml.JXONTree(oNode);\n if (this.hasOwnProperty(sProp)) {\n if (this[sProp].constructor !== Array) { this[sProp] = [this[sProp]]; }\n this[sProp].push(vContent);\n } else { this[sProp] = vContent; }\n }\n }\n if (sCollectedTxt) { this.keyValue = parseText(sCollectedTxt); }\n }\n\n //IE8 Stupid fix\n var hasAttr = typeof oXMLParent.hasAttributes === 'undefined'? oXMLParent.attributes.length > 0: oXMLParent.hasAttributes();\n if (hasAttr) {\n var oAttrib;\n for (var nAttrib = 0; nAttrib < oXMLParent.attributes.length; nAttrib++) {\n oAttrib = oXMLParent.attributes.item(nAttrib);\n this[\"@\" + utilities.decapitalize(oAttrib.name)] = parseText(oAttrib.value.trim());\n }\n }\n};\n\nxml.JXONTree.prototype.attr = function(attr) {\n return this['@' + utilities.decapitalize(attr)];\n};\n\nxml.toJXONTree = function toJXONTree(xmlString){\n var xmlDoc = xml.strToXMLDoc(xmlString);\n return new xml.JXONTree(xmlDoc);\n};\n\n/**\n * Helper function to extract the keyvalue of a JXONTree obj\n *\n * @param xmlObj {JXONTree}\n * return the key value or undefined;\n */\nxml.keyValue = function getKeyValue(xmlObj) {\n if(xmlObj){\n return xmlObj.keyValue;\n }\n return undefined;\n};\n\nxml.attr = function getAttrValue(xmlObj, attr) {\n if(xmlObj) {\n return xmlObj['@' + utilities.decapitalize(attr)];\n }\n return undefined;\n};\n\nxml.encode = function encodeXML(str) {\n return str.replace(/&/g, '&')\n .replace(//g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n};\n\nxml.decode = function decodeXML(str) {\n return str.replace(/'/g, \"'\")\n .replace(/"/g, '\"')\n .replace(/>/g, '>')\n .replace(/</g, '<')\n .replace(/&/g, '&');\n};\n\nmodule.exports = xml;","'use strict';\n\nrequire('./plugin/components/ads-label_4');\nrequire('./plugin/components/black-poster_4');\n\nvar videoJsVAST = require('./plugin/videojs.vast.vpaid');\n\nvideojs.plugin('vastClient', videoJsVAST);\n\n"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/bin/videojs_5.vast.vpaid.js b/bin/videojs_5.vast.vpaid.js index ea22d6be..4d750051 100644 --- a/bin/videojs_5.vast.vpaid.js +++ b/bin/videojs_5.vast.vpaid.js @@ -1219,13 +1219,12 @@ function stringEndsWith(string, search) { } function hideFlashEl(el) { - // can't use display none because will not run the flash + // can't use display none or visibility none because will block flash in some browsers el.style.position = 'absolute'; el.style.left = '-1px'; el.style.top = '-1px'; el.style.width = '1px'; el.style.height = '1px'; - el.style.visibility = 'hidden'; } },{}],9:[function(require,module,exports){ @@ -6823,4 +6822,4 @@ var videoJsVAST = require('./plugin/videojs.vast.vpaid'); videojs.plugin('vastClient', videoJsVAST); },{"./plugin/components/ads-label_5":35,"./plugin/components/black-poster_5":37,"./plugin/videojs.vast.vpaid":38}]},{},[46]) -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJib3dlcl9jb21wb25lbnRzL1ZQQUlERkxBU0hDbGllbnQvanMvSVZQQUlEQWRVbml0LmpzIiwiYm93ZXJfY29tcG9uZW50cy9WUEFJREZMQVNIQ2xpZW50L2pzL1ZQQUlEQWRVbml0LmpzIiwiYm93ZXJfY29tcG9uZW50cy9WUEFJREZMQVNIQ2xpZW50L2pzL1ZQQUlERkxBU0hDbGllbnQuanMiLCJib3dlcl9jb21wb25lbnRzL1ZQQUlERkxBU0hDbGllbnQvanMvZmxhc2hUZXN0ZXIuanMiLCJib3dlcl9jb21wb25lbnRzL1ZQQUlERkxBU0hDbGllbnQvanMvanNGbGFzaEJyaWRnZS5qcyIsImJvd2VyX2NvbXBvbmVudHMvVlBBSURGTEFTSENsaWVudC9qcy9qc0ZsYXNoQnJpZGdlUmVnaXN0cnkuanMiLCJib3dlcl9jb21wb25lbnRzL1ZQQUlERkxBU0hDbGllbnQvanMvcmVnaXN0cnkuanMiLCJib3dlcl9jb21wb25lbnRzL1ZQQUlERkxBU0hDbGllbnQvanMvdXRpbHMuanMiLCJib3dlcl9jb21wb25lbnRzL1ZQQUlESFRNTDVDbGllbnQvanMvSVZQQUlEQWRVbml0LmpzIiwiYm93ZXJfY29tcG9uZW50cy9WUEFJREhUTUw1Q2xpZW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gdGhpcy5faGFuZGxlcnMuZ2V0KGV2ZW50TmFtZSkuZm9yRWFjaCgoY2FsbGJhY2spID0+IHtcbiAgICAgICAgICAgIC8vY2xpY2tUaHJ1IGhhcyB0byBiZSBzeW5jLCBpZiBub3Qgd2lsbCBiZSBibG9jayBieSB0aGUgcG9wdXBibG9ja2VyXG4gICAgICAgICAgICBpZiAoZXZlbnROYW1lID09PSAnQWRDbGlja1RocnUnKSB7XG4gICAgICAgICAgICAgICAgY2FsbGJhY2soZXZlbnQpO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuX2hhbmRsZXJzLmdldChldmVudE5hbWUpLmxlbmd0aCA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrKGV2ZW50KTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0sIDApO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICB9XG5cbiAgICBfY2FsbENhbGxiYWNrKG1ldGhvZE5hbWUsIGNhbGxiYWNrSUQsIGVyciwgcmVzdWx0KSB7XG5cbiAgICAgICAgbGV0IGNhbGxiYWNrID0gdGhpcy5fY2FsbGJhY2tzLmdldChjYWxsYmFja0lEKTtcblxuICAgICAgICAvL25vdCBhbGwgbWV0aG9kcyBjYWxsYmFjaydzIGFyZSBtYW5kYXRvcnlcbiAgICAgICAgLy9idXQgaWYgdGhlcmUgZXhpc3QgYW4gZXJyb3IsIGZpcmUgdGhlIGVycm9yIGV2ZW50XG4gICAgICAgIGlmICghY2FsbGJhY2spIHtcbiAgICAgICAgICAgIGlmIChlcnIgJiYgY2FsbGJhY2tJRCA9PT0gJycpIHtcbiAgICAgICAgICAgICAgICB0aGlzLnRyaWdnZXIoRVJST1IsIGVycik7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm47XG4gICA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b25maWcuZGF0YSwgdGhpcy5fZmxhc2hJRCwgc3dmQ29uZmlnLndpZHRoLCBzd2ZDb25maWcuaGVpZ2h0LCBoYW5kbGVyKTtcblxuICAgICAgICBmdW5jdGlvbiBvbkVycm9yKGVycm9yKSB7XG4gICAgICAgICAgICBzZXRUaW1lb3V0KCgpID0+IHtcbiAgICAgICAgICAgICAgICBjYWxsYmFjayhuZXcgRXJyb3IoZXJyb3IpKTtcbiAgICAgICAgICAgIH0sIDApO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgICAgIH1cblxuICAgIH1cblxuICAgIGRlc3Ryb3kgKCkge1xuICAgICAgICB0aGlzLl9kZXN0cm95QWRVbml0KCk7XG5cbiAgICAgICAgaWYgKHRoaXMuX2ZsYXNoKSB7XG4gICAgICAgICAgICB0aGlzLl9mbGFzaC5kZXN0cm95KCk7XG4gICAgICAgICAgICB0aGlzLl9mbGFzaCA9IG51bGw7XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy5lbCA9IG51bGw7XG4gICAgICAgIHRoaXMuX2Rlc3Ryb3llZCA9IHRydWU7XG4gICAgfVxuXG4gICAgaXNEZXN0cm95ZWQgKCkge1xuICAgICAgICByZXR1cm4gdGhpcy5fZGVzdHJveWVkO1xuICAgIH1cblxuICAgIF9kZXN0cm95QWRVbml0KCkge1xuICAgICAgICBkZWxldGUgdGhpcy5fbG9hZExhdGVyO1xuXG4gICAgICAgIGlmICh0aGlzLl9hZFVuaXRMb2FkKSB7XG4gICAgICAgICAgICB0aGlzLl9hZFVuaXRMb2FkID0gbnVsbDtcbiAgICAgICAgICAgIHRoaXMuX2ZsYXNoLnJlbW92ZUNhbGxiYWNrKHRoaXMuX2FkVW5pdExvYWQpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKHRoaXMuX2FkVW5pdCkge1xuICAgICAgICAgICAgdGhpcy5fYWRVbml0Ll9kZXN0cm95KCk7XG4gICAgICAgICAgICB0aGlzLl9hZFVuaXQgPSBudWxsO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgbG9hZEFkVW5pdChhZFVSTCwgY2FsbGJhY2spIHtcbiAgICAgICAgJHRocm93SWZEZXN0cm95ZWQuY2FsbCh0aGlzKTtcblxuICAgICAgICBpZiAodGhpcy5fYWRVbml0KSB7XG4gICAgICAgICAgICB0aGlzLl9kZXN0cm95QWRVbml0KCk7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAodGhpcy5fZmxhc2guaXNSZWFkeSgpKSB7XG4gICAgICAgICAgICB0aGlzLl9hZFVuaXRMb2FkID0gKGVyciwgbWVzc2FnZSkgPT4ge1xuICAgICAgICAgICAgICAgIGlmICghZXJyKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuX2FkVW5pdCA9IG5ldyBWUEFJREFkVW5pdCh0aGlzLl9mbGFzaCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHRoaXMuX2FkVW5pdExvYWQgPSBudWxsO1xuICAgICAgICAgICAgICAgIGNhbGxiYWNrKGVyciwgdGhpcy5fYWRVbml0KTtcbiAgICAgICAgICAgIH07XG5cbiAgICAgICAgICAgIHRoaXMuX2ZsYXNoLmNhbGxGbGFzaE1ldGhvZCgnbG9hZEFkVW5pdCcsIFthZFVSTF0sIHRoaXMuX2FkVW5pdExvYWQpO1xuICAgICAgICB9ZWxzZSB7XG4gICAgICAgICAgICB0aGlzLl9sb2FkTGF0ZXIgPSB7dXJsOiBhZFVSTCwgY2FsbGJhY2t9O1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgdW5sb2FkQWRVbml0KGNhbGxiYWNrID0gdW5kZWZpbmVkKSB7XG4gICAgICAgICR0aHJvd0lmRGVzdHJveWVkLmNhbGwodGhpcyk7XG5cbiAgICAgICAgdGhpcy5fZGVzdHJveUFkVW5pdCgpO1xuICAgICAgICB0aGlzLl9mbGFzaC5jYWxsRmxhc2hNZXRob2QoJ3VubG9hZEFkVW5pdCcsIFtdLCBjYWxsYmFjayk7XG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XG4gIHJldHVybiBzdHIucmVwbGFjZSgvJmFwb3M7L2csIFwiJ1wiKVxuICAgIC5yZXBsYWNlKC8mcXVvdDsvZywgJ1wiJylcbiAgICAucmVwbGFjZSgvJmd0Oy9nLCAnPicpXG4gICAgLnJlcGxhY2UoLyZsdDsvZywgJzwnKVxuICAgIC5yZXBsYWNlKC8mYW1wOy9nLCAnJicpO1xufTtcblxubW9kdWxlLmV4cG9ydHMgPSB4bWw7IiwiJ3VzZSBzdHJpY3QnO1xuXG5yZXF1aXJlKCcuL3BsdWdpbi9jb21wb25lbnRzL2Fkcy1sYWJlbF81Jyk7XG5yZXF1aXJlKCcuL3BsdWdpbi9jb21wb25lbnRzL2JsYWNrLXBvc3Rlcl81Jyk7XG5cbnZhciB2aWRlb0pzVkFTVCA9IHJlcXVpcmUoJy4vcGx1Z2luL3ZpZGVvanMudmFzdC52cGFpZCcpO1xuXG52aWRlb2pzLnBsdWdpbigndmFzdENsaWVudCcsIHZpZGVvSnNWQVNUKTtcbiJdfQ== diff --git a/bin/videojs_5.vast.vpaid.min.js b/bin/videojs_5.vast.vpaid.min.js index f5545fcf..91f9f06e 100644 --- a/bin/videojs_5.vast.vpaid.min.js +++ b/bin/videojs_5.vast.vpaid.min.js @@ -1,4 +1,4 @@ -(function t(e,n,i){function r(s,o){if(!n[s]){if(!e[s]){var u=typeof require=="function"&&require;if(!o&&u)return u(s,!0);if(a)return a(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[s]={exports:{}};e[s][0].call(c.exports,function(t){var n=e[s][1][t];return r(n?n:t)},c,c.exports,t,e,n,i)}return n[s].exports}var a=typeof require=="function"&&require;for(var s=0;s0){i(e)}},0)}})}},{key:"_callCallback",value:function _(t,e,n,i){var r=this._callbacks.get(e);if(!r){if(n&&e===""){this.trigger(f,n)}return}p.call(this,e,n,i)}},{key:"_handShake",value:function k(t,e){this._ready=true;if(this._handShakeHandler){this._handShakeHandler(t,e);delete this._handShakeHandler}}},{key:"getSize",value:function E(){return{width:this._width,height:this._height}}},{key:"setSize",value:function T(t,e){this._width=s(t,this._width);this._height=s(e,this._height);this._el.setAttribute("width",this._width);this._el.setAttribute("height",this._height)}},{key:"getWidth",value:function w(){return this._width}},{key:"setWidth",value:function b(t){this.setSize(t,this._height)}},{key:"getHeight",value:function S(){return this._height}},{key:"setHeight",value:function V(t){this.setSize(this._width,t)}},{key:"getFlashID",value:function C(){return this._flashID}},{key:"getFlashURL",value:function I(){return this._flashURL}},{key:"isReady",value:function F(){return this._ready}},{key:"destroy",value:function L(){this.offAll();this.removeAllCallbacks();c.removeInstanceByID(this._flashID);if(this._el.parentElement){this._el.parentElement.removeChild(this._el)}}}]);return t}();function p(t,e,n){var i=this;setTimeout(function(){var r=i._callbacks.get(t);if(r){i._callbacks.remove(t);r(e,n)}},0)}Object.defineProperty(h,"VPAID_FLASH_HANDLER",{writable:false,configurable:false,value:d});window[d]=function(t,e,n,i,r,a){var s=c.getInstanceByID(t);if(!s)return;if(n==="handShake"){s._handShake(r,a)}else{if(e!=="event"){s._callCallback(n,i,r,a)}else{s._trigger(n,a)}}}},{"./jsFlashBridgeRegistry":6,"./registry":7,"./utils":8}],6:[function(t,e,n){"use strict";var i=t("./registry").SingleValueRegistry;var r=new i;var a={};Object.defineProperty(a,"addInstance",{writable:false,configurable:false,value:function s(t,e){r.add(t,e)}});Object.defineProperty(a,"getInstanceByID",{writable:false,configurable:false,value:function o(t){return r.get(t)}});Object.defineProperty(a,"removeInstanceByID",{writable:false,configurable:false,value:function u(t){return r.remove(t)}});e.exports=a},{"./registry":7}],7:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:true});var i=function(){function t(t,e){for(var n=0;n0?t:e}var u=function(){if(String.prototype.endsWith)return String.prototype.endsWith;return function t(e,n){var i=this.toString();if(n===undefined||n>i.length){n=i.length}n-=e.length;var r=i.indexOf(e,n);return r!==-1&&r===n}}();function l(t,e){return u.call(t,e)}function c(t){t.style.position="absolute";t.style.left="-1px";t.style.top="-1px";t.style.width="1px";t.style.height="1px";t.style.visibility="hidden"}},{}],9:[function(t,e,n){"use strict";var i=["handshakeVersion","initAd","startAd","stopAd","skipAd","resizeAd","pauseAd","resumeAd","expandAd","collapseAd","subscribe","unsubscribe"];var r=["AdLoaded","AdStarted","AdStopped","AdSkipped","AdSkippableStateChange","AdSizeChange","AdLinearChange","AdDurationChange","AdExpandedChange","AdRemainingTimeChange","AdVolumeChange","AdImpression","AdVideoStart","AdVideoFirstQuartile","AdVideoMidpoint","AdVideoThirdQuartile","AdVideoComplete","AdClickThru","AdInteraction","AdUserAcceptInvitation","AdUserMinimize","AdUserClose","AdPaused","AdPlaying","AdLog","AdError"];var a=["getAdLinear","getAdWidth","getAdHeight","getAdExpanded","getAdSkippableState","getAdRemainingTime","getAdDuration","getAdVolume","getAdCompanions","getAdIcons"];var s=["setAdVolume"];function o(t,e,n){}o.prototype.handshakeVersion=function(t,e){};o.prototype.initAd=function(t,e,n,i,r,a,s){};o.prototype.startAd=function(t){};o.prototype.stopAd=function(t){};o.prototype.skipAd=function(t){};o.prototype.resizeAd=function(t,e,n,i){};o.prototype.pauseAd=function(t){};o.prototype.resumeAd=function(t){};o.prototype.expandAd=function(t){};o.prototype.collapseAd=function(t){};o.prototype.subscribe=function(t,e,n){};o.prototype.unsubscribe=function(t,e){};o.prototype.getAdLinear=function(t){};o.prototype.getAdWidth=function(t){};o.prototype.getAdHeight=function(t){};o.prototype.getAdExpanded=function(t){};o.prototype.getAdSkippableState=function(t){};o.prototype.getAdRemainingTime=function(t){};o.prototype.getAdDuration=function(t){};o.prototype.getAdVolume=function(t){};o.prototype.getAdCompanions=function(t){};o.prototype.getAdIcons=function(t){};o.prototype.setAdVolume=function(t,e){};l(o,"METHODS",i);l(o,"GETTERS",a);l(o,"SETTERS",s);l(o,"EVENTS",r);var u=i.filter(function(t){return["skipAd"].indexOf(t)===-1});l(o,"checkVPAIDInterface",function c(t){var e=u.every(function(e){return typeof t[e]==="function"});return e});e.exports=o;function l(t,e,n){Object.defineProperty(t,e,{writable:false,configurable:false,value:n})}},{}],10:[function(t,e,n){"use strict";var i=t("./IVPAIDAdUnit");var r=t("./subscriber");var a=i.checkVPAIDInterface;var s=t("./utils");var o=i.METHODS;var u="AdError";var l="AdClickThru";var c=i.EVENTS.filter(function(t){return t!=l});function d(t,e,n,i){this._isValid=a(t);if(this._isValid){this._creative=t;this._el=e;this._videoEl=n;this._iframe=i;this._subscribers=new r;f.call(this)}}d.prototype=Object.create(i.prototype);d.prototype.isValidVPAIDAd=function g(){return this._isValid};i.METHODS.forEach(function(t){var e=["subscribe","unsubscribe","initAd"];if(e.indexOf(t)!==-1)return;d.prototype[t]=function(){var e=i.prototype[t].length;var n=Array.prototype.slice.call(arguments);var r=e===n.length?n.pop():undefined;setTimeout(function(){var e,i=null;try{e=this._creative[t].apply(this._creative,n)}catch(a){i=a}v(r,this._subscribers,i,e)}.bind(this),0)}});d.prototype.initAd=function m(t,e,n,i,r,a,o){r=r||{};a=s.extend({slot:this._el,videoSlot:this._videoEl},a||{});setTimeout(function(){var s;try{this._creative.initAd(t,e,n,i,r,a)}catch(u){s=u}v(o,this._subscribers,s)}.bind(this),0)};d.prototype.subscribe=function y(t,e,n){this._subscribers.subscribe(e,t,n)};d.prototype.unsubscribe=function A(t,e){this._subscribers.unsubscribe(e,t)};d.prototype.on=d.prototype.subscribe;d.prototype.off=d.prototype.unsubscribe;i.GETTERS.forEach(function(t){d.prototype[t]=function(e){setTimeout(function(){var n,i=null;try{n=this._creative[t]()}catch(r){i=r}v(e,this._subscribers,i,n)}.bind(this),0)}});d.prototype.setAdVolume=function _(t,e){setTimeout(function(){var n,i=null;try{this._creative.setAdVolume(t);n=this._creative.getAdVolume()}catch(r){i=r}if(!i){i=s.validate(n===t,"failed to apply volume: "+t)}v(e,this._subscribers,i,n)}.bind(this),0)};d.prototype._destroy=function k(){this.stopAd();this._subscribers.unsubscribeAll()};function f(){c.forEach(function(t){this._creative.subscribe(p.bind(this,t),t)}.bind(this));this._creative.subscribe(h.bind(this),l);if(this._videoEl){var t=this._iframe.contentDocument.documentElement;var e=this._videoEl;t.addEventListener("click",function(n){if(n.target===t){e.click()}})}}function h(t,e,n){this._subscribers.triggerSync(l,{url:t,id:e,playerHandles:n})}function p(t){this._subscribers.trigger(t,Array.prototype.slice(arguments,1))}function v(t,e,n,i){if(t){t(n,i)}else if(n){e.trigger(u,n)}}e.exports=d},{"./IVPAIDAdUnit":9,"./subscriber":12,"./utils":13}],11:[function(t,e,n){"use strict";var i=t("./utils");var r=i.unique("vpaidIframe");var a=t("./VPAIDAdUnit");var s=""+''+''+'
'+''+'"+""+"";var o="AdStopped";function u(t,e,n,a){n=n||{};this._id=r();this._destroyed=false;this._frameContainer=i.createElementInEl(t,"div");this._videoEl=e;this._vpaidOptions=a||{timeout:1e4};this._templateConfig={template:n.template||s,extraOptions:n.extraOptions||{}}}u.prototype.destroy=function m(){if(this._destroyed){return}this._destroyed=true;d.call(this)};u.prototype.isDestroyed=function y(){return this._destroyed};u.prototype.loadAdUnit=function A(t,e){v.call(this);d.call(this);var n=this;var r=i.createIframeWithContent(this._frameContainer,this._templateConfig.template,i.extend({iframeURL_JS:t,iframeID:this.getID(),origin:g()},this._templateConfig.extraOptions));this._frame=r;this._onLoad=i.callbackTimeout(this._vpaidOptions.timeout,s.bind(this),u.bind(this));window.addEventListener("message",this._onLoad);function s(t){if(t.origin!==g())return;var r=JSON.parse(t.data);if(r.id!==n.getID())return;var s,u,l;if(!n._frame.contentWindow){u="the iframe is not anymore in the DOM tree"}else{l=n._frame.contentWindow.getVPAIDAd;u=i.validate(typeof l==="function","the ad didn't return a function to create an ad")}if(!u){var d=n._frame.contentWindow.document.querySelector(".ad-element");s=new a(l(),d,n._videoEl,n._frame);s.subscribe(o,c.bind(n));u=i.validate(s.isValidVPAIDAd(),"the add is not fully complaint with VPAID specification")}n._adUnit=s;h.call(n);e(u,u?null:s);return true}function u(){e("timeout",null)}};u.prototype.unloadAdUnit=function _(){d.call(this)};u.prototype.getID=function(){return this._id};function l(t){var e=this[t];if(e){e.remove();delete this[t]}}function c(){f.call(this);delete this._adUnit}function d(){f.call(this);p.call(this)}function f(){l.call(this,"_frame");h.call(this)}function h(){if(this._onLoad){window.removeEventListener("message",this._onLoad);i.clearCallbackTimeout(this._onLoad);delete this._onLoad}}function p(){if(this._adUnit){this._adUnit.stopAd();delete this._adUnit}}function v(){if(this._destroyed){throw new Error("VPAIDHTML5Client already destroyed!")}}function g(){if(window.location.origin){return window.location.origin}else{return window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"")}}e.exports=u;window.VPAIDHTML5Client=u},{"./VPAIDAdUnit":10,"./utils":13}],12:[function(t,e,n){"use strict";function i(){this._subscribers={}}i.prototype.subscribe=function r(t,e,n){if(!this.isHandlerAttached(t,e)){this.get(e).push({handler:t,context:n,eventName:e})}};i.prototype.unsubscribe=function a(t,e){this._subscribers[e]=this.get(e).filter(function(e){return t!==e.handler})};i.prototype.unsubscribeAll=function s(){this._subscribers={}};i.prototype.trigger=function(t,e){var n=this;var i=this.get(t).concat(this.get("*"));i.forEach(function(t){setTimeout(function(){if(n.isHandlerAttached(t.handler,t.eventName)){t.handler.call(t.context,e)}},0)})};i.prototype.triggerSync=function(t,e){var n=this.get(t).concat(this.get("*"));n.forEach(function(t){t.handler.call(t.context,e)})};i.prototype.get=function o(t){if(!this._subscribers[t]){this._subscribers[t]=[]}return this._subscribers[t]};i.prototype.isHandlerAttached=function u(t,e){return this.get(e).some(function(e){return t===e.handler})};e.exports=i},{}],13:[function(t,e,n){"use strict";function i(){}function r(t,e){return t?null:new Error(e)}var a={};function s(t){var e=a[t];if(e){clearTimeout(e);delete a[t]}}function o(t,e,n){var r,o;o=setTimeout(function(){e=i;delete o[r];n()},t);r=function(){if(e.apply(this,arguments)){s(r)}};a[r]=o;return r}function u(t,e,n){var i=document.createElement(e);if(n)i.id=n;t.appendChild(i);return i}function l(t,e,n){var i=c(t,null,n.zIndex);if(!f(i,d(e,n)))return;return i}function c(t,e,n){var i=document.createElement("iframe");i.src=e||"about:blank";i.marginWidth="0";i.marginHeight="0";i.frameBorder="0";i.width="100%";i.height="100%";i.style.position="absolute";i.style.left="0";i.style.top="0";i.style.margin="0px";i.style.padding="0px";i.style.border="none";if(n){i.style.zIndex=n}i.setAttribute("SCROLLING","NO");t.innerHTML="";t.appendChild(i);return i}function d(t,e){Object.keys(e).forEach(function(n){var i=typeof i==="object"?JSON.stringify(e[n]):e[n];t=t.replace(new RegExp("{{"+n+"}}","g"),i)});return t}function f(t,e){var n=t.contentWindow&&t.contentWindow.document;if(!n)return false;n.write(e);return true}function h(t,e){Object.keys(e).forEach(function(n){t[n]=e[n]});return t}function p(t){var e=-1;return function(){return t+"_"+ ++e}}e.exports={noop:i,validate:r,clearCallbackTimeout:s,callbackTimeout:o,createElementInEl:u,createIframeWithContent:l,createIframe:c,simpleTemplate:d,setIframeContent:f,extend:h,unique:p}},{}],14:[function(t,e,n){"use strict";var i=t("./InLine");var r=t("./Wrapper");function a(t){if(!(this instanceof a)){return new a(t)}this.initialize(t)}a.prototype.initialize=function(t){this.id=t.attr("id");this.sequence=t.attr("sequence");if(t.inLine){this.inLine=new i(t.inLine)}if(t.wrapper){this.wrapper=new r(t.wrapper)}};e.exports=a},{"./InLine":17,"./Wrapper":27}],15:[function(t,e,n){"use strict";var i=t("./TrackingEvent");var r=t("../../utils/utilityFunctions");var a=t("../../utils/xml");function s(t){if(!(this instanceof s)){return new s(t)}this.creativeType=a.attr(t.staticResource,"creativeType");this.staticResource=a.keyValue(t.staticResource);var e=null;if(a.keyValue(t.HTMLResource)){e=a.keyValue(t.HTMLResource)}else if(a.keyValue(t.hTMLResource)){e=a.keyValue(t.hTMLResource)}this.htmlResource=e; -var n=null;if(a.keyValue(t.IFrameResource)){n=a.keyValue(t.IFrameResource)}else if(a.keyValue(t.iFrameresource)){n=a.keyValue(t.iFrameresource)}this.iframeResource=n;this.id=a.attr(t,"id");this.width=a.attr(t,"width");this.height=a.attr(t,"height");this.expandedWidth=a.attr(t,"expandedWidth");this.expandedHeight=a.attr(t,"expandedHeight");this.scalable=a.attr(t,"scalable");this.maintainAspectRatio=a.attr(t,"maintainAspectRatio");this.minSuggestedDuration=a.attr(t,"minSuggestedDuration");this.apiFramework=a.attr(t,"apiFramework");this.companionClickThrough=a.keyValue(t.companionClickThrough);this.trackingEvents=o(t.trackingEvents&&t.trackingEvents.tracking);function o(t){var e=[];if(r.isDefined(t)){t=r.isArray(t)?t:[t];t.forEach(function(t){e.push(new i(t))})}return e}}e.exports=s},{"../../utils/utilityFunctions":44,"../../utils/xml":45,"./TrackingEvent":20}],16:[function(t,e,n){"use strict";var i=t("./Linear");var r=t("./Companion");var a=t("../../utils/utilityFunctions");function s(t){if(!(this instanceof s)){return new s(t)}this.id=t.attr("id");this.sequence=t.attr("sequence");this.adId=t.attr("adId");this.apiFramework=t.attr("apiFramework");if(t.linear){this.linear=new i(t.linear)}if(t.companionAds){var e=[];var n=t.companionAds&&t.companionAds.companion;if(a.isDefined(n)){n=a.isArray(n)?n:[n];n.forEach(function(t){e.push(new r(t))})}this.companionAds=e}}s.prototype.isSupported=function(){if(this.linear){return this.linear.isSupported()}return true};s.parseCreatives=function o(t){var e=[];var n;if(a.isDefined(t)&&a.isDefined(t.creative)){n=a.isArray(t.creative)?t.creative:[t.creative];n.forEach(function(t){e.push(new s(t))})}return e};e.exports=s},{"../../utils/utilityFunctions":44,"./Companion":15,"./Linear":18}],17:[function(t,e,n){"use strict";var i=t("./vastUtil");var r=t("./Creative");var a=t("../../utils/utilityFunctions");var s=t("../../utils/xml");function o(t){if(!(this instanceof o)){return new o(t)}this.adTitle=s.keyValue(t.adTitle);this.adSystem=s.keyValue(t.adSystem);this.impressions=i.parseImpressions(t.impression);this.creatives=r.parseCreatives(t.creatives);this.description=s.keyValue(t.description);this.advertiser=s.keyValue(t.advertiser);this.surveys=e(t.survey);this.error=s.keyValue(t.error);this.pricing=s.keyValue(t.pricing);this.extensions=t.extensions;function e(t){if(t){return a.transformArray(a.isArray(t)?t:[t],function(t){if(a.isNotEmptyString(t.keyValue)){return{uri:t.keyValue,type:t.attr("type")}}return undefined})}return[]}}o.prototype.isSupported=function(){var t,e;if(this.creatives.length===0){return false}for(t=0,e=this.creatives.length;t0){d(r.shift(),[],a)}else{e(t,i)}}else{e(null,i)}}});function a(t,e){var i=n._requestVASTXml.bind(n,t);o.waterfall([i,s],e)}function s(t,e){var n;try{n=c.toJXONTree(t);if(l.isArray(n.ad)){n.ads=n.ad}else if(n.ad){n.ads=[n.ad]}else{n.ads=[]}e(u(n),n)}catch(i){e(new r("on VASTClient.getVASTAd.buildVastWaterfall, error parsing xml",100),null)}}function u(t){var e=c.attr(t,"version");if(!t.ad){return new r("on VASTClient.getVASTAd.validateVASTTree, no Ad in VAST tree",303)}if(e&&(e!=3&&e!=2)){return new r('on VASTClient.getVASTAd.validateVASTTree, not supported VAST version "'+e+'"',102)}return null}function d(t,e,i){if(e.length>=n.WRAPPER_LIMIT){return i(new r("on VASTClient.getVASTAd.getAd, players wrapper limit reached (the limit is "+n.WRAPPER_LIMIT+")",302),e)}o.waterfall([function(e){if(l.isString(t)){p(t,e)}else{e(null,t)}},f],function(t,n){if(n){e.push(n)}if(t){return i(t,e)}if(n.wrapper){return d(n.wrapper.VASTAdTagURI,e,i)}return i(null,e)})}function f(t,e){try{var n=new i(t);e(h(n),n)}catch(a){e(new r("on VASTClient.getVASTAd.buildAd, error parsing xml",100),null)}}function h(t){var e=t.wrapper;var n=t.inLine;var i="on VASTClient.getVASTAd.validateAd, ";if(n&&e){return new r(i+"InLine and Wrapper both found on the same Ad",101)}if(!n&&!e){return new r(i+"nor wrapper nor inline elements found on the Ad",101)}if(n&&!n.isSupported()){return new r(i+"could not find MediaFile that is supported by this video player",403)}if(e&&!e.VASTAdTagURI){return new r(i+"missing 'VASTAdTagURI' in wrapper",101)}return null}function p(t,e){n._requestVASTXml(t,function(t,n){if(t){return e(t)}try{var i=c.toJXONTree(n);e(u(i),i.ad)}catch(a){e(new r("on VASTClient.getVASTAd.requestVASTAd, error parsing xml",100))}})}};d.prototype._requestVASTXml=function h(t,e){try{if(l.isFunction(t)){t(i)}else{u.get(t,i,{withCredentials:true})}}catch(n){e(n)}function i(t,n,i){if(t){var a=l.isDefined(i)?"on VASTClient.requestVastXML, HTTP request error with status '"+i+"'":"on VASTClient.requestVastXML, Error getting the the VAST XML with he passed adTagXML fn";return e(new r(a,301),null)}e(null,n)}};d.prototype._buildVASTResponse=function p(t){var e=new a;n(e,t);i(e);return e;function n(t,e){e.forEach(function(e){t.addAd(e)})}function i(t){var e=t.trackingEvents.progress;if(!t.hasLinear()){throw new r("on VASTClient._buildVASTResponse, Received an Ad type that is not supported",200)}if(t.duration===undefined){throw new r("on VASTClient._buildVASTResponse, Missing duration field in VAST response",101)}if(e){e.forEach(function(t){if(!l.isNumber(t.offset)){throw new r("on VASTClient._buildVASTResponse, missing or wrong offset attribute on progress tracking event",101)}})}}};d.prototype._trackError=function(t,e){if(!l.isArray(e)||e.length===0){return}var n=[];e.forEach(i);s.track(n,{ERRORCODE:t.code||900});function i(t){if(t.wrapper&&t.wrapper.error){n.push(t.wrapper.error)}if(t.inLine&&t.inLine.error){n.push(t.inLine.error)}}};e.exports=d},{"../../utils/async":39,"../../utils/http":41,"../../utils/utilityFunctions":44,"../../utils/xml":45,"./Ad":14,"./VASTError":22,"./VASTResponse":24,"./vastUtil":29}],22:[function(t,e,n){"use strict";function i(t,e){this.message="VAST Error: "+(t||"");if(e){this.code=e}}i.prototype=new Error;i.prototype.name="VAST Error";e.exports=i},{}],23:[function(t,e,n){"use strict";var i=t("./VASTResponse");var r=t("./VASTError");var a=t("./VASTTracker");var s=t("./vastUtil");var o=t("../../utils/async");var u=t("../../utils/dom");var l=t("../../utils/playerUtils");var c=t("../../utils/utilityFunctions");function d(t){if(!(this instanceof d)){return new d(t)}this.player=t}d.prototype.playAd=function f(t,e){var n=this;e=e||c.noop;if(!(t instanceof i)){return e(new r("On VASTIntegrator, missing required VASTResponse"))}o.waterfall([function(e){e(null,t)},this._selectAdSource.bind(this),this._createVASTTracker.bind(this),this._addClickThrough.bind(this),this._addSkipButton.bind(this),this._setupEvents.bind(this),this._playSelectedAd.bind(this)],function(t,i){if(t&&i){n._trackError(t,i)}e(t,i)});this._adUnit={_src:null,type:"VAST",pauseAd:function(){n.player.pause(true)},resumeAd:function(){n.player.play(true)},isPaused:function(){return n.player.paused(true)},getSrc:function(){return this._src}};return this._adUnit};d.prototype._selectAdSource=function h(t,e){var n;var i=u.getDimension(this.player.el()).width;t.mediaFiles.sort(function a(t,e){var n=Math.abs(i-t.width);var r=Math.abs(i-e.width);return n-r});n=this.player.selectSource(t.mediaFiles).source;if(n){if(this._adUnit){this._adUnit._src=n}return e(null,n,t)}e(new r("Could not find Ad mediafile supported by this player",403),t)};d.prototype._createVASTTracker=function p(t,e,n){try{n(null,t,new a(t.src,e),e)}catch(i){n(i,e)}};d.prototype._setupEvents=function v(t,e,n,i){var r;var a=this.player;a.on("fullscreenchange",o);a.on("vast.adStart",d);a.on("pause",u);a.on("timeupdate",c);a.on("volumechange",f);l.once(a,["vast.adEnd","vast.adsCancel"],s);l.once(a,["vast.adEnd","vast.adsCancel","vast.adSkip"],function(t){if(t.type==="vast.adEnd"){e.trackComplete()}});return i(null,t,n);function s(){a.off("fullscreenchange",o);a.off("vast.adStart",d);a.off("pause",u);a.off("timeupdate",c);a.off("volumechange",f)}function o(){if(a.isFullscreen()){e.trackFullscreen()}else{e.trackExitFullscreen()}}function u(){if(Math.abs(a.duration()-a.currentTime())<2){return}e.trackPause();l.once(a,["play","vast.adEnd","vast.adsCancel"],function(t){if(t.type==="play"){e.trackResume()}})}function c(){var t=a.currentTime()*1e3;e.trackProgress(t)}function d(){e.trackImpressions();e.trackCreativeView()}function f(){var t=a.muted();if(t){e.trackMute()}else if(r){e.trackUnmute()}r=t}};d.prototype._addSkipButton=function g(t,e,n,i){var r;var a=this;if(c.isNumber(n.skipoffset)){r=n.skipoffset/1e3;s(this.player,r)}i(null,t,e,n);function s(t,e){var n=o(t);var i=d.bind(a,n,e,t);t.el().appendChild(n);t.on("timeupdate",i);l.once(t,["vast.adEnd","vast.adsCancel"],r);function r(){t.off("timeupdate",i);u.remove(n)}}function o(t){var n=window.document.createElement("div");u.addClass(n,"vast-skip-button");n.onclick=function(i){if(u.hasClass(n,"enabled")){e.trackSkip();t.trigger("vast.adSkip")}if(window.Event.prototype.stopPropagation!==undefined){i.stopPropagation()}else{return false}};return n}function d(t,e,n){var i=Math.ceil(e-n.currentTime());if(i>0){t.innerHTML="Skip in "+c.toFixedDigits(i,2)+"..."}else{if(!u.hasClass(t,"enabled")){u.addClass(t,"enabled");t.innerHTML="Skip ad"}}}};d.prototype._addClickThrough=function m(t,e,n,i){var r=this.player;var a=d(r,e,n);var o=f.bind(this,a,n,r);r.el().insertBefore(a,r.controlBar.el());r.on("timeupdate",o);l.once(r,["vast.adEnd","vast.adsCancel"],p);return i(null,t,e,n);function d(t,e,n){var i=window.document.createElement("a");var r=n.clickThrough;u.addClass(i,"vast-blocker");i.href=h(r,t);if(c.isString(r)){i.target="_blank"}i.onclick=function(n){if(t.paused()){t.play();if(window.Event.prototype.stopPropagation!==undefined){n.stopPropagation()}return false}t.pause();e.trackClick()};return i}function f(t,e,n){t.href=h(e.clickThrough,n)}function h(e,n){var i={ASSETURI:t.src,CONTENTPLAYHEAD:s.formatProgress(n.currentTime()*1e3)};return e?s.parseURLMacro(e,i):"#"}function p(){r.off("timeupdate",o);u.remove(a)}};d.prototype._playSelectedAd=function y(t,e,n){var i=this.player;i.preload("auto");i.src(t);l.once(i,["durationchange","error","vast.adsCancel"],function(t){if(t.type==="durationchange"){a()}else if(t.type==="error"){n(new r("on VASTIntegrator, Player is unable to play the Ad",400),e)}});function a(){l.once(i,["playing","vast.adsCancel"],function(t){if(t.type==="vast.adsCancel"){return}i.trigger("vast.adStart");i.on("ended",r);i.on("vast.adsCancel",r);i.on("vast.adSkip",r);function r(t){if(t.type==="ended"&&i.duration()-i.currentTime()>3){return}i.off("ended",r);i.off("vast.adsCancel",r);i.off("vast.adSkip",r);if(t.type==="ended"||t.type==="vast.adSkip"){n(null,e)}}});i.play()}};d.prototype._trackError=function A(t,e){s.track(e.errorURLMacros,{ERRORCODE:t.code||900})};e.exports=d},{"../../utils/async":39,"../../utils/dom":40,"../../utils/playerUtils":42,"../../utils/utilityFunctions":44,"./VASTError":22,"./VASTResponse":24,"./VASTTracker":25,"./vastUtil":29}],24:[function(t,e,n){"use strict";var i=t("./Ad");var r=t("./VideoClicks");var a=t("./Linear");var s=t("./InLine");var o=t("./Wrapper");var u=t("../../utils/utilityFunctions");var l=t("../../utils/xml");window.InLine__A=s;function c(){if(!(this instanceof c)){return new c}this._linearAdded=false;this.ads=[];this.errorURLMacros=[];this.impressions=[];this.clickTrackings=[];this.customClicks=[];this.trackingEvents={};this.mediaFiles=[];this.clickThrough=undefined;this.adTitle="";this.duration=undefined;this.skipoffset=undefined}c.prototype.addAd=function(t){var e,n;if(t instanceof i){e=t.inLine;n=t.wrapper;this.ads.push(t);if(e){this._addInLine(e)}if(n){this._addWrapper(n)}}};c.prototype._addErrorTrackUrl=function(t){var e=t instanceof l.JXONTree?l.keyValue(t):t;if(e){this.errorURLMacros.push(e)}};c.prototype._addImpressions=function(t){u.isArray(t)&&d(this.impressions,t)};c.prototype._addClickThrough=function(t){if(u.isNotEmptyString(t)){this.clickThrough=t}};c.prototype._addClickTrackings=function(t){u.isArray(t)&&d(this.clickTrackings,t)};c.prototype._addCustomClicks=function(t){u.isArray(t)&&d(this.customClicks,t)};c.prototype._addTrackingEvents=function(t){var e=this.trackingEvents;if(t){t=u.isArray(t)?t:[t];t.forEach(function(t){if(!e[t.name]){e[t.name]=[]}e[t.name].push(t)})}};c.prototype._addTitle=function(t){if(u.isNotEmptyString(t)){this.adTitle=t}};c.prototype._addDuration=function(t){if(u.isNumber(t)){this.duration=t}};c.prototype._addVideoClicks=function(t){if(t instanceof r){this._addClickThrough(t.clickThrough);this._addClickTrackings(t.clickTrackings);this._addCustomClicks(t.customClicks)}};c.prototype._addMediaFiles=function(t){u.isArray(t)&&d(this.mediaFiles,t)};c.prototype._addSkipoffset=function(t){if(t){this.skipoffset=t}};c.prototype._addAdParameters=function(t){if(t){this.adParameters=t}};c.prototype._addLinear=function(t){if(t instanceof a){this._addDuration(t.duration);this._addTrackingEvents(t.trackingEvents);this._addVideoClicks(t.videoClicks);this._addMediaFiles(t.mediaFiles);this._addSkipoffset(t.skipoffset);this._addAdParameters(t.adParameters);this._linearAdded=true}};c.prototype._addInLine=function(t){var e=this;if(t instanceof s){this._addTitle(t.adTitle);this._addErrorTrackUrl(t.error);this._addImpressions(t.impressions);t.creatives.forEach(function(t){if(t.linear){e._addLinear(t.linear)}})}};c.prototype._addWrapper=function(t){var e=this;if(t instanceof o){this._addErrorTrackUrl(t.error);this._addImpressions(t.impressions);t.creatives.forEach(function(t){var n=t.linear;if(n){e._addVideoClicks(n.videoClicks);e.clickThrough=undefined;e._addTrackingEvents(n.trackingEvents)}})}};c.prototype.hasLinear=function(){return this._linearAdded};function d(t,e){e.forEach(function(e){t.push(e)})}e.exports=c},{"../../utils/utilityFunctions":44,"../../utils/xml":45,"./Ad":14,"./InLine":17,"./Linear":18,"./VideoClicks":26,"./Wrapper":27}],25:[function(t,e,n){"use strict";var i=t("./VASTError");var r=t("./VASTResponse");var a=t("./vastUtil");var s=t("../../utils/utilityFunctions");function o(t,e){if(!(this instanceof o)){return new o(t,e)}this.sanityCheck(t,e);this.initialize(t,e)}o.prototype.initialize=function(t,e){this.response=e;this.assetURI=t;this.progress=0;this.quartiles={firstQuartile:{tracked:false,time:Math.round(25*e.duration)/100},midpoint:{tracked:false,time:Math.round(50*e.duration)/100},thirdQuartile:{tracked:false,time:Math.round(75*e.duration)/100}}};o.prototype.sanityCheck=function(t,e){if(!s.isString(t)||s.isEmptyString(t)){throw new i("on VASTTracker constructor, missing required the URI of the ad asset being played")}if(!(e instanceof r)){throw new i("on VASTTracker constructor, missing required VAST response")}};o.prototype.trackURLs=function u(t,e){if(s.isArray(t)&&t.length>0){e=s.extend({ASSETURI:this.assetURI,CONTENTPLAYHEAD:a.formatProgress(this.progress)},e||{});a.track(t,e)}};o.prototype.trackEvent=function l(t,e){this.trackURLs(n(this.response.trackingEvents[t]));if(e){this.response.trackingEvents[t]=undefined}function n(t){var e;if(t){e=[];t.forEach(function(t){e.push(t.uri)})}return e}};o.prototype.trackProgress=function c(t){var e=this;var n=[];var i=true;var r=false;var a=this.response.trackingEvents;if(s.isNumber(t)){u("start",i,t>0);u("rewind",r,o(this.progress,t));l(t);d(t);f();this.progress=t}function o(e,n){var i=3e3;return e>t&&Math.abs(n-e)>i}function u(t,e,i){if(a[t]&&i){n.push({name:t,trackOnce:!!e})}}function l(t){var n=e.quartiles;var r=e.quartiles.firstQuartile;var a=e.quartiles.midpoint;var s=e.quartiles.thirdQuartile;if(!r.tracked){o("firstQuartile",t)}else if(!a.tracked){o("midpoint",t)}else if(!s.tracked){o("thirdQuartile",t)}function o(t,e){var r=n[t];if(c(r,e)){r.tracked=true;u(t,i,true)}}}function c(t,e){var n=t.time;return e>=n&&e<=n+5e3}function d(t){if(!s.isArray(a.progress)){return}var n=[];a.progress.forEach(function(i){if(i.offset<=t){e.trackURLs([i.uri])}else{n.push(i)}});a.progress=n}function f(){n.forEach(function(t){e.trackEvent(t.name,t.trackOnce)})}};["rewind","fullscreen","exitFullscreen","pause","resume","mute","unmute","acceptInvitation","acceptInvitationLinear","collapse","expand"].forEach(function(t){o.prototype["track"+s.capitalize(t)]=function(){this.trackEvent(t)}});["start","skip","close","closeLinear"].forEach(function(t){o.prototype["track"+s.capitalize(t)]=function(){this.trackEvent(t,true)}});["firstQuartile","midpoint","thirdQuartile"].forEach(function(t){o.prototype["track"+s.capitalize(t)]=function(){this.quartiles[t].tracked=true;this.trackEvent(t,true)}});o.prototype.trackComplete=function(){if(this.quartiles.thirdQuartile.tracked){this.trackEvent("complete",true)}};o.prototype.trackErrorWithCode=function d(t){if(s.isNumber(t)){this.trackURLs(this.response.errorURLMacros,{ERRORCODE:t})}};o.prototype.trackImpressions=function f(){this.trackURLs(this.response.impressions)};o.prototype.trackCreativeView=function h(){this.trackEvent("creativeView")};o.prototype.trackClick=function p(){this.trackURLs(this.response.clickTrackings)};e.exports=o},{"../../utils/utilityFunctions":44,"./VASTError":22,"./VASTResponse":24,"./vastUtil":29}],26:[function(t,e,n){"use strict";var i=t("../../utils/utilityFunctions");var r=t("../../utils/xml");function a(t){if(!(this instanceof a)){return new a(t)}this.clickThrough=r.keyValue(t.clickThrough);this.clickTrackings=e(t.clickTracking);this.customClicks=e(t.customClick);function e(t){var e=[];if(t){t=i.isArray(t)?t:[t];t.forEach(function(t){e.push(r.keyValue(t))})}return e}}e.exports=a},{"../../utils/utilityFunctions":44,"../../utils/xml":45}],27:[function(t,e,n){"use strict";var i=t("./vastUtil");var r=t("./Creative");var a=t("../../utils/utilityFunctions");var s=t("../../utils/xml");function o(t){if(!(this instanceof o)){return new o(t)}this.adSystem=s.keyValue(t.adSystem);this.impressions=i.parseImpressions(t.impression);this.VASTAdTagURI=s.keyValue(t.vASTAdTagURI);this.creatives=r.parseCreatives(t.creatives);this.error=s.keyValue(t.error);this.extensions=t.extensions;this.followAdditionalWrappers=a.isDefined(s.attr(t,"followAdditionalWrappers"))?s.attr(t,"followAdditionalWrappers"):true;this.allowMultipleAds=s.attr(t,"allowMultipleAds");this.fallbackOnNoAd=s.attr(t,"fallbackOnNoAd")}e.exports=o},{"../../utils/utilityFunctions":44,"../../utils/xml":45,"./Creative":16,"./vastUtil":29}],28:[function(t,e,n){"use strict";var i=t("../../utils/utilityFunctions");var r=/(\d\d):(\d\d):(\d\d)(\.(\d\d\d))?/;var a={duration:function s(t){var e,n;if(i.isString(t)){e=t.match(r);if(e){n=a(e[1])+s(e[2])+o(e[3])+parseInt(e[5]||0)}}return isNaN(n)?null:n;function a(t){return parseInt(t,10)*60*60*1e3}function s(t){return parseInt(t,10)*60*1e3}function o(t){return parseInt(t,10)*1e3}},offset:function o(t,e){if(n(t)){return i(t,e)}return a.duration(t);function n(t){var e=/^\d+(\.\d+)?%$/g;return e.test(t)}function i(t,e){if(e){return r(e,parseFloat(t.replace("%","")))}return null}function r(t,e){return t*e/100}}};e.exports=a},{"../../utils/utilityFunctions":44}],29:[function(t,e,n){"use strict";var i=t("../../utils/utilityFunctions");var r=t("../vpaid/VPAIDHTML5Tech");var a=t("../vpaid/VPAIDFlashTech");var s=t("VPAIDFLASHClient/js/VPAIDFLASHClient");var o={track:function u(t,e){var n=o.parseURLMacros(t,e);var i=[];n.forEach(function(t){var e=new Image;e.src=t;i.push(e)});return i},parseURLMacros:function l(t,e){var n=[];e=e||{};if(!e["CACHEBUSTING"]){e["CACHEBUSTING"]=Math.round(Math.random()*1e10)}t.forEach(function(t){n.push(o._parseURLMacro(t,e))});return n},parseURLMacro:function c(t,e){e=e||{};if(!e["CACHEBUSTING"]){e["CACHEBUSTING"]=Math.round(Math.random()*1e10)}return o._parseURLMacro(t,e)},_parseURLMacro:function d(t,e){e=e||{};i.forEach(e,function(e,n){t=t.replace(new RegExp("\\["+n+"\\]","gm"),e)});return t},parseDuration:function f(t){var e=/(\d\d):(\d\d):(\d\d)(\.(\d\d\d))?/;var n,r;if(i.isString(t)){n=t.match(e);if(n){r=a(n[1])+s(n[2])+o(n[3])+parseInt(n[5]||0)}}return isNaN(r)?null:r;function a(t){return parseInt(t,10)*60*60*1e3}function s(t){return parseInt(t,10)*60*1e3}function o(t){return parseInt(t,10)*1e3}},parseImpressions:function h(t){if(t){t=i.isArray(t)?t:[t];return i.transformArray(t,function(t){if(i.isNotEmptyString(t.keyValue)){return t.keyValue}return undefined})}return[]},formatProgress:function p(t){var e,n,r,a;e=t/(60*60*1e3);e=Math.floor(e);n=t/(60*1e3)%60;n=Math.floor(n);r=t/1e3%60;r=Math.floor(r);a=t%1e3;return i.toFixedDigits(e,2)+":"+i.toFixedDigits(n,2)+":"+i.toFixedDigits(r,2)+"."+i.toFixedDigits(a,3)},parseOffset:function v(t,e){if(n(t)){return i(t,e)}return o.parseDuration(t);function n(t){var e=/^\d+(\.\d+)?%$/g;return e.test(t)}function i(t,e){if(e){return r(e,parseFloat(t.replace("%","")))}return null}function r(t,e){return t*e/100}},VPAID_techs:[a,r],isVPAID:function g(t){return!!t&&t.apiFramework==="VPAID"},findSupportedVPAIDTech:function m(t){var e,n,i;for(e=0,n=this.VPAID_techs.length;e=1&&e<=2}function a(t){var e=t.split(".");return parseInt(e[0],10)}};f.prototype._initAd=function(t,e,n){var i=this.player.el().querySelector(".vjs-tech");var r=l.getDimension(i);t.initAd(r.width,r.height,this.VIEW_MODE.NORMAL,-1,{AdParameters:e.adParameters||""},function(i){n(i,t,e)})};f.prototype._createVASTTracker=function(t,e){return new a(t,e)};f.prototype._setupEvents=function(t,e,n){var i=t.options.src;var r=this._createVASTTracker(i,e);var a=this.player;var o=this;t.on("AdSkipped",function(){a.trigger("vpaid.AdSkipped");r.trackSkip()});t.on("AdImpression",function(){a.trigger("vpaid.AdImpression");r.trackImpressions()});t.on("AdStarted",function(){a.trigger("vpaid.AdStarted");r.trackCreativeView();u()});t.on("AdVideoStart",function(){a.trigger("vpaid.AdVideoStart");r.trackStart();u()});t.on("AdPlaying",function(){a.trigger("vpaid.AdPlaying");r.trackResume();u()});t.on("AdPaused",function(){a.trigger("vpaid.AdPaused");r.trackPause();c()});function u(){if(o._adUnit&&o._adUnit.isPaused()){o._adUnit._paused=false}a.trigger("play")}function c(){if(o._adUnit){o._adUnit._paused=true}a.trigger("pause")}t.on("AdVideoFirstQuartile",function(){a.trigger("vpaid.AdVideoFirstQuartile");r.trackFirstQuartile()});t.on("AdVideoMidpoint",function(){a.trigger("vpaid.AdVideoMidpoint");r.trackMidpoint()});t.on("AdVideoThirdQuartile",function(){a.trigger("vpaid.AdVideoThirdQuartile");r.trackThirdQuartile()});t.on("AdVideoComplete",function(){a.trigger("vpaid.AdVideoComplete");r.trackComplete()});t.on("AdClickThru",function(n){a.trigger("vpaid.AdClickThru");var i=n.url;var o=n.playerHandles;var u=d.isNotEmptyString(i)?i:l(e.clickThrough);r.trackClick();if(o&&u){window.open(u,"_blank")}function l(e){var n={ASSETURI:t.options.src,CONTENTPLAYHEAD:0};return e?s.parseURLMacro(e,n):null}});t.on("AdUserAcceptInvitation",function(){a.trigger("vpaid.AdUserAcceptInvitation");r.trackAcceptInvitation();r.trackAcceptInvitationLinear()});t.on("AdUserClose",function(){a.trigger("vpaid.AdUserClose");r.trackClose();r.trackCloseLinear()});t.on("AdUserMinimize",function(){a.trigger("vpaid.AdUserMinimize");r.trackCollapse()});t.on("AdError",function(){a.trigger("vpaid.AdError");r.trackErrorWithCode(901)});t.on("AdVolumeChange",function(){a.trigger("vpaid.AdVolumeChange");var e=a.volume();t.getAdVolume(function(t,n){if(n===0&&e>0){r.trackMute()}if(n>0&&e===0){r.trackUnmute()}a.volume(n)})});var f=h.bind(this,a,t,this.VIEW_MODE);var p=d.throttle(f,100);var v=this.settings.autoResize;if(v){l.addEventListener(window,"resize",p);l.addEventListener(window,"orientationchange",p)}a.on("vast.resize",f);a.on("vpaid.pauseAd",g);a.on("vpaid.resumeAd",m);a.one("vpaid.adEnd",function(){a.off("vast.resize",f);a.off("vpaid.pauseAd",g);a.off("vpaid.resumeAd",m);if(v){l.removeEventListener(window,"resize",p);l.removeEventListener(window,"orientationchange",p)}});n(null,t,e);function g(){t.pauseAd(d.noop)}function m(){t.resumeAd(d.noop)}};f.prototype._addSkipButton=function(t,e,n){var i;var r=this.player;t.on("AdSkippableStateChange",a);c.once(r,["vast.adEnd","vast.adsCancel"],o);n(null,t,e);function a(){r.trigger("vpaid.AdSkippableStateChange");t.getAdSkippableState(function(t,e){if(e){if(!i){s(r)}}else{o(r)}})}function s(t){i=u(t);t.el().appendChild(i)}function o(){l.remove(i);i=null}function u(){var e=window.document.createElement("div");l.addClass(e,"vast-skip-button");l.addClass(e,"enabled");e.innerHTML="Skip ad";e.onclick=function(e){t.skipAd(d.noop);if(window.Event.prototype.stopPropagation!==undefined){e.stopPropagation()}else{return false}};return e}};f.prototype._linkPlayerControls=function(t,e,n){var i=this;r(this.player,t);a(this.player,t,this.VIEW_MODE);n(null,t,e);function r(t,e){t.on("volumechange",n);e.on("AdVolumeChange",i);t.one("vpaid.adEnd",function(){t.off("volumechange",n)});function n(){var n=t.muted()?0:t.volume();e.setAdVolume(n,p)}function i(){t.trigger("vpaid.AdVolumeChange");e.getAdVolume(function(e,n){if(e){p(e)}else{t.volume(n)}})}}function a(t,e,n){var r=h.bind(i,t,e,n);t.on("fullscreenchange",r);t.one("vpaid.adEnd",function(){t.off("fullscreenchange",r)})}};f.prototype._startAd=function(t,e,n){var i=this.player;t.startAd(function(r){if(!r){i.trigger("vast.adStart")}n(r,t,e)})};f.prototype._finishPlaying=function(t,e,n){var r=this.player;t.on("AdStopped",function(){r.trigger("vpaid.AdStopped");a(null)});t.on("AdError",function(t){var e=t?t.message:"on VPAIDIntegrator, error while waiting for the adUnit to finish playing";a(new i(e))});function a(i){n(i,t,e)}};f.prototype._trackError=function m(t,e){s.track(t.errorURLMacros,{ERRORCODE:e||901})};function h(t,e,n){var i=t.el().querySelector(".vjs-tech");var r=l.getDimension(i);var a=t.isFullscreen()?n.FULLSCREEN:n.NORMAL;e.resizeAd(r.width,r.height,a,p)}function p(t){if(t&&console&&console.log){console.log("ERROR: "+t.message,t)}}e.exports=f},{"../../utils/async":39,"../../utils/dom":40,"../../utils/playerUtils":42,"../../utils/utilityFunctions":44,"../vast/VASTError":22,"../vast/VASTResponse":24,"../vast/VASTTracker":25,"../vast/vastUtil":29,"./VPAIDAdUnitWrapper":30}],34:[function(t,e,n){"use strict";var i=t("../../utils/dom");var r=document.createElement("div");r.className="vjs-ads-label vjs-control vjs-label-hidden";r.innerHTML="Advertisement";var a=function(t){return{init:function e(n,a){a.el=r;t.call(this,n,a);setTimeout(function(){var t=n.controlBar&&(n.controlBar.getChild("timerControls")||n.controlBar.getChild("currentTimeDisplay"));if(t){n.controlBar.el().insertBefore(r,t.el())}i.removeClass(r,"vjs-label-hidden")},0)},el:function n(){return r}}};e.exports=a},{"../../utils/dom":40}],35:[function(t,e,n){"use strict";var i=videojs.getComponent("Component");var r=t("./ads-label")(i);videojs.registerComponent("AdsLabel",videojs.extend(i,r))},{"./ads-label":34}],36:[function(t,e,n){"use strict";var i=document.createElement("div");var r=function(t){return{init:function e(n,r){r.el=i;i.className="vjs-black-poster";t.call(this,n,r);var a=n.getChild("posterImage");setTimeout(function(){if(a&&n&&n.el()){n.el().insertBefore(i,a.el())}},0)},el:function n(){return i}}};e.exports=r},{}],37:[function(t,e,n){"use strict";var i=videojs.getComponent("Component");var r=t("./black-poster")(i);videojs.registerComponent("BlackPoster",videojs.extend(i,r))},{"./black-poster":36}],38:[function(t,e,n){"use strict";var i=t("../ads/vast/VASTClient");var r=t("../ads/vast/VASTError");var a=t("../ads/vast/vastUtil");var s=t("../ads/vast/VASTIntegrator");var o=t("../ads/vpaid/VPAIDIntegrator");var u=t("../utils/async");var l=t("../utils/dom");var c=t("../utils/playerUtils");var d=t("../utils/utilityFunctions");e.exports=function f(t){var e;var n=this;var f=new i;var h=false;var p={timeout:500,iosPrerollCancelTimeout:2e3,adCancelTimeout:3e3,playAdAlways:false,adsEnabled:true,autoResize:true,vpaidFlashLoaderPath:"/VPAIDFlash.swf"};var v=d.extend({},p,t||{});if(d.isUndefined(v.adTagUrl)&&d.isDefined(v.url)){v.adTagUrl=v.url}if(d.isString(v.adTagUrl)){v.adTagUrl=d.echoFn(v.adTagUrl)}if(d.isDefined(v.adTagXML)&&!d.isFunction(v.adTagXML)){return k(new r("on VideoJS VAST plugin, the passed adTagXML option does not contain a function"))}if(!d.isDefined(v.adTagUrl)&&!d.isFunction(v.adTagXML)){return k(new r("on VideoJS VAST plugin, missing adTagUrl on options object"))}a.runFlashSupportCheck(v.vpaidFlashLoaderPath);c.prepareForAds(n);if(v.playAdAlways){n.on("vast.contentEnd",function(){setTimeout(function(){n.trigger("vast.reset")},0)})}n.on("vast.firstPlay",g);n.on("vast.reset",function(){e=null;m()});n.vast={isEnabled:function(){return v.adsEnabled},enable:function(){v.adsEnabled=true},disable:function(){v.adsEnabled=false}};return n.vast;function g(){c.removeNativePoster(n);c.once(n,["vast.adsCancel","vast.adEnd"],function(){t();i()});u.waterfall([s,o,p,y],function(t,e){if(t){k(t,e)}else{n.trigger("vast.adEnd")}});function t(){if(n.vast&&n.vast.adUnit){n.vast.adUnit=null}}function i(){a();if(e){c.restorePlayerSnapshot(n,e);e=null}}function a(){c.once(n,["playing","vast.reset","vast.firstPlay"],function(t){if(t.type!=="playing"){return}n.trigger("vast.contentStart");c.once(n,["ended","vast.reset","vast.firstPlay"],function(t){if(t.type==="ended"){n.trigger("vast.contentEnd")}})})}function s(t){if(v.adsEnabled){return t(null)}t(new r("Ads are not enabled"))}function o(t){if(f()){e=c.getPlayerSnapshot(n);n.pause();g();if(n.paused()){t(null)}else{c.once(n,["playing"],function(){n.pause();t(null)})}}else{t(new r("video content has been playing before preroll ad"))}}function f(){return!d.isIPhone()||n.currentTime()<=v.iosPrerollCancelTimeout}function p(t){var e;h=false;e=setTimeout(function(){k(new r("timeout while waiting for the video to start playing",402))},v.adCancelTimeout);c.once(n,["vast.adStart","vast.adsCancel"],i);function i(){if(e){clearTimeout(e);e=null}}t(null)}function g(){l.addClass(n.el(),"vjs-vast-ad-loading");c.once(n,["vast.adStart","vast.adsCancel"],m)}function m(){setTimeout(function(){l.removeClass(n.el(),"vjs-vast-ad-loading")},100)}}function m(){n.trigger("vast.adsCancel");h=true}function y(t){u.waterfall([A,_],t)}function A(t){f.getVASTResponse(v.adTagUrl?v.adTagUrl():v.adTagXML,t)}function _(t,e){if(h){return}var i=E(t)?new o(n,v):new s(n);var r=false;c.once(n,["vast.adStart","vast.adsCancel"],function(t){if(t.type==="vast.adStart"){a()}});c.once(n,["vast.adEnd","vast.adsCancel"],u);if(d.isIDevice()){l()}n.vast.vastResponse=t;n.vast.adUnit=i.playAd(t,e);function a(){if(r||n.controlBar.getChild("AdsLabel")){return}n.controlBar.addChild("AdsLabel")}function u(){n.controlBar.removeChild("AdsLabel");r=true}function l(){var t=3;var e=0;var i=0;n.on("timeupdate",a);n.on("ended",r);c.once(n,["vast.adEnd","vast.adsCancel","vast.adError"],s);function r(){if(n.duration()-e>t){n.pause(true);n.play(true);n.currentTime(e)}}function a(){var r=n.currentTime();var a=Math.abs(r-e);if(a>t){i+=1;if(i>=2){n.pause(true)}n.currentTime(e)}else{e=r}}function s(){n.off("timeupdate",a);n.off("ended",r)}}}function k(t,e){n.trigger({type:"vast.adError",error:t});m();if(console&&console.log){console.log("AD ERROR:",t.message,t,e)}}function E(t){var e,n;var i=t.mediaFiles;for(e=0,n=i.length;e0){u=setTimeout(function(){l&&l.abort()},o)}function c(t,e,n){if(!r.isString(t)||r.isEmptyString(t)){throw new a("Invalid url '"+t+"'")}if(!r.isFunction(e)){throw new a("Invalid handler '"+e+"' for the http request")}if(r.isDefined(n)&&!r.isObject(n)){throw new a("Invalid options map '"+n+"'")}}function d(t,e){r.forEach(e,function(e,n){if(r.isDefined(e)){t.setRequestHeader(n,e)}})}function f(){n(-1,null,null,"")}};s.prototype.get=function(t,e,n){this.run("GET",t,i,n);function i(t,n,i,s){if(r(t)){e(null,n,t,i,s)}else{e(new a(s),n,t,i,s)}}function r(t){return 200<=t&&t<300}};function o(){var t=new XMLHttpRequest;if(!("withCredentials"in t)){t=new XDomainRequest}return t}var u=new s(o);e.exports={http:u,HttpRequest:s,HttpRequestError:a,createXhr:o}},{"./urlUtils":43,"./utilityFunctions":44}],42:[function(t,e,n){"use strict";var i=t("./dom");var r=t("./utilityFunctions");var a={};a.getPlayerSnapshot=function s(t){var e=t.el().querySelector(".vjs-tech");var n={ended:t.ended(),src:t.currentSrc(),currentTime:t.currentTime(),type:t.currentType(),playing:!t.paused(),suppressedTracks:i(t)};if(e){n.nativePoster=e.poster;n.style=e.getAttribute("style")}return n;function i(t){var e=t.remoteTextTracks?t.remoteTextTracks():[];if(e&&r.isArray(e.tracks_)){e=e.tracks_}if(!r.isArray(e)){e=[]}var n=[];e.forEach(function(t){n.push({track:t,mode:t.mode});t.mode="disabled"});return n}};a.restorePlayerSnapshot=function o(t,e){var n=t.el().querySelector(".vjs-tech");var i=20;if(e.nativePoster){n.poster=e.nativePoster}if("style"in e){n.setAttribute("style",e.style||"")}if(s(t,e)){t.one("contentloadedmetadata",o);t.one("canplay",u);r();t.src({src:e.src,type:e.type});t.load()}else{o();if(e.playing){t.play()}}function r(){var e=setTimeout(function(){t.trigger("canplay")},1e3);t.one("canplay",function(){clearTimeout(e)})}function s(t,e){if(t.src()){return t.src()!==e.src}return t.currentSrc()!==e.src}function o(){var t=e.suppressedTracks;t.forEach(function(t){t.track.mode=t.mode})}function u(){if(!a.isReadyToResume(t)&&i--){setTimeout(u,50)}else{try{if(t.currentTime()!==e.currentTime){if(e.playing){t.one("seeked",function(){t.play()})}t.currentTime(e.currentTime)}else if(e.playing){t.play()}}catch(n){videojs.log.warn("Failed to resume the content after an advertisement",n)}}}};a.isReadyToResume=function(t){if(t.readyState()>1){return true}if(t.seekable()===undefined){return true}if(t.seekable().length>0){return true}return false};a.prepareForAds=function(t){var e=t.addChild("blackPoster");var n=true;var a;s();t.on("play",u);t.on("vast.reset",l);t.on("vast.firstPlay",f);t.on("error",p);t.on("vast.adStart",p);t.on("vast.adsCancel",p);t.on("vast.adError",p);t.on("vast.adStart",v);t.on("vast.adEnd",g);t.on("vast.adsCancel",g);function s(){var e=t.play;t.play=function(n){var i=this;if(c()){s()}else{u(n)}return this;function s(){if(!r.isIPhone()){a=d();t.muted(true)}e.apply(i,arguments)}function u(n){if(o()&&!n){t.vast.adUnit.resumeAd()}else{e.apply(i,arguments)}}};var n=t.pause;t.pause=function(e){if(o()&&!e){t.vast.adUnit.pauseAd()}else{n.apply(this,arguments)}return this};var i=t.paused;t.paused=function(e){if(o()&&!e){return t.vast.adUnit.isPaused()}return i.apply(this,arguments)}}function o(){return t.vast&&t.vast.adUnit}function u(){if(c()){n=false;t.trigger("vast.firstPlay")}}function l(){n=true;e.show();f()}function c(){return n}function d(){return{muted:t.muted(),volume:t.volume()}}function f(){if(a){t.currentTime(0);h(a);a=null}}function h(e){if(r.isObject(e)){t.volume(e.volume);t.muted(e.muted)}}function p(){if(!i.hasClass(e.el(),"vjs-hidden")){e.hide()}}function v(){i.addClass(t.el(),"vjs-ad-playing")}function g(){i.removeClass(t.el(),"vjs-ad-playing")}};a.removeNativePoster=function(t){var e=t.el().querySelector(".vjs-tech");if(e){e.removeAttribute("poster")}};a.once=function u(t,e,n){function i(){n.apply(null,arguments);e.forEach(function(e){t.off(e,i)})}e.forEach(function(e){t.on(e,i)})};e.exports=a},{"./dom":40,"./utilityFunctions":44}],43:[function(t,e,n){"use strict";var i=t("./utilityFunctions");var r=document.createElement("a");var a=document.documentMode;function s(t){var e=t;if(a){r.setAttribute("href",e);e=r.href}r.setAttribute("href",e);return{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:i.isNotEmptyString(r.port)?r.port:80,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}function o(t,e){var n,r;e=i.isFunction(e)?e:function(){return true};t=t.trim().replace(/^\?/,"");n=t.split("&");r={};i.forEach(n,function(t){var n,i,a;if(t!==""){n=t.split("=");i=n[0];a=n[1];if(e(i,a)){r[i]=a}}});return r}function u(t){var e=[];i.forEach(t,function(t,n){e.push(n+"="+t)});return e.join("&")}e.exports={urlParts:s,queryStringToObj:o,objToQueryString:u}},{"./utilityFunctions":44}],44:[function(t,e,n){"use strict";var i=1;var r=/[A-Z]/g;var a=/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i;var s=/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function o(){}function u(t){return t===null}function l(t){return t!==undefined}function c(t){return t===undefined}function d(t){return typeof t==="object"}function f(t){return typeof t==="function"}function h(t){return typeof t==="number"}function p(t){return j.isObject(t)&&t.window===t}function v(t){return Object.prototype.toString.call(t)==="[object Array]"}function g(t){if(t===null||j.isWindow(t)||j.isFunction(t)||j.isUndefined(t)){return false}var e=t.length;if(t.nodeType===i&&e){return true}return j.isString(t)||j.isArray(t)||e===0||typeof e==="number"&&e>0&&e-1 in t}function m(t){return typeof t==="string"}function y(t){return j.isString(t)&&t.length===0}function A(t){return j.isString(t)&&t.length!==0}function _(t){return Array.prototype.slice.call(t)}function k(t,e,n){var i,r;if(t){if(f(t)){for(i in t){if(i!=="prototype"&&i!=="length"&&i!=="name"&&(!t.hasOwnProperty||t.hasOwnProperty(i))){e.call(n,t[i],i,t)}}}else if(v(t)){var a=typeof t!=="object";for(i=0,r=t.length;i=e){n=i;t.apply(this,arguments)}}}function F(t,e){var n;return function(){if(n){clearTimeout(n)}n=setTimeout(function(){t.apply(this,arguments);n=undefined},e)}}function L(t,e,n){var i=e(t);for(var r=0;r0}return t.getElementsByTagNameNS(i,"parsererror").length>0}catch(r){}}};r.parseText=function s(t){if(/^\s*$/.test(t)){return null}if(/^(?:true|false)$/i.test(t)){return t.toLowerCase()==="true"}if(isFinite(t)){return parseFloat(t)}if(i.isISO8601(t)){return new Date(t)}return t.trim()};r.JXONTree=function o(t){var e=r.parseText;if(t.documentElement){return new r.JXONTree(t.documentElement)}if(t.hasChildNodes()){var n="";for(var a,s,o,u=0;u0:t.hasAttributes();if(l){var c;for(var d=0;d/g,">").replace(/"/g,""").replace(/'/g,"'")};r.decode=function f(t){return t.replace(/'/g,"'").replace(/"/g,'"').replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&")};e.exports=r},{"./utilityFunctions":44}],46:[function(t,e,n){"use strict";t("./plugin/components/ads-label_5");t("./plugin/components/black-poster_5");var i=t("./plugin/videojs.vast.vpaid");videojs.plugin("vastClient",i)},{"./plugin/components/ads-label_5":35,"./plugin/components/black-poster_5":37,"./plugin/videojs.vast.vpaid":38}]},{},[46]); +(function t(e,n,i){function r(s,o){if(!n[s]){if(!e[s]){var u=typeof require=="function"&&require;if(!o&&u)return u(s,!0);if(a)return a(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[s]={exports:{}};e[s][0].call(c.exports,function(t){var n=e[s][1][t];return r(n?n:t)},c,c.exports,t,e,n,i)}return n[s].exports}var a=typeof require=="function"&&require;for(var s=0;s0){i(e)}},0)}})}},{key:"_callCallback",value:function _(t,e,n,i){var r=this._callbacks.get(e);if(!r){if(n&&e===""){this.trigger(f,n)}return}p.call(this,e,n,i)}},{key:"_handShake",value:function k(t,e){this._ready=true;if(this._handShakeHandler){this._handShakeHandler(t,e);delete this._handShakeHandler}}},{key:"getSize",value:function E(){return{width:this._width,height:this._height}}},{key:"setSize",value:function T(t,e){this._width=s(t,this._width);this._height=s(e,this._height);this._el.setAttribute("width",this._width);this._el.setAttribute("height",this._height)}},{key:"getWidth",value:function w(){return this._width}},{key:"setWidth",value:function b(t){this.setSize(t,this._height)}},{key:"getHeight",value:function S(){return this._height}},{key:"setHeight",value:function V(t){this.setSize(this._width,t)}},{key:"getFlashID",value:function C(){return this._flashID}},{key:"getFlashURL",value:function I(){return this._flashURL}},{key:"isReady",value:function F(){return this._ready}},{key:"destroy",value:function L(){this.offAll();this.removeAllCallbacks();c.removeInstanceByID(this._flashID);if(this._el.parentElement){this._el.parentElement.removeChild(this._el)}}}]);return t}();function p(t,e,n){var i=this;setTimeout(function(){var r=i._callbacks.get(t);if(r){i._callbacks.remove(t);r(e,n)}},0)}Object.defineProperty(h,"VPAID_FLASH_HANDLER",{writable:false,configurable:false,value:d});window[d]=function(t,e,n,i,r,a){var s=c.getInstanceByID(t);if(!s)return;if(n==="handShake"){s._handShake(r,a)}else{if(e!=="event"){s._callCallback(n,i,r,a)}else{s._trigger(n,a)}}}},{"./jsFlashBridgeRegistry":6,"./registry":7,"./utils":8}],6:[function(t,e,n){"use strict";var i=t("./registry").SingleValueRegistry;var r=new i;var a={};Object.defineProperty(a,"addInstance",{writable:false,configurable:false,value:function s(t,e){r.add(t,e)}});Object.defineProperty(a,"getInstanceByID",{writable:false,configurable:false,value:function o(t){return r.get(t)}});Object.defineProperty(a,"removeInstanceByID",{writable:false,configurable:false,value:function u(t){return r.remove(t)}});e.exports=a},{"./registry":7}],7:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:true});var i=function(){function t(t,e){for(var n=0;n0?t:e}var u=function(){if(String.prototype.endsWith)return String.prototype.endsWith;return function t(e,n){var i=this.toString();if(n===undefined||n>i.length){n=i.length}n-=e.length;var r=i.indexOf(e,n);return r!==-1&&r===n}}();function l(t,e){return u.call(t,e)}function c(t){t.style.position="absolute";t.style.left="-1px";t.style.top="-1px";t.style.width="1px";t.style.height="1px"}},{}],9:[function(t,e,n){"use strict";var i=["handshakeVersion","initAd","startAd","stopAd","skipAd","resizeAd","pauseAd","resumeAd","expandAd","collapseAd","subscribe","unsubscribe"];var r=["AdLoaded","AdStarted","AdStopped","AdSkipped","AdSkippableStateChange","AdSizeChange","AdLinearChange","AdDurationChange","AdExpandedChange","AdRemainingTimeChange","AdVolumeChange","AdImpression","AdVideoStart","AdVideoFirstQuartile","AdVideoMidpoint","AdVideoThirdQuartile","AdVideoComplete","AdClickThru","AdInteraction","AdUserAcceptInvitation","AdUserMinimize","AdUserClose","AdPaused","AdPlaying","AdLog","AdError"];var a=["getAdLinear","getAdWidth","getAdHeight","getAdExpanded","getAdSkippableState","getAdRemainingTime","getAdDuration","getAdVolume","getAdCompanions","getAdIcons"];var s=["setAdVolume"];function o(t,e,n){}o.prototype.handshakeVersion=function(t,e){};o.prototype.initAd=function(t,e,n,i,r,a,s){};o.prototype.startAd=function(t){};o.prototype.stopAd=function(t){};o.prototype.skipAd=function(t){};o.prototype.resizeAd=function(t,e,n,i){};o.prototype.pauseAd=function(t){};o.prototype.resumeAd=function(t){};o.prototype.expandAd=function(t){};o.prototype.collapseAd=function(t){};o.prototype.subscribe=function(t,e,n){};o.prototype.unsubscribe=function(t,e){};o.prototype.getAdLinear=function(t){};o.prototype.getAdWidth=function(t){};o.prototype.getAdHeight=function(t){};o.prototype.getAdExpanded=function(t){};o.prototype.getAdSkippableState=function(t){};o.prototype.getAdRemainingTime=function(t){};o.prototype.getAdDuration=function(t){};o.prototype.getAdVolume=function(t){};o.prototype.getAdCompanions=function(t){};o.prototype.getAdIcons=function(t){};o.prototype.setAdVolume=function(t,e){};l(o,"METHODS",i);l(o,"GETTERS",a);l(o,"SETTERS",s);l(o,"EVENTS",r);var u=i.filter(function(t){return["skipAd"].indexOf(t)===-1});l(o,"checkVPAIDInterface",function c(t){var e=u.every(function(e){return typeof t[e]==="function"});return e});e.exports=o;function l(t,e,n){Object.defineProperty(t,e,{writable:false,configurable:false,value:n})}},{}],10:[function(t,e,n){"use strict";var i=t("./IVPAIDAdUnit");var r=t("./subscriber");var a=i.checkVPAIDInterface;var s=t("./utils");var o=i.METHODS;var u="AdError";var l="AdClickThru";var c=i.EVENTS.filter(function(t){return t!=l});function d(t,e,n,i){this._isValid=a(t);if(this._isValid){this._creative=t;this._el=e;this._videoEl=n;this._iframe=i;this._subscribers=new r;f.call(this)}}d.prototype=Object.create(i.prototype);d.prototype.isValidVPAIDAd=function g(){return this._isValid};i.METHODS.forEach(function(t){var e=["subscribe","unsubscribe","initAd"];if(e.indexOf(t)!==-1)return;d.prototype[t]=function(){var e=i.prototype[t].length;var n=Array.prototype.slice.call(arguments);var r=e===n.length?n.pop():undefined;setTimeout(function(){var e,i=null;try{e=this._creative[t].apply(this._creative,n)}catch(a){i=a}v(r,this._subscribers,i,e)}.bind(this),0)}});d.prototype.initAd=function m(t,e,n,i,r,a,o){r=r||{};a=s.extend({slot:this._el,videoSlot:this._videoEl},a||{});setTimeout(function(){var s;try{this._creative.initAd(t,e,n,i,r,a)}catch(u){s=u}v(o,this._subscribers,s)}.bind(this),0)};d.prototype.subscribe=function y(t,e,n){this._subscribers.subscribe(e,t,n)};d.prototype.unsubscribe=function A(t,e){this._subscribers.unsubscribe(e,t)};d.prototype.on=d.prototype.subscribe;d.prototype.off=d.prototype.unsubscribe;i.GETTERS.forEach(function(t){d.prototype[t]=function(e){setTimeout(function(){var n,i=null;try{n=this._creative[t]()}catch(r){i=r}v(e,this._subscribers,i,n)}.bind(this),0)}});d.prototype.setAdVolume=function _(t,e){setTimeout(function(){var n,i=null;try{this._creative.setAdVolume(t);n=this._creative.getAdVolume()}catch(r){i=r}if(!i){i=s.validate(n===t,"failed to apply volume: "+t)}v(e,this._subscribers,i,n)}.bind(this),0)};d.prototype._destroy=function k(){this.stopAd();this._subscribers.unsubscribeAll()};function f(){c.forEach(function(t){this._creative.subscribe(p.bind(this,t),t)}.bind(this));this._creative.subscribe(h.bind(this),l);if(this._videoEl){var t=this._iframe.contentDocument.documentElement;var e=this._videoEl;t.addEventListener("click",function(n){if(n.target===t){e.click()}})}}function h(t,e,n){this._subscribers.triggerSync(l,{url:t,id:e,playerHandles:n})}function p(t){this._subscribers.trigger(t,Array.prototype.slice(arguments,1))}function v(t,e,n,i){if(t){t(n,i)}else if(n){e.trigger(u,n)}}e.exports=d},{"./IVPAIDAdUnit":9,"./subscriber":12,"./utils":13}],11:[function(t,e,n){"use strict";var i=t("./utils");var r=i.unique("vpaidIframe");var a=t("./VPAIDAdUnit");var s=""+''+''+'
'+''+'"+""+"";var o="AdStopped";function u(t,e,n,a){n=n||{};this._id=r();this._destroyed=false;this._frameContainer=i.createElementInEl(t,"div");this._videoEl=e;this._vpaidOptions=a||{timeout:1e4};this._templateConfig={template:n.template||s,extraOptions:n.extraOptions||{}}}u.prototype.destroy=function m(){if(this._destroyed){return}this._destroyed=true;d.call(this)};u.prototype.isDestroyed=function y(){return this._destroyed};u.prototype.loadAdUnit=function A(t,e){v.call(this);d.call(this);var n=this;var r=i.createIframeWithContent(this._frameContainer,this._templateConfig.template,i.extend({iframeURL_JS:t,iframeID:this.getID(),origin:g()},this._templateConfig.extraOptions));this._frame=r;this._onLoad=i.callbackTimeout(this._vpaidOptions.timeout,s.bind(this),u.bind(this));window.addEventListener("message",this._onLoad);function s(t){if(t.origin!==g())return;var r=JSON.parse(t.data);if(r.id!==n.getID())return;var s,u,l;if(!n._frame.contentWindow){u="the iframe is not anymore in the DOM tree"}else{l=n._frame.contentWindow.getVPAIDAd;u=i.validate(typeof l==="function","the ad didn't return a function to create an ad")}if(!u){var d=n._frame.contentWindow.document.querySelector(".ad-element");s=new a(l(),d,n._videoEl,n._frame);s.subscribe(o,c.bind(n));u=i.validate(s.isValidVPAIDAd(),"the add is not fully complaint with VPAID specification")}n._adUnit=s;h.call(n);e(u,u?null:s);return true}function u(){e("timeout",null)}};u.prototype.unloadAdUnit=function _(){d.call(this)};u.prototype.getID=function(){return this._id};function l(t){var e=this[t];if(e){e.remove();delete this[t]}}function c(){f.call(this);delete this._adUnit}function d(){f.call(this);p.call(this)}function f(){l.call(this,"_frame");h.call(this)}function h(){if(this._onLoad){window.removeEventListener("message",this._onLoad);i.clearCallbackTimeout(this._onLoad);delete this._onLoad}}function p(){if(this._adUnit){this._adUnit.stopAd();delete this._adUnit}}function v(){if(this._destroyed){throw new Error("VPAIDHTML5Client already destroyed!")}}function g(){if(window.location.origin){return window.location.origin}else{return window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"")}}e.exports=u;window.VPAIDHTML5Client=u},{"./VPAIDAdUnit":10,"./utils":13}],12:[function(t,e,n){"use strict";function i(){this._subscribers={}}i.prototype.subscribe=function r(t,e,n){if(!this.isHandlerAttached(t,e)){this.get(e).push({handler:t,context:n,eventName:e})}};i.prototype.unsubscribe=function a(t,e){this._subscribers[e]=this.get(e).filter(function(e){return t!==e.handler})};i.prototype.unsubscribeAll=function s(){this._subscribers={}};i.prototype.trigger=function(t,e){var n=this;var i=this.get(t).concat(this.get("*"));i.forEach(function(t){setTimeout(function(){if(n.isHandlerAttached(t.handler,t.eventName)){t.handler.call(t.context,e)}},0)})};i.prototype.triggerSync=function(t,e){var n=this.get(t).concat(this.get("*"));n.forEach(function(t){t.handler.call(t.context,e)})};i.prototype.get=function o(t){if(!this._subscribers[t]){this._subscribers[t]=[]}return this._subscribers[t]};i.prototype.isHandlerAttached=function u(t,e){return this.get(e).some(function(e){return t===e.handler})};e.exports=i},{}],13:[function(t,e,n){"use strict";function i(){}function r(t,e){return t?null:new Error(e)}var a={};function s(t){var e=a[t];if(e){clearTimeout(e);delete a[t]}}function o(t,e,n){var r,o;o=setTimeout(function(){e=i;delete o[r];n()},t);r=function(){if(e.apply(this,arguments)){s(r)}};a[r]=o;return r}function u(t,e,n){var i=document.createElement(e);if(n)i.id=n;t.appendChild(i);return i}function l(t,e,n){var i=c(t,null,n.zIndex);if(!f(i,d(e,n)))return;return i}function c(t,e,n){var i=document.createElement("iframe");i.src=e||"about:blank";i.marginWidth="0";i.marginHeight="0";i.frameBorder="0";i.width="100%";i.height="100%";i.style.position="absolute";i.style.left="0";i.style.top="0";i.style.margin="0px";i.style.padding="0px";i.style.border="none";if(n){i.style.zIndex=n}i.setAttribute("SCROLLING","NO");t.innerHTML="";t.appendChild(i);return i}function d(t,e){Object.keys(e).forEach(function(n){var i=typeof i==="object"?JSON.stringify(e[n]):e[n];t=t.replace(new RegExp("{{"+n+"}}","g"),i)});return t}function f(t,e){var n=t.contentWindow&&t.contentWindow.document;if(!n)return false;n.write(e);return true}function h(t,e){Object.keys(e).forEach(function(n){t[n]=e[n]});return t}function p(t){var e=-1;return function(){return t+"_"+ ++e}}e.exports={noop:i,validate:r,clearCallbackTimeout:s,callbackTimeout:o,createElementInEl:u,createIframeWithContent:l,createIframe:c,simpleTemplate:d,setIframeContent:f,extend:h,unique:p}},{}],14:[function(t,e,n){"use strict";var i=t("./InLine");var r=t("./Wrapper");function a(t){if(!(this instanceof a)){return new a(t)}this.initialize(t)}a.prototype.initialize=function(t){this.id=t.attr("id");this.sequence=t.attr("sequence");if(t.inLine){this.inLine=new i(t.inLine)}if(t.wrapper){this.wrapper=new r(t.wrapper)}};e.exports=a},{"./InLine":17,"./Wrapper":27}],15:[function(t,e,n){"use strict";var i=t("./TrackingEvent");var r=t("../../utils/utilityFunctions");var a=t("../../utils/xml");function s(t){if(!(this instanceof s)){return new s(t)}this.creativeType=a.attr(t.staticResource,"creativeType");this.staticResource=a.keyValue(t.staticResource);var e=null;if(a.keyValue(t.HTMLResource)){e=a.keyValue(t.HTMLResource)}else if(a.keyValue(t.hTMLResource)){e=a.keyValue(t.hTMLResource)}this.htmlResource=e;var n=null;if(a.keyValue(t.IFrameResource)){ +n=a.keyValue(t.IFrameResource)}else if(a.keyValue(t.iFrameresource)){n=a.keyValue(t.iFrameresource)}this.iframeResource=n;this.id=a.attr(t,"id");this.width=a.attr(t,"width");this.height=a.attr(t,"height");this.expandedWidth=a.attr(t,"expandedWidth");this.expandedHeight=a.attr(t,"expandedHeight");this.scalable=a.attr(t,"scalable");this.maintainAspectRatio=a.attr(t,"maintainAspectRatio");this.minSuggestedDuration=a.attr(t,"minSuggestedDuration");this.apiFramework=a.attr(t,"apiFramework");this.companionClickThrough=a.keyValue(t.companionClickThrough);this.trackingEvents=o(t.trackingEvents&&t.trackingEvents.tracking);function o(t){var e=[];if(r.isDefined(t)){t=r.isArray(t)?t:[t];t.forEach(function(t){e.push(new i(t))})}return e}}e.exports=s},{"../../utils/utilityFunctions":44,"../../utils/xml":45,"./TrackingEvent":20}],16:[function(t,e,n){"use strict";var i=t("./Linear");var r=t("./Companion");var a=t("../../utils/utilityFunctions");function s(t){if(!(this instanceof s)){return new s(t)}this.id=t.attr("id");this.sequence=t.attr("sequence");this.adId=t.attr("adId");this.apiFramework=t.attr("apiFramework");if(t.linear){this.linear=new i(t.linear)}if(t.companionAds){var e=[];var n=t.companionAds&&t.companionAds.companion;if(a.isDefined(n)){n=a.isArray(n)?n:[n];n.forEach(function(t){e.push(new r(t))})}this.companionAds=e}}s.prototype.isSupported=function(){if(this.linear){return this.linear.isSupported()}return true};s.parseCreatives=function o(t){var e=[];var n;if(a.isDefined(t)&&a.isDefined(t.creative)){n=a.isArray(t.creative)?t.creative:[t.creative];n.forEach(function(t){e.push(new s(t))})}return e};e.exports=s},{"../../utils/utilityFunctions":44,"./Companion":15,"./Linear":18}],17:[function(t,e,n){"use strict";var i=t("./vastUtil");var r=t("./Creative");var a=t("../../utils/utilityFunctions");var s=t("../../utils/xml");function o(t){if(!(this instanceof o)){return new o(t)}this.adTitle=s.keyValue(t.adTitle);this.adSystem=s.keyValue(t.adSystem);this.impressions=i.parseImpressions(t.impression);this.creatives=r.parseCreatives(t.creatives);this.description=s.keyValue(t.description);this.advertiser=s.keyValue(t.advertiser);this.surveys=e(t.survey);this.error=s.keyValue(t.error);this.pricing=s.keyValue(t.pricing);this.extensions=t.extensions;function e(t){if(t){return a.transformArray(a.isArray(t)?t:[t],function(t){if(a.isNotEmptyString(t.keyValue)){return{uri:t.keyValue,type:t.attr("type")}}return undefined})}return[]}}o.prototype.isSupported=function(){var t,e;if(this.creatives.length===0){return false}for(t=0,e=this.creatives.length;t0){d(r.shift(),[],a)}else{e(t,i)}}else{e(null,i)}}});function a(t,e){var i=n._requestVASTXml.bind(n,t);o.waterfall([i,s],e)}function s(t,e){var n;try{n=c.toJXONTree(t);if(l.isArray(n.ad)){n.ads=n.ad}else if(n.ad){n.ads=[n.ad]}else{n.ads=[]}e(u(n),n)}catch(i){e(new r("on VASTClient.getVASTAd.buildVastWaterfall, error parsing xml",100),null)}}function u(t){var e=c.attr(t,"version");if(!t.ad){return new r("on VASTClient.getVASTAd.validateVASTTree, no Ad in VAST tree",303)}if(e&&(e!=3&&e!=2)){return new r('on VASTClient.getVASTAd.validateVASTTree, not supported VAST version "'+e+'"',102)}return null}function d(t,e,i){if(e.length>=n.WRAPPER_LIMIT){return i(new r("on VASTClient.getVASTAd.getAd, players wrapper limit reached (the limit is "+n.WRAPPER_LIMIT+")",302),e)}o.waterfall([function(e){if(l.isString(t)){p(t,e)}else{e(null,t)}},f],function(t,n){if(n){e.push(n)}if(t){return i(t,e)}if(n.wrapper){return d(n.wrapper.VASTAdTagURI,e,i)}return i(null,e)})}function f(t,e){try{var n=new i(t);e(h(n),n)}catch(a){e(new r("on VASTClient.getVASTAd.buildAd, error parsing xml",100),null)}}function h(t){var e=t.wrapper;var n=t.inLine;var i="on VASTClient.getVASTAd.validateAd, ";if(n&&e){return new r(i+"InLine and Wrapper both found on the same Ad",101)}if(!n&&!e){return new r(i+"nor wrapper nor inline elements found on the Ad",101)}if(n&&!n.isSupported()){return new r(i+"could not find MediaFile that is supported by this video player",403)}if(e&&!e.VASTAdTagURI){return new r(i+"missing 'VASTAdTagURI' in wrapper",101)}return null}function p(t,e){n._requestVASTXml(t,function(t,n){if(t){return e(t)}try{var i=c.toJXONTree(n);e(u(i),i.ad)}catch(a){e(new r("on VASTClient.getVASTAd.requestVASTAd, error parsing xml",100))}})}};d.prototype._requestVASTXml=function h(t,e){try{if(l.isFunction(t)){t(i)}else{u.get(t,i,{withCredentials:true})}}catch(n){e(n)}function i(t,n,i){if(t){var a=l.isDefined(i)?"on VASTClient.requestVastXML, HTTP request error with status '"+i+"'":"on VASTClient.requestVastXML, Error getting the the VAST XML with he passed adTagXML fn";return e(new r(a,301),null)}e(null,n)}};d.prototype._buildVASTResponse=function p(t){var e=new a;n(e,t);i(e);return e;function n(t,e){e.forEach(function(e){t.addAd(e)})}function i(t){var e=t.trackingEvents.progress;if(!t.hasLinear()){throw new r("on VASTClient._buildVASTResponse, Received an Ad type that is not supported",200)}if(t.duration===undefined){throw new r("on VASTClient._buildVASTResponse, Missing duration field in VAST response",101)}if(e){e.forEach(function(t){if(!l.isNumber(t.offset)){throw new r("on VASTClient._buildVASTResponse, missing or wrong offset attribute on progress tracking event",101)}})}}};d.prototype._trackError=function(t,e){if(!l.isArray(e)||e.length===0){return}var n=[];e.forEach(i);s.track(n,{ERRORCODE:t.code||900});function i(t){if(t.wrapper&&t.wrapper.error){n.push(t.wrapper.error)}if(t.inLine&&t.inLine.error){n.push(t.inLine.error)}}};e.exports=d},{"../../utils/async":39,"../../utils/http":41,"../../utils/utilityFunctions":44,"../../utils/xml":45,"./Ad":14,"./VASTError":22,"./VASTResponse":24,"./vastUtil":29}],22:[function(t,e,n){"use strict";function i(t,e){this.message="VAST Error: "+(t||"");if(e){this.code=e}}i.prototype=new Error;i.prototype.name="VAST Error";e.exports=i},{}],23:[function(t,e,n){"use strict";var i=t("./VASTResponse");var r=t("./VASTError");var a=t("./VASTTracker");var s=t("./vastUtil");var o=t("../../utils/async");var u=t("../../utils/dom");var l=t("../../utils/playerUtils");var c=t("../../utils/utilityFunctions");function d(t){if(!(this instanceof d)){return new d(t)}this.player=t}d.prototype.playAd=function f(t,e){var n=this;e=e||c.noop;if(!(t instanceof i)){return e(new r("On VASTIntegrator, missing required VASTResponse"))}o.waterfall([function(e){e(null,t)},this._selectAdSource.bind(this),this._createVASTTracker.bind(this),this._addClickThrough.bind(this),this._addSkipButton.bind(this),this._setupEvents.bind(this),this._playSelectedAd.bind(this)],function(t,i){if(t&&i){n._trackError(t,i)}e(t,i)});this._adUnit={_src:null,type:"VAST",pauseAd:function(){n.player.pause(true)},resumeAd:function(){n.player.play(true)},isPaused:function(){return n.player.paused(true)},getSrc:function(){return this._src}};return this._adUnit};d.prototype._selectAdSource=function h(t,e){var n;var i=u.getDimension(this.player.el()).width;t.mediaFiles.sort(function a(t,e){var n=Math.abs(i-t.width);var r=Math.abs(i-e.width);return n-r});n=this.player.selectSource(t.mediaFiles).source;if(n){if(this._adUnit){this._adUnit._src=n}return e(null,n,t)}e(new r("Could not find Ad mediafile supported by this player",403),t)};d.prototype._createVASTTracker=function p(t,e,n){try{n(null,t,new a(t.src,e),e)}catch(i){n(i,e)}};d.prototype._setupEvents=function v(t,e,n,i){var r;var a=this.player;a.on("fullscreenchange",o);a.on("vast.adStart",d);a.on("pause",u);a.on("timeupdate",c);a.on("volumechange",f);l.once(a,["vast.adEnd","vast.adsCancel"],s);l.once(a,["vast.adEnd","vast.adsCancel","vast.adSkip"],function(t){if(t.type==="vast.adEnd"){e.trackComplete()}});return i(null,t,n);function s(){a.off("fullscreenchange",o);a.off("vast.adStart",d);a.off("pause",u);a.off("timeupdate",c);a.off("volumechange",f)}function o(){if(a.isFullscreen()){e.trackFullscreen()}else{e.trackExitFullscreen()}}function u(){if(Math.abs(a.duration()-a.currentTime())<2){return}e.trackPause();l.once(a,["play","vast.adEnd","vast.adsCancel"],function(t){if(t.type==="play"){e.trackResume()}})}function c(){var t=a.currentTime()*1e3;e.trackProgress(t)}function d(){e.trackImpressions();e.trackCreativeView()}function f(){var t=a.muted();if(t){e.trackMute()}else if(r){e.trackUnmute()}r=t}};d.prototype._addSkipButton=function g(t,e,n,i){var r;var a=this;if(c.isNumber(n.skipoffset)){r=n.skipoffset/1e3;s(this.player,r)}i(null,t,e,n);function s(t,e){var n=o(t);var i=d.bind(a,n,e,t);t.el().appendChild(n);t.on("timeupdate",i);l.once(t,["vast.adEnd","vast.adsCancel"],r);function r(){t.off("timeupdate",i);u.remove(n)}}function o(t){var n=window.document.createElement("div");u.addClass(n,"vast-skip-button");n.onclick=function(i){if(u.hasClass(n,"enabled")){e.trackSkip();t.trigger("vast.adSkip")}if(window.Event.prototype.stopPropagation!==undefined){i.stopPropagation()}else{return false}};return n}function d(t,e,n){var i=Math.ceil(e-n.currentTime());if(i>0){t.innerHTML="Skip in "+c.toFixedDigits(i,2)+"..."}else{if(!u.hasClass(t,"enabled")){u.addClass(t,"enabled");t.innerHTML="Skip ad"}}}};d.prototype._addClickThrough=function m(t,e,n,i){var r=this.player;var a=d(r,e,n);var o=f.bind(this,a,n,r);r.el().insertBefore(a,r.controlBar.el());r.on("timeupdate",o);l.once(r,["vast.adEnd","vast.adsCancel"],p);return i(null,t,e,n);function d(t,e,n){var i=window.document.createElement("a");var r=n.clickThrough;u.addClass(i,"vast-blocker");i.href=h(r,t);if(c.isString(r)){i.target="_blank"}i.onclick=function(n){if(t.paused()){t.play();if(window.Event.prototype.stopPropagation!==undefined){n.stopPropagation()}return false}t.pause();e.trackClick()};return i}function f(t,e,n){t.href=h(e.clickThrough,n)}function h(e,n){var i={ASSETURI:t.src,CONTENTPLAYHEAD:s.formatProgress(n.currentTime()*1e3)};return e?s.parseURLMacro(e,i):"#"}function p(){r.off("timeupdate",o);u.remove(a)}};d.prototype._playSelectedAd=function y(t,e,n){var i=this.player;i.preload("auto");i.src(t);l.once(i,["durationchange","error","vast.adsCancel"],function(t){if(t.type==="durationchange"){a()}else if(t.type==="error"){n(new r("on VASTIntegrator, Player is unable to play the Ad",400),e)}});function a(){l.once(i,["playing","vast.adsCancel"],function(t){if(t.type==="vast.adsCancel"){return}i.trigger("vast.adStart");i.on("ended",r);i.on("vast.adsCancel",r);i.on("vast.adSkip",r);function r(t){if(t.type==="ended"&&i.duration()-i.currentTime()>3){return}i.off("ended",r);i.off("vast.adsCancel",r);i.off("vast.adSkip",r);if(t.type==="ended"||t.type==="vast.adSkip"){n(null,e)}}});i.play()}};d.prototype._trackError=function A(t,e){s.track(e.errorURLMacros,{ERRORCODE:t.code||900})};e.exports=d},{"../../utils/async":39,"../../utils/dom":40,"../../utils/playerUtils":42,"../../utils/utilityFunctions":44,"./VASTError":22,"./VASTResponse":24,"./VASTTracker":25,"./vastUtil":29}],24:[function(t,e,n){"use strict";var i=t("./Ad");var r=t("./VideoClicks");var a=t("./Linear");var s=t("./InLine");var o=t("./Wrapper");var u=t("../../utils/utilityFunctions");var l=t("../../utils/xml");window.InLine__A=s;function c(){if(!(this instanceof c)){return new c}this._linearAdded=false;this.ads=[];this.errorURLMacros=[];this.impressions=[];this.clickTrackings=[];this.customClicks=[];this.trackingEvents={};this.mediaFiles=[];this.clickThrough=undefined;this.adTitle="";this.duration=undefined;this.skipoffset=undefined}c.prototype.addAd=function(t){var e,n;if(t instanceof i){e=t.inLine;n=t.wrapper;this.ads.push(t);if(e){this._addInLine(e)}if(n){this._addWrapper(n)}}};c.prototype._addErrorTrackUrl=function(t){var e=t instanceof l.JXONTree?l.keyValue(t):t;if(e){this.errorURLMacros.push(e)}};c.prototype._addImpressions=function(t){u.isArray(t)&&d(this.impressions,t)};c.prototype._addClickThrough=function(t){if(u.isNotEmptyString(t)){this.clickThrough=t}};c.prototype._addClickTrackings=function(t){u.isArray(t)&&d(this.clickTrackings,t)};c.prototype._addCustomClicks=function(t){u.isArray(t)&&d(this.customClicks,t)};c.prototype._addTrackingEvents=function(t){var e=this.trackingEvents;if(t){t=u.isArray(t)?t:[t];t.forEach(function(t){if(!e[t.name]){e[t.name]=[]}e[t.name].push(t)})}};c.prototype._addTitle=function(t){if(u.isNotEmptyString(t)){this.adTitle=t}};c.prototype._addDuration=function(t){if(u.isNumber(t)){this.duration=t}};c.prototype._addVideoClicks=function(t){if(t instanceof r){this._addClickThrough(t.clickThrough);this._addClickTrackings(t.clickTrackings);this._addCustomClicks(t.customClicks)}};c.prototype._addMediaFiles=function(t){u.isArray(t)&&d(this.mediaFiles,t)};c.prototype._addSkipoffset=function(t){if(t){this.skipoffset=t}};c.prototype._addAdParameters=function(t){if(t){this.adParameters=t}};c.prototype._addLinear=function(t){if(t instanceof a){this._addDuration(t.duration);this._addTrackingEvents(t.trackingEvents);this._addVideoClicks(t.videoClicks);this._addMediaFiles(t.mediaFiles);this._addSkipoffset(t.skipoffset);this._addAdParameters(t.adParameters);this._linearAdded=true}};c.prototype._addInLine=function(t){var e=this;if(t instanceof s){this._addTitle(t.adTitle);this._addErrorTrackUrl(t.error);this._addImpressions(t.impressions);t.creatives.forEach(function(t){if(t.linear){e._addLinear(t.linear)}})}};c.prototype._addWrapper=function(t){var e=this;if(t instanceof o){this._addErrorTrackUrl(t.error);this._addImpressions(t.impressions);t.creatives.forEach(function(t){var n=t.linear;if(n){e._addVideoClicks(n.videoClicks);e.clickThrough=undefined;e._addTrackingEvents(n.trackingEvents)}})}};c.prototype.hasLinear=function(){return this._linearAdded};function d(t,e){e.forEach(function(e){t.push(e)})}e.exports=c},{"../../utils/utilityFunctions":44,"../../utils/xml":45,"./Ad":14,"./InLine":17,"./Linear":18,"./VideoClicks":26,"./Wrapper":27}],25:[function(t,e,n){"use strict";var i=t("./VASTError");var r=t("./VASTResponse");var a=t("./vastUtil");var s=t("../../utils/utilityFunctions");function o(t,e){if(!(this instanceof o)){return new o(t,e)}this.sanityCheck(t,e);this.initialize(t,e)}o.prototype.initialize=function(t,e){this.response=e;this.assetURI=t;this.progress=0;this.quartiles={firstQuartile:{tracked:false,time:Math.round(25*e.duration)/100},midpoint:{tracked:false,time:Math.round(50*e.duration)/100},thirdQuartile:{tracked:false,time:Math.round(75*e.duration)/100}}};o.prototype.sanityCheck=function(t,e){if(!s.isString(t)||s.isEmptyString(t)){throw new i("on VASTTracker constructor, missing required the URI of the ad asset being played")}if(!(e instanceof r)){throw new i("on VASTTracker constructor, missing required VAST response")}};o.prototype.trackURLs=function u(t,e){if(s.isArray(t)&&t.length>0){e=s.extend({ASSETURI:this.assetURI,CONTENTPLAYHEAD:a.formatProgress(this.progress)},e||{});a.track(t,e)}};o.prototype.trackEvent=function l(t,e){this.trackURLs(n(this.response.trackingEvents[t]));if(e){this.response.trackingEvents[t]=undefined}function n(t){var e;if(t){e=[];t.forEach(function(t){e.push(t.uri)})}return e}};o.prototype.trackProgress=function c(t){var e=this;var n=[];var i=true;var r=false;var a=this.response.trackingEvents;if(s.isNumber(t)){u("start",i,t>0);u("rewind",r,o(this.progress,t));l(t);d(t);f();this.progress=t}function o(e,n){var i=3e3;return e>t&&Math.abs(n-e)>i}function u(t,e,i){if(a[t]&&i){n.push({name:t,trackOnce:!!e})}}function l(t){var n=e.quartiles;var r=e.quartiles.firstQuartile;var a=e.quartiles.midpoint;var s=e.quartiles.thirdQuartile;if(!r.tracked){o("firstQuartile",t)}else if(!a.tracked){o("midpoint",t)}else if(!s.tracked){o("thirdQuartile",t)}function o(t,e){var r=n[t];if(c(r,e)){r.tracked=true;u(t,i,true)}}}function c(t,e){var n=t.time;return e>=n&&e<=n+5e3}function d(t){if(!s.isArray(a.progress)){return}var n=[];a.progress.forEach(function(i){if(i.offset<=t){e.trackURLs([i.uri])}else{n.push(i)}});a.progress=n}function f(){n.forEach(function(t){e.trackEvent(t.name,t.trackOnce)})}};["rewind","fullscreen","exitFullscreen","pause","resume","mute","unmute","acceptInvitation","acceptInvitationLinear","collapse","expand"].forEach(function(t){o.prototype["track"+s.capitalize(t)]=function(){this.trackEvent(t)}});["start","skip","close","closeLinear"].forEach(function(t){o.prototype["track"+s.capitalize(t)]=function(){this.trackEvent(t,true)}});["firstQuartile","midpoint","thirdQuartile"].forEach(function(t){o.prototype["track"+s.capitalize(t)]=function(){this.quartiles[t].tracked=true;this.trackEvent(t,true)}});o.prototype.trackComplete=function(){if(this.quartiles.thirdQuartile.tracked){this.trackEvent("complete",true)}};o.prototype.trackErrorWithCode=function d(t){if(s.isNumber(t)){this.trackURLs(this.response.errorURLMacros,{ERRORCODE:t})}};o.prototype.trackImpressions=function f(){this.trackURLs(this.response.impressions)};o.prototype.trackCreativeView=function h(){this.trackEvent("creativeView")};o.prototype.trackClick=function p(){this.trackURLs(this.response.clickTrackings)};e.exports=o},{"../../utils/utilityFunctions":44,"./VASTError":22,"./VASTResponse":24,"./vastUtil":29}],26:[function(t,e,n){"use strict";var i=t("../../utils/utilityFunctions");var r=t("../../utils/xml");function a(t){if(!(this instanceof a)){return new a(t)}this.clickThrough=r.keyValue(t.clickThrough);this.clickTrackings=e(t.clickTracking);this.customClicks=e(t.customClick);function e(t){var e=[];if(t){t=i.isArray(t)?t:[t];t.forEach(function(t){e.push(r.keyValue(t))})}return e}}e.exports=a},{"../../utils/utilityFunctions":44,"../../utils/xml":45}],27:[function(t,e,n){"use strict";var i=t("./vastUtil");var r=t("./Creative");var a=t("../../utils/utilityFunctions");var s=t("../../utils/xml");function o(t){if(!(this instanceof o)){return new o(t)}this.adSystem=s.keyValue(t.adSystem);this.impressions=i.parseImpressions(t.impression);this.VASTAdTagURI=s.keyValue(t.vASTAdTagURI);this.creatives=r.parseCreatives(t.creatives);this.error=s.keyValue(t.error);this.extensions=t.extensions;this.followAdditionalWrappers=a.isDefined(s.attr(t,"followAdditionalWrappers"))?s.attr(t,"followAdditionalWrappers"):true;this.allowMultipleAds=s.attr(t,"allowMultipleAds");this.fallbackOnNoAd=s.attr(t,"fallbackOnNoAd")}e.exports=o},{"../../utils/utilityFunctions":44,"../../utils/xml":45,"./Creative":16,"./vastUtil":29}],28:[function(t,e,n){"use strict";var i=t("../../utils/utilityFunctions");var r=/(\d\d):(\d\d):(\d\d)(\.(\d\d\d))?/;var a={duration:function s(t){var e,n;if(i.isString(t)){e=t.match(r);if(e){n=a(e[1])+s(e[2])+o(e[3])+parseInt(e[5]||0)}}return isNaN(n)?null:n;function a(t){return parseInt(t,10)*60*60*1e3}function s(t){return parseInt(t,10)*60*1e3}function o(t){return parseInt(t,10)*1e3}},offset:function o(t,e){if(n(t)){return i(t,e)}return a.duration(t);function n(t){var e=/^\d+(\.\d+)?%$/g;return e.test(t)}function i(t,e){if(e){return r(e,parseFloat(t.replace("%","")))}return null}function r(t,e){return t*e/100}}};e.exports=a},{"../../utils/utilityFunctions":44}],29:[function(t,e,n){"use strict";var i=t("../../utils/utilityFunctions");var r=t("../vpaid/VPAIDHTML5Tech");var a=t("../vpaid/VPAIDFlashTech");var s=t("VPAIDFLASHClient/js/VPAIDFLASHClient");var o={track:function u(t,e){var n=o.parseURLMacros(t,e);var i=[];n.forEach(function(t){var e=new Image;e.src=t;i.push(e)});return i},parseURLMacros:function l(t,e){var n=[];e=e||{};if(!e["CACHEBUSTING"]){e["CACHEBUSTING"]=Math.round(Math.random()*1e10)}t.forEach(function(t){n.push(o._parseURLMacro(t,e))});return n},parseURLMacro:function c(t,e){e=e||{};if(!e["CACHEBUSTING"]){e["CACHEBUSTING"]=Math.round(Math.random()*1e10)}return o._parseURLMacro(t,e)},_parseURLMacro:function d(t,e){e=e||{};i.forEach(e,function(e,n){t=t.replace(new RegExp("\\["+n+"\\]","gm"),e)});return t},parseDuration:function f(t){var e=/(\d\d):(\d\d):(\d\d)(\.(\d\d\d))?/;var n,r;if(i.isString(t)){n=t.match(e);if(n){r=a(n[1])+s(n[2])+o(n[3])+parseInt(n[5]||0)}}return isNaN(r)?null:r;function a(t){return parseInt(t,10)*60*60*1e3}function s(t){return parseInt(t,10)*60*1e3}function o(t){return parseInt(t,10)*1e3}},parseImpressions:function h(t){if(t){t=i.isArray(t)?t:[t];return i.transformArray(t,function(t){if(i.isNotEmptyString(t.keyValue)){return t.keyValue}return undefined})}return[]},formatProgress:function p(t){var e,n,r,a;e=t/(60*60*1e3);e=Math.floor(e);n=t/(60*1e3)%60;n=Math.floor(n);r=t/1e3%60;r=Math.floor(r);a=t%1e3;return i.toFixedDigits(e,2)+":"+i.toFixedDigits(n,2)+":"+i.toFixedDigits(r,2)+"."+i.toFixedDigits(a,3)},parseOffset:function v(t,e){if(n(t)){return i(t,e)}return o.parseDuration(t);function n(t){var e=/^\d+(\.\d+)?%$/g;return e.test(t)}function i(t,e){if(e){return r(e,parseFloat(t.replace("%","")))}return null}function r(t,e){return t*e/100}},VPAID_techs:[a,r],isVPAID:function g(t){return!!t&&t.apiFramework==="VPAID"},findSupportedVPAIDTech:function m(t){var e,n,i;for(e=0,n=this.VPAID_techs.length;e=1&&e<=2}function a(t){var e=t.split(".");return parseInt(e[0],10)}};f.prototype._initAd=function(t,e,n){var i=this.player.el().querySelector(".vjs-tech");var r=l.getDimension(i);t.initAd(r.width,r.height,this.VIEW_MODE.NORMAL,-1,{AdParameters:e.adParameters||""},function(i){n(i,t,e)})};f.prototype._createVASTTracker=function(t,e){return new a(t,e)};f.prototype._setupEvents=function(t,e,n){var i=t.options.src;var r=this._createVASTTracker(i,e);var a=this.player;var o=this;t.on("AdSkipped",function(){a.trigger("vpaid.AdSkipped");r.trackSkip()});t.on("AdImpression",function(){a.trigger("vpaid.AdImpression");r.trackImpressions()});t.on("AdStarted",function(){a.trigger("vpaid.AdStarted");r.trackCreativeView();u()});t.on("AdVideoStart",function(){a.trigger("vpaid.AdVideoStart");r.trackStart();u()});t.on("AdPlaying",function(){a.trigger("vpaid.AdPlaying");r.trackResume();u()});t.on("AdPaused",function(){a.trigger("vpaid.AdPaused");r.trackPause();c()});function u(){if(o._adUnit&&o._adUnit.isPaused()){o._adUnit._paused=false}a.trigger("play")}function c(){if(o._adUnit){o._adUnit._paused=true}a.trigger("pause")}t.on("AdVideoFirstQuartile",function(){a.trigger("vpaid.AdVideoFirstQuartile");r.trackFirstQuartile()});t.on("AdVideoMidpoint",function(){a.trigger("vpaid.AdVideoMidpoint");r.trackMidpoint()});t.on("AdVideoThirdQuartile",function(){a.trigger("vpaid.AdVideoThirdQuartile");r.trackThirdQuartile()});t.on("AdVideoComplete",function(){a.trigger("vpaid.AdVideoComplete");r.trackComplete()});t.on("AdClickThru",function(n){a.trigger("vpaid.AdClickThru");var i=n.url;var o=n.playerHandles;var u=d.isNotEmptyString(i)?i:l(e.clickThrough);r.trackClick();if(o&&u){window.open(u,"_blank")}function l(e){var n={ASSETURI:t.options.src,CONTENTPLAYHEAD:0};return e?s.parseURLMacro(e,n):null}});t.on("AdUserAcceptInvitation",function(){a.trigger("vpaid.AdUserAcceptInvitation");r.trackAcceptInvitation();r.trackAcceptInvitationLinear()});t.on("AdUserClose",function(){a.trigger("vpaid.AdUserClose");r.trackClose();r.trackCloseLinear()});t.on("AdUserMinimize",function(){a.trigger("vpaid.AdUserMinimize");r.trackCollapse()});t.on("AdError",function(){a.trigger("vpaid.AdError");r.trackErrorWithCode(901)});t.on("AdVolumeChange",function(){a.trigger("vpaid.AdVolumeChange");var e=a.volume();t.getAdVolume(function(t,n){if(n===0&&e>0){r.trackMute()}if(n>0&&e===0){r.trackUnmute()}a.volume(n)})});var f=h.bind(this,a,t,this.VIEW_MODE);var p=d.throttle(f,100);var v=this.settings.autoResize;if(v){l.addEventListener(window,"resize",p);l.addEventListener(window,"orientationchange",p)}a.on("vast.resize",f);a.on("vpaid.pauseAd",g);a.on("vpaid.resumeAd",m);a.one("vpaid.adEnd",function(){a.off("vast.resize",f);a.off("vpaid.pauseAd",g);a.off("vpaid.resumeAd",m);if(v){l.removeEventListener(window,"resize",p);l.removeEventListener(window,"orientationchange",p)}});n(null,t,e);function g(){t.pauseAd(d.noop)}function m(){t.resumeAd(d.noop)}};f.prototype._addSkipButton=function(t,e,n){var i;var r=this.player;t.on("AdSkippableStateChange",a);c.once(r,["vast.adEnd","vast.adsCancel"],o);n(null,t,e);function a(){r.trigger("vpaid.AdSkippableStateChange");t.getAdSkippableState(function(t,e){if(e){if(!i){s(r)}}else{o(r)}})}function s(t){i=u(t);t.el().appendChild(i)}function o(){l.remove(i);i=null}function u(){var e=window.document.createElement("div");l.addClass(e,"vast-skip-button");l.addClass(e,"enabled");e.innerHTML="Skip ad";e.onclick=function(e){t.skipAd(d.noop);if(window.Event.prototype.stopPropagation!==undefined){e.stopPropagation()}else{return false}};return e}};f.prototype._linkPlayerControls=function(t,e,n){var i=this;r(this.player,t);a(this.player,t,this.VIEW_MODE);n(null,t,e);function r(t,e){t.on("volumechange",n);e.on("AdVolumeChange",i);t.one("vpaid.adEnd",function(){t.off("volumechange",n)});function n(){var n=t.muted()?0:t.volume();e.setAdVolume(n,p)}function i(){t.trigger("vpaid.AdVolumeChange");e.getAdVolume(function(e,n){if(e){p(e)}else{t.volume(n)}})}}function a(t,e,n){var r=h.bind(i,t,e,n);t.on("fullscreenchange",r);t.one("vpaid.adEnd",function(){t.off("fullscreenchange",r)})}};f.prototype._startAd=function(t,e,n){var i=this.player;t.startAd(function(r){if(!r){i.trigger("vast.adStart")}n(r,t,e)})};f.prototype._finishPlaying=function(t,e,n){var r=this.player;t.on("AdStopped",function(){r.trigger("vpaid.AdStopped");a(null)});t.on("AdError",function(t){var e=t?t.message:"on VPAIDIntegrator, error while waiting for the adUnit to finish playing";a(new i(e))});function a(i){n(i,t,e)}};f.prototype._trackError=function m(t,e){s.track(t.errorURLMacros,{ERRORCODE:e||901})};function h(t,e,n){var i=t.el().querySelector(".vjs-tech");var r=l.getDimension(i);var a=t.isFullscreen()?n.FULLSCREEN:n.NORMAL;e.resizeAd(r.width,r.height,a,p)}function p(t){if(t&&console&&console.log){console.log("ERROR: "+t.message,t)}}e.exports=f},{"../../utils/async":39,"../../utils/dom":40,"../../utils/playerUtils":42,"../../utils/utilityFunctions":44,"../vast/VASTError":22,"../vast/VASTResponse":24,"../vast/VASTTracker":25,"../vast/vastUtil":29,"./VPAIDAdUnitWrapper":30}],34:[function(t,e,n){"use strict";var i=t("../../utils/dom");var r=document.createElement("div");r.className="vjs-ads-label vjs-control vjs-label-hidden";r.innerHTML="Advertisement";var a=function(t){return{init:function e(n,a){a.el=r;t.call(this,n,a);setTimeout(function(){var t=n.controlBar&&(n.controlBar.getChild("timerControls")||n.controlBar.getChild("currentTimeDisplay"));if(t){n.controlBar.el().insertBefore(r,t.el())}i.removeClass(r,"vjs-label-hidden")},0)},el:function n(){return r}}};e.exports=a},{"../../utils/dom":40}],35:[function(t,e,n){"use strict";var i=videojs.getComponent("Component");var r=t("./ads-label")(i);videojs.registerComponent("AdsLabel",videojs.extend(i,r))},{"./ads-label":34}],36:[function(t,e,n){"use strict";var i=document.createElement("div");var r=function(t){return{init:function e(n,r){r.el=i;i.className="vjs-black-poster";t.call(this,n,r);var a=n.getChild("posterImage");setTimeout(function(){if(a&&n&&n.el()){n.el().insertBefore(i,a.el())}},0)},el:function n(){return i}}};e.exports=r},{}],37:[function(t,e,n){"use strict";var i=videojs.getComponent("Component");var r=t("./black-poster")(i);videojs.registerComponent("BlackPoster",videojs.extend(i,r))},{"./black-poster":36}],38:[function(t,e,n){"use strict";var i=t("../ads/vast/VASTClient");var r=t("../ads/vast/VASTError");var a=t("../ads/vast/vastUtil");var s=t("../ads/vast/VASTIntegrator");var o=t("../ads/vpaid/VPAIDIntegrator");var u=t("../utils/async");var l=t("../utils/dom");var c=t("../utils/playerUtils");var d=t("../utils/utilityFunctions");e.exports=function f(t){var e;var n=this;var f=new i;var h=false;var p={timeout:500,iosPrerollCancelTimeout:2e3,adCancelTimeout:3e3,playAdAlways:false,adsEnabled:true,autoResize:true,vpaidFlashLoaderPath:"/VPAIDFlash.swf"};var v=d.extend({},p,t||{});if(d.isUndefined(v.adTagUrl)&&d.isDefined(v.url)){v.adTagUrl=v.url}if(d.isString(v.adTagUrl)){v.adTagUrl=d.echoFn(v.adTagUrl)}if(d.isDefined(v.adTagXML)&&!d.isFunction(v.adTagXML)){return k(new r("on VideoJS VAST plugin, the passed adTagXML option does not contain a function"))}if(!d.isDefined(v.adTagUrl)&&!d.isFunction(v.adTagXML)){return k(new r("on VideoJS VAST plugin, missing adTagUrl on options object"))}a.runFlashSupportCheck(v.vpaidFlashLoaderPath);c.prepareForAds(n);if(v.playAdAlways){n.on("vast.contentEnd",function(){setTimeout(function(){n.trigger("vast.reset")},0)})}n.on("vast.firstPlay",g);n.on("vast.reset",function(){e=null;m()});n.vast={isEnabled:function(){return v.adsEnabled},enable:function(){v.adsEnabled=true},disable:function(){v.adsEnabled=false}};return n.vast;function g(){c.removeNativePoster(n);c.once(n,["vast.adsCancel","vast.adEnd"],function(){t();i()});u.waterfall([s,o,p,y],function(t,e){if(t){k(t,e)}else{n.trigger("vast.adEnd")}});function t(){if(n.vast&&n.vast.adUnit){n.vast.adUnit=null}}function i(){a();if(e){c.restorePlayerSnapshot(n,e);e=null}}function a(){c.once(n,["playing","vast.reset","vast.firstPlay"],function(t){if(t.type!=="playing"){return}n.trigger("vast.contentStart");c.once(n,["ended","vast.reset","vast.firstPlay"],function(t){if(t.type==="ended"){n.trigger("vast.contentEnd")}})})}function s(t){if(v.adsEnabled){return t(null)}t(new r("Ads are not enabled"))}function o(t){if(f()){e=c.getPlayerSnapshot(n);n.pause();g();if(n.paused()){t(null)}else{c.once(n,["playing"],function(){n.pause();t(null)})}}else{t(new r("video content has been playing before preroll ad"))}}function f(){return!d.isIPhone()||n.currentTime()<=v.iosPrerollCancelTimeout}function p(t){var e;h=false;e=setTimeout(function(){k(new r("timeout while waiting for the video to start playing",402))},v.adCancelTimeout);c.once(n,["vast.adStart","vast.adsCancel"],i);function i(){if(e){clearTimeout(e);e=null}}t(null)}function g(){l.addClass(n.el(),"vjs-vast-ad-loading");c.once(n,["vast.adStart","vast.adsCancel"],m)}function m(){setTimeout(function(){l.removeClass(n.el(),"vjs-vast-ad-loading")},100)}}function m(){n.trigger("vast.adsCancel");h=true}function y(t){u.waterfall([A,_],t)}function A(t){f.getVASTResponse(v.adTagUrl?v.adTagUrl():v.adTagXML,t)}function _(t,e){if(h){return}var i=E(t)?new o(n,v):new s(n);var r=false;c.once(n,["vast.adStart","vast.adsCancel"],function(t){if(t.type==="vast.adStart"){a()}});c.once(n,["vast.adEnd","vast.adsCancel"],u);if(d.isIDevice()){l()}n.vast.vastResponse=t;n.vast.adUnit=i.playAd(t,e);function a(){if(r||n.controlBar.getChild("AdsLabel")){return}n.controlBar.addChild("AdsLabel")}function u(){n.controlBar.removeChild("AdsLabel");r=true}function l(){var t=3;var e=0;var i=0;n.on("timeupdate",a);n.on("ended",r);c.once(n,["vast.adEnd","vast.adsCancel","vast.adError"],s);function r(){if(n.duration()-e>t){n.pause(true);n.play(true);n.currentTime(e)}}function a(){var r=n.currentTime();var a=Math.abs(r-e);if(a>t){i+=1;if(i>=2){n.pause(true)}n.currentTime(e)}else{e=r}}function s(){n.off("timeupdate",a);n.off("ended",r)}}}function k(t,e){n.trigger({type:"vast.adError",error:t});m();if(console&&console.log){console.log("AD ERROR:",t.message,t,e)}}function E(t){var e,n;var i=t.mediaFiles;for(e=0,n=i.length;e0){u=setTimeout(function(){l&&l.abort()},o)}function c(t,e,n){if(!r.isString(t)||r.isEmptyString(t)){throw new a("Invalid url '"+t+"'")}if(!r.isFunction(e)){throw new a("Invalid handler '"+e+"' for the http request")}if(r.isDefined(n)&&!r.isObject(n)){throw new a("Invalid options map '"+n+"'")}}function d(t,e){r.forEach(e,function(e,n){if(r.isDefined(e)){t.setRequestHeader(n,e)}})}function f(){n(-1,null,null,"")}};s.prototype.get=function(t,e,n){this.run("GET",t,i,n);function i(t,n,i,s){if(r(t)){e(null,n,t,i,s)}else{e(new a(s),n,t,i,s)}}function r(t){return 200<=t&&t<300}};function o(){var t=new XMLHttpRequest;if(!("withCredentials"in t)){t=new XDomainRequest}return t}var u=new s(o);e.exports={http:u,HttpRequest:s,HttpRequestError:a,createXhr:o}},{"./urlUtils":43,"./utilityFunctions":44}],42:[function(t,e,n){"use strict";var i=t("./dom");var r=t("./utilityFunctions");var a={};a.getPlayerSnapshot=function s(t){var e=t.el().querySelector(".vjs-tech");var n={ended:t.ended(),src:t.currentSrc(),currentTime:t.currentTime(),type:t.currentType(),playing:!t.paused(),suppressedTracks:i(t)};if(e){n.nativePoster=e.poster;n.style=e.getAttribute("style")}return n;function i(t){var e=t.remoteTextTracks?t.remoteTextTracks():[];if(e&&r.isArray(e.tracks_)){e=e.tracks_}if(!r.isArray(e)){e=[]}var n=[];e.forEach(function(t){n.push({track:t,mode:t.mode});t.mode="disabled"});return n}};a.restorePlayerSnapshot=function o(t,e){var n=t.el().querySelector(".vjs-tech");var i=20;if(e.nativePoster){n.poster=e.nativePoster}if("style"in e){n.setAttribute("style",e.style||"")}if(s(t,e)){t.one("contentloadedmetadata",o);t.one("canplay",u);r();t.src({src:e.src,type:e.type});t.load()}else{o();if(e.playing){t.play()}}function r(){var e=setTimeout(function(){t.trigger("canplay")},1e3);t.one("canplay",function(){clearTimeout(e)})}function s(t,e){if(t.src()){return t.src()!==e.src}return t.currentSrc()!==e.src}function o(){var t=e.suppressedTracks;t.forEach(function(t){t.track.mode=t.mode})}function u(){if(!a.isReadyToResume(t)&&i--){setTimeout(u,50)}else{try{if(t.currentTime()!==e.currentTime){if(e.playing){t.one("seeked",function(){t.play()})}t.currentTime(e.currentTime)}else if(e.playing){t.play()}}catch(n){videojs.log.warn("Failed to resume the content after an advertisement",n)}}}};a.isReadyToResume=function(t){if(t.readyState()>1){return true}if(t.seekable()===undefined){return true}if(t.seekable().length>0){return true}return false};a.prepareForAds=function(t){var e=t.addChild("blackPoster");var n=true;var a;s();t.on("play",u);t.on("vast.reset",l);t.on("vast.firstPlay",f);t.on("error",p);t.on("vast.adStart",p);t.on("vast.adsCancel",p);t.on("vast.adError",p);t.on("vast.adStart",v);t.on("vast.adEnd",g);t.on("vast.adsCancel",g);function s(){var e=t.play;t.play=function(n){var i=this;if(c()){s()}else{u(n)}return this;function s(){if(!r.isIPhone()){a=d();t.muted(true)}e.apply(i,arguments)}function u(n){if(o()&&!n){t.vast.adUnit.resumeAd()}else{e.apply(i,arguments)}}};var n=t.pause;t.pause=function(e){if(o()&&!e){t.vast.adUnit.pauseAd()}else{n.apply(this,arguments)}return this};var i=t.paused;t.paused=function(e){if(o()&&!e){return t.vast.adUnit.isPaused()}return i.apply(this,arguments)}}function o(){return t.vast&&t.vast.adUnit}function u(){if(c()){n=false;t.trigger("vast.firstPlay")}}function l(){n=true;e.show();f()}function c(){return n}function d(){return{muted:t.muted(),volume:t.volume()}}function f(){if(a){t.currentTime(0);h(a);a=null}}function h(e){if(r.isObject(e)){t.volume(e.volume);t.muted(e.muted)}}function p(){if(!i.hasClass(e.el(),"vjs-hidden")){e.hide()}}function v(){i.addClass(t.el(),"vjs-ad-playing")}function g(){i.removeClass(t.el(),"vjs-ad-playing")}};a.removeNativePoster=function(t){var e=t.el().querySelector(".vjs-tech");if(e){e.removeAttribute("poster")}};a.once=function u(t,e,n){function i(){n.apply(null,arguments);e.forEach(function(e){t.off(e,i)})}e.forEach(function(e){t.on(e,i)})};e.exports=a},{"./dom":40,"./utilityFunctions":44}],43:[function(t,e,n){"use strict";var i=t("./utilityFunctions");var r=document.createElement("a");var a=document.documentMode;function s(t){var e=t;if(a){r.setAttribute("href",e);e=r.href}r.setAttribute("href",e);return{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:i.isNotEmptyString(r.port)?r.port:80,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}function o(t,e){var n,r;e=i.isFunction(e)?e:function(){return true};t=t.trim().replace(/^\?/,"");n=t.split("&");r={};i.forEach(n,function(t){var n,i,a;if(t!==""){n=t.split("=");i=n[0];a=n[1];if(e(i,a)){r[i]=a}}});return r}function u(t){var e=[];i.forEach(t,function(t,n){e.push(n+"="+t)});return e.join("&")}e.exports={urlParts:s,queryStringToObj:o,objToQueryString:u}},{"./utilityFunctions":44}],44:[function(t,e,n){"use strict";var i=1;var r=/[A-Z]/g;var a=/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i;var s=/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function o(){}function u(t){return t===null}function l(t){return t!==undefined}function c(t){return t===undefined}function d(t){return typeof t==="object"}function f(t){return typeof t==="function"}function h(t){return typeof t==="number"}function p(t){return j.isObject(t)&&t.window===t}function v(t){return Object.prototype.toString.call(t)==="[object Array]"}function g(t){if(t===null||j.isWindow(t)||j.isFunction(t)||j.isUndefined(t)){return false}var e=t.length;if(t.nodeType===i&&e){return true}return j.isString(t)||j.isArray(t)||e===0||typeof e==="number"&&e>0&&e-1 in t}function m(t){return typeof t==="string"}function y(t){return j.isString(t)&&t.length===0}function A(t){return j.isString(t)&&t.length!==0}function _(t){return Array.prototype.slice.call(t)}function k(t,e,n){var i,r;if(t){if(f(t)){for(i in t){if(i!=="prototype"&&i!=="length"&&i!=="name"&&(!t.hasOwnProperty||t.hasOwnProperty(i))){e.call(n,t[i],i,t)}}}else if(v(t)){var a=typeof t!=="object";for(i=0,r=t.length;i=e){n=i;t.apply(this,arguments)}}}function F(t,e){var n;return function(){if(n){clearTimeout(n)}n=setTimeout(function(){t.apply(this,arguments);n=undefined},e)}}function L(t,e,n){var i=e(t);for(var r=0;r0}return t.getElementsByTagNameNS(i,"parsererror").length>0}catch(r){}}};r.parseText=function s(t){if(/^\s*$/.test(t)){return null}if(/^(?:true|false)$/i.test(t)){return t.toLowerCase()==="true"}if(isFinite(t)){return parseFloat(t)}if(i.isISO8601(t)){return new Date(t)}return t.trim()};r.JXONTree=function o(t){var e=r.parseText;if(t.documentElement){return new r.JXONTree(t.documentElement)}if(t.hasChildNodes()){var n="";for(var a,s,o,u=0;u0:t.hasAttributes();if(l){var c;for(var d=0;d/g,">").replace(/"/g,""").replace(/'/g,"'")};r.decode=function f(t){return t.replace(/'/g,"'").replace(/"/g,'"').replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&")};e.exports=r},{"./utilityFunctions":44}],46:[function(t,e,n){"use strict";t("./plugin/components/ads-label_5");t("./plugin/components/black-poster_5");var i=t("./plugin/videojs.vast.vpaid");videojs.plugin("vastClient",i)},{"./plugin/components/ads-label_5":35,"./plugin/components/black-poster_5":37,"./plugin/videojs.vast.vpaid":38}]},{},[46]); //# sourceMappingURL=videojs_5.vast.vpaid.min.js.map diff --git a/bin/videojs_5.vast.vpaid.min.js.map b/bin/videojs_5.vast.vpaid.min.js.map index 718fca94..499aa471 100644 --- a/bin/videojs_5.vast.vpaid.min.js.map +++ b/bin/videojs_5.vast.vpaid.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["node_modules/browserify/node_modules/browser-pack/_prelude.js","bower_components/VPAIDFLASHClient/js/IVPAIDAdUnit.js","videojs_5.vast.vpaid.js","bower_components/VPAIDFLASHClient/js/VPAIDAdUnit.js","bower_components/VPAIDFLASHClient/js/VPAIDFLASHClient.js","bower_components/VPAIDFLASHClient/js/flashTester.js","bower_components/VPAIDFLASHClient/js/jsFlashBridge.js","bower_components/VPAIDFLASHClient/js/jsFlashBridgeRegistry.js","bower_components/VPAIDFLASHClient/js/registry.js","bower_components/VPAIDFLASHClient/js/utils.js","bower_components/VPAIDHTML5Client/js/IVPAIDAdUnit.js","bower_components/VPAIDHTML5Client/js/VPAIDAdUnit.js","bower_components/VPAIDHTML5Client/js/VPAIDHTML5Client.js","bower_components/VPAIDHTML5Client/js/subscriber.js","bower_components/VPAIDHTML5Client/js/utils.js","src/scripts/ads/vast/Ad.js","src/scripts/ads/vast/Companion.js","src/scripts/ads/vast/Creative.js","src/scripts/ads/vast/InLine.js","src/scripts/ads/vast/Linear.js","src/scripts/ads/vast/MediaFile.js","src/scripts/ads/vast/TrackingEvent.js","src/scripts/ads/vast/VASTClient.js","src/scripts/ads/vast/VASTError.js","src/scripts/ads/vast/VASTIntegrator.js","src/scripts/ads/vast/VASTResponse.js","src/scripts/ads/vast/VASTTracker.js","src/scripts/ads/vast/VideoClicks.js","src/scripts/ads/vast/Wrapper.js","src/scripts/ads/vast/parsers.js","src/scripts/ads/vast/vastUtil.js","src/scripts/ads/vpaid/VPAIDAdUnitWrapper.js","src/scripts/ads/vpaid/VPAIDFlashTech.js","src/scripts/ads/vpaid/VPAIDHTML5Tech.js","src/scripts/ads/vpaid/VPAIDIntegrator.js","src/scripts/plugin/components/ads-label.js","src/scripts/plugin/components/ads-label_5.js","src/scripts/plugin/components/black-poster.js","src/scripts/plugin/components/black-poster_5.js","src/scripts/plugin/videojs.vast.vpaid.js","src/scripts/utils/async.js","src/scripts/utils/dom.js","src/scripts/utils/http.js","src/scripts/utils/playerUtils.js","src/scripts/utils/urlUtils.js","src/scripts/utils/utilityFunctions.js","src/scripts/utils/xml.js","src/scripts/videojs_5.vast.vpaid.js"],"names":["e","t","n","r","s","o","u","a","require","i","f","Error","code","l","exports","call","length",1,"module","Object","defineProperty","value","_createClass","defineProperties","target","props","descriptor","enumerable","configurable","writable","key","Constructor","protoProps","staticProps","prototype","_classCallCheck","instance","TypeError","IVPAIDAdUnit","this","handshakeVersion","playerVPAIDVersion","arguments","undefined","callback","initAd","width","height","viewMode","desiredBitrate","creativeData","AdParameters","environmentVars","flashVars","resizeAd","startAd","stopAd","pauseAd","resumeAd","expandAd","collapseAd","skipAd","getAdLinear","getAdWidth","getAdHeight","getAdExpanded","getAdSkippableState","getAdRemainingTime","getAdDuration","setAdVolume","soundVolume","getAdVolume","getAdCompanions","getAdIcons",2,"_typeof","Symbol","iterator","obj","constructor","_possibleConstructorReturn","self","ReferenceError","_inherits","subClass","superClass","create","setPrototypeOf","__proto__","ALL_VPAID_METHODS","getOwnPropertyNames","filter","property","indexOf","VPAIDAdUnit","_IVPAIDAdUnit","flash","_this","getPrototypeOf","_destroyed","_flash","_destroy","_this2","forEach","methodName","removeCallbackByMethodName","EVENTS","event","offEvent","isDestroyed","on","eventName","off","callFlashMethod","setSize","getWidth","getHeight","volume","./IVPAIDAdUnit",3,"JSFlashBridge","noop","callbackTimeout","isPositiveInt","createElementWithID","uniqueVPAID","unique","createFlashTester","ERROR","FLASH_VERSION","flashTester","isSupported","VPAIDFLASHClient","vpaidParentEl","swfConfig","data","params","wmode","salign","align","allowScriptAccess","scale","allowFullScreen","quality","vpaidOptions","debug","timeout","hasExternalDependencies","onError","_vpaidParentEl","_flashID","movie","FlashVars","VPAID_FLASH_HANDLER","el","swfobject","createSWF","handler","err","$loadPendedAdUnit","error","setTimeout","destroy","_destroyAdUnit","_loadLater","_adUnitLoad","removeCallback","_adUnit","loadAdUnit","adURL","$throwIfDestroyed","isReady","message","url","unloadAdUnit","getFlashID","getFlashURL","setStaticProperty","hasFlashPlayerVersion","window","document","body","propertyName","./VPAIDAdUnit","./flashTester.js","./jsFlashBridge","./utils",4,"FLASH_TEST","FLASH_TEST_EL","utils","MultipleValuesRegistry","FlashTester","parent","parentEl","hideFlashEl","_handlers","_isSupported","support","get","add","./registry",5,"stringEndsWith","SingleValueRegistry","registry","flashURL","flashID","loadHandShake","_el","_flashURL","_width","_height","_callbacks","_uniqueMethodIdentifier","_ready","_handShakeHandler","addInstance","remove","removeByKey","offAll","removeAll","args","callbackID","concat","$asyncCallback","_trigger","removeByValue","suffix","filterKeys","removeAllCallbacks","_callCallback","result","trigger","_handShake","getSize","newWidth","newHeight","setAttribute","setWidth","setHeight","removeInstanceByID","parentElement","removeChild","_this3","typeID","typeName","getInstanceByID","./jsFlashBridgeRegistry",6,"instances","JSFlashBridgeRegistry","id",7,"_registries","push","keys","findByValue","index","splice","old","map","size","_this4",8,"prefix","count","timer","onSuccess","onTimeout","clearTimeout","apply","cleanContent","nEl","createElement","innerHTML","appendChild","newVal","oldVal","isNaN","parseFloat","isFinite","endsWith","String","searchString","position","subjectString","toString","lastIndex","string","search","style","left","top","visibility",9,"METHODS","GETTERS","SETTERS","creative","video","VPAIDVersion","subscribe","context","unsubscribe","addStaticToInterface","VPAID1_METHODS","method","checkVPAIDInterface","every","Interface","name",10,"Subscriber","AD_CLICK","FILTERED_EVENTS","VPAIDCreative","iframe","_isValid","_creative","_videoEl","_iframe","_subscribers","$addEventsSubscribers","isValidVPAIDAd","ignores","ariaty","Array","slice","pop","callOrTriggerEvent","bind","extend","slot","videoSlot","getter","validate","unsubscribeAll","$trigger","$clickThruHook","documentElement","contentDocument","videoEl","addEventListener","click","playerHandles","triggerSync","subscribers","./subscriber",11,"defaultTemplate","AD_STOPPED","VPAIDHTML5Client","templateConfig","_id","_frameContainer","createElementInEl","_vpaidOptions","_templateConfig","template","extraOptions","$unloadPreviousAdUnit","that","frame","createIframeWithContent","iframeURL_JS","iframeID","getID","origin","getOrigin","_frame","_onLoad","onLoad","JSON","parse","adUnit","createAd","contentWindow","getVPAIDAd","adEl","querySelector","$adDestroyed","$destroyLoadListener","$removeEl","$removeAdElements","$destroyAdUnit","removeEventListener","clearCallbackTimeout","location","protocol","hostname","port",12,"isHandlerAttached","subscriber","some",13,"isValid","timeouts","func","tagName","createIframe","zIndex","setIframeContent","simpleTemplate","src","marginWidth","marginHeight","frameBorder","margin","padding","border","stringify","replace","RegExp","iframeEl","content","iframeDoc","write","toExtend","fromSource",14,"InLine","Wrapper","Ad","adJTree","initialize","attr","sequence","inLine","wrapper","./InLine","./Wrapper",15,"TrackingEvent","utilities","xml","Companion","companionJTree","creativeType","staticResource","keyValue","htmlResource","HTMLResource","hTMLResource","iframeResource","IFrameResource","iFrameresource","expandedWidth","expandedHeight","scalable","maintainAspectRatio","minSuggestedDuration","apiFramework","companionClickThrough","trackingEvents","parseTrackingEvents","tracking","trackings","isDefined","isArray","trackingData","../../utils/utilityFunctions","../../utils/xml","./TrackingEvent",16,"Linear","Creative","creativeJTree","adId","linear","companionAds","companions","companion","companionData","parseCreatives","creativesJTree","creatives","creativesData","./Companion","./Linear",17,"vastUtil","inlineJTree","adTitle","adSystem","impressions","parseImpressions","impression","description","advertiser","surveys","parseSurveys","survey","pricing","extensions","inlineSurveys","transformArray","isNotEmptyString","uri","type","len","./Creative","./vastUtil",18,"MediaFile","VideoClicks","parsers","linearJTree","duration","mediaFiles","parseMediaFiles","mediaFile","skipoffset","offset","videoClicks","adParameters","decode","mediaFilesJxonTree","mfData","./MediaFile","./VideoClicks","./parsers",19,"attributesList","mediaFileJTree","x","attribute","isVPAID","findSupportedVPAIDTech","isFlashSupported",20,"trackingJTree",21,"VASTError","VASTResponse","async","http","VASTClient","options","defaultOptions","WRAPPER_LIMIT","settings","errorURLMacros","getVASTResponse","adTagUrl","sanityCheck","isFunction","waterfall","_getVASTAd","buildVASTResponse","adsChain","cb","response","_buildVASTResponse","getAdWaterfall","vastTree","waterfallAds","ads","_trackError","getAd","shift","waterfallHandler","adChain","requestVastXML","_requestVASTXml","buildVastWaterfall","xmlStr","toJXONTree","ad","validateVASTTree","vastVersion","next","isString","requestVASTAd","buildAd","VASTAdTagURI","adJxonTree","validateAd","errMsgPrefix","requestVASTXml","requestHandler","withCredentials","status","errMsg","addAdsToResponse","validateResponse","addAd","progressEvents","progress","hasLinear","progressEvent","isNumber","addErrorUrlMacros","track","ERRORCODE","../../utils/async","../../utils/http","./Ad","./VASTError","./VASTResponse",22,23,"VASTTracker","dom","playerUtils","VASTIntegrator","player","playAd","vastResponse","_selectAdSource","_createVASTTracker","_addClickThrough","_addSkipButton","_setupEvents","_playSelectedAd","_src","pause","play","isPaused","paused","getSrc","selectAdSource","source","playerWidth","getDimension","sort","compareTo","b","deltaA","Math","abs","deltaB","selectSource","createVASTTracker","adMediaFile","setupEvents","tracker","previouslyMuted","trackFullscreenChange","trackImpressions","trackPause","trackProgress","trackVolumeChange","once","unbindEvents","evt","trackComplete","isFullscreen","trackFullscreen","trackExitFullscreen","currentTime","trackResume","currentTimeInMs","trackCreativeView","muted","trackMute","trackUnmute","addSkipButton","skipOffsetInSec","addSkipButtonToPlayer","skipOffset","skipButton","createSkipButton","updateSkipButton","updateSkipButtonState","removeSkipButton","addClass","onclick","hasClass","trackSkip","Event","stopPropagation","timeLeft","ceil","toFixedDigits","addClickThrough","blocker","createClickThroughBlocker","updateBlocker","updateBlockerURL","insertBefore","controlBar","removeBlocker","clickThroughMacro","clickThrough","href","generateClickThroughURL","trackClick","variables","ASSETURI","CONTENTPLAYHEAD","formatProgress","parseURLMacro","playSelectedAd","preload","proceed","trackError","../../utils/dom","../../utils/playerUtils","./VASTTracker",24,"InLine__A","_linearAdded","clickTrackings","customClicks","_addInLine","_addWrapper","_addErrorTrackUrl","errorURL","JXONTree","_addImpressions","appendToArray","_addClickTrackings","_addCustomClicks","_addTrackingEvents","eventsMap","trackingEvent","_addTitle","title","_addDuration","_addVideoClicks","_addMediaFiles","_addSkipoffset","_addAdParameters","_addLinear","array","items","item",25,"assetURI","quartiles","firstQuartile","tracked","time","round","midpoint","thirdQuartile","isEmptyString","trackURLs","urls","trackEvent","trackOnce","getEventUris","uris","newProgressInMs","events","ONCE","ALWAYS","addTrackEvent","hasRewound","addQuartileEvents","trackProgressEvents","trackEvents","currentProgress","newProgress","REWIND_THRESHOLD","canBeAdded","trackQuartile","quartileName","quartile","canBeTracked","quartileTime","pendingProgressEvts","capitalize","trackErrorWithCode","errorcode",26,"videoClickJTree","parseClickTrackings","clickTracking","customClick","clickTrackingData",27,"wrapperJTree","vASTAdTagURI","followAdditionalWrappers","allowMultipleAds","fallbackOnNoAd",28,"durationRegex","parseDuration","durationStr","match","durationInMs","parseHoursToMs","parseMinToMs","parseSecToMs","parseInt","hourStr","minStr","secStr","parseOffset","isPercentage","calculatePercentage","percentageRegex","test","percentStr","calcPercent","quantity","percent",29,"VPAIDHTML5Tech","VPAIDFlashTech","URLMacros","sources","parseURLMacros","trackImgs","img","Image","parseMacros","parsedURLs","random","URLMacro","_parseURLMacro","parseMacro","hours","minutes","seconds","milliseconds","floor","VPAID_techs","isVPAIDMediaFile","mimeType","VPAIDTech","supports","runFlashSupportCheck","vpaidFlashLoaderPath","runFlashTest","../vpaid/VPAIDFlashTech","../vpaid/VPAIDHTML5Tech","VPAIDFLASHClient/js/VPAIDFLASHClient",30,"VPAIDAdUnitWrapper","vpaidAdUnit","opts","isObject","responseTimeout","VPAIDInterfaceMethods","canSubscribeToEvents","canUnsubscribeFromEvents","adUnitAsyncCall","arrayLikeObjToArray","timeoutId","wrapCallback","evtName","waitForEvent","responseListener","unshift","version","adUnitData","getterName","../vast/VASTError",31,"containerEl","vpaidFlashClient","loadFlashCreative","objectEl","flashClientOpts","container","isDomElement","console","log",32,"vpaidHTMLClient","INVALID_MEDIA_FILE","isOldIE","INVALID_DOM_CONTAINER_EL","toLowerCase","MISSING_CALLBACK","PREFIX","INVALID_DOM_VIDEO_EL","VPAIDHTML5Client/js/VPAIDHTML5Client",33,"VPAIDIntegrator","VIEW_MODE","NORMAL","FULLSCREEN","THUMBNAIL","createVPAIDContainerEl","VPAID_VERSION","playVPaidAd","tech","_findSupportedTech","triggerVpaidAdEnd","one","removeAdUnit","_loadAdUnit","_playAdUnit","_finishPlaying","adComplete","_paused","removeClass","vpaidMediaFiles","_createVPAIDAdUnitWrapper","vjsTechEl","WrappedAdUnit","techClass","_handshake","_initAd","_linkPlayerControls","_startAd","handshake","isSupportedVersion","majorNum","major","parts","split","dimension","adUnitSrc","notifyPlayToPlayer","trackStart","notifyPauseToPlayer","trackFirstQuartile","trackMidpoint","trackThirdQuartile","clickThruUrl","open","trackAcceptInvitation","trackAcceptInvitationLinear","trackClose","trackCloseLinear","trackCollapse","lastVolume","currentVolume","updateViewSize","updateViewSizeThrottled","throttle","autoResize","pauseAdUnit","resumeAdUnit","isSkippable","linkVolumeControl","linkFullScreenControl","updateAdUnitVolume","updatePlayerVolume","vol","logError","finishPlayingAd","errorCode","MODE","../vast/VASTResponse","../vast/VASTTracker","../vast/vastUtil","./VPAIDAdUnitWrapper",34,"element","className","AdsLabelFactory","baseComponent","init","currentTimeComp","getChild","getElement",35,"baseVideoJsComponent","videojs","getComponent","AdsLabel","registerComponent","./ads-label",36,"BlackPosterFactory","posterImg",37,"BlackPoster","./black-poster",38,"VASTPlugin","snapshot","vast","adsCanceled","defaultOpts","iosPrerollCancelTimeout","adCancelTimeout","playAdAlways","adsEnabled","isUndefined","echoFn","adTagXML","trackAdError","prepareForAds","tryToPlayPrerollAd","cancelAds","isEnabled","enable","disable","removeNativePoster","restoreVideoContent","checkAdsEnabled","preparePlayerForAd","startAdCancelTimeout","playPrerollAd","setupContentEvents","restorePlayerSnapshot","canPlayPrerollAd","getPlayerSnapshot","addSpinnerIcon","isIPhone","adCancelTimeoutId","clearAdCancelTimeout","removeSpinnerIcon","getVastResponse","adIntegrator","adFinished","addAdsLabel","removeAdsLabel","isIDevice","preventManualProgress","addChild","PROGRESS_THRESHOLD","previousTime","skipad_attempts","preventAdSeek","preventAdSkip","stopPreventManualProgress","progressDelta","../ads/vast/VASTClient","../ads/vast/VASTError","../ads/vast/VASTIntegrator","../ads/vast/vastUtil","../ads/vpaid/VPAIDIntegrator","../utils/async","../utils/dom","../utils/playerUtils","../utils/utilityFunctions",39,"setImmediate","fn","tasks","makeCallback","wrapIterator","when","condition","isAllowed","./utilityFunctions",40,"isVisible","getComputedStyle","isHidden","display","isShown","hide","__prev_style_display_","show","cssClass","classes","classList","contains","getAttribute","join","newClasses","attachEvent","detachEvent","dispatchEvent","fireEvent","eventType","isDescendant","child","node","parentNode","getTextContent","textContent","text","prependChild","firstChild","removeNode","Element","handlerWrap","rect","getBoundingClientRect","offsetWidth","offsetHeight",41,"urlUtils","HttpRequestError","HttpRequest","createXhr","run","xhr","urlParts","headers","setHeaders","onload","statusText","getAllResponseHeaders","responseText","onerror","requestError","onabort","send","abort","setRequestHeader","processResponse","headersString","isSuccess","XMLHttpRequest","XDomainRequest","./urlUtils",42,"ended","currentSrc","currentType","playing","suppressedTracks","getSuppressedTracks","nativePoster","poster","tracks","remoteTextTracks","tracks_","mode","attempts","hasSrcChanged","restoreTracks","tryToResume","ensureCanplayEvtGetsFired","load","trackSnapshot","isReadyToResume","warn","readyState","seekable","blackPoster","_firstPlay","volumeSnapshot","monkeyPatchPlayerApi","tryToTriggerFirstPlay","resetFirstPlay","restoreContentVolume","hideBlackPoster","addStyles","removeStyles","origPlay","callOrigPlay","isFirstPlay","firstPlay","resume","saveVolumeSnapshot","isAdPlaying","origPause","callOrigPause","origPaused","callOrigPaused","restoreVolumeSnapshot","removeAttribute","listener","./dom",43,"urlParsingNode","msie","documentMode","host","hash","pathname","charAt","queryStringToObj","qs","cond","pairs","qsObj","trim","pair","objToQueryString",44,"NODE_TYPE_ELEMENT","SNAKE_CASE_REGEXP","EMAIL_REGEXP","ISO8086_REGEXP","isNull","str","num","isWindow","isArrayLike","nodeType","hasOwnProperty","isPrimitive","snake_case","separator","letter","pos","isValidEmail","email","arg","k","toUpperCase","decapitalize","transformer","transformedArray","transformedItem","digits","formattedNum","NaN","delay","previousCall","Date","getTime","debounce","wait","treeSearch","root","getChildren","found","children","val","isISO8601","getInternetExplorerVersion","navigator","rv","appName","ua","userAgent","re","res","exec","_UA","isMobile","isAndroid",45,"strToXMLDoc","stringContainingXMLSource","DOMParser","xmlDocument","ActiveXObject","loadXML","parseString","parser","parsedDocument","parseFromString","isParseError","erroneousParse","parsererrorNS","getElementsByTagName","namespaceURI","getElementsByTagNameNS","parseText","sValue","oXMLParent","hasChildNodes","sCollectedTxt","oNode","sProp","vContent","nItem","childNodes","nodeValue","nodeName","hasAttr","hasAttributes","attributes","oAttrib","nAttrib","xmlString","xmlDoc","getKeyValue","xmlObj","getAttrValue","encode","encodeXML","decodeXML",46,"videoJsVAST","plugin","./plugin/components/ads-label_5","./plugin/components/black-poster_5","./plugin/videojs.vast.vpaid"],"mappings":"CAAA,QAAAA,GAAAC,EAAAC,EAAAC,GAAA,QAAAC,GAAAC,EAAAC,GAAA,IAAAJ,EAAAG,GAAA,CAAA,IAAAJ,EAAAI,GAAA,CAAA,GAAAE,SAAAC,UAAA,YAAAA,OAAA,KAAAF,GAAAC,EAAA,MAAAA,GAAAF,GAAA,EAAA,IAAAI,EAAA,MAAAA,GAAAJ,GAAA,EAAA,IAAAK,GAAA,GAAAC,OAAA,uBAAAN,EAAA,IAAA,MAAAK,GAAAE,KAAA,mBAAAF,EAAA,GAAAG,GAAAX,EAAAG,IAAAS,WAAAb,GAAAI,GAAA,GAAAU,KAAAF,EAAAC,QAAA,SAAAd,GAAA,GAAAE,GAAAD,EAAAI,GAAA,GAAAL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E,EAAA36B,OAAA45B,EAAAe,EAAA7sC,MAAAonC,UAKArtB,GAAAkR,SAAApqB,UAAAyY,KAAA,SAAAA,GACA,MAAApY,MAAA,IAAA4Y,EAAA+uB,aAAAvvB,IAGAS,GAAAoI,WAAA,QAAAA,GAAA4qB,GACA,GAAAC,GAAAjzB,EAAA+wB,YAAAiC,EACA,OAAA,IAAAhzB,GAAAkR,SAAA+hB,GASAjzB,GAAAK,SAAA,QAAA6yB,GAAAC,GACA,GAAAA,EAAA,CACA,MAAAA,GAAA9yB,SAEA,MAAA9Y,WAGAyY,GAAAT,KAAA,QAAA6zB,GAAAD,EAAA5zB,GACA,GAAA4zB,EAAA,CACA,MAAAA,GAAA,IAAApzB,EAAA+uB,aAAAvvB,IAEA,MAAAhY,WAGAyY,GAAAqzB,OAAA,QAAAC,GAAAxF,GACA,MAAAA,GAAArvB,QAAA,KAAA,SACAA,QAAA,KAAA,QACAA,QAAA,KAAA,QACAA,QAAA,KAAA,UACAA,QAAA,KAAA,UAGAuB,GAAAiF,OAAA,QAAAsuB,GAAAzF,GACA,MAAAA,GAAArvB,QAAA,UAAA,KACAA,QAAA,UAAA,KACAA,QAAA,QAAA,KACAA,QAAA,QAAA,KACAA,QAAA,SAAA,KAGA3Y,GAAAJ,QAAAsa,I5C6gNGulB,qBAAqB,KAAKiO,IAAI,SAASpuC,EAAQU,EAAOJ,G6C9pNzD,YAEAN,GAAA,kCACAA,GAAA,qCAEA,IAAAquC,GAAAruC,EAAA,8BAEAo7B,SAAAkT,OAAA,aAAAD,K7CiqNGE,kCAAkC,GAAGC,qCAAqC,GAAGC,8BAA8B,UAAU","file":"videojs_5.vast.vpaid.min.js","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o 0) {\n callback(event);\n }\n }, 0);\n }\n });\n }\n }, {\n key: '_callCallback',\n value: function _callCallback(methodName, callbackID, err, result) {\n\n var callback = this._callbacks.get(callbackID);\n\n //not all methods callback's are mandatory\n //but if there exist an error, fire the error event\n if (!callback) {\n if (err && callbackID === '') {\n this.trigger(ERROR, err);\n }\n return;\n }\n\n $asyncCallback.call(this, callbackID, err, result);\n }\n }, {\n key: '_handShake',\n value: function _handShake(err, data) {\n this._ready = true;\n if (this._handShakeHandler) {\n this._handShakeHandler(err, data);\n delete this._handShakeHandler;\n }\n }\n\n //methods like properties specific to this implementation of VPAID\n\n }, {\n key: 'getSize',\n value: function getSize() {\n return { width: this._width, height: this._height };\n }\n }, {\n key: 'setSize',\n value: function setSize(newWidth, newHeight) {\n this._width = isPositiveInt(newWidth, this._width);\n this._height = isPositiveInt(newHeight, this._height);\n this._el.setAttribute('width', this._width);\n this._el.setAttribute('height', this._height);\n }\n }, {\n key: 'getWidth',\n value: function getWidth() {\n return this._width;\n }\n }, {\n key: 'setWidth',\n value: function setWidth(newWidth) {\n this.setSize(newWidth, this._height);\n }\n }, {\n key: 'getHeight',\n value: function getHeight() {\n return this._height;\n }\n }, {\n key: 'setHeight',\n value: function setHeight(newHeight) {\n this.setSize(this._width, newHeight);\n }\n }, {\n key: 'getFlashID',\n value: function getFlashID() {\n return this._flashID;\n }\n }, {\n key: 'getFlashURL',\n value: function getFlashURL() {\n return this._flashURL;\n }\n }, {\n key: 'isReady',\n value: function isReady() {\n return this._ready;\n }\n }, {\n key: 'destroy',\n value: function destroy() {\n this.offAll();\n this.removeAllCallbacks();\n registry.removeInstanceByID(this._flashID);\n if (this._el.parentElement) {\n this._el.parentElement.removeChild(this._el);\n }\n }\n }]);\n\n return JSFlashBridge;\n}();\n\nfunction $asyncCallback(callbackID, err, result) {\n var _this3 = this;\n\n setTimeout(function () {\n var callback = _this3._callbacks.get(callbackID);\n if (callback) {\n _this3._callbacks.remove(callbackID);\n callback(err, result);\n }\n }, 0);\n}\n\nObject.defineProperty(JSFlashBridge, 'VPAID_FLASH_HANDLER', {\n writable: false,\n configurable: false,\n value: VPAID_FLASH_HANDLER\n});\n\n/**\n * External interface handler\n *\n * @param {string} flashID identifier of the flash who call this\n * @param {string} typeID what type of message is, can be 'event' or 'callback'\n * @param {string} typeName if the typeID is a event the typeName will be the eventName, if is a callback the typeID is the methodName that is related this callback\n * @param {string} callbackID only applies when the typeID is 'callback', identifier of the callback to call\n * @param {object} error error object\n * @param {object} data\n */\nwindow[VPAID_FLASH_HANDLER] = function (flashID, typeID, typeName, callbackID, error, data) {\n var instance = registry.getInstanceByID(flashID);\n if (!instance) return;\n if (typeName === 'handShake') {\n instance._handShake(error, data);\n } else {\n if (typeID !== 'event') {\n instance._callCallback(typeName, callbackID, error, data);\n } else {\n instance._trigger(typeName, data);\n }\n }\n};\n\n},{\"./jsFlashBridgeRegistry\":6,\"./registry\":7,\"./utils\":8}],6:[function(require,module,exports){\n'use strict';\n\nvar SingleValueRegistry = require('./registry').SingleValueRegistry;\nvar instances = new SingleValueRegistry();\n\nvar JSFlashBridgeRegistry = {};\nObject.defineProperty(JSFlashBridgeRegistry, 'addInstance', {\n writable: false,\n configurable: false,\n value: function value(id, instance) {\n instances.add(id, instance);\n }\n});\n\nObject.defineProperty(JSFlashBridgeRegistry, 'getInstanceByID', {\n writable: false,\n configurable: false,\n value: function value(id) {\n return instances.get(id);\n }\n});\n\nObject.defineProperty(JSFlashBridgeRegistry, 'removeInstanceByID', {\n writable: false,\n configurable: false,\n value: function value(id) {\n return instances.remove(id);\n }\n});\n\nmodule.exports = JSFlashBridgeRegistry;\n\n},{\"./registry\":7}],7:[function(require,module,exports){\n'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if (\"value\" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);\n }\n }return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;\n };\n}();\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nvar MultipleValuesRegistry = exports.MultipleValuesRegistry = function () {\n function MultipleValuesRegistry() {\n _classCallCheck(this, MultipleValuesRegistry);\n\n this._registries = {};\n }\n\n _createClass(MultipleValuesRegistry, [{\n key: 'add',\n value: function add(id, value) {\n if (!this._registries[id]) {\n this._registries[id] = [];\n }\n if (this._registries[id].indexOf(value) === -1) {\n this._registries[id].push(value);\n }\n }\n }, {\n key: 'get',\n value: function get(id) {\n return this._registries[id] || [];\n }\n }, {\n key: 'filterKeys',\n value: function filterKeys(handler) {\n return Object.keys(this._registries).filter(handler);\n }\n }, {\n key: 'findByValue',\n value: function findByValue(value) {\n var _this = this;\n\n var keys = Object.keys(this._registries).filter(function (key) {\n return _this._registries[key].indexOf(value) !== -1;\n });\n\n return keys;\n }\n }, {\n key: 'remove',\n value: function remove(key, value) {\n if (!this._registries[key]) {\n return;\n }\n\n var index = this._registries[key].indexOf(value);\n\n if (index < 0) {\n return;\n }\n return this._registries[key].splice(index, 1);\n }\n }, {\n key: 'removeByKey',\n value: function removeByKey(id) {\n var old = this._registries[id];\n delete this._registries[id];\n return old;\n }\n }, {\n key: 'removeByValue',\n value: function removeByValue(value) {\n var _this2 = this;\n\n var keys = this.findByValue(value);\n return keys.map(function (key) {\n return _this2.remove(key, value);\n });\n }\n }, {\n key: 'removeAll',\n value: function removeAll() {\n var old = this._registries;\n this._registries = {};\n return old;\n }\n }, {\n key: 'size',\n value: function size() {\n return Object.keys(this._registries).length;\n }\n }]);\n\n return MultipleValuesRegistry;\n}();\n\nvar SingleValueRegistry = exports.SingleValueRegistry = function () {\n function SingleValueRegistry() {\n _classCallCheck(this, SingleValueRegistry);\n\n this._registries = {};\n }\n\n _createClass(SingleValueRegistry, [{\n key: 'add',\n value: function add(id, value) {\n this._registries[id] = value;\n }\n }, {\n key: 'get',\n value: function get(id) {\n return this._registries[id];\n }\n }, {\n key: 'filterKeys',\n value: function filterKeys(handler) {\n return Object.keys(this._registries).filter(handler);\n }\n }, {\n key: 'findByValue',\n value: function findByValue(value) {\n var _this3 = this;\n\n var keys = Object.keys(this._registries).filter(function (key) {\n return _this3._registries[key] === value;\n });\n\n return keys;\n }\n }, {\n key: 'remove',\n value: function remove(id) {\n var old = this._registries[id];\n delete this._registries[id];\n return old;\n }\n }, {\n key: 'removeByValue',\n value: function removeByValue(value) {\n var _this4 = this;\n\n var keys = this.findByValue(value);\n return keys.map(function (key) {\n return _this4.remove(key);\n });\n }\n }, {\n key: 'removeAll',\n value: function removeAll() {\n var old = this._registries;\n this._registries = {};\n return old;\n }\n }, {\n key: 'size',\n value: function size() {\n return Object.keys(this._registries).length;\n }\n }]);\n\n return SingleValueRegistry;\n}();\n\n},{}],8:[function(require,module,exports){\n'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.unique = unique;\nexports.noop = noop;\nexports.callbackTimeout = callbackTimeout;\nexports.createElementWithID = createElementWithID;\nexports.isPositiveInt = isPositiveInt;\nexports.stringEndsWith = stringEndsWith;\nexports.hideFlashEl = hideFlashEl;\nfunction unique(prefix) {\n var count = -1;\n return function (f) {\n return prefix + '_' + ++count;\n };\n}\n\nfunction noop() {}\n\nfunction callbackTimeout(timer, onSuccess, onTimeout) {\n\n var timeout = setTimeout(function () {\n\n onSuccess = noop;\n onTimeout();\n }, timer);\n\n return function () {\n clearTimeout(timeout);\n onSuccess.apply(this, arguments);\n };\n}\n\nfunction createElementWithID(parent, id) {\n var cleanContent = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2];\n\n var nEl = document.createElement('div');\n nEl.id = id;\n if (cleanContent) {\n parent.innerHTML = '';\n }\n parent.appendChild(nEl);\n return nEl;\n}\n\nfunction isPositiveInt(newVal, oldVal) {\n return !isNaN(parseFloat(newVal)) && isFinite(newVal) && newVal > 0 ? newVal : oldVal;\n}\n\nvar endsWith = function () {\n if (String.prototype.endsWith) return String.prototype.endsWith;\n return function endsWith(searchString, position) {\n var subjectString = this.toString();\n if (position === undefined || position > subjectString.length) {\n position = subjectString.length;\n }\n position -= searchString.length;\n var lastIndex = subjectString.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n };\n}();\n\nfunction stringEndsWith(string, search) {\n return endsWith.call(string, search);\n}\n\nfunction hideFlashEl(el) {\n // can't use display none because will not run the flash\n el.style.position = 'absolute';\n el.style.left = '-1px';\n el.style.top = '-1px';\n el.style.width = '1px';\n el.style.height = '1px';\n el.style.visibility = 'hidden';\n}\n\n},{}],9:[function(require,module,exports){\n'use strict';\n\nvar METHODS = [\n 'handshakeVersion',\n 'initAd',\n 'startAd',\n 'stopAd',\n 'skipAd', // VPAID 2.0 new method\n 'resizeAd',\n 'pauseAd',\n 'resumeAd',\n 'expandAd',\n 'collapseAd',\n 'subscribe',\n 'unsubscribe'\n];\n\nvar EVENTS = [\n 'AdLoaded',\n 'AdStarted',\n 'AdStopped',\n 'AdSkipped',\n 'AdSkippableStateChange', // VPAID 2.0 new event\n 'AdSizeChange', // VPAID 2.0 new event\n 'AdLinearChange',\n 'AdDurationChange', // VPAID 2.0 new event\n 'AdExpandedChange',\n 'AdRemainingTimeChange', // [Deprecated in 2.0] but will be still fired for backwards compatibility\n 'AdVolumeChange',\n 'AdImpression',\n 'AdVideoStart',\n 'AdVideoFirstQuartile',\n 'AdVideoMidpoint',\n 'AdVideoThirdQuartile',\n 'AdVideoComplete',\n 'AdClickThru',\n 'AdInteraction', // VPAID 2.0 new event\n 'AdUserAcceptInvitation',\n 'AdUserMinimize',\n 'AdUserClose',\n 'AdPaused',\n 'AdPlaying',\n 'AdLog',\n 'AdError'\n];\n\nvar GETTERS = [\n 'getAdLinear',\n 'getAdWidth', // VPAID 2.0 new getter\n 'getAdHeight', // VPAID 2.0 new getter\n 'getAdExpanded',\n 'getAdSkippableState', // VPAID 2.0 new getter\n 'getAdRemainingTime',\n 'getAdDuration', // VPAID 2.0 new getter\n 'getAdVolume',\n 'getAdCompanions', // VPAID 2.0 new getter\n 'getAdIcons' // VPAID 2.0 new getter\n];\n\nvar SETTERS = [\n 'setAdVolume'\n];\n\n\n/**\n * This callback is displayed as global member. The callback use nodejs error-first callback style\n * @callback NodeStyleCallback\n * @param {string|null}\n * @param {undefined|object}\n */\n\n\n/**\n * IVPAIDAdUnit\n *\n * @class\n *\n * @param {object} creative\n * @param {HTMLElement} el\n * @param {HTMLVideoElement} video\n */\nfunction IVPAIDAdUnit(creative, el, video) {}\n\n\n/**\n * handshakeVersion\n *\n * @param {string} VPAIDVersion\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.handshakeVersion = function (VPAIDVersion, callback) {};\n\n/**\n * initAd\n *\n * @param {number} width\n * @param {number} height\n * @param {string} viewMode can be 'normal', 'thumbnail' or 'fullscreen'\n * @param {number} desiredBitrate indicates the desired bitrate in kbps\n * @param {object} [creativeData] used for additional initialization data\n * @param {object} [environmentVars] used for passing implementation-specific of js version\n * @param {NodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.initAd = function(width, height, viewMode, desiredBitrate, creativeData, environmentVars, callback) {};\n\n/**\n * startAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.startAd = function(callback) {};\n\n/**\n * stopAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.stopAd = function(callback) {};\n\n/**\n * skipAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.skipAd = function(callback) {};\n\n/**\n * resizeAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.resizeAd = function(width, height, viewMode, callback) {};\n\n/**\n * pauseAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.pauseAd = function(callback) {};\n\n/**\n * resumeAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.resumeAd = function(callback) {};\n\n/**\n * expandAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.expandAd = function(callback) {};\n\n/**\n * collapseAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.collapseAd = function(callback) {};\n\n/**\n * subscribe\n *\n * @param {string} event\n * @param {nodeStyleCallback} handler\n * @param {object} context\n */\nIVPAIDAdUnit.prototype.subscribe = function(event, handler, context) {};\n\n/**\n * startAd\n *\n * @param {string} event\n * @param {function} handler\n */\nIVPAIDAdUnit.prototype.unsubscribe = function(event, handler) {};\n\n\n\n/**\n * getAdLinear\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdLinear = function(callback) {};\n\n/**\n * getAdWidth\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdWidth = function(callback) {};\n\n/**\n * getAdHeight\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdHeight = function(callback) {};\n\n/**\n * getAdExpanded\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdExpanded = function(callback) {};\n\n/**\n * getAdSkippableState\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdSkippableState = function(callback) {};\n\n/**\n * getAdRemainingTime\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdRemainingTime = function(callback) {};\n\n/**\n * getAdDuration\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdDuration = function(callback) {};\n\n/**\n * getAdVolume\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdVolume = function(callback) {};\n\n/**\n * getAdCompanions\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdCompanions = function(callback) {};\n\n/**\n * getAdIcons\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdIcons = function(callback) {};\n\n/**\n * setAdVolume\n *\n * @param {number} volume\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.setAdVolume = function(volume, callback) {};\n\naddStaticToInterface(IVPAIDAdUnit, 'METHODS', METHODS);\naddStaticToInterface(IVPAIDAdUnit, 'GETTERS', GETTERS);\naddStaticToInterface(IVPAIDAdUnit, 'SETTERS', SETTERS);\naddStaticToInterface(IVPAIDAdUnit, 'EVENTS', EVENTS);\n\n\nvar VPAID1_METHODS = METHODS.filter(function(method) {\n return ['skipAd'].indexOf(method) === -1;\n});\n\naddStaticToInterface(IVPAIDAdUnit, 'checkVPAIDInterface', function checkVPAIDInterface (creative) {\n var result = VPAID1_METHODS.every(function(key) {\n return typeof creative[key] === 'function';\n });\n return result;\n});\n\nmodule.exports = IVPAIDAdUnit;\n\nfunction addStaticToInterface(Interface, name, value) {\n Object.defineProperty(Interface, name, {\n writable: false,\n configurable: false,\n value: value\n });\n}\n\n\n},{}],10:[function(require,module,exports){\n'use strict';\n\nvar IVPAIDAdUnit = require('./IVPAIDAdUnit');\nvar Subscriber = require('./subscriber');\nvar checkVPAIDInterface = IVPAIDAdUnit.checkVPAIDInterface;\nvar utils = require('./utils');\nvar METHODS = IVPAIDAdUnit.METHODS;\nvar ERROR = 'AdError';\nvar AD_CLICK = 'AdClickThru';\nvar FILTERED_EVENTS = IVPAIDAdUnit.EVENTS.filter(function (event) {\n return event != AD_CLICK;\n});\n\n/**\n * This callback is displayed as global member. The callback use nodejs error-first callback style\n * @callback NodeStyleCallback\n * @param {string|null}\n * @param {undefined|object}\n */\n\n\n/**\n * VPAIDAdUnit\n * @class\n *\n * @param VPAIDCreative\n * @param {HTMLElement} [el] this will be used in initAd environmentVars.slot if defined\n * @param {HTMLVideoElement} [video] this will be used in initAd environmentVars.videoSlot if defined\n */\nfunction VPAIDAdUnit(VPAIDCreative, el, video, iframe) {\n this._isValid = checkVPAIDInterface(VPAIDCreative);\n if (this._isValid) {\n this._creative = VPAIDCreative;\n this._el = el;\n this._videoEl = video;\n this._iframe = iframe;\n this._subscribers = new Subscriber();\n $addEventsSubscribers.call(this);\n }\n}\n\nVPAIDAdUnit.prototype = Object.create(IVPAIDAdUnit.prototype);\n\n/**\n * isValidVPAIDAd will return if the VPAIDCreative passed in constructor is valid or not\n *\n * @return {boolean}\n */\nVPAIDAdUnit.prototype.isValidVPAIDAd = function isValidVPAIDAd() {\n return this._isValid;\n};\n\nIVPAIDAdUnit.METHODS.forEach(function(method) {\n //NOTE: this methods arguments order are implemented differently from the spec\n var ignores = [\n 'subscribe',\n 'unsubscribe',\n 'initAd'\n ];\n\n if (ignores.indexOf(method) !== -1) return;\n\n VPAIDAdUnit.prototype[method] = function () {\n var ariaty = IVPAIDAdUnit.prototype[method].length;\n // TODO avoid leaking arguments\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n var args = Array.prototype.slice.call(arguments);\n var callback = (ariaty === args.length) ? args.pop() : undefined;\n\n setTimeout(function () {\n var result, error = null;\n try {\n result = this._creative[method].apply(this._creative, args);\n } catch(e) {\n error = e;\n }\n\n callOrTriggerEvent(callback, this._subscribers, error, result);\n }.bind(this), 0);\n };\n});\n\n\n/**\n * initAd concreate implementation\n *\n * @param {number} width\n * @param {number} height\n * @param {string} viewMode can be 'normal', 'thumbnail' or 'fullscreen'\n * @param {number} desiredBitrate indicates the desired bitrate in kbps\n * @param {object} [creativeData] used for additional initialization data\n * @param {object} [environmentVars] used for passing implementation-specific of js version, if el & video was used in constructor slot & videoSlot will be added to the object\n * @param {NodeStyleCallback} callback\n */\nVPAIDAdUnit.prototype.initAd = function initAd(width, height, viewMode, desiredBitrate, creativeData, environmentVars, callback) {\n creativeData = creativeData || {};\n environmentVars = utils.extend({\n slot: this._el,\n videoSlot: this._videoEl\n }, environmentVars || {});\n\n setTimeout(function () {\n var error;\n try {\n this._creative.initAd(width, height, viewMode, desiredBitrate, creativeData, environmentVars);\n } catch (e) {\n error = e;\n }\n\n callOrTriggerEvent(callback, this._subscribers, error);\n }.bind(this), 0);\n};\n\n/**\n * subscribe\n *\n * @param {string} event\n * @param {nodeStyleCallback} handler\n * @param {object} context\n */\nVPAIDAdUnit.prototype.subscribe = function subscribe(event, handler, context) {\n this._subscribers.subscribe(handler, event, context);\n};\n\n\n/**\n * unsubscribe\n *\n * @param {string} event\n * @param {nodeStyleCallback} handler\n */\nVPAIDAdUnit.prototype.unsubscribe = function unsubscribe(event, handler) {\n this._subscribers.unsubscribe(handler, event);\n};\n\n//alias\nVPAIDAdUnit.prototype.on = VPAIDAdUnit.prototype.subscribe;\nVPAIDAdUnit.prototype.off = VPAIDAdUnit.prototype.unsubscribe;\n\nIVPAIDAdUnit.GETTERS.forEach(function(getter) {\n VPAIDAdUnit.prototype[getter] = function (callback) {\n setTimeout(function () {\n\n var result, error = null;\n try {\n result = this._creative[getter]();\n } catch(e) {\n error = e;\n }\n\n callOrTriggerEvent(callback, this._subscribers, error, result);\n }.bind(this), 0);\n };\n});\n\n/**\n * setAdVolume\n *\n * @param volume\n * @param {nodeStyleCallback} callback\n */\nVPAIDAdUnit.prototype.setAdVolume = function setAdVolume(volume, callback) {\n setTimeout(function () {\n\n var result, error = null;\n try {\n this._creative.setAdVolume(volume);\n result = this._creative.getAdVolume();\n } catch(e) {\n error = e;\n }\n\n if (!error) {\n error = utils.validate(result === volume, 'failed to apply volume: ' + volume);\n }\n callOrTriggerEvent(callback, this._subscribers, error, result);\n }.bind(this), 0);\n};\n\nVPAIDAdUnit.prototype._destroy = function destroy() {\n this.stopAd();\n this._subscribers.unsubscribeAll();\n};\n\nfunction $addEventsSubscribers() {\n // some ads implement\n // so they only handle one subscriber\n // to handle this we create our one\n FILTERED_EVENTS.forEach(function (event) {\n this._creative.subscribe($trigger.bind(this, event), event);\n }.bind(this));\n\n // map the click event to be an object instead of depending of the order of the arguments\n // and to be consistent with the flash\n this._creative.subscribe($clickThruHook.bind(this), AD_CLICK);\n\n // because we are adding the element inside the iframe\n // the user is not able to click in the video\n if (this._videoEl) {\n var documentElement = this._iframe.contentDocument.documentElement;\n var videoEl = this._videoEl;\n documentElement.addEventListener('click', function(e) {\n if (e.target === documentElement) {\n videoEl.click();\n }\n });\n }\n}\n\nfunction $clickThruHook(url, id, playerHandles) {\n this._subscribers.triggerSync(AD_CLICK, {url: url, id: id, playerHandles: playerHandles});\n}\n\nfunction $trigger(event) {\n // TODO avoid leaking arguments\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n this._subscribers.trigger(event, Array.prototype.slice(arguments, 1));\n}\n\nfunction callOrTriggerEvent(callback, subscribers, error, result) {\n if (callback) {\n callback(error, result);\n } else if (error) {\n subscribers.trigger(ERROR, error);\n }\n}\n\nmodule.exports = VPAIDAdUnit;\n\n\n},{\"./IVPAIDAdUnit\":9,\"./subscriber\":12,\"./utils\":13}],11:[function(require,module,exports){\n'use strict';\n\nvar utils = require('./utils');\nvar unique = utils.unique('vpaidIframe');\nvar VPAIDAdUnit = require('./VPAIDAdUnit');\n\nvar defaultTemplate = '' +\n '' +\n '' +\n '
' +\n '' +\n '' +\n '' +\n '';\n\nvar AD_STOPPED = 'AdStopped';\n\n/**\n * This callback is displayed as global member. The callback use nodejs error-first callback style\n * @callback NodeStyleCallback\n * @param {string|null}\n * @param {undefined|object}\n */\n\n/**\n * VPAIDHTML5Client\n * @class\n *\n * @param {HTMLElement} el that will contain the iframe to load adUnit and a el to add to adUnit slot\n * @param {HTMLVideoElement} video default video element to be used by adUnit\n * @param {object} [templateConfig] template: html template to be used instead of the default, extraOptions: to be used when rendering the template\n * @param {object} [vpaidOptions] timeout: when loading adUnit\n */\nfunction VPAIDHTML5Client(el, video, templateConfig, vpaidOptions) {\n templateConfig = templateConfig || {};\n\n this._id = unique();\n this._destroyed = false;\n\n this._frameContainer = utils.createElementInEl(el, 'div');\n this._videoEl = video;\n this._vpaidOptions = vpaidOptions || {timeout: 10000};\n\n this._templateConfig = {\n template: templateConfig.template || defaultTemplate,\n extraOptions: templateConfig.extraOptions || {}\n };\n}\n\n/**\n * destroy\n *\n */\nVPAIDHTML5Client.prototype.destroy = function destroy() {\n if (this._destroyed) {\n return;\n }\n this._destroyed = true;\n $unloadPreviousAdUnit.call(this);\n};\n\n/**\n * isDestroyed\n *\n * @return {boolean}\n */\nVPAIDHTML5Client.prototype.isDestroyed = function isDestroyed() {\n return this._destroyed;\n};\n\n/**\n * loadAdUnit\n *\n * @param {string} adURL url of the js of the adUnit\n * @param {nodeStyleCallback} callback\n */\nVPAIDHTML5Client.prototype.loadAdUnit = function loadAdUnit(adURL, callback) {\n $throwIfDestroyed.call(this);\n $unloadPreviousAdUnit.call(this);\n var that = this;\n\n var frame = utils.createIframeWithContent(\n this._frameContainer,\n this._templateConfig.template,\n utils.extend({\n iframeURL_JS: adURL,\n iframeID: this.getID(),\n origin: getOrigin()\n }, this._templateConfig.extraOptions)\n );\n\n this._frame = frame;\n\n this._onLoad = utils.callbackTimeout(\n this._vpaidOptions.timeout,\n onLoad.bind(this),\n onTimeout.bind(this)\n );\n\n window.addEventListener('message', this._onLoad);\n\n function onLoad (e) {\n /*jshint validthis: false */\n //don't clear timeout\n if (e.origin !== getOrigin()) return;\n var result = JSON.parse(e.data);\n\n //don't clear timeout\n if (result.id !== that.getID()) return;\n\n var adUnit, error, createAd;\n if (!that._frame.contentWindow) {\n\n error = 'the iframe is not anymore in the DOM tree';\n\n } else {\n createAd = that._frame.contentWindow.getVPAIDAd;\n error = utils.validate(typeof createAd === 'function', 'the ad didn\\'t return a function to create an ad');\n }\n\n if (!error) {\n var adEl = that._frame.contentWindow.document.querySelector('.ad-element');\n adUnit = new VPAIDAdUnit(createAd(), adEl, that._videoEl, that._frame);\n adUnit.subscribe(AD_STOPPED, $adDestroyed.bind(that));\n error = utils.validate(adUnit.isValidVPAIDAd(), 'the add is not fully complaint with VPAID specification');\n }\n\n that._adUnit = adUnit;\n $destroyLoadListener.call(that);\n callback(error, error ? null : adUnit);\n\n //clear timeout\n return true;\n }\n\n function onTimeout() {\n callback('timeout', null);\n }\n};\n\n/**\n * unloadAdUnit\n *\n */\nVPAIDHTML5Client.prototype.unloadAdUnit = function unloadAdUnit() {\n $unloadPreviousAdUnit.call(this);\n};\n\n/**\n * getID will return the unique id\n *\n * @return {string}\n */\nVPAIDHTML5Client.prototype.getID = function () {\n return this._id;\n};\n\n\n/**\n * $removeEl\n *\n * @param {string} key\n */\nfunction $removeEl(key) {\n var el = this[key];\n if (el) {\n el.remove();\n delete this[key];\n }\n}\n\nfunction $adDestroyed() {\n $removeAdElements.call(this);\n delete this._adUnit;\n}\n\nfunction $unloadPreviousAdUnit() {\n $removeAdElements.call(this);\n $destroyAdUnit.call(this);\n}\n\nfunction $removeAdElements() {\n $removeEl.call(this, '_frame');\n $destroyLoadListener.call(this);\n}\n\n/**\n * $destroyLoadListener\n *\n */\nfunction $destroyLoadListener() {\n if (this._onLoad) {\n window.removeEventListener('message', this._onLoad);\n utils.clearCallbackTimeout(this._onLoad);\n delete this._onLoad;\n }\n}\n\n\nfunction $destroyAdUnit() {\n if (this._adUnit) {\n this._adUnit.stopAd();\n delete this._adUnit;\n }\n}\n\n/**\n * $throwIfDestroyed\n *\n */\nfunction $throwIfDestroyed() {\n if (this._destroyed) {\n throw new Error ('VPAIDHTML5Client already destroyed!');\n }\n}\n\nfunction getOrigin() {\n if( window.location.origin ) {\n return window.location.origin;\n }\n else {\n return window.location.protocol + \"//\" +\n window.location.hostname +\n (window.location.port ? ':' + window.location.port: '');\n }\n}\n\nmodule.exports = VPAIDHTML5Client;\nwindow.VPAIDHTML5Client = VPAIDHTML5Client;\n\n\n},{\"./VPAIDAdUnit\":10,\"./utils\":13}],12:[function(require,module,exports){\n'use strict';\n\nfunction Subscriber() {\n this._subscribers = {};\n}\n\nSubscriber.prototype.subscribe = function subscribe(handler, eventName, context) {\n if (!this.isHandlerAttached(handler, eventName)) {\n this.get(eventName).push({handler: handler, context: context, eventName: eventName});\n }\n};\n\nSubscriber.prototype.unsubscribe = function unsubscribe(handler, eventName) {\n this._subscribers[eventName] = this.get(eventName).filter(function (subscriber) {\n return handler !== subscriber.handler;\n });\n};\n\nSubscriber.prototype.unsubscribeAll = function unsubscribeAll() {\n this._subscribers = {};\n};\n\nSubscriber.prototype.trigger = function(eventName, data) {\n var that = this;\n var subscribers = this.get(eventName)\n .concat(this.get('*'));\n\n subscribers.forEach(function (subscriber) {\n setTimeout(function () {\n if (that.isHandlerAttached(subscriber.handler, subscriber.eventName)) {\n subscriber.handler.call(subscriber.context, data);\n }\n }, 0);\n });\n};\n\nSubscriber.prototype.triggerSync = function(eventName, data) {\n var subscribers = this.get(eventName)\n .concat(this.get('*'));\n\n subscribers.forEach(function (subscriber) {\n subscriber.handler.call(subscriber.context, data);\n });\n};\n\nSubscriber.prototype.get = function get(eventName) {\n if (!this._subscribers[eventName]) {\n this._subscribers[eventName] = [];\n }\n return this._subscribers[eventName];\n};\n\nSubscriber.prototype.isHandlerAttached = function isHandlerAttached(handler, eventName) {\n return this.get(eventName).some(function(subscriber) {\n return handler === subscriber.handler;\n })\n};\n\nmodule.exports = Subscriber;\n\n\n},{}],13:[function(require,module,exports){\n'use strict';\n\n/**\n * noop a empty function\n */\nfunction noop() {}\n\n/**\n * validate if is not validate will return an Error with the message\n *\n * @param {boolean} isValid\n * @param {string} message\n */\nfunction validate(isValid, message) {\n return isValid ? null : new Error(message);\n}\n\nvar timeouts = {};\n/**\n * clearCallbackTimeout\n *\n * @param {function} func handler to remove\n */\nfunction clearCallbackTimeout(func) {\n var timeout = timeouts[func];\n if (timeout) {\n clearTimeout(timeout);\n delete timeouts[func];\n }\n}\n\n/**\n * callbackTimeout if the onSuccess is not called and returns true in the timelimit then onTimeout will be called\n *\n * @param {number} timer\n * @param {function} onSuccess\n * @param {function} onTimeout\n */\nfunction callbackTimeout(timer, onSuccess, onTimeout) {\n var callback, timeout;\n\n timeout = setTimeout(function () {\n onSuccess = noop;\n delete timeout[callback];\n onTimeout();\n }, timer);\n\n callback = function () {\n // TODO avoid leaking arguments\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n if (onSuccess.apply(this, arguments)) {\n clearCallbackTimeout(callback);\n }\n };\n\n timeouts[callback] = timeout;\n\n return callback;\n}\n\n\n/**\n * createElementInEl\n *\n * @param {HTMLElement} parent\n * @param {string} tagName\n * @param {string} id\n */\nfunction createElementInEl(parent, tagName, id) {\n var nEl = document.createElement(tagName);\n if (id) nEl.id = id;\n parent.appendChild(nEl);\n return nEl;\n}\n\n/**\n * createIframeWithContent\n *\n * @param {HTMLElement} parent\n * @param {string} template simple template using {{var}}\n * @param {object} data\n */\nfunction createIframeWithContent(parent, template, data) {\n var iframe = createIframe(parent, null, data.zIndex);\n if (!setIframeContent(iframe, simpleTemplate(template, data))) return;\n return iframe;\n}\n\n/**\n * createIframe\n *\n * @param {HTMLElement} parent\n * @param {string} url\n */\nfunction createIframe(parent, url, zIndex) {\n var nEl = document.createElement('iframe');\n nEl.src = url || 'about:blank';\n nEl.marginWidth = '0';\n nEl.marginHeight = '0';\n nEl.frameBorder = '0';\n nEl.width = '100%';\n nEl.height = '100%';\n nEl.style.position = 'absolute';\n nEl.style.left = '0';\n nEl.style.top = '0';\n nEl.style.margin = '0px';\n nEl.style.padding = '0px';\n nEl.style.border = 'none';\n\n if(zIndex){\n nEl.style.zIndex = zIndex;\n }\n\n nEl.setAttribute('SCROLLING','NO');\n parent.innerHTML = '';\n parent.appendChild(nEl);\n return nEl;\n}\n\n/**\n * simpleTemplate\n *\n * @param {string} template\n * @param {object} data\n */\nfunction simpleTemplate(template, data) {\n Object.keys(data).forEach(function (key) {\n var value = (typeof value === 'object') ? JSON.stringify(data[key]) : data[key];\n template = template.replace(new RegExp('{{' + key + '}}', 'g'), value);\n });\n return template;\n}\n\n/**\n * setIframeContent\n *\n * @param {HTMLIframeElement} iframeEl\n * @param content\n */\nfunction setIframeContent(iframeEl, content) {\n var iframeDoc = iframeEl.contentWindow && iframeEl.contentWindow.document;\n if (!iframeDoc) return false;\n\n iframeDoc.write(content);\n\n return true;\n}\n\n\n/**\n * extend object with keys from another object\n *\n * @param {object} toExtend\n * @param {object} fromSource\n */\nfunction extend(toExtend, fromSource) {\n Object.keys(fromSource).forEach(function(key) {\n toExtend[key] = fromSource[key];\n });\n return toExtend;\n}\n\n\n/**\n * unique will create a unique string everytime is called, sequentially and prefixed\n *\n * @param {string} prefix\n */\nfunction unique(prefix) {\n var count = -1;\n return function () {\n return prefix + '_' + (++count);\n };\n}\n\nmodule.exports = {\n noop: noop,\n validate: validate,\n clearCallbackTimeout: clearCallbackTimeout,\n callbackTimeout: callbackTimeout,\n createElementInEl: createElementInEl,\n createIframeWithContent: createIframeWithContent,\n createIframe: createIframe,\n simpleTemplate: simpleTemplate,\n setIframeContent: setIframeContent,\n extend: extend,\n unique: unique\n};\n\n\n},{}],14:[function(require,module,exports){\n'use strict';\n\nvar InLine = require('./InLine');\nvar Wrapper = require('./Wrapper');\n\nfunction Ad(adJTree) {\n if (!(this instanceof Ad)) {\n return new Ad(adJTree);\n }\n this.initialize(adJTree);\n}\n\nAd.prototype.initialize = function(adJTree) {\n this.id = adJTree.attr('id');\n this.sequence = adJTree.attr('sequence');\n\n if(adJTree.inLine) {\n this.inLine = new InLine(adJTree.inLine);\n }\n\n if(adJTree.wrapper){\n this.wrapper = new Wrapper(adJTree.wrapper);\n }\n};\n\nmodule.exports = Ad;\n},{\"./InLine\":17,\"./Wrapper\":27}],15:[function(require,module,exports){\n'use strict';\n\nvar TrackingEvent = require('./TrackingEvent');\n\nvar utilities = require('../../utils/utilityFunctions');\n\nvar xml = require('../../utils/xml');\n\n\nfunction Companion(companionJTree) {\n if (!(this instanceof Companion)) {\n return new Companion(companionJTree);\n }\n\n //Required Elements\n this.creativeType = xml.attr(companionJTree.staticResource, 'creativeType');\n this.staticResource = xml.keyValue(companionJTree.staticResource);\n\n // Weird bug when the JXON tree is built it doesn't handle casing properly in this situation...\n var htmlResource = null;\n if (xml.keyValue(companionJTree.HTMLResource)) {\n htmlResource = xml.keyValue(companionJTree.HTMLResource);\n } else if (xml.keyValue(companionJTree.hTMLResource)) {\n htmlResource = xml.keyValue(companionJTree.hTMLResource);\n }\n this.htmlResource = htmlResource;\n\n var iframeResource = null;\n if (xml.keyValue(companionJTree.IFrameResource)) {\n iframeResource = xml.keyValue(companionJTree.IFrameResource);\n } else if (xml.keyValue(companionJTree.iFrameresource)) {\n iframeResource = xml.keyValue(companionJTree.iFrameresource);\n }\n this.iframeResource = iframeResource;\n\n //Optional fields\n this.id = xml.attr(companionJTree, 'id');\n this.width = xml.attr(companionJTree, 'width');\n this.height = xml.attr(companionJTree, 'height');\n this.expandedWidth = xml.attr(companionJTree, 'expandedWidth');\n this.expandedHeight = xml.attr(companionJTree, 'expandedHeight');\n this.scalable = xml.attr(companionJTree, 'scalable');\n this.maintainAspectRatio = xml.attr(companionJTree, 'maintainAspectRatio');\n this.minSuggestedDuration = xml.attr(companionJTree, 'minSuggestedDuration');\n this.apiFramework = xml.attr(companionJTree, 'apiFramework');\n this.companionClickThrough = xml.keyValue(companionJTree.companionClickThrough);\n this.trackingEvents = parseTrackingEvents(companionJTree.trackingEvents && companionJTree.trackingEvents.tracking);\n\n /*** Local functions ***/\n function parseTrackingEvents(trackingEvents) {\n var trackings = [];\n if (utilities.isDefined(trackingEvents)) {\n trackingEvents = utilities.isArray(trackingEvents) ? trackingEvents : [trackingEvents];\n trackingEvents.forEach(function (trackingData) {\n trackings.push(new TrackingEvent(trackingData));\n });\n }\n return trackings;\n }\n}\n\nmodule.exports = Companion;\n},{\"../../utils/utilityFunctions\":44,\"../../utils/xml\":45,\"./TrackingEvent\":20}],16:[function(require,module,exports){\n'use strict';\n\nvar Linear = require('./Linear');\nvar Companion = require('./Companion');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction Creative(creativeJTree) {\n if(!(this instanceof Creative)) {\n return new Creative(creativeJTree);\n }\n\n this.id = creativeJTree.attr('id');\n this.sequence = creativeJTree.attr('sequence');\n this.adId = creativeJTree.attr('adId');\n this.apiFramework = creativeJTree.attr('apiFramework');\n\n if(creativeJTree.linear) {\n this.linear = new Linear(creativeJTree.linear);\n }\n\n if (creativeJTree.companionAds) {\n var companions = [];\n var companionAds = creativeJTree.companionAds && creativeJTree.companionAds.companion;\n if (utilities.isDefined(companionAds)) {\n companionAds = utilities.isArray(companionAds) ? companionAds : [companionAds];\n companionAds.forEach(function (companionData) {\n companions.push(new Companion(companionData));\n });\n }\n this.companionAds = companions;\n }\n}\n\n/**\n * Returns true if the browser supports at the creative.\n */\nCreative.prototype.isSupported = function(){\n if(this.linear) {\n return this.linear.isSupported();\n }\n\n return true;\n};\n\nCreative.parseCreatives = function parseCreatives(creativesJTree) {\n var creatives = [];\n var creativesData;\n if (utilities.isDefined(creativesJTree) && utilities.isDefined(creativesJTree.creative)) {\n creativesData = utilities.isArray(creativesJTree.creative) ? creativesJTree.creative : [creativesJTree.creative];\n creativesData.forEach(function (creative) {\n creatives.push(new Creative(creative));\n });\n }\n return creatives;\n};\n\nmodule.exports = Creative;\n\n},{\"../../utils/utilityFunctions\":44,\"./Companion\":15,\"./Linear\":18}],17:[function(require,module,exports){\n'use strict';\n\nvar vastUtil = require('./vastUtil');\nvar Creative = require('./Creative');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nfunction InLine(inlineJTree) {\n if (!(this instanceof InLine)) {\n return new InLine(inlineJTree);\n }\n\n //Required Fields\n this.adTitle = xml.keyValue(inlineJTree.adTitle);\n this.adSystem = xml.keyValue(inlineJTree.adSystem);\n this.impressions = vastUtil.parseImpressions(inlineJTree.impression);\n this.creatives = Creative.parseCreatives(inlineJTree.creatives);\n\n //Optional Fields\n this.description = xml.keyValue(inlineJTree.description);\n this.advertiser = xml.keyValue(inlineJTree.advertiser);\n this.surveys = parseSurveys(inlineJTree.survey);\n this.error = xml.keyValue(inlineJTree.error);\n this.pricing = xml.keyValue(inlineJTree.pricing);\n this.extensions = inlineJTree.extensions;\n\n /*** Local Functions ***/\n function parseSurveys(inlineSurveys) {\n if (inlineSurveys) {\n return utilities.transformArray(utilities.isArray(inlineSurveys) ? inlineSurveys : [inlineSurveys], function (survey) {\n if(utilities.isNotEmptyString(survey.keyValue)){\n return {\n uri: survey.keyValue,\n type: survey.attr('type')\n };\n }\n\n return undefined;\n });\n }\n return [];\n }\n}\n\n\n/**\n * Returns true if the browser supports all the creatives.\n */\nInLine.prototype.isSupported = function(){\n var i,len;\n\n if(this.creatives.length === 0) {\n return false;\n }\n\n for(i = 0, len = this.creatives.length; i< len; i+=1){\n if(!this.creatives[i].isSupported()){\n return false;\n }\n }\n return true;\n};\n\nmodule.exports = InLine;\n\n},{\"../../utils/utilityFunctions\":44,\"../../utils/xml\":45,\"./Creative\":16,\"./vastUtil\":29}],18:[function(require,module,exports){\n'use strict';\n\nvar TrackingEvent = require('./TrackingEvent');\nvar MediaFile = require('./MediaFile');\nvar VideoClicks = require('./VideoClicks');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar parsers = require('./parsers');\n\nvar xml = require('../../utils/xml');\n\n\nfunction Linear(linearJTree) {\n if (!(this instanceof Linear)) {\n return new Linear(linearJTree);\n }\n\n //Required Elements\n this.duration = parsers.duration(xml.keyValue(linearJTree.duration));\n this.mediaFiles = parseMediaFiles(linearJTree.mediaFiles && linearJTree.mediaFiles.mediaFile);\n\n //Optional fields\n this.trackingEvents = parseTrackingEvents(linearJTree.trackingEvents && linearJTree.trackingEvents.tracking, this.duration);\n this.skipoffset = parsers.offset(xml.attr(linearJTree, 'skipoffset'), this.duration);\n\n if (linearJTree.videoClicks) {\n this.videoClicks = new VideoClicks(linearJTree.videoClicks);\n }\n\n if(linearJTree.adParameters) {\n this.adParameters = xml.keyValue(linearJTree.adParameters);\n\n if(xml.attr(linearJTree.adParameters, 'xmlEncoded')){\n this.adParameters = xml.decode(this.adParameters);\n }\n }\n\n /*** Local functions ***/\n function parseTrackingEvents(trackingEvents, duration) {\n var trackings = [];\n if (utilities.isDefined(trackingEvents)) {\n trackingEvents = utilities.isArray(trackingEvents) ? trackingEvents : [trackingEvents];\n trackingEvents.forEach(function (trackingData) {\n trackings.push(new TrackingEvent(trackingData, duration));\n });\n }\n return trackings;\n }\n\n function parseMediaFiles(mediaFilesJxonTree) {\n var mediaFiles = [];\n if (utilities.isDefined(mediaFilesJxonTree)) {\n mediaFilesJxonTree = utilities.isArray(mediaFilesJxonTree) ? mediaFilesJxonTree : [mediaFilesJxonTree];\n\n mediaFilesJxonTree.forEach(function (mfData) {\n mediaFiles.push(new MediaFile(mfData));\n });\n }\n return mediaFiles;\n }\n}\n\n/**\n * Must return true if at least one of the MediaFiles' type is supported\n */\nLinear.prototype.isSupported = function () {\n var i, len;\n for(i=0, len=this.mediaFiles.length; i 0) {\n getAd(waterfallAds.shift(),[], waterfallHandler);\n } else {\n callback(error, adChain);\n }\n } else {\n callback(null, adChain);\n }\n }\n });\n\n /*** Local functions ***/\n function getAdWaterfall(adTagUrl, callback) {\n var requestVastXML = that._requestVASTXml.bind(that, adTagUrl);\n async.waterfall([\n requestVastXML,\n buildVastWaterfall\n ], callback);\n }\n\n function buildVastWaterfall(xmlStr, callback) {\n var vastTree;\n try {\n vastTree = xml.toJXONTree(xmlStr);\n\n if(utilities.isArray(vastTree.ad)) {\n vastTree.ads = vastTree.ad;\n } else if(vastTree.ad){\n vastTree.ads = [vastTree.ad];\n } else {\n vastTree.ads = [];\n }\n callback(validateVASTTree(vastTree), vastTree);\n\n } catch (e) {\n callback(new VASTError(\"on VASTClient.getVASTAd.buildVastWaterfall, error parsing xml\", 100), null);\n }\n }\n\n function validateVASTTree(vastTree) {\n var vastVersion = xml.attr(vastTree, 'version');\n\n if (!vastTree.ad) {\n return new VASTError('on VASTClient.getVASTAd.validateVASTTree, no Ad in VAST tree', 303);\n }\n\n if (vastVersion && (vastVersion != 3 && vastVersion != 2)) {\n return new VASTError('on VASTClient.getVASTAd.validateVASTTree, not supported VAST version \"' + vastVersion + '\"', 102);\n }\n\n return null;\n }\n\n function getAd(adTagUrl, adChain, callback) {\n if (adChain.length >= that.WRAPPER_LIMIT) {\n return callback(new VASTError(\"on VASTClient.getVASTAd.getAd, players wrapper limit reached (the limit is \" + that.WRAPPER_LIMIT + \")\", 302), adChain);\n }\n\n async.waterfall([\n function (next) {\n if (utilities.isString(adTagUrl)) {\n requestVASTAd(adTagUrl, next);\n } else {\n next(null, adTagUrl);\n }\n },\n buildAd\n ], function (error, ad) {\n if (ad) {\n adChain.push(ad);\n }\n\n if (error) {\n return callback(error, adChain);\n }\n\n if (ad.wrapper) {\n return getAd(ad.wrapper.VASTAdTagURI, adChain, callback);\n }\n\n return callback(null, adChain);\n });\n }\n\n function buildAd(adJxonTree, callback) {\n try {\n var ad = new Ad(adJxonTree);\n callback(validateAd(ad), ad);\n } catch (e) {\n callback(new VASTError('on VASTClient.getVASTAd.buildAd, error parsing xml', 100), null);\n }\n }\n\n function validateAd(ad) {\n var wrapper = ad.wrapper;\n var inLine = ad.inLine;\n var errMsgPrefix = 'on VASTClient.getVASTAd.validateAd, ';\n\n if (inLine && wrapper) {\n return new VASTError(errMsgPrefix +\"InLine and Wrapper both found on the same Ad\", 101);\n }\n\n if (!inLine && !wrapper) {\n return new VASTError(errMsgPrefix + \"nor wrapper nor inline elements found on the Ad\", 101);\n }\n\n if (inLine && !inLine.isSupported()) {\n return new VASTError(errMsgPrefix + \"could not find MediaFile that is supported by this video player\", 403);\n }\n\n if (wrapper && !wrapper.VASTAdTagURI) {\n return new VASTError(errMsgPrefix + \"missing 'VASTAdTagURI' in wrapper\", 101);\n }\n\n return null;\n }\n\n function requestVASTAd(adTagUrl, callback) {\n that._requestVASTXml(adTagUrl, function (error, xmlStr) {\n if (error) {\n return callback(error);\n }\n try {\n var vastTree = xml.toJXONTree(xmlStr);\n callback(validateVASTTree(vastTree), vastTree.ad);\n } catch (e) {\n callback(new VASTError(\"on VASTClient.getVASTAd.requestVASTAd, error parsing xml\", 100));\n }\n });\n }\n};\n\nVASTClient.prototype._requestVASTXml = function requestVASTXml(adTagUrl, callback) {\n try {\n if (utilities.isFunction(adTagUrl)) {\n adTagUrl(requestHandler);\n } else {\n http.get(adTagUrl, requestHandler, {\n withCredentials: true\n });\n }\n } catch (e) {\n callback(e);\n }\n\n /*** Local functions ***/\n function requestHandler(error, response, status) {\n if (error) {\n var errMsg = utilities.isDefined(status) ?\n \"on VASTClient.requestVastXML, HTTP request error with status '\" + status + \"'\" :\n \"on VASTClient.requestVastXML, Error getting the the VAST XML with he passed adTagXML fn\";\n return callback(new VASTError(errMsg, 301), null);\n }\n\n callback(null, response);\n }\n};\n\nVASTClient.prototype._buildVASTResponse = function buildVASTResponse(adsChain) {\n var response = new VASTResponse();\n addAdsToResponse(response, adsChain);\n validateResponse(response);\n\n return response;\n\n //*** Local function ****\n function addAdsToResponse(response, ads) {\n ads.forEach(function (ad) {\n response.addAd(ad);\n });\n }\n\n function validateResponse(response) {\n var progressEvents = response.trackingEvents.progress;\n\n if (!response.hasLinear()) {\n throw new VASTError(\"on VASTClient._buildVASTResponse, Received an Ad type that is not supported\", 200);\n }\n\n if (response.duration === undefined) {\n throw new VASTError(\"on VASTClient._buildVASTResponse, Missing duration field in VAST response\", 101);\n }\n\n if (progressEvents) {\n progressEvents.forEach(function (progressEvent) {\n if (!utilities.isNumber(progressEvent.offset)) {\n throw new VASTError(\"on VASTClient._buildVASTResponse, missing or wrong offset attribute on progress tracking event\", 101);\n }\n });\n }\n }\n};\n\nVASTClient.prototype._trackError = function (error, adChain) {\n if (!utilities.isArray(adChain) || adChain.length === 0) { //There is nothing to track\n return;\n }\n\n var errorURLMacros = [];\n adChain.forEach(addErrorUrlMacros);\n vastUtil.track(errorURLMacros, {ERRORCODE: error.code || 900}); //900 <== Undefined error\n\n /*** Local functions ***/\n function addErrorUrlMacros(ad) {\n if (ad.wrapper && ad.wrapper.error) {\n errorURLMacros.push(ad.wrapper.error);\n }\n\n if (ad.inLine && ad.inLine.error) {\n errorURLMacros.push(ad.inLine.error);\n }\n }\n};\n\nmodule.exports = VASTClient;\n\n},{\"../../utils/async\":39,\"../../utils/http\":41,\"../../utils/utilityFunctions\":44,\"../../utils/xml\":45,\"./Ad\":14,\"./VASTError\":22,\"./VASTResponse\":24,\"./vastUtil\":29}],22:[function(require,module,exports){\n'use strict';\n\nfunction VASTError(message, code) {\n this.message = 'VAST Error: ' + (message || '');\n if (code) {\n this.code = code;\n }\n}\n\nVASTError.prototype = new Error();\nVASTError.prototype.name = \"VAST Error\";\n\nmodule.exports = VASTError;\n},{}],23:[function(require,module,exports){\n'use strict';\n\n/**\n * Inner helper class that deals with the logic of the individual steps needed to setup an ad in the player.\n *\n * @param player {object} instance of the player that will play the ad. It assumes that the videojs-contrib-ads plugin\n * has been initialized when you use its utility functions.\n *\n * @constructor\n */\n\nvar VASTResponse = require('./VASTResponse');\nvar VASTError = require('./VASTError');\nvar VASTTracker = require('./VASTTracker');\nvar vastUtil = require('./vastUtil');\n\nvar async = require('../../utils/async');\nvar dom = require('../../utils/dom');\nvar playerUtils = require('../../utils/playerUtils');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VASTIntegrator(player) {\n if (!(this instanceof VASTIntegrator)) {\n return new VASTIntegrator(player);\n }\n\n this.player = player;\n}\n\nVASTIntegrator.prototype.playAd = function playAd(vastResponse, callback) {\n var that = this;\n callback = callback || utilities.noop;\n\n if (!(vastResponse instanceof VASTResponse)) {\n return callback(new VASTError('On VASTIntegrator, missing required VASTResponse'));\n }\n\n async.waterfall([\n function (next) {\n next(null, vastResponse);\n },\n this._selectAdSource.bind(this),\n this._createVASTTracker.bind(this),\n this._addClickThrough.bind(this),\n this._addSkipButton.bind(this),\n this._setupEvents.bind(this),\n this._playSelectedAd.bind(this)\n ], function (error, response) {\n if (error && response) {\n that._trackError(error, response);\n }\n callback(error, response);\n });\n\n this._adUnit = {\n _src: null,\n type: 'VAST',\n pauseAd: function () {\n that.player.pause(true);\n },\n\n resumeAd: function () {\n that.player.play(true);\n },\n\n isPaused: function () {\n return that.player.paused(true);\n },\n\n getSrc: function () {\n return this._src;\n }\n };\n\n return this._adUnit;\n};\n\nVASTIntegrator.prototype._selectAdSource = function selectAdSource(response, callback) {\n var source;\n\n var playerWidth = dom.getDimension(this.player.el()).width;\n response.mediaFiles.sort(function compareTo(a, b) {\n var deltaA = Math.abs(playerWidth - a.width);\n var deltaB = Math.abs(playerWidth - b.width);\n return deltaA - deltaB;\n });\n\n source = this.player.selectSource(response.mediaFiles).source;\n\n if (source) {\n if (this._adUnit) {\n this._adUnit._src = source;\n }\n return callback(null, source, response);\n }\n\n // code 403 <== Couldn't find MediaFile that is supported by this video player\n callback(new VASTError(\"Could not find Ad mediafile supported by this player\", 403), response);\n};\n\nVASTIntegrator.prototype._createVASTTracker = function createVASTTracker(adMediaFile, response, callback) {\n try {\n callback(null, adMediaFile, new VASTTracker(adMediaFile.src, response), response);\n } catch (e) {\n callback(e, response);\n }\n};\n\nVASTIntegrator.prototype._setupEvents = function setupEvents(adMediaFile, tracker, response, callback) {\n var previouslyMuted;\n var player = this.player;\n player.on('fullscreenchange', trackFullscreenChange);\n player.on('vast.adStart', trackImpressions);\n player.on('pause', trackPause);\n player.on('timeupdate', trackProgress);\n player.on('volumechange', trackVolumeChange);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], unbindEvents);\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel', 'vast.adSkip'], function(evt){\n if(evt.type === 'vast.adEnd'){\n tracker.trackComplete();\n }\n });\n\n return callback(null, adMediaFile, response);\n\n /*** Local Functions ***/\n function unbindEvents() {\n player.off('fullscreenchange', trackFullscreenChange);\n player.off('vast.adStart', trackImpressions);\n player.off('pause', trackPause);\n player.off('timeupdate', trackProgress);\n player.off('volumechange', trackVolumeChange);\n }\n\n function trackFullscreenChange() {\n if (player.isFullscreen()) {\n tracker.trackFullscreen();\n } else {\n tracker.trackExitFullscreen();\n }\n }\n\n function trackPause() {\n //NOTE: whenever a video ends the video Element triggers a 'pause' event before the 'ended' event.\n // We should not track this pause event because it makes the VAST tracking confusing again we use a\n // Threshold of 2 seconds to prevent false positives on IOS.\n if (Math.abs(player.duration() - player.currentTime()) < 2) {\n return;\n }\n\n tracker.trackPause();\n playerUtils.once(player, ['play', 'vast.adEnd', 'vast.adsCancel'], function (evt) {\n if(evt.type === 'play'){\n tracker.trackResume();\n }\n });\n }\n\n function trackProgress() {\n var currentTimeInMs = player.currentTime() * 1000;\n tracker.trackProgress(currentTimeInMs);\n }\n\n function trackImpressions() {\n tracker.trackImpressions();\n tracker.trackCreativeView();\n }\n\n function trackVolumeChange() {\n var muted = player.muted();\n if (muted) {\n tracker.trackMute();\n } else if (previouslyMuted) {\n tracker.trackUnmute();\n }\n previouslyMuted = muted;\n }\n};\n\nVASTIntegrator.prototype._addSkipButton = function addSkipButton(source, tracker, response, callback) {\n var skipOffsetInSec;\n var that = this;\n\n if (utilities.isNumber(response.skipoffset)) {\n skipOffsetInSec = response.skipoffset / 1000;\n addSkipButtonToPlayer(this.player, skipOffsetInSec);\n }\n callback(null, source, tracker, response);\n\n /*** Local function ***/\n function addSkipButtonToPlayer(player, skipOffset) {\n var skipButton = createSkipButton(player);\n var updateSkipButton = updateSkipButtonState.bind(that, skipButton, skipOffset, player);\n\n player.el().appendChild(skipButton);\n player.on('timeupdate', updateSkipButton);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeSkipButton);\n\n function removeSkipButton() {\n player.off('timeupdate', updateSkipButton);\n dom.remove(skipButton);\n }\n }\n\n function createSkipButton(player) {\n var skipButton = window.document.createElement(\"div\");\n dom.addClass(skipButton, \"vast-skip-button\");\n\n skipButton.onclick = function (e) {\n if (dom.hasClass(skipButton, 'enabled')) {\n tracker.trackSkip();\n player.trigger('vast.adSkip');\n }\n\n //We prevent event propagation to avoid problems with the clickThrough and so on\n if (window.Event.prototype.stopPropagation !== undefined) {\n e.stopPropagation();\n } else {\n return false;\n }\n };\n\n return skipButton;\n }\n\n function updateSkipButtonState(skipButton, skipOffset, player) {\n var timeLeft = Math.ceil(skipOffset - player.currentTime());\n if (timeLeft > 0) {\n skipButton.innerHTML = \"Skip in \" + utilities.toFixedDigits(timeLeft, 2) + \"...\";\n } else {\n if (!dom.hasClass(skipButton, 'enabled')) {\n dom.addClass(skipButton, 'enabled');\n skipButton.innerHTML = \"Skip ad\";\n }\n }\n }\n};\n\nVASTIntegrator.prototype._addClickThrough = function addClickThrough(mediaFile, tracker, response, callback) {\n var player = this.player;\n var blocker = createClickThroughBlocker(player, tracker, response);\n var updateBlocker = updateBlockerURL.bind(this, blocker, response, player);\n\n player.el().insertBefore(blocker, player.controlBar.el());\n player.on('timeupdate', updateBlocker);\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeBlocker);\n\n return callback(null, mediaFile, tracker, response);\n\n /*** Local Functions ***/\n\n function createClickThroughBlocker(player, tracker, response) {\n var blocker = window.document.createElement(\"a\");\n var clickThroughMacro = response.clickThrough;\n\n dom.addClass(blocker, 'vast-blocker');\n blocker.href = generateClickThroughURL(clickThroughMacro, player);\n\n if (utilities.isString(clickThroughMacro)) {\n blocker.target = \"_blank\";\n }\n\n blocker.onclick = function (e) {\n if (player.paused()) {\n player.play();\n\n //We prevent event propagation to avoid problems with the player's normal pause mechanism\n if (window.Event.prototype.stopPropagation !== undefined) {\n e.stopPropagation();\n }\n return false;\n }\n\n player.pause();\n tracker.trackClick();\n };\n\n return blocker;\n }\n\n function updateBlockerURL(blocker, response, player) {\n blocker.href = generateClickThroughURL(response.clickThrough, player);\n }\n\n function generateClickThroughURL(clickThroughMacro, player) {\n var variables = {\n ASSETURI: mediaFile.src,\n CONTENTPLAYHEAD: vastUtil.formatProgress(player.currentTime() * 1000)\n };\n\n return clickThroughMacro ? vastUtil.parseURLMacro(clickThroughMacro, variables) : '#';\n }\n\n function removeBlocker() {\n player.off('timeupdate', updateBlocker);\n dom.remove(blocker);\n }\n};\n\nVASTIntegrator.prototype._playSelectedAd = function playSelectedAd(source, response, callback) {\n var player = this.player;\n\n player.preload(\"auto\"); //without preload=auto the durationchange event is never fired\n player.src(source);\n\n playerUtils.once(player, ['durationchange', 'error', 'vast.adsCancel'], function (evt) {\n if (evt.type === 'durationchange') {\n playAd();\n } else if(evt.type === 'error') {\n callback(new VASTError(\"on VASTIntegrator, Player is unable to play the Ad\", 400), response);\n }\n //NOTE: If the ads get canceled we do nothing/\n });\n\n /**** local functions ******/\n function playAd() {\n\n playerUtils.once(player, ['playing', 'vast.adsCancel'], function (evt) {\n if(evt.type === 'vast.adsCancel'){\n return;\n }\n\n player.trigger('vast.adStart');\n\n player.on('ended', proceed);\n player.on('vast.adsCancel', proceed);\n player.on('vast.adSkip', proceed);\n\n function proceed(evt) {\n\n if(evt.type === 'ended' && (player.duration() - player.currentTime()) > 3 ) {\n // Ignore ended event if the Ad time was not 'near' the end\n // avoids issues where IOS controls could skip the Ad\n return;\n }\n\n player.off('ended', proceed);\n player.off('vast.adsCancel', proceed);\n player.off('vast.adSkip', proceed);\n\n //NOTE: if the ads get cancel we do nothing apart removing the listners\n if(evt.type === 'ended' || evt.type === 'vast.adSkip'){\n callback(null, response);\n }\n }\n });\n\n player.play();\n }\n};\n\nVASTIntegrator.prototype._trackError = function trackError(error, response) {\n vastUtil.track(response.errorURLMacros, {ERRORCODE: error.code || 900});\n};\n\nmodule.exports = VASTIntegrator;\n},{\"../../utils/async\":39,\"../../utils/dom\":40,\"../../utils/playerUtils\":42,\"../../utils/utilityFunctions\":44,\"./VASTError\":22,\"./VASTResponse\":24,\"./VASTTracker\":25,\"./vastUtil\":29}],24:[function(require,module,exports){\n'use strict';\n\nvar Ad = require('./Ad');\nvar VideoClicks = require('./VideoClicks');\nvar Linear = require('./Linear');\nvar InLine = require('./InLine');\nvar Wrapper = require('./Wrapper');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nwindow.InLine__A = InLine;\nfunction VASTResponse() {\n if (!(this instanceof VASTResponse)) {\n return new VASTResponse();\n }\n\n this._linearAdded = false;\n this.ads = [];\n this.errorURLMacros = [];\n this.impressions = [];\n this.clickTrackings = [];\n this.customClicks = [];\n this.trackingEvents = {};\n this.mediaFiles = [];\n this.clickThrough = undefined;\n this.adTitle = '';\n this.duration = undefined;\n this.skipoffset = undefined;\n}\n\nVASTResponse.prototype.addAd = function (ad) {\n var inLine, wrapper;\n if (ad instanceof Ad) {\n inLine = ad.inLine;\n wrapper = ad.wrapper;\n\n this.ads.push(ad);\n\n if (inLine) {\n this._addInLine(inLine);\n }\n\n if (wrapper) {\n this._addWrapper(wrapper);\n }\n }\n};\n\nVASTResponse.prototype._addErrorTrackUrl = function (error) {\n var errorURL = error instanceof xml.JXONTree ? xml.keyValue(error) : error;\n if (errorURL) {\n this.errorURLMacros.push(errorURL);\n }\n};\n\nVASTResponse.prototype._addImpressions = function (impressions) {\n utilities.isArray(impressions) && appendToArray(this.impressions, impressions);\n};\n\nVASTResponse.prototype._addClickThrough = function (clickThrough) {\n if (utilities.isNotEmptyString(clickThrough)) {\n this.clickThrough = clickThrough;\n }\n};\n\nVASTResponse.prototype._addClickTrackings = function (clickTrackings) {\n utilities.isArray(clickTrackings) && appendToArray(this.clickTrackings, clickTrackings);\n};\n\nVASTResponse.prototype._addCustomClicks = function (customClicks) {\n utilities.isArray(customClicks) && appendToArray(this.customClicks, customClicks);\n};\n\nVASTResponse.prototype._addTrackingEvents = function (trackingEvents) {\n var eventsMap = this.trackingEvents;\n\n if (trackingEvents) {\n trackingEvents = utilities.isArray(trackingEvents) ? trackingEvents : [trackingEvents];\n trackingEvents.forEach(function (trackingEvent) {\n if (!eventsMap[trackingEvent.name]) {\n eventsMap[trackingEvent.name] = [];\n }\n eventsMap[trackingEvent.name].push(trackingEvent);\n });\n }\n};\n\nVASTResponse.prototype._addTitle = function (title) {\n if (utilities.isNotEmptyString(title)) {\n this.adTitle = title;\n }\n};\n\nVASTResponse.prototype._addDuration = function (duration) {\n if (utilities.isNumber(duration)) {\n this.duration = duration;\n }\n};\n\nVASTResponse.prototype._addVideoClicks = function (videoClicks) {\n if (videoClicks instanceof VideoClicks) {\n this._addClickThrough(videoClicks.clickThrough);\n this._addClickTrackings(videoClicks.clickTrackings);\n this._addCustomClicks(videoClicks.customClicks);\n }\n};\n\nVASTResponse.prototype._addMediaFiles = function (mediaFiles) {\n utilities.isArray(mediaFiles) && appendToArray(this.mediaFiles, mediaFiles);\n};\n\nVASTResponse.prototype._addSkipoffset = function (offset) {\n if (offset) {\n this.skipoffset = offset;\n }\n};\n\nVASTResponse.prototype._addAdParameters = function (adParameters) {\n if (adParameters) {\n this.adParameters = adParameters;\n }\n};\n\nVASTResponse.prototype._addLinear = function (linear) {\n if (linear instanceof Linear) {\n this._addDuration(linear.duration);\n this._addTrackingEvents(linear.trackingEvents);\n this._addVideoClicks(linear.videoClicks);\n this._addMediaFiles(linear.mediaFiles);\n this._addSkipoffset(linear.skipoffset);\n this._addAdParameters(linear.adParameters);\n this._linearAdded = true;\n }\n};\n\nVASTResponse.prototype._addInLine = function (inLine) {\n var that = this;\n\n if (inLine instanceof InLine) {\n this._addTitle(inLine.adTitle);\n this._addErrorTrackUrl(inLine.error);\n this._addImpressions(inLine.impressions);\n\n inLine.creatives.forEach(function (creative) {\n if (creative.linear) {\n that._addLinear(creative.linear);\n }\n });\n }\n};\n\nVASTResponse.prototype._addWrapper = function (wrapper) {\n var that = this;\n\n if (wrapper instanceof Wrapper) {\n this._addErrorTrackUrl(wrapper.error);\n this._addImpressions(wrapper.impressions);\n\n wrapper.creatives.forEach(function (creative) {\n var linear = creative.linear;\n if (linear) {\n that._addVideoClicks(linear.videoClicks);\n that.clickThrough = undefined;//We ensure that no clickThrough has been added\n that._addTrackingEvents(linear.trackingEvents);\n }\n });\n }\n};\n\nVASTResponse.prototype.hasLinear = function(){\n return this._linearAdded;\n};\n\nfunction appendToArray(array, items) {\n items.forEach(function (item) {\n array.push(item);\n });\n}\n\nmodule.exports = VASTResponse;\n\n\n},{\"../../utils/utilityFunctions\":44,\"../../utils/xml\":45,\"./Ad\":14,\"./InLine\":17,\"./Linear\":18,\"./VideoClicks\":26,\"./Wrapper\":27}],25:[function(require,module,exports){\n'use strict';\n\nvar VASTError = require('./VASTError');\nvar VASTResponse = require('./VASTResponse');\nvar vastUtil = require('./vastUtil');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VASTTracker(assetURI, vastResponse) {\n if (!(this instanceof VASTTracker)) {\n return new VASTTracker(assetURI, vastResponse);\n }\n\n this.sanityCheck(assetURI, vastResponse);\n this.initialize(assetURI, vastResponse);\n\n}\n\nVASTTracker.prototype.initialize = function(assetURI, vastResponse) {\n this.response = vastResponse;\n this.assetURI = assetURI;\n this.progress = 0;\n this.quartiles = {\n firstQuartile: {tracked: false, time: Math.round(25 * vastResponse.duration) / 100},\n midpoint: {tracked: false, time: Math.round(50 * vastResponse.duration) / 100},\n thirdQuartile: {tracked: false, time: Math.round(75 * vastResponse.duration) / 100}\n };\n};\n\nVASTTracker.prototype.sanityCheck = function(assetURI, vastResponse) {\n if (!utilities.isString(assetURI) || utilities.isEmptyString(assetURI)) {\n throw new VASTError('on VASTTracker constructor, missing required the URI of the ad asset being played');\n }\n\n if (!(vastResponse instanceof VASTResponse)) {\n throw new VASTError('on VASTTracker constructor, missing required VAST response');\n }\n};\n\nVASTTracker.prototype.trackURLs = function trackURLs(urls, variables) {\n if (utilities.isArray(urls) && urls.length > 0) {\n variables = utilities.extend({\n ASSETURI: this.assetURI,\n CONTENTPLAYHEAD: vastUtil.formatProgress(this.progress)\n }, variables || {});\n\n vastUtil.track(urls, variables);\n }\n};\n\nVASTTracker.prototype.trackEvent = function trackEvent(eventName, trackOnce) {\n this.trackURLs(getEventUris(this.response.trackingEvents[eventName]));\n if (trackOnce) {\n this.response.trackingEvents[eventName] = undefined;\n }\n\n /*** Local function ***/\n function getEventUris(trackingEvents) {\n var uris;\n\n if (trackingEvents) {\n uris = [];\n trackingEvents.forEach(function (event) {\n uris.push(event.uri);\n });\n }\n return uris;\n }\n};\n\nVASTTracker.prototype.trackProgress = function trackProgress(newProgressInMs) {\n var that = this;\n var events = [];\n var ONCE = true;\n var ALWAYS = false;\n var trackingEvents = this.response.trackingEvents;\n\n if (utilities.isNumber(newProgressInMs)) {\n addTrackEvent('start', ONCE, newProgressInMs > 0);\n addTrackEvent('rewind', ALWAYS, hasRewound(this.progress, newProgressInMs));\n addQuartileEvents(newProgressInMs);\n trackProgressEvents(newProgressInMs);\n trackEvents();\n this.progress = newProgressInMs;\n }\n\n /*** Local function ***/\n function hasRewound(currentProgress, newProgress) {\n var REWIND_THRESHOLD = 3000; //IOS video clock is very unreliable and we need a 3 seconds threshold to ensure that there was a rewind an that it was on purpose.\n return currentProgress > newProgressInMs && Math.abs(newProgress - currentProgress) > REWIND_THRESHOLD;\n }\n\n function addTrackEvent(eventName, trackOnce, canBeAdded) {\n if (trackingEvents[eventName] && canBeAdded) {\n events.push({\n name: eventName,\n trackOnce: !!trackOnce\n });\n }\n }\n\n function addQuartileEvents(progress) {\n var quartiles = that.quartiles;\n var firstQuartile = that.quartiles.firstQuartile;\n var midpoint = that.quartiles.midpoint;\n var thirdQuartile = that.quartiles.thirdQuartile;\n\n if (!firstQuartile.tracked) {\n trackQuartile('firstQuartile', progress);\n } else if (!midpoint.tracked) {\n trackQuartile('midpoint', progress);\n } else if (!thirdQuartile.tracked){\n trackQuartile('thirdQuartile', progress);\n }\n\n /*** Local function ***/\n function trackQuartile(quartileName, progress){\n var quartile = quartiles[quartileName];\n if(canBeTracked(quartile, progress)){\n quartile.tracked = true;\n addTrackEvent(quartileName, ONCE, true);\n }\n }\n }\n\n function canBeTracked(quartile, progress) {\n var quartileTime = quartile.time;\n //We only fire the quartile event if the progress is bigger than the quartile time by 5 seconds at most.\n return progress >= quartileTime && progress <= (quartileTime + 5000);\n }\n\n function trackProgressEvents(progress) {\n if (!utilities.isArray(trackingEvents.progress)) {\n return; //Nothing to track\n }\n\n var pendingProgressEvts = [];\n\n trackingEvents.progress.forEach(function (evt) {\n if (evt.offset <= progress) {\n that.trackURLs([evt.uri]);\n } else {\n pendingProgressEvts.push(evt);\n }\n });\n trackingEvents.progress = pendingProgressEvts;\n }\n\n function trackEvents() {\n events.forEach(function (event) {\n that.trackEvent(event.name, event.trackOnce);\n });\n }\n};\n\n[\n 'rewind',\n 'fullscreen',\n 'exitFullscreen',\n 'pause',\n 'resume',\n 'mute',\n 'unmute',\n 'acceptInvitation',\n 'acceptInvitationLinear',\n 'collapse',\n 'expand'\n].forEach(function (eventName) {\n VASTTracker.prototype['track' + utilities.capitalize(eventName)] = function () {\n this.trackEvent(eventName);\n };\n });\n\n[\n 'start',\n 'skip',\n 'close',\n 'closeLinear'\n].forEach(function (eventName) {\n VASTTracker.prototype['track' + utilities.capitalize(eventName)] = function () {\n this.trackEvent(eventName, true);\n };\n });\n\n[\n 'firstQuartile',\n 'midpoint',\n 'thirdQuartile'\n].forEach(function (quartile) {\n VASTTracker.prototype['track' + utilities.capitalize(quartile)] = function () {\n this.quartiles[quartile].tracked = true;\n this.trackEvent(quartile, true);\n };\n });\n\nVASTTracker.prototype.trackComplete = function () {\n if(this.quartiles.thirdQuartile.tracked){\n this.trackEvent('complete', true);\n }\n};\n\nVASTTracker.prototype.trackErrorWithCode = function trackErrorWithCode(errorcode) {\n if (utilities.isNumber(errorcode)) {\n this.trackURLs(this.response.errorURLMacros, {ERRORCODE: errorcode});\n }\n};\n\nVASTTracker.prototype.trackImpressions = function trackImpressions() {\n this.trackURLs(this.response.impressions);\n};\n\nVASTTracker.prototype.trackCreativeView = function trackCreativeView() {\n this.trackEvent('creativeView');\n};\n\nVASTTracker.prototype.trackClick = function trackClick() {\n this.trackURLs(this.response.clickTrackings);\n};\n\nmodule.exports = VASTTracker;\n\n},{\"../../utils/utilityFunctions\":44,\"./VASTError\":22,\"./VASTResponse\":24,\"./vastUtil\":29}],26:[function(require,module,exports){\n'use strict';\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nfunction VideoClicks(videoClickJTree) {\n if (!(this instanceof VideoClicks)) {\n return new VideoClicks(videoClickJTree);\n }\n\n this.clickThrough = xml.keyValue(videoClickJTree.clickThrough);\n this.clickTrackings = parseClickTrackings(videoClickJTree.clickTracking);\n this.customClicks = parseClickTrackings(videoClickJTree.customClick);\n\n /*** Local functions ***/\n function parseClickTrackings(trackingData) {\n var clickTrackings = [];\n if (trackingData) {\n trackingData = utilities.isArray(trackingData) ? trackingData : [trackingData];\n trackingData.forEach(function (clickTrackingData) {\n clickTrackings.push(xml.keyValue(clickTrackingData));\n });\n }\n return clickTrackings;\n }\n}\n\nmodule.exports = VideoClicks;\n},{\"../../utils/utilityFunctions\":44,\"../../utils/xml\":45}],27:[function(require,module,exports){\n'use strict';\n\nvar vastUtil = require('./vastUtil');\nvar Creative = require('./Creative');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nfunction Wrapper(wrapperJTree) {\n if(!(this instanceof Wrapper)) {\n return new Wrapper(wrapperJTree);\n }\n\n //Required elements\n this.adSystem = xml.keyValue(wrapperJTree.adSystem);\n this.impressions = vastUtil.parseImpressions(wrapperJTree.impression);\n this.VASTAdTagURI = xml.keyValue(wrapperJTree.vASTAdTagURI);\n\n //Optional elements\n this.creatives = Creative.parseCreatives(wrapperJTree.creatives);\n this.error = xml.keyValue(wrapperJTree.error);\n this.extensions = wrapperJTree.extensions;\n\n //Optional attrs\n this.followAdditionalWrappers = utilities.isDefined(xml.attr(wrapperJTree, 'followAdditionalWrappers'))? xml.attr(wrapperJTree, 'followAdditionalWrappers'): true;\n this.allowMultipleAds = xml.attr(wrapperJTree, 'allowMultipleAds');\n this.fallbackOnNoAd = xml.attr(wrapperJTree, 'fallbackOnNoAd');\n}\n\nmodule.exports = Wrapper;\n\n},{\"../../utils/utilityFunctions\":44,\"../../utils/xml\":45,\"./Creative\":16,\"./vastUtil\":29}],28:[function(require,module,exports){\n'use strict';\n\nvar utilities = require('../../utils/utilityFunctions');\n\nvar durationRegex = /(\\d\\d):(\\d\\d):(\\d\\d)(\\.(\\d\\d\\d))?/;\n\nvar parsers = {\n\n duration: function parseDuration(durationStr) {\n\n var match, durationInMs;\n\n if (utilities.isString(durationStr)) {\n match = durationStr.match(durationRegex);\n if (match) {\n durationInMs = parseHoursToMs(match[1]) + parseMinToMs(match[2]) + parseSecToMs(match[3]) + parseInt(match[5] || 0);\n }\n }\n\n return isNaN(durationInMs) ? null : durationInMs;\n\n /*** local functions ***/\n function parseHoursToMs(hourStr) {\n return parseInt(hourStr, 10) * 60 * 60 * 1000;\n }\n\n function parseMinToMs(minStr) {\n return parseInt(minStr, 10) * 60 * 1000;\n }\n\n function parseSecToMs(secStr) {\n return parseInt(secStr, 10) * 1000;\n }\n },\n\n offset: function parseOffset(offset, duration) {\n if(isPercentage(offset)){\n return calculatePercentage(offset, duration);\n }\n return parsers.duration(offset);\n\n /*** Local function ***/\n function isPercentage(offset) {\n var percentageRegex = /^\\d+(\\.\\d+)?%$/g;\n return percentageRegex.test(offset);\n }\n\n function calculatePercentage(percentStr, duration) {\n if(duration) {\n return calcPercent(duration, parseFloat(percentStr.replace('%', '')));\n }\n return null;\n }\n\n function calcPercent(quantity, percent){\n return quantity * percent / 100;\n }\n }\n\n};\n\n\nmodule.exports = parsers;\n},{\"../../utils/utilityFunctions\":44}],29:[function(require,module,exports){\n'use strict';\n\nvar utilities = require('../../utils/utilityFunctions');\nvar VPAIDHTML5Tech = require('../vpaid/VPAIDHTML5Tech');\nvar VPAIDFlashTech = require('../vpaid/VPAIDFlashTech');\nvar VPAIDFLASHClient = require('VPAIDFLASHClient/js/VPAIDFLASHClient');\n\nvar vastUtil = {\n\n track: function track(URLMacros, variables) {\n var sources = vastUtil.parseURLMacros(URLMacros, variables);\n var trackImgs = [];\n sources.forEach(function (src) {\n var img = new Image();\n img.src = src;\n trackImgs.push(img);\n });\n return trackImgs;\n },\n\n parseURLMacros: function parseMacros(URLMacros, variables) {\n var parsedURLs = [];\n\n variables = variables || {};\n\n if (!(variables[\"CACHEBUSTING\"])) {\n variables[\"CACHEBUSTING\"] = Math.round(Math.random() * 1.0e+10);\n }\n\n URLMacros.forEach(function (URLMacro) {\n parsedURLs.push(vastUtil._parseURLMacro(URLMacro, variables));\n });\n\n return parsedURLs;\n },\n\n parseURLMacro: function parseMacro(URLMacro, variables) {\n variables = variables || {};\n\n if (!(variables[\"CACHEBUSTING\"])) {\n variables[\"CACHEBUSTING\"] = Math.round(Math.random() * 1.0e+10);\n }\n\n return vastUtil._parseURLMacro(URLMacro, variables);\n },\n\n _parseURLMacro: function parseMacro(URLMacro, variables) {\n variables = variables || {};\n\n utilities.forEach(variables, function (value, key) {\n URLMacro = URLMacro.replace(new RegExp(\"\\\\[\" + key + \"\\\\\\]\", 'gm'), value);\n });\n\n return URLMacro;\n },\n\n parseDuration: function parseDuration(durationStr) {\n var durationRegex = /(\\d\\d):(\\d\\d):(\\d\\d)(\\.(\\d\\d\\d))?/;\n var match, durationInMs;\n\n if (utilities.isString(durationStr)) {\n match = durationStr.match(durationRegex);\n if (match) {\n durationInMs = parseHoursToMs(match[1]) + parseMinToMs(match[2]) + parseSecToMs(match[3]) + parseInt(match[5] || 0);\n }\n }\n\n return isNaN(durationInMs) ? null : durationInMs;\n\n /*** local functions ***/\n function parseHoursToMs(hourStr) {\n return parseInt(hourStr, 10) * 60 * 60 * 1000;\n }\n\n function parseMinToMs(minStr) {\n return parseInt(minStr, 10) * 60 * 1000;\n }\n\n function parseSecToMs(secStr) {\n return parseInt(secStr, 10) * 1000;\n }\n },\n\n parseImpressions: function parseImpressions(impressions) {\n if (impressions) {\n impressions = utilities.isArray(impressions) ? impressions : [impressions];\n return utilities.transformArray(impressions, function (impression) {\n if (utilities.isNotEmptyString(impression.keyValue)) {\n return impression.keyValue;\n }\n return undefined;\n });\n }\n return [];\n },\n\n\n //We assume that the progress is going to arrive in milliseconds\n formatProgress: function formatProgress(progress) {\n var hours, minutes, seconds, milliseconds;\n hours = progress / (60 * 60 * 1000);\n hours = Math.floor(hours);\n minutes = (progress / (60 * 1000)) % 60;\n minutes = Math.floor(minutes);\n seconds = (progress / 1000) % 60;\n seconds = Math.floor(seconds);\n milliseconds = progress % 1000;\n return utilities.toFixedDigits(hours, 2) + ':' + utilities.toFixedDigits(minutes, 2) + ':' + utilities.toFixedDigits(seconds, 2) + '.' + utilities.toFixedDigits(milliseconds, 3);\n },\n\n parseOffset: function parseOffset(offset, duration) {\n if (isPercentage(offset)) {\n return calculatePercentage(offset, duration);\n }\n return vastUtil.parseDuration(offset);\n\n /*** Local function ***/\n function isPercentage(offset) {\n var percentageRegex = /^\\d+(\\.\\d+)?%$/g;\n return percentageRegex.test(offset);\n }\n\n function calculatePercentage(percentStr, duration) {\n if (duration) {\n return calcPercent(duration, parseFloat(percentStr.replace('%', '')));\n }\n return null;\n }\n\n function calcPercent(quantity, percent) {\n return quantity * percent / 100;\n }\n },\n\n\n //List of supported VPAID technologies\n VPAID_techs: [\n VPAIDFlashTech,\n VPAIDHTML5Tech\n ],\n\n isVPAID: function isVPAIDMediaFile(mediaFile) {\n return !!mediaFile && mediaFile.apiFramework === 'VPAID';\n },\n\n findSupportedVPAIDTech: function findSupportedVPAIDTech(mimeType) {\n var i, len, VPAIDTech;\n\n for (i = 0, len = this.VPAID_techs.length; i < len; i += 1) {\n VPAIDTech = this.VPAID_techs[i];\n if (VPAIDTech.supports(mimeType)) {\n return VPAIDTech;\n }\n }\n return null;\n },\n\n isFlashSupported: function isFlashSupported() {\n return VPAIDFLASHClient.isSupported();\n },\n\n /**\n * Necessary step for VPAIDFLAShClient to know if flash is supported and not blocked.\n * IMPORTANT NOTE: This is an async test and needs to be run as soon as possible.\n *\n * @param vpaidFlashLoaderPath the path to the vpaidFlashLoader swf obj.\n */\n runFlashSupportCheck: function runFlashSupportCheck(vpaidFlashLoaderPath) {\n VPAIDFLASHClient.runFlashTest({data: vpaidFlashLoaderPath});\n }\n\n};\n\nmodule.exports = vastUtil;\n\n},{\"../../utils/utilityFunctions\":44,\"../vpaid/VPAIDFlashTech\":31,\"../vpaid/VPAIDHTML5Tech\":32,\"VPAIDFLASHClient/js/VPAIDFLASHClient\":3}],30:[function(require,module,exports){\n'use strict';\n\nvar VASTError = require('../vast/VASTError');\n\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VPAIDAdUnitWrapper(vpaidAdUnit, opts) {\n if (!(this instanceof VPAIDAdUnitWrapper)) {\n return new VPAIDAdUnitWrapper(vpaidAdUnit, opts);\n }\n sanityCheck(vpaidAdUnit, opts);\n\n this.options = utilities.extend({}, opts);\n\n this._adUnit = vpaidAdUnit;\n\n /*** Local Functions ***/\n function sanityCheck(adUnit, opts) {\n if (!adUnit || !VPAIDAdUnitWrapper.checkVPAIDInterface(adUnit)) {\n throw new VASTError('on VPAIDAdUnitWrapper, the passed VPAID adUnit does not fully implement the VPAID interface');\n }\n\n if (!utilities.isObject(opts)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper, expected options hash but got '\" + opts + \"'\");\n }\n\n if (!(\"responseTimeout\" in opts) || !utilities.isNumber(opts.responseTimeout) ){\n throw new VASTError(\"on VPAIDAdUnitWrapper, expected responseTimeout in options\");\n }\n }\n}\n\nVPAIDAdUnitWrapper.checkVPAIDInterface = function checkVPAIDInterface(VPAIDAdUnit) {\n //NOTE: skipAd is not part of the method list because it only appears in VPAID 2.0 and we support VPAID 1.0\n var VPAIDInterfaceMethods = [\n 'handshakeVersion', 'initAd', 'startAd', 'stopAd', 'resizeAd', 'pauseAd', 'expandAd', 'collapseAd'\n ];\n\n for (var i = 0, len = VPAIDInterfaceMethods.length; i < len; i++) {\n if (!VPAIDAdUnit || !utilities.isFunction(VPAIDAdUnit[VPAIDInterfaceMethods[i]])) {\n return false;\n }\n }\n\n\n return canSubscribeToEvents(VPAIDAdUnit) && canUnsubscribeFromEvents(VPAIDAdUnit);\n\n /*** Local Functions ***/\n\n function canSubscribeToEvents(adUnit) {\n return utilities.isFunction(adUnit.subscribe) || utilities.isFunction(adUnit.addEventListener) || utilities.isFunction(adUnit.on);\n }\n\n function canUnsubscribeFromEvents(adUnit) {\n return utilities.isFunction(adUnit.unsubscribe) || utilities.isFunction(adUnit.removeEventListener) || utilities.isFunction(adUnit.off);\n\n }\n};\n\nVPAIDAdUnitWrapper.prototype.adUnitAsyncCall = function () {\n var args = utilities.arrayLikeObjToArray(arguments);\n var method = args.shift();\n var cb = args.pop();\n var timeoutId;\n\n sanityCheck(method, cb, this._adUnit);\n args.push(wrapCallback());\n\n this._adUnit[method].apply(this._adUnit, args);\n timeoutId = setTimeout(function () {\n timeoutId = null;\n cb(new VASTError(\"on VPAIDAdUnitWrapper, timeout while waiting for a response on call '\" + method + \"'\"));\n cb = utilities.noop;\n }, this.options.responseTimeout);\n\n /*** Local functions ***/\n function sanityCheck(method, cb, adUnit) {\n if (!utilities.isString(method) || !utilities.isFunction(adUnit[method])) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.adUnitAsyncCall, invalid method name\");\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.adUnitAsyncCall, missing callback\");\n }\n }\n\n function wrapCallback() {\n return function () {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n cb.apply(this, arguments);\n };\n }\n};\n\nVPAIDAdUnitWrapper.prototype.on = function (evtName, handler) {\n var addEventListener = this._adUnit.addEventListener || this._adUnit.subscribe || this._adUnit.on;\n addEventListener.call(this._adUnit, evtName, handler);\n};\n\nVPAIDAdUnitWrapper.prototype.off = function (evtName, handler) {\n var removeEventListener = this._adUnit.removeEventListener || this._adUnit.unsubscribe || this._adUnit.off;\n removeEventListener.call(this._adUnit, evtName, handler);\n};\n\nVPAIDAdUnitWrapper.prototype.waitForEvent = function (evtName, cb, context) {\n var timeoutId;\n sanityCheck(evtName, cb);\n context = context || null;\n\n this.on(evtName, responseListener);\n\n timeoutId = setTimeout(function () {\n cb(new VASTError(\"on VPAIDAdUnitWrapper.waitForEvent, timeout while waiting for event '\" + evtName + \"'\"));\n timeoutId = null;\n cb = utilities.noop;\n }, this.options.responseTimeout);\n\n /*** Local functions ***/\n function sanityCheck(evtName, cb) {\n if (!utilities.isString(evtName)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.waitForEvent, missing evt name\");\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.waitForEvent, missing callback\");\n }\n }\n\n function responseListener() {\n var args = utilities.arrayLikeObjToArray(arguments);\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n\n args.unshift(null);\n cb.apply(context, args);\n }\n};\n\n// VPAID METHODS\nVPAIDAdUnitWrapper.prototype.handshakeVersion = function (version, cb) {\n this.adUnitAsyncCall('handshakeVersion', version, cb);\n};\n\n/* jshint maxparams:6 */\nVPAIDAdUnitWrapper.prototype.initAd = function (width, height, viewMode, desiredBitrate, adUnitData, cb) {\n this.waitForEvent('AdLoaded', cb);\n this._adUnit.initAd(width, height, viewMode, desiredBitrate, adUnitData);\n};\n\nVPAIDAdUnitWrapper.prototype.resizeAd = function (width, height, viewMode, cb) {\n // NOTE: AdSizeChange event is only supported on VPAID 2.0 so for the moment we are not going to use it\n // and will assume that everything is fine after the async call\n this.adUnitAsyncCall('resizeAd', width, height, viewMode, cb);\n};\n\nVPAIDAdUnitWrapper.prototype.startAd = function (cb) {\n this.waitForEvent('AdStarted', cb);\n this._adUnit.startAd();\n};\n\nVPAIDAdUnitWrapper.prototype.stopAd = function (cb) {\n this.waitForEvent('AdStopped', cb);\n this._adUnit.stopAd();\n};\n\nVPAIDAdUnitWrapper.prototype.pauseAd = function (cb) {\n this.waitForEvent('AdPaused', cb);\n this._adUnit.pauseAd();\n};\n\nVPAIDAdUnitWrapper.prototype.resumeAd = function (cb) {\n this.waitForEvent('AdPlaying', cb);\n this._adUnit.resumeAd();\n};\n\nVPAIDAdUnitWrapper.prototype.expandAd = function (cb) {\n this.waitForEvent('AdExpandedChange', cb);\n this._adUnit.expandAd();\n};\n\nVPAIDAdUnitWrapper.prototype.collapseAd = function (cb) {\n this.waitForEvent('AdExpandedChange', cb);\n this._adUnit.collapseAd();\n};\n\nVPAIDAdUnitWrapper.prototype.skipAd = function (cb) {\n this.waitForEvent('AdSkipped', cb);\n this._adUnit.skipAd();\n};\n\n//VPAID property getters\n[\n 'adLinear',\n 'adWidth',\n 'adHeight',\n 'adExpanded',\n 'adSkippableState',\n 'adRemainingTime',\n 'adDuration',\n 'adVolume',\n 'adCompanions',\n 'adIcons'\n].forEach(function (property) {\n var getterName = 'get' + utilities.capitalize(property);\n\n VPAIDAdUnitWrapper.prototype[getterName] = function (cb) {\n this.adUnitAsyncCall(getterName, cb);\n };\n});\n\n//VPAID property setters\nVPAIDAdUnitWrapper.prototype.setAdVolume = function(volume, cb){\n this.adUnitAsyncCall('setAdVolume',volume, cb);\n};\n\nmodule.exports = VPAIDAdUnitWrapper;\n\n},{\"../../utils/utilityFunctions\":44,\"../vast/VASTError\":22}],31:[function(require,module,exports){\n'use strict';\n\nvar VASTError = require('../vast/VASTError');\n\nvar VPAIDFLASHClient = require('VPAIDFLASHClient/js/VPAIDFLASHClient');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar dom = require('../../utils/dom');\n\nfunction VPAIDFlashTech(mediaFile, settings) {\n if (!(this instanceof VPAIDFlashTech)) {\n return new VPAIDFlashTech(mediaFile);\n }\n sanityCheck(mediaFile);\n this.name = 'vpaid-flash';\n this.mediaFile = mediaFile;\n this.containerEl = null;\n this.vpaidFlashClient = null;\n this.settings = settings;\n\n /*** local functions ***/\n function sanityCheck(mediaFile) {\n if (!mediaFile || !utilities.isString(mediaFile.src)) {\n throw new VASTError('on VPAIDFlashTech, invalid MediaFile');\n }\n }\n}\n\nVPAIDFlashTech.VPAIDFLASHClient = VPAIDFLASHClient;\n\nVPAIDFlashTech.supports = function (type) {\n return type === 'application/x-shockwave-flash' && VPAIDFlashTech.VPAIDFLASHClient.isSupported();\n};\n\nVPAIDFlashTech.prototype.loadAdUnit = function loadFlashCreative(containerEl, objectEl, callback) {\n var that = this;\n var flashClientOpts = this.settings && this.settings.vpaidFlashLoaderPath ? {data: this.settings.vpaidFlashLoaderPath} : undefined;\n sanityCheck(containerEl, callback);\n\n this.containerEl = containerEl;\n this.vpaidFlashClient = new VPAIDFlashTech.VPAIDFLASHClient(containerEl, function (error) {\n if (error) {\n return callback(error);\n }\n\n that.vpaidFlashClient.loadAdUnit(that.mediaFile.src, callback);\n }, flashClientOpts);\n\n /*** Local Functions ***/\n function sanityCheck(container, cb) {\n\n if (!dom.isDomElement(container)) {\n throw new VASTError('on VPAIDFlashTech.loadAdUnit, invalid dom container element');\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError('on VPAIDFlashTech.loadAdUnit, missing valid callback');\n }\n }\n};\n\nVPAIDFlashTech.prototype.unloadAdUnit = function () {\n if (this.vpaidFlashClient) {\n try{\n this.vpaidFlashClient.destroy();\n } catch(e){\n if(console && utilities.isFunction(console.log)){\n console.log('VAST ERROR: trying to unload the VPAID adunit');\n }\n }\n this.vpaidFlashClient = null;\n }\n\n if (this.containerEl) {\n dom.remove(this.containerEl);\n this.containerEl = null;\n }\n};\n\nmodule.exports = VPAIDFlashTech;\n\n},{\"../../utils/dom\":40,\"../../utils/utilityFunctions\":44,\"../vast/VASTError\":22,\"VPAIDFLASHClient/js/VPAIDFLASHClient\":3}],32:[function(require,module,exports){\n'use strict';\n\nvar VASTError = require('../vast/VASTError');\n\nvar VPAIDHTML5Client = require('VPAIDHTML5Client/js/VPAIDHTML5Client');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar dom = require('../../utils/dom');\n\nfunction VPAIDHTML5Tech(mediaFile) {\n\n if(!(this instanceof VPAIDHTML5Tech)) {\n return new VPAIDHTML5Tech(mediaFile);\n }\n\n sanityCheck(mediaFile);\n\n this.name = 'vpaid-html5';\n this.containerEl = null;\n this.videoEl = null;\n this.vpaidHTMLClient = null;\n\n this.mediaFile = mediaFile;\n\n function sanityCheck(mediaFile) {\n if (!mediaFile || !utilities.isString(mediaFile.src)) {\n throw new VASTError(VPAIDHTML5Tech.INVALID_MEDIA_FILE);\n }\n }\n}\n\nVPAIDHTML5Tech.VPAIDHTML5Client = VPAIDHTML5Client;\n\nVPAIDHTML5Tech.supports = function (type) {\n return !utilities.isOldIE() && type === 'application/javascript';\n};\n\nVPAIDHTML5Tech.prototype.loadAdUnit = function loadAdUnit(containerEl, videoEl, callback) {\n sanityCheck(containerEl, videoEl, callback);\n\n this.containerEl = containerEl;\n this.videoEl = videoEl;\n this.vpaidHTMLClient = new VPAIDHTML5Tech.VPAIDHTML5Client(containerEl, videoEl, {});\n this.vpaidHTMLClient.loadAdUnit(this.mediaFile.src, callback);\n\n function sanityCheck(container, video, cb) {\n if (!dom.isDomElement(container)) {\n throw new VASTError(VPAIDHTML5Tech.INVALID_DOM_CONTAINER_EL);\n }\n\n if (!dom.isDomElement(video) || video.tagName.toLowerCase() !== 'video') {\n throw new VASTError(VPAIDHTML5Tech.INVALID_DOM_CONTAINER_EL);\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError(VPAIDHTML5Tech.MISSING_CALLBACK);\n }\n }\n};\n\nVPAIDHTML5Tech.prototype.unloadAdUnit = function unloadAdUnit() {\n if (this.vpaidHTMLClient) {\n try {\n this.vpaidHTMLClient.destroy();\n } catch(e) {\n if (console && utilities.isFunction(console.log)) {\n console.log('VAST ERROR: trying to unload the VPAID adunit');\n }\n }\n\n this.vpaidHTMLClient = null;\n }\n\n if (this.containerEl) {\n dom.remove(this.containerEl);\n this.containerEl = null;\n }\n};\n\nvar PREFIX = 'on VPAIDHTML5Tech';\nVPAIDHTML5Tech.INVALID_MEDIA_FILE = PREFIX + ', invalid MediaFile';\nVPAIDHTML5Tech.INVALID_DOM_CONTAINER_EL = PREFIX + ', invalid container HtmlElement';\nVPAIDHTML5Tech.INVALID_DOM_VIDEO_EL = PREFIX + ', invalid HTMLVideoElement';\nVPAIDHTML5Tech.MISSING_CALLBACK = PREFIX + ', missing valid callback';\n\nmodule.exports = VPAIDHTML5Tech;\n},{\"../../utils/dom\":40,\"../../utils/utilityFunctions\":44,\"../vast/VASTError\":22,\"VPAIDHTML5Client/js/VPAIDHTML5Client\":11}],33:[function(require,module,exports){\n'use strict';\n\nvar VASTError = require('../vast/VASTError');\nvar VASTResponse = require('../vast/VASTResponse');\nvar VASTTracker = require('../vast/VASTTracker');\nvar vastUtil = require('../vast/vastUtil');\n\nvar VPAIDAdUnitWrapper = require('./VPAIDAdUnitWrapper');\n\nvar async = require('../../utils/async');\nvar dom = require('../../utils/dom');\nvar playerUtils = require('../../utils/playerUtils');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VPAIDIntegrator(player, settings) {\n if (!(this instanceof VPAIDIntegrator)) {\n return new VPAIDIntegrator(player);\n }\n\n this.VIEW_MODE = {\n NORMAL: 'normal',\n FULLSCREEN: \"fullscreen\",\n THUMBNAIL: \"thumbnail\"\n };\n this.player = player;\n this.containerEl = createVPAIDContainerEl(player);\n this.options = {\n responseTimeout: 5000,\n VPAID_VERSION: '2.0'\n };\n this.settings = settings;\n\n /*** Local functions ***/\n\n function createVPAIDContainerEl() {\n var containerEl = document.createElement('div');\n dom.addClass(containerEl, 'VPAID-container');\n player.el().insertBefore(containerEl, player.controlBar.el());\n return containerEl;\n\n }\n}\n\nVPAIDIntegrator.prototype.playAd = function playVPaidAd(vastResponse, callback) {\n if (!(vastResponse instanceof VASTResponse)) {\n return callback(new VASTError('on VASTIntegrator.playAd, missing required VASTResponse'));\n }\n\n var that = this;\n var player = this.player;\n var tech = this._findSupportedTech(vastResponse, this.settings);\n\n callback = callback || utilities.noop;\n\n this._adUnit = null;\n\n dom.addClass(player.el(), 'vjs-vpaid-ad');\n\n player.on('vast.adsCancel', triggerVpaidAdEnd);\n player.one('vpaid.adEnd', function(){\n player.off('vast.adsCancel', triggerVpaidAdEnd);\n removeAdUnit();\n });\n\n if (tech) {\n async.waterfall([\n function (next) {\n next(null, tech, vastResponse);\n },\n this._loadAdUnit.bind(this),\n this._playAdUnit.bind(this),\n this._finishPlaying.bind(this)\n\n ], adComplete);\n\n this._adUnit = {\n _paused: true,\n type: 'VPAID',\n pauseAd: function() {\n player.trigger('vpaid.pauseAd');\n player.pause(true);//we make sure that the video content gets stopped.\n },\n resumeAd: function() {\n player.trigger('vpaid.resumeAd');\n },\n isPaused: function() {\n return this._paused;\n },\n getSrc: function() {\n return tech.mediaFile;\n }\n };\n\n } else {\n var error = new VASTError('on VPAIDIntegrator.playAd, could not find a supported mediaFile', 403);\n adComplete(error, this._adUnit, vastResponse);\n }\n\n return this._adUnit;\n\n /*** Local functions ***/\n function adComplete(error, adUnit, vastResponse) {\n if (error && vastResponse) {\n that._trackError(vastResponse, error.code);\n }\n player.trigger('vpaid.adEnd');\n callback(error, vastResponse);\n }\n\n function triggerVpaidAdEnd(){\n player.trigger('vpaid.adEnd');\n }\n\n function removeAdUnit() {\n if (tech) {\n tech.unloadAdUnit();\n }\n dom.removeClass(player.el(), 'vjs-vpaid-ad');\n }\n};\n\nVPAIDIntegrator.prototype._findSupportedTech = function (vastResponse, settings) {\n if (!(vastResponse instanceof VASTResponse)) {\n return null;\n }\n\n var vpaidMediaFiles = vastResponse.mediaFiles.filter(vastUtil.isVPAID);\n var i, len, mediaFile, VPAIDTech;\n\n for (i = 0, len = vpaidMediaFiles.length; i < len; i += 1) {\n mediaFile = vpaidMediaFiles[i];\n VPAIDTech = vastUtil.findSupportedVPAIDTech(mediaFile.type);\n if (VPAIDTech) {\n return new VPAIDTech(mediaFile, settings);\n }\n }\n return null;\n};\n\nVPAIDIntegrator.prototype._createVPAIDAdUnitWrapper = function(adUnit, src, responseTimeout) {\n return new VPAIDAdUnitWrapper(adUnit, {src: src, responseTimeout: responseTimeout});\n};\n\nVPAIDIntegrator.prototype._loadAdUnit = function (tech, vastResponse, next) {\n var that = this;\n var player = this.player;\n var vjsTechEl = player.el().querySelector('.vjs-tech');\n var responseTimeout = this.settings.responseTimeout || this.options.responseTimeout;\n tech.loadAdUnit(this.containerEl, vjsTechEl, function (error, adUnit) {\n if (error) {\n return next(error, adUnit, vastResponse);\n }\n\n try {\n var WrappedAdUnit = that._createVPAIDAdUnitWrapper(adUnit, tech.mediaFile.src, responseTimeout);\n var techClass = 'vjs-' + tech.name + '-ad';\n dom.addClass(player.el(), techClass);\n player.one('vpaid.adEnd', function() {\n dom.removeClass(player.el(),techClass);\n });\n next(null, WrappedAdUnit, vastResponse);\n } catch (e) {\n next(e, adUnit, vastResponse);\n }\n });\n};\n\nVPAIDIntegrator.prototype._playAdUnit = function (adUnit, vastResponse, callback) {\n async.waterfall([\n function (next) {\n next(null, adUnit, vastResponse);\n },\n this._handshake.bind(this),\n this._initAd.bind(this),\n this._setupEvents.bind(this),\n this._addSkipButton.bind(this),\n this._linkPlayerControls.bind(this),\n this._startAd.bind(this)\n ], callback);\n};\n\nVPAIDIntegrator.prototype._handshake = function handshake(adUnit, vastResponse, next) {\n adUnit.handshakeVersion(this.options.VPAID_VERSION, function (error, version) {\n if (error) {\n return next(error, adUnit, vastResponse);\n }\n\n if (version && isSupportedVersion(version)) {\n return next(null, adUnit, vastResponse);\n }\n\n return next(new VASTError('on VPAIDIntegrator._handshake, unsupported version \"' + version + '\"'), adUnit, vastResponse);\n });\n\n function isSupportedVersion(version) {\n var majorNum = major(version);\n return majorNum >= 1 && majorNum <= 2;\n }\n\n function major(version) {\n var parts = version.split('.');\n return parseInt(parts[0], 10);\n }\n};\n\nVPAIDIntegrator.prototype._initAd = function (adUnit, vastResponse, next) {\n var tech = this.player.el().querySelector('.vjs-tech');\n var dimension = dom.getDimension(tech);\n adUnit.initAd(dimension.width, dimension.height, this.VIEW_MODE.NORMAL, -1, {AdParameters: vastResponse.adParameters || ''}, function (error) {\n next(error, adUnit, vastResponse);\n });\n};\n\nVPAIDIntegrator.prototype._createVASTTracker = function(adUnitSrc, vastResponse) {\n return new VASTTracker(adUnitSrc, vastResponse);\n};\n\nVPAIDIntegrator.prototype._setupEvents = function (adUnit, vastResponse, next) {\n var adUnitSrc = adUnit.options.src;\n var tracker = this._createVASTTracker(adUnitSrc, vastResponse);\n var player = this.player;\n var that = this;\n\n adUnit.on('AdSkipped', function () {\n player.trigger('vpaid.AdSkipped');\n tracker.trackSkip();\n });\n\n adUnit.on('AdImpression', function () {\n player.trigger('vpaid.AdImpression');\n tracker.trackImpressions();\n });\n\n adUnit.on('AdStarted', function () {\n player.trigger('vpaid.AdStarted');\n tracker.trackCreativeView();\n notifyPlayToPlayer();\n });\n\n adUnit.on('AdVideoStart', function () {\n player.trigger('vpaid.AdVideoStart');\n tracker.trackStart();\n notifyPlayToPlayer();\n });\n\n adUnit.on('AdPlaying', function () {\n player.trigger('vpaid.AdPlaying');\n tracker.trackResume();\n notifyPlayToPlayer();\n });\n\n adUnit.on('AdPaused', function () {\n player.trigger('vpaid.AdPaused');\n tracker.trackPause();\n notifyPauseToPlayer();\n });\n\n function notifyPlayToPlayer(){\n if(that._adUnit && that._adUnit.isPaused()){\n that._adUnit._paused = false;\n }\n player.trigger('play');\n\n }\n\n function notifyPauseToPlayer() {\n if(that._adUnit){\n that._adUnit._paused = true;\n }\n player.trigger('pause');\n }\n\n adUnit.on('AdVideoFirstQuartile', function () {\n player.trigger('vpaid.AdVideoFirstQuartile');\n tracker.trackFirstQuartile();\n });\n\n adUnit.on('AdVideoMidpoint', function () {\n player.trigger('vpaid.AdVideoMidpoint');\n tracker.trackMidpoint();\n });\n\n adUnit.on('AdVideoThirdQuartile', function () {\n player.trigger('vpaid.AdVideoThirdQuartile');\n tracker.trackThirdQuartile();\n });\n\n adUnit.on('AdVideoComplete', function () {\n player.trigger('vpaid.AdVideoComplete');\n tracker.trackComplete();\n });\n\n adUnit.on('AdClickThru', function (data) {\n player.trigger('vpaid.AdClickThru');\n var url = data.url;\n var playerHandles = data.playerHandles;\n var clickThruUrl = utilities.isNotEmptyString(url) ? url : generateClickThroughURL(vastResponse.clickThrough);\n\n tracker.trackClick();\n if (playerHandles && clickThruUrl) {\n window.open(clickThruUrl, '_blank');\n }\n\n function generateClickThroughURL(clickThroughMacro) {\n var variables = {\n ASSETURI: adUnit.options.src,\n CONTENTPLAYHEAD: 0 //In VPAID there is no method to know the current time from the adUnit\n };\n\n return clickThroughMacro ? vastUtil.parseURLMacro(clickThroughMacro, variables) : null;\n }\n });\n\n adUnit.on('AdUserAcceptInvitation', function () {\n player.trigger('vpaid.AdUserAcceptInvitation');\n tracker.trackAcceptInvitation();\n tracker.trackAcceptInvitationLinear();\n });\n\n adUnit.on('AdUserClose', function () {\n player.trigger('vpaid.AdUserClose');\n tracker.trackClose();\n tracker.trackCloseLinear();\n });\n\n adUnit.on('AdUserMinimize', function () {\n player.trigger('vpaid.AdUserMinimize');\n tracker.trackCollapse();\n });\n\n adUnit.on('AdError', function () {\n player.trigger('vpaid.AdError');\n //NOTE: we track errors code 901, as noted in VAST 3.0\n tracker.trackErrorWithCode(901);\n });\n\n adUnit.on('AdVolumeChange', function () {\n player.trigger('vpaid.AdVolumeChange');\n var lastVolume = player.volume();\n adUnit.getAdVolume(function (error, currentVolume) {\n if (currentVolume === 0 && lastVolume > 0) {\n tracker.trackMute();\n }\n\n if (currentVolume > 0 && lastVolume === 0) {\n tracker.trackUnmute();\n }\n\n player.volume(currentVolume);\n });\n });\n\n var updateViewSize = resizeAd.bind(this, player, adUnit, this.VIEW_MODE);\n var updateViewSizeThrottled = utilities.throttle(updateViewSize, 100);\n var autoResize = this.settings.autoResize;\n\n if (autoResize) {\n dom.addEventListener(window, 'resize', updateViewSizeThrottled);\n dom.addEventListener(window, 'orientationchange', updateViewSizeThrottled);\n }\n\n player.on('vast.resize', updateViewSize);\n player.on('vpaid.pauseAd', pauseAdUnit);\n player.on('vpaid.resumeAd', resumeAdUnit);\n\n player.one('vpaid.adEnd', function () {\n player.off('vast.resize', updateViewSize);\n player.off('vpaid.pauseAd', pauseAdUnit);\n player.off('vpaid.resumeAd', resumeAdUnit);\n\n if (autoResize) {\n dom.removeEventListener(window, 'resize', updateViewSizeThrottled);\n dom.removeEventListener(window, 'orientationchange', updateViewSizeThrottled);\n }\n });\n\n next(null, adUnit, vastResponse);\n\n /*** Local Functions ***/\n function pauseAdUnit() {\n adUnit.pauseAd(utilities.noop);\n }\n\n function resumeAdUnit() {\n adUnit.resumeAd(utilities.noop);\n }\n};\n\nVPAIDIntegrator.prototype._addSkipButton = function (adUnit, vastResponse, next) {\n var skipButton;\n var player = this.player;\n\n adUnit.on('AdSkippableStateChange', updateSkipButtonState);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeSkipButton);\n\n next(null, adUnit, vastResponse);\n\n /*** Local function ***/\n function updateSkipButtonState() {\n player.trigger('vpaid.AdSkippableStateChange');\n adUnit.getAdSkippableState(function (error, isSkippable) {\n if (isSkippable) {\n if (!skipButton) {\n addSkipButton(player);\n }\n } else {\n removeSkipButton(player);\n }\n });\n }\n\n function addSkipButton(player) {\n skipButton = createSkipButton(player);\n player.el().appendChild(skipButton);\n }\n\n function removeSkipButton() {\n dom.remove(skipButton);\n skipButton = null;\n }\n\n function createSkipButton() {\n var skipButton = window.document.createElement(\"div\");\n dom.addClass(skipButton, \"vast-skip-button\");\n dom.addClass(skipButton, \"enabled\");\n skipButton.innerHTML = \"Skip ad\";\n\n skipButton.onclick = function (e) {\n adUnit.skipAd(utilities.noop);//We skip the adUnit\n\n //We prevent event propagation to avoid problems with the clickThrough and so on\n if (window.Event.prototype.stopPropagation !== undefined) {\n e.stopPropagation();\n } else {\n return false;\n }\n };\n\n return skipButton;\n }\n};\n\nVPAIDIntegrator.prototype._linkPlayerControls = function (adUnit, vastResponse, next) {\n var that = this;\n linkVolumeControl(this.player, adUnit);\n linkFullScreenControl(this.player, adUnit, this.VIEW_MODE);\n\n next(null, adUnit, vastResponse);\n\n /*** Local functions ***/\n function linkVolumeControl(player, adUnit) {\n player.on('volumechange', updateAdUnitVolume);\n adUnit.on('AdVolumeChange', updatePlayerVolume);\n\n player.one('vpaid.adEnd', function () {\n player.off('volumechange', updateAdUnitVolume);\n });\n\n\n /*** local functions ***/\n function updateAdUnitVolume() {\n var vol = player.muted() ? 0 : player.volume();\n adUnit.setAdVolume(vol, logError);\n }\n\n function updatePlayerVolume() {\n player.trigger('vpaid.AdVolumeChange');\n adUnit.getAdVolume(function (error, vol) {\n if (error) {\n logError(error);\n } else {\n player.volume(vol);\n }\n });\n }\n }\n\n function linkFullScreenControl(player, adUnit, VIEW_MODE) {\n var updateViewSize = resizeAd.bind(that, player, adUnit, VIEW_MODE);\n\n player.on('fullscreenchange', updateViewSize);\n\n player.one('vpaid.adEnd', function () {\n player.off('fullscreenchange', updateViewSize);\n });\n }\n};\n\nVPAIDIntegrator.prototype._startAd = function (adUnit, vastResponse, next) {\n var player = this.player;\n\n adUnit.startAd(function (error) {\n if (!error) {\n player.trigger('vast.adStart');\n }\n next(error, adUnit, vastResponse);\n });\n};\n\nVPAIDIntegrator.prototype._finishPlaying = function (adUnit, vastResponse, next) {\n var player = this.player;\n adUnit.on('AdStopped', function () {\n player.trigger('vpaid.AdStopped');\n finishPlayingAd(null);\n });\n\n adUnit.on('AdError', function (error) {\n var errMsg = error? error.message : 'on VPAIDIntegrator, error while waiting for the adUnit to finish playing';\n finishPlayingAd(new VASTError(errMsg));\n });\n\n /*** local functions ***/\n function finishPlayingAd(error) {\n next(error, adUnit, vastResponse);\n }\n};\n\nVPAIDIntegrator.prototype._trackError = function trackError(response, errorCode) {\n vastUtil.track(response.errorURLMacros, {ERRORCODE: errorCode || 901});\n};\n\nfunction resizeAd(player, adUnit, VIEW_MODE) {\n var tech = player.el().querySelector('.vjs-tech');\n var dimension = dom.getDimension(tech);\n var MODE = player.isFullscreen() ? VIEW_MODE.FULLSCREEN : VIEW_MODE.NORMAL;\n adUnit.resizeAd(dimension.width, dimension.height, MODE, logError);\n}\n\nfunction logError(error) {\n if (error && console && console.log) {\n console.log('ERROR: ' + error.message, error);\n }\n}\n\nmodule.exports = VPAIDIntegrator;\n},{\"../../utils/async\":39,\"../../utils/dom\":40,\"../../utils/playerUtils\":42,\"../../utils/utilityFunctions\":44,\"../vast/VASTError\":22,\"../vast/VASTResponse\":24,\"../vast/VASTTracker\":25,\"../vast/vastUtil\":29,\"./VPAIDAdUnitWrapper\":30}],34:[function(require,module,exports){\n'use strict';\n\nvar dom = require('../../utils/dom');\n\nvar element = document.createElement('div');\nelement.className = 'vjs-ads-label vjs-control vjs-label-hidden';\nelement.innerHTML = 'Advertisement';\n\nvar AdsLabelFactory = function(baseComponent) {\n return {\n /** @constructor */\n init: function init(player, options) {\n options.el = element;\n baseComponent.call(this, player, options);\n\n // We asynchronously reposition the ads label element\n setTimeout(function () {\n var currentTimeComp = player.controlBar &&( player.controlBar.getChild(\"timerControls\") || player.controlBar.getChild(\"currentTimeDisplay\") );\n if(currentTimeComp) {\n player.controlBar.el().insertBefore(element, currentTimeComp.el());\n }\n dom.removeClass(element, 'vjs-label-hidden');\n }, 0);\n },\n\n el: function getElement() {\n return element;\n }\n };\n};\n\nmodule.exports = AdsLabelFactory;\n},{\"../../utils/dom\":40}],35:[function(require,module,exports){\n'use strict';\n\nvar baseVideoJsComponent = videojs.getComponent('Component');\n\nvar AdsLabel = require('./ads-label')(baseVideoJsComponent);\n\nvideojs.registerComponent('AdsLabel', videojs.extend(baseVideoJsComponent, AdsLabel));\n\n},{\"./ads-label\":34}],36:[function(require,module,exports){\n'use strict';\n\n/**\n * The component that shows a black screen until the ads plugin has decided if it can or it can not play the ad.\n *\n * Note: In case you wonder why instead of this black poster we don't just show the spinner loader.\n * IOS devices do not work well with animations and the browser chrashes from time to time That is why we chose to\n * have a secondary black poster.\n *\n * It also makes it much more easier for the users of the plugin since it does not change the default behaviour of the\n * spinner and the player works the same way with and without the plugin.\n *\n * @param {vjs.Player|Object} player\n * @param {Object=} options\n * @constructor\n */\nvar element = document.createElement('div');\n\nvar BlackPosterFactory = function(baseComponent) {\n return {\n /** @constructor */\n init: function init(player, options) {\n options.el = element;\n element.className = 'vjs-black-poster';\n baseComponent.call(this, player, options);\n\n var posterImg = player.getChild('posterImage');\n\n //We need to do it asynchronously to be sure that the black poster el is on the dom.\n setTimeout(function() {\n if(posterImg && player && player.el()) {\n player.el().insertBefore(element, posterImg.el());\n }\n }, 0);\n },\n el: function getElement() {\n return element;\n }\n };\n};\n\nmodule.exports = BlackPosterFactory;\n},{}],37:[function(require,module,exports){\n'use strict';\n\nvar baseVideoJsComponent = videojs.getComponent('Component');\n\nvar BlackPoster = require('./black-poster')(baseVideoJsComponent);\n\nvideojs.registerComponent('BlackPoster', videojs.extend(baseVideoJsComponent, BlackPoster));\n\n},{\"./black-poster\":36}],38:[function(require,module,exports){\n'use strict';\n\nvar VASTClient = require('../ads/vast/VASTClient');\nvar VASTError = require('../ads/vast/VASTError');\nvar vastUtil = require('../ads/vast/vastUtil');\n\nvar VASTIntegrator = require('../ads/vast/VASTIntegrator');\nvar VPAIDIntegrator = require('../ads/vpaid/VPAIDIntegrator');\n\nvar async = require('../utils/async');\nvar dom = require('../utils/dom');\nvar playerUtils = require('../utils/playerUtils');\nvar utilities = require('../utils/utilityFunctions');\n\nmodule.exports = function VASTPlugin(options) {\n var snapshot;\n var player = this;\n var vast = new VASTClient();\n var adsCanceled = false;\n var defaultOpts = {\n // maximum amount of time in ms to wait to receive `adsready` from the ad\n // implementation after play has been requested. Ad implementations are\n // expected to load any dynamic libraries and make any requests to determine\n // ad policies for a video during this time.\n timeout: 500,\n\n //TODO:finish this IOS FIX\n //Whenever you play an add on IOS, the native player kicks in and we loose control of it. On very heavy pages the 'play' event\n // May occur after the video content has already started. This is wrong if you want to play a preroll ad that needs to happen before the user\n // starts watching the content. To prevent this usec\n iosPrerollCancelTimeout: 2000,\n\n // maximun amount of time for the ad to actually start playing. If this timeout gets\n // triggered the ads will be cancelled\n adCancelTimeout: 3000,\n\n // Boolean flag that configures the player to play a new ad before the user sees the video again\n // the current video\n playAdAlways: false,\n\n // Flag to enable or disable the ads by default.\n adsEnabled: true,\n\n // Boolean flag to enable or disable the resize with window.resize or orientationchange\n autoResize: true,\n\n // Path to the VPAID flash ad's loader\n vpaidFlashLoaderPath: '/VPAIDFlash.swf'\n };\n\n var settings = utilities.extend({}, defaultOpts, options || {});\n\n if(utilities.isUndefined(settings.adTagUrl) && utilities.isDefined(settings.url)){\n settings.adTagUrl = settings.url;\n }\n\n if (utilities.isString(settings.adTagUrl)) {\n settings.adTagUrl = utilities.echoFn(settings.adTagUrl);\n }\n\n if (utilities.isDefined(settings.adTagXML) && !utilities.isFunction(settings.adTagXML)) {\n return trackAdError(new VASTError('on VideoJS VAST plugin, the passed adTagXML option does not contain a function'));\n }\n\n if (!utilities.isDefined(settings.adTagUrl) && !utilities.isFunction(settings.adTagXML)) {\n return trackAdError(new VASTError('on VideoJS VAST plugin, missing adTagUrl on options object'));\n }\n\n vastUtil.runFlashSupportCheck(settings.vpaidFlashLoaderPath);// Necessary step for VPAIDFLASHClient to work.\n\n playerUtils.prepareForAds(player);\n\n if (settings.playAdAlways) {\n // No matter what happens we play a new ad before the user sees the video again.\n player.on('vast.contentEnd', function () {\n setTimeout(function () {\n player.trigger('vast.reset');\n }, 0);\n });\n }\n\n player.on('vast.firstPlay', tryToPlayPrerollAd);\n\n player.on('vast.reset', function () {\n //If we are reseting the plugin, we don't want to restore the content\n snapshot = null;\n cancelAds();\n });\n\n player.vast = {\n isEnabled: function () {\n return settings.adsEnabled;\n },\n\n enable: function () {\n settings.adsEnabled = true;\n },\n\n disable: function () {\n settings.adsEnabled = false;\n }\n };\n\n return player.vast;\n\n /**** Local functions ****/\n function tryToPlayPrerollAd() {\n //We remove the poster to prevent flickering whenever the content starts playing\n playerUtils.removeNativePoster(player);\n\n playerUtils.once(player, ['vast.adsCancel', 'vast.adEnd'], function () {\n removeAdUnit();\n restoreVideoContent();\n });\n\n async.waterfall([\n checkAdsEnabled,\n preparePlayerForAd,\n startAdCancelTimeout,\n playPrerollAd\n ], function (error, response) {\n if (error) {\n trackAdError(error, response);\n } else {\n player.trigger('vast.adEnd');\n }\n });\n\n /*** Local functions ***/\n\n function removeAdUnit() {\n if (player.vast && player.vast.adUnit) {\n player.vast.adUnit = null; //We remove the adUnit\n }\n }\n\n function restoreVideoContent() {\n setupContentEvents();\n if (snapshot) {\n playerUtils.restorePlayerSnapshot(player, snapshot);\n snapshot = null;\n }\n }\n\n function setupContentEvents() {\n playerUtils.once(player, ['playing', 'vast.reset', 'vast.firstPlay'], function (evt) {\n if (evt.type !== 'playing') {\n return;\n }\n\n player.trigger('vast.contentStart');\n\n playerUtils.once(player, ['ended', 'vast.reset', 'vast.firstPlay'], function (evt) {\n if (evt.type === 'ended') {\n player.trigger('vast.contentEnd');\n }\n });\n });\n }\n\n function checkAdsEnabled(next) {\n if (settings.adsEnabled) {\n return next(null);\n }\n next(new VASTError('Ads are not enabled'));\n }\n\n function preparePlayerForAd(next) {\n if (canPlayPrerollAd()) {\n snapshot = playerUtils.getPlayerSnapshot(player);\n player.pause();\n addSpinnerIcon();\n\n if(player.paused()) {\n next(null);\n } else {\n playerUtils.once(player, ['playing'], function() {\n player.pause();\n next(null);\n });\n }\n } else {\n next(new VASTError('video content has been playing before preroll ad'));\n }\n }\n\n function canPlayPrerollAd() {\n return !utilities.isIPhone() || player.currentTime() <= settings.iosPrerollCancelTimeout;\n }\n\n function startAdCancelTimeout(next) {\n var adCancelTimeoutId;\n adsCanceled = false;\n\n adCancelTimeoutId = setTimeout(function () {\n trackAdError(new VASTError('timeout while waiting for the video to start playing', 402));\n }, settings.adCancelTimeout);\n\n playerUtils.once(player, ['vast.adStart', 'vast.adsCancel'], clearAdCancelTimeout);\n\n /*** local functions ***/\n function clearAdCancelTimeout() {\n if (adCancelTimeoutId) {\n clearTimeout(adCancelTimeoutId);\n adCancelTimeoutId = null;\n }\n }\n\n next(null);\n }\n\n function addSpinnerIcon() {\n dom.addClass(player.el(), 'vjs-vast-ad-loading');\n playerUtils.once(player, ['vast.adStart', 'vast.adsCancel'], removeSpinnerIcon);\n }\n\n function removeSpinnerIcon() {\n //IMPORTANT NOTE: We remove the spinnerIcon asynchronously to give time to the browser to start the video.\n // If we remove it synchronously we see a flash of the content video before the ad starts playing.\n setTimeout(function () {\n dom.removeClass(player.el(), 'vjs-vast-ad-loading');\n }, 100);\n }\n\n }\n\n function cancelAds() {\n player.trigger('vast.adsCancel');\n adsCanceled = true;\n }\n\n function playPrerollAd(callback) {\n async.waterfall([\n getVastResponse,\n playAd\n ], callback);\n }\n\n function getVastResponse(callback) {\n vast.getVASTResponse(settings.adTagUrl ? settings.adTagUrl() : settings.adTagXML, callback);\n }\n\n function playAd(vastResponse, callback) {\n //TODO: Find a better way to stop the play. The 'playPrerollWaterfall' ends in an inconsistent situation\n //If the state is not 'preroll?' it means the ads were canceled therefore, we break the waterfall\n if (adsCanceled) {\n return;\n }\n\n var adIntegrator = isVPAID(vastResponse) ? new VPAIDIntegrator(player, settings) : new VASTIntegrator(player);\n var adFinished = false;\n\n playerUtils.once(player, ['vast.adStart', 'vast.adsCancel'], function (evt) {\n if (evt.type === 'vast.adStart') {\n addAdsLabel();\n }\n });\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeAdsLabel);\n\n if (utilities.isIDevice()) {\n preventManualProgress();\n }\n\n player.vast.vastResponse = vastResponse;\n player.vast.adUnit = adIntegrator.playAd(vastResponse, callback);\n\n /*** Local functions ****/\n function addAdsLabel() {\n if (adFinished || player.controlBar.getChild('AdsLabel')) {\n return;\n }\n\n player.controlBar.addChild('AdsLabel');\n }\n\n function removeAdsLabel() {\n player.controlBar.removeChild('AdsLabel');\n adFinished = true;\n }\n\n function preventManualProgress() {\n //IOS video clock is very unreliable and we need a 3 seconds threshold to ensure that the user forwarded/rewound the ad\n var PROGRESS_THRESHOLD = 3;\n var previousTime = 0;\n var skipad_attempts = 0;\n\n player.on('timeupdate', preventAdSeek);\n player.on('ended', preventAdSkip);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel', 'vast.adError'], stopPreventManualProgress);\n\n /*** Local functions ***/\n function preventAdSkip() {\n // Ignore ended event if the Ad time was not 'near' the end\n // and revert time to the previous 'valid' time\n if ((player.duration() - previousTime) > PROGRESS_THRESHOLD) {\n player.pause(true); // this reduce the video jitter if the IOS skip button is pressed\n player.play(true); // we need to trigger the play to put the video element back in a valid state\n player.currentTime(previousTime);\n }\n }\n\n function preventAdSeek() {\n var currentTime = player.currentTime();\n var progressDelta = Math.abs(currentTime - previousTime);\n if (progressDelta > PROGRESS_THRESHOLD) {\n skipad_attempts += 1;\n if (skipad_attempts >= 2) {\n player.pause(true);\n }\n player.currentTime(previousTime);\n } else {\n previousTime = currentTime;\n }\n }\n\n function stopPreventManualProgress() {\n player.off('timeupdate', preventAdSeek);\n player.off('ended', preventAdSkip);\n }\n }\n }\n\n function trackAdError(error, vastResponse) {\n player.trigger({type: 'vast.adError', error: error});\n cancelAds();\n if (console && console.log) {\n console.log('AD ERROR:', error.message, error, vastResponse);\n }\n }\n\n function isVPAID(vastResponse) {\n var i, len;\n var mediaFiles = vastResponse.mediaFiles;\n for (i = 0, len = mediaFiles.length; i < len; i++) {\n if (vastUtil.isVPAID(mediaFiles[i])) {\n return true;\n }\n }\n return false;\n }\n};\n\n},{\"../ads/vast/VASTClient\":21,\"../ads/vast/VASTError\":22,\"../ads/vast/VASTIntegrator\":23,\"../ads/vast/vastUtil\":29,\"../ads/vpaid/VPAIDIntegrator\":33,\"../utils/async\":39,\"../utils/dom\":40,\"../utils/playerUtils\":42,\"../utils/utilityFunctions\":44}],39:[function(require,module,exports){\n//Small subset of async\n\nvar utilities = require('./utilityFunctions');\n\nvar async = {};\n\nasync.setImmediate = function (fn) {\n setTimeout(fn, 0);\n};\n\nasync.iterator = function (tasks) {\n var makeCallback = function (index) {\n var fn = function () {\n if (tasks.length) {\n tasks[index].apply(null, arguments);\n }\n return fn.next();\n };\n fn.next = function () {\n return (index < tasks.length - 1) ? makeCallback(index + 1) : null;\n };\n return fn;\n };\n return makeCallback(0);\n};\n\n\nasync.waterfall = function (tasks, callback) {\n callback = callback || function () { };\n if (!utilities.isArray(tasks)) {\n var err = new Error('First argument to waterfall must be an array of functions');\n return callback(err);\n }\n if (!tasks.length) {\n return callback();\n }\n var wrapIterator = function (iterator) {\n return function (err) {\n if (err) {\n callback.apply(null, arguments);\n callback = function () {\n };\n }\n else {\n var args = Array.prototype.slice.call(arguments, 1);\n var next = iterator.next();\n if (next) {\n args.push(wrapIterator(next));\n }\n else {\n args.push(callback);\n }\n async.setImmediate(function () {\n iterator.apply(null, args);\n });\n }\n };\n };\n wrapIterator(async.iterator(tasks))();\n};\n\nasync.when = function (condition, callback) {\n if (!utilities.isFunction(callback)) {\n throw new Error(\"async.when error: missing callback argument\");\n }\n\n var isAllowed = utilities.isFunction(condition) ? condition : function () {\n return !!condition;\n };\n\n return function () {\n var args = utilities.arrayLikeObjToArray(arguments);\n var next = args.pop();\n\n if (isAllowed.apply(null, args)) {\n return callback.apply(this, arguments);\n }\n\n args.unshift(null);\n return next.apply(null, args);\n };\n};\n\nmodule.exports = async;\n\n\n},{\"./utilityFunctions\":44}],40:[function(require,module,exports){\n'use strict';\n\nvar utilities = require('./utilityFunctions');\n\nvar dom = {};\n\ndom.isVisible = function isVisible(el) {\n var style = window.getComputedStyle(el);\n return style.visibility !== 'hidden';\n};\n\ndom.isHidden = function isHidden(el) {\n var style = window.getComputedStyle(el);\n return style.display === 'none';\n};\n\ndom.isShown = function isShown(el) {\n return !dom.isHidden(el);\n};\n\ndom.hide = function hide(el) {\n el.__prev_style_display_ = el.style.display;\n el.style.display = 'none';\n};\n\ndom.show = function show(el) {\n if (dom.isHidden(el)) {\n el.style.display = el.__prev_style_display_;\n }\n el.__prev_style_display_ = undefined;\n};\n\ndom.hasClass = function hasClass(el, cssClass) {\n var classes, i, len;\n\n if (utilities.isNotEmptyString(cssClass)) {\n if (el.classList) {\n return el.classList.contains(cssClass);\n }\n\n classes = utilities.isString(el.getAttribute('class')) ? el.getAttribute('class').split(/\\s+/) : [];\n cssClass = (cssClass || '');\n\n for (i = 0, len = classes.length; i < len; i += 1) {\n if (classes[i] === cssClass) {\n return true;\n }\n }\n }\n return false;\n};\n\ndom.addClass = function (el, cssClass) {\n var classes;\n\n if (utilities.isNotEmptyString(cssClass)) {\n if (el.classList) {\n return el.classList.add(cssClass);\n }\n\n classes = utilities.isString(el.getAttribute('class')) ? el.getAttribute('class').split(/\\s+/) : [];\n if (utilities.isString(cssClass) && utilities.isNotEmptyString(cssClass.replace(/\\s+/, ''))) {\n classes.push(cssClass);\n el.setAttribute('class', classes.join(' '));\n }\n }\n};\n\ndom.removeClass = function (el, cssClass) {\n var classes;\n\n if (utilities.isNotEmptyString(cssClass)) {\n if (el.classList) {\n return el.classList.remove(cssClass);\n }\n\n classes = utilities.isString(el.getAttribute('class')) ? el.getAttribute('class').split(/\\s+/) : [];\n var newClasses = [];\n var i, len;\n if (utilities.isString(cssClass) && utilities.isNotEmptyString(cssClass.replace(/\\s+/, ''))) {\n\n for (i = 0, len = classes.length; i < len; i += 1) {\n if (cssClass !== classes[i]) {\n newClasses.push(classes[i]);\n }\n }\n el.setAttribute('class', newClasses.join(' '));\n }\n }\n};\n\ndom.addEventListener = function addEventListener(el, type, handler) {\n if(utilities.isArray(el)){\n utilities.forEach(el, function(e) {\n dom.addEventListener(e, type, handler);\n });\n return;\n }\n\n if(utilities.isArray(type)){\n utilities.forEach(type, function(t) {\n dom.addEventListener(el, t, handler);\n });\n return;\n }\n\n if (el.addEventListener) {\n el.addEventListener(type, handler, false);\n } else if (el.attachEvent) {\n // WARNING!!! this is a very naive implementation !\n // the event object that should be passed to the handler\n // would not be there for IE8\n // we should use \"window.event\" and then \"event.srcElement\"\n // instead of \"event.target\"\n el.attachEvent(\"on\" + type, handler);\n }\n};\n\ndom.removeEventListener = function removeEventListener(el, type, handler) {\n if(utilities.isArray(el)){\n utilities.forEach(el, function(e) {\n dom.removeEventListener(e, type, handler);\n });\n return;\n }\n\n if(utilities.isArray(type)){\n utilities.forEach(type, function(t) {\n dom.removeEventListener(el, t, handler);\n });\n return;\n }\n\n if (el.removeEventListener) {\n el.removeEventListener(type, handler, false);\n } else if (el.detachEvent) {\n el.detachEvent(\"on\" + type, handler);\n } else {\n el[\"on\" + type] = null;\n }\n};\n\ndom.dispatchEvent = function dispatchEvent(el, event) {\n if (el.dispatchEvent) {\n el.dispatchEvent(event);\n } else {\n el.fireEvent(\"on\" + event.eventType, event);\n }\n};\n\ndom.isDescendant = function isDescendant(parent, child) {\n var node = child.parentNode;\n while (node !== null) {\n if (node === parent) {\n return true;\n }\n node = node.parentNode;\n }\n return false;\n};\n\ndom.getTextContent = function getTextContent(el){\n return el.textContent || el.text;\n};\n\ndom.prependChild = function prependChild(parent, child) {\n if(child.parentNode){\n child.parentNode.removeChild(child);\n }\n return parent.insertBefore(child, parent.firstChild);\n};\n\ndom.remove = function removeNode(node){\n if(node && node.parentNode){\n node.parentNode.removeChild(node);\n }\n};\n\ndom.isDomElement = function isDomElement(o) {\n return o instanceof Element;\n};\n\ndom.click = function(el, handler) {\n dom.addEventListener(el, 'click', handler);\n};\n\ndom.once = function(el, type, handler) {\n function handlerWrap() {\n handler.apply(null, arguments);\n dom.removeEventListener(el, type, handlerWrap);\n }\n\n dom.addEventListener(el, type, handlerWrap);\n};\n\n//Note: there is no getBoundingClientRect on iPad so we need a fallback\ndom.getDimension = function getDimension(element) {\n var rect;\n\n //On IE9 and below getBoundingClientRect does not work consistently\n if(!utilities.isOldIE() && element.getBoundingClientRect) {\n rect = element.getBoundingClientRect();\n return {\n width: rect.width,\n height: rect.height\n };\n }\n\n return {\n width: element.offsetWidth,\n height: element.offsetHeight\n };\n};\n\nmodule.exports = dom;\n},{\"./utilityFunctions\":44}],41:[function(require,module,exports){\n'use strict';\n\nvar urlUtils = require('./urlUtils');\nvar utilities = require('./utilityFunctions');\n\nfunction HttpRequestError(message) {\n this.message = 'HttpRequest Error: ' + (message || '');\n}\nHttpRequestError.prototype = new Error();\nHttpRequestError.prototype.name = \"HttpRequest Error\";\n\nfunction HttpRequest(createXhr) {\n if (!utilities.isFunction(createXhr)) {\n throw new HttpRequestError('Missing XMLHttpRequest factory method');\n }\n\n this.createXhr = createXhr;\n}\n\nHttpRequest.prototype.run = function (method, url, callback, options) {\n sanityCheck(url, callback, options);\n var timeout, timeoutId;\n var xhr = this.createXhr();\n options = options || {};\n timeout = utilities.isNumber(options.timeout) ? options.timeout : 0;\n\n xhr.open(method, urlUtils.urlParts(url).href, true);\n\n if (options.headers) {\n setHeaders(xhr, options.headers);\n }\n\n if (options.withCredentials) {\n xhr.withCredentials = true;\n }\n\n xhr.onload = function () {\n var statusText, response, status;\n\n /**\n * The only way to do a secure request on IE8 and IE9 is with the XDomainRequest object. Unfortunately, microsoft is\n * so nice that decided that the status property and the 'getAllResponseHeaders' method where not needed so we have to\n * fake them. If the request gets done with an XDomainRequest instance, we will assume that there are no headers and\n * the status will always be 200. If you don't like it, DO NOT USE ANCIENT BROWSERS!!!\n *\n * For mor info go to: https://msdn.microsoft.com/en-us/library/cc288060(v=vs.85).aspx\n */\n if (!xhr.getAllResponseHeaders) {\n xhr.getAllResponseHeaders = function () {\n return null;\n };\n }\n\n if (!xhr.status) {\n xhr.status = 200;\n }\n\n if (utilities.isDefined(timeoutId)) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n\n statusText = xhr.statusText || '';\n\n // responseText is the old-school way of retrieving response (supported by IE8 & 9)\n // response/responseType properties were introduced in XHR Level2 spec (supported by IE10)\n response = ('response' in xhr) ? xhr.response : xhr.responseText;\n\n // normalize IE9 bug (http://bugs.jquery.com/ticket/1450)\n status = xhr.status === 1223 ? 204 : xhr.status;\n\n callback(\n status,\n response,\n xhr.getAllResponseHeaders(),\n statusText);\n };\n\n xhr.onerror = requestError;\n xhr.onabort = requestError;\n\n xhr.send();\n\n if (timeout > 0) {\n timeoutId = setTimeout(function () {\n xhr && xhr.abort();\n }, timeout);\n }\n\n function sanityCheck(url, callback, options) {\n if (!utilities.isString(url) || utilities.isEmptyString(url)) {\n throw new HttpRequestError(\"Invalid url '\" + url + \"'\");\n }\n\n if (!utilities.isFunction(callback)) {\n throw new HttpRequestError(\"Invalid handler '\" + callback + \"' for the http request\");\n }\n\n if (utilities.isDefined(options) && !utilities.isObject(options)) {\n throw new HttpRequestError(\"Invalid options map '\" + options + \"'\");\n }\n }\n\n function setHeaders(xhr, headers) {\n utilities.forEach(headers, function (value, key) {\n if (utilities.isDefined(value)) {\n xhr.setRequestHeader(key, value);\n }\n });\n }\n\n function requestError() {\n callback(-1, null, null, '');\n }\n};\n\nHttpRequest.prototype.get = function (url, callback, options) {\n this.run('GET', url, processResponse, options);\n\n function processResponse(status, response, headersString, statusText) {\n if (isSuccess(status)) {\n callback(null, response, status, headersString, statusText);\n } else {\n callback(new HttpRequestError(statusText), response, status, headersString, statusText);\n }\n }\n\n function isSuccess(status) {\n return 200 <= status && status < 300;\n }\n};\n\nfunction createXhr() {\n var xhr = new XMLHttpRequest();\n if (!(\"withCredentials\" in xhr)) {\n // XDomainRequest for IE.\n xhr = new XDomainRequest();\n }\n return xhr;\n}\n\nvar http = new HttpRequest(createXhr);\n\nmodule.exports = {\n http: http,\n HttpRequest: HttpRequest,\n HttpRequestError: HttpRequestError,\n createXhr: createXhr\n};\n\n},{\"./urlUtils\":43,\"./utilityFunctions\":44}],42:[function(require,module,exports){\n'use strict';\n\nvar dom = require('./dom');\nvar utilities = require('./utilityFunctions');\n\nvar playerUtils = {};\n\n/**\n * Returns an object that captures the portions of player state relevant to\n * video playback. The result of this function can be passed to\n * restorePlayerSnapshot with a player to return the player to the state it\n * was in when this function was invoked.\n * @param {object} player The videojs player object\n */\nplayerUtils.getPlayerSnapshot = function getPlayerSnapshot(player) {\n var tech = player.el().querySelector('.vjs-tech');\n\n var snapshot = {\n ended: player.ended(),\n src: player.currentSrc(),\n currentTime: player.currentTime(),\n type: player.currentType(),\n playing: !player.paused(),\n suppressedTracks: getSuppressedTracks(player)\n };\n\n if (tech) {\n snapshot.nativePoster = tech.poster;\n snapshot.style = tech.getAttribute('style');\n }\n return snapshot;\n\n /**** Local Functions ****/\n function getSuppressedTracks(player) {\n var tracks = player.remoteTextTracks ? player.remoteTextTracks() : [];\n\n if (tracks && utilities.isArray(tracks.tracks_)) {\n tracks = tracks.tracks_;\n }\n\n if (!utilities.isArray(tracks)) {\n tracks = [];\n }\n\n var suppressedTracks = [];\n tracks.forEach(function (track) {\n suppressedTracks.push({\n track: track,\n mode: track.mode\n });\n track.mode = 'disabled';\n });\n\n return suppressedTracks;\n }\n};\n\n/**\n * Attempts to modify the specified player so that its state is equivalent to\n * the state of the snapshot.\n * @param {object} snapshot - the player state to apply\n */\nplayerUtils.restorePlayerSnapshot = function restorePlayerSnapshot(player, snapshot) {\n var tech = player.el().querySelector('.vjs-tech');\n var attempts = 20; // the number of remaining attempts to restore the snapshot\n\n if (snapshot.nativePoster) {\n tech.poster = snapshot.nativePoster;\n }\n\n if ('style' in snapshot) {\n // overwrite all css style properties to restore state precisely\n tech.setAttribute('style', snapshot.style || '');\n }\n\n if (hasSrcChanged(player, snapshot)) {\n\n // on ios7, fiddling with textTracks too early will cause safari to crash\n player.one('contentloadedmetadata', restoreTracks);\n\n player.one('canplay', tryToResume);\n ensureCanplayEvtGetsFired();\n\n // if the src changed for ad playback, reset it\n player.src({src: snapshot.src, type: snapshot.type});\n\n // safari requires a call to `load` to pick up a changed source\n player.load();\n\n } else {\n restoreTracks();\n\n if (snapshot.playing) {\n player.play();\n }\n }\n\n /*** Local Functions ***/\n\n /**\n * Sometimes firefox does not trigger the 'canplay' evt.\n * This code ensure that it always gets triggered triggered.\n */\n function ensureCanplayEvtGetsFired() {\n var timeoutId = setTimeout(function() {\n player.trigger('canplay');\n }, 1000);\n\n player.one('canplay', function(){\n clearTimeout(timeoutId);\n });\n }\n\n /**\n * Determine whether the player needs to be restored to its state\n * before ad playback began. With a custom ad display or burned-in\n * ads, the content player state hasn't been modified and so no\n * restoration is required\n */\n function hasSrcChanged(player, snapshot) {\n if (player.src()) {\n return player.src() !== snapshot.src;\n }\n // the player was configured through source element children\n return player.currentSrc() !== snapshot.src;\n }\n\n function restoreTracks() {\n var suppressedTracks = snapshot.suppressedTracks;\n suppressedTracks.forEach(function (trackSnapshot) {\n trackSnapshot.track.mode = trackSnapshot.mode;\n });\n }\n\n /**\n * Determine if the video element has loaded enough of the snapshot source\n * to be ready to apply the rest of the state\n */\n function tryToResume() {\n\n // if some period of the video is seekable, resume playback\n // otherwise delay a bit and then check again unless we're out of attempts\n\n if (!playerUtils.isReadyToResume(player) && attempts--) {\n setTimeout(tryToResume, 50);\n } else {\n try {\n if(player.currentTime() !== snapshot.currentTime) {\n if (snapshot.playing) { // if needed restore playing status after seek completes\n player.one('seeked', function() {\n player.play();\n });\n }\n player.currentTime(snapshot.currentTime);\n\n } else if (snapshot.playing) {\n // if needed and no seek has been performed, restore playing status immediately\n player.play();\n }\n\n } catch (e) {\n videojs.log.warn('Failed to resume the content after an advertisement', e);\n }\n }\n }\n};\n\nplayerUtils.isReadyToResume = function (player) {\n\n if (player.readyState() > 1) {\n // some browsers and media aren't \"seekable\".\n // readyState greater than 1 allows for seeking without exceptions\n return true;\n }\n\n if (player.seekable() === undefined) {\n // if the player doesn't expose the seekable time ranges, try to\n // resume playback immediately\n return true;\n }\n\n if (player.seekable().length > 0) {\n // if some period of the video is seekable, resume playback\n return true;\n }\n\n return false;\n};\n\n/**\n * This function prepares the player to display ads.\n * Adding convenience events like the 'vast.firsPlay' that gets fired when the video is first played\n * and ads the blackPoster to the player to prevent content from being displayed before the preroll ad.\n *\n * @param player\n */\nplayerUtils.prepareForAds = function (player) {\n var blackPoster = player.addChild('blackPoster');\n var _firstPlay = true;\n var volumeSnapshot;\n\n\n monkeyPatchPlayerApi();\n\n player.on('play', tryToTriggerFirstPlay);\n player.on('vast.reset', resetFirstPlay);//Every time we change the sources we reset the first play.\n player.on('vast.firstPlay', restoreContentVolume);\n player.on('error', hideBlackPoster);//If there is an error in the player we remove the blackposter to show the err msg\n player.on('vast.adStart', hideBlackPoster);\n player.on('vast.adsCancel', hideBlackPoster);\n player.on('vast.adError', hideBlackPoster);\n player.on('vast.adStart', addStyles);\n player.on('vast.adEnd', removeStyles);\n player.on('vast.adsCancel', removeStyles);\n\n /*** Local Functions ***/\n\n /**\n What this function does is ugly and horrible and I should think twice before calling myself a good developer. With that said,\n it is the best solution I could find to mute the video until the 'play' event happens (on mobile devices) and the plugin can decide whether\n to play the ad or not.\n\n We also need this monkeypatch to be able to pause and resume an ad using the player's API\n\n If you have a better solution please do tell me.\n */\n function monkeyPatchPlayerApi() {\n\n /**\n * Monkey patch needed to handle firstPlay and resume of playing ad.\n *\n * @param callOrigPlay necessary flag to prevent infinite loop when you are restoring a VAST ad.\n * @returns {player}\n */\n var origPlay = player.play;\n player.play = function (callOrigPlay) {\n var that = this;\n\n if (isFirstPlay()) {\n firstPlay();\n } else {\n resume(callOrigPlay);\n }\n\n return this;\n\n /*** local functions ***/\n function firstPlay() {\n if (!utilities.isIPhone()) {\n volumeSnapshot = saveVolumeSnapshot();\n player.muted(true);\n }\n\n origPlay.apply(that, arguments);\n }\n\n function resume(callOrigPlay) {\n if (isAdPlaying() && !callOrigPlay) {\n player.vast.adUnit.resumeAd();\n } else {\n origPlay.apply(that, arguments);\n }\n }\n };\n\n\n /**\n * Needed monkey patch to handle pause of playing ad.\n *\n * @param callOrigPlay necessary flag to prevent infinite loop when you are pausing a VAST ad.\n * @returns {player}\n */\n var origPause = player.pause;\n player.pause = function (callOrigPause) {\n if (isAdPlaying() && !callOrigPause) {\n player.vast.adUnit.pauseAd();\n } else {\n origPause.apply(this, arguments);\n }\n return this;\n };\n\n\n /**\n * Needed monkey patch to handle paused state of the player when ads are playing.\n *\n * @param callOrigPlay necessary flag to prevent infinite loop when you are pausing a VAST ad.\n * @returns {player}\n */\n var origPaused = player.paused;\n player.paused = function (callOrigPaused) {\n if (isAdPlaying() && !callOrigPaused) {\n return player.vast.adUnit.isPaused();\n }\n return origPaused.apply(this, arguments);\n };\n }\n\n function isAdPlaying() {\n return player.vast && player.vast.adUnit;\n }\n\n function tryToTriggerFirstPlay() {\n if (isFirstPlay()) {\n _firstPlay = false;\n player.trigger('vast.firstPlay');\n }\n }\n\n function resetFirstPlay() {\n _firstPlay = true;\n blackPoster.show();\n restoreContentVolume();\n }\n\n function isFirstPlay() {\n return _firstPlay;\n }\n\n function saveVolumeSnapshot() {\n return {\n muted: player.muted(),\n volume: player.volume()\n };\n }\n\n function restoreContentVolume() {\n if (volumeSnapshot) {\n player.currentTime(0);\n restoreVolumeSnapshot(volumeSnapshot);\n volumeSnapshot = null;\n }\n }\n\n function restoreVolumeSnapshot(snapshot) {\n if (utilities.isObject(snapshot)) {\n player.volume(snapshot.volume);\n player.muted(snapshot.muted);\n }\n }\n\n function hideBlackPoster() {\n if (!dom.hasClass(blackPoster.el(), 'vjs-hidden')) {\n blackPoster.hide();\n }\n }\n\n function addStyles() {\n dom.addClass(player.el(), 'vjs-ad-playing');\n }\n\n function removeStyles() {\n dom.removeClass(player.el(), 'vjs-ad-playing');\n }\n};\n\n/**\n * Remove the poster attribute from the video element tech, if present. When\n * reusing a video element for multiple videos, the poster image will briefly\n * reappear while the new source loads. Removing the attribute ahead of time\n * prevents the poster from showing up between videos.\n * @param {object} player The videojs player object\n */\nplayerUtils.removeNativePoster = function (player) {\n var tech = player.el().querySelector('.vjs-tech');\n if (tech) {\n tech.removeAttribute('poster');\n }\n};\n\n/**\n * Helper function to listen to many events until one of them gets fired, then we\n * execute the handler and unsubscribe all the event listeners;\n *\n * @param player specific player from where to listen for the events\n * @param events array of events\n * @param handler function to execute once one of the events fires\n */\nplayerUtils.once = function once(player, events, handler) {\n function listener() {\n handler.apply(null, arguments);\n\n events.forEach(function (event) {\n player.off(event, listener);\n });\n }\n\n events.forEach(function (event) {\n player.on(event, listener);\n });\n};\n\n\nmodule.exports = playerUtils;\n},{\"./dom\":40,\"./utilityFunctions\":44}],43:[function(require,module,exports){\n'use strict';\n\nvar utilities = require('./utilityFunctions');\n\n/**\n *\n * IMPORTANT NOTE: This function comes from angularJs and was originally called urlResolve\n * you can take a look at the original code here https://github.com/angular/angular.js/blob/master/src/ng/urlUtils.js\n *\n * Implementation Notes for non-IE browsers\n * ----------------------------------------\n * Assigning a URL to the href property of an anchor DOM node, even one attached to the DOM,\n * results both in the normalizing and parsing of the URL. Normalizing means that a relative\n * URL will be resolved into an absolute URL in the context of the application document.\n * Parsing means that the anchor node's host, hostname, protocol, port, pathname and related\n * properties are all populated to reflect the normalized URL. This approach has wide\n * compatibility - Safari 1+, Mozilla 1+, Opera 7+,e etc. See\n * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html\n *\n * Implementation Notes for IE\n * ---------------------------\n * IE >= 8 and <= 10 normalizes the URL when assigned to the anchor node similar to the other\n * browsers. However, the parsed components will not be set if the URL assigned did not specify\n * them. (e.g. if you assign a.href = \"foo\", then a.protocol, a.host, etc. will be empty.) We\n * work around that by performing the parsing in a 2nd step by taking a previously normalized\n * URL (e.g. by assigning to a.href) and assigning it a.href again. This correctly populates the\n * properties such as protocol, hostname, port, etc.\n *\n * IE7 does not normalize the URL when assigned to an anchor node. (Apparently, it does, if one\n * uses the inner HTML approach to assign the URL as part of an HTML snippet -\n * http://stackoverflow.com/a/472729) However, setting img[src] does normalize the URL.\n * Unfortunately, setting img[src] to something like \"javascript:foo\" on IE throws an exception.\n * Since the primary usage for normalizing URLs is to sanitize such URLs, we can't use that\n * method and IE < 8 is unsupported.\n *\n * References:\n * http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement\n * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html\n * http://url.spec.whatwg.org/#urlutils\n * https://github.com/angular/angular.js/pull/2902\n * http://james.padolsey.com/javascript/parsing-urls-with-the-dom/\n *\n * @kind function\n * @param {string} url The URL to be parsed.\n * @description Normalizes and parses a URL.\n * @returns {object} Returns the normalized URL as a dictionary.\n *\n * | member name | Description |\n * |---------------|----------------|\n * | href | A normalized version of the provided URL if it was not an absolute URL |\n * | protocol | The protocol including the trailing colon |\n * | host | The host and port (if the port is non-default) of the normalizedUrl |\n * | search | The search params, minus the question mark |\n * | hash | The hash string, minus the hash symbol\n * | hostname | The hostname\n * | port | The port, without \":\"\n * | pathname | The pathname, beginning with \"/\"\n *\n */\n\nvar urlParsingNode = document.createElement(\"a\");\n/**\n * documentMode is an IE-only property\n * http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx\n */\nvar msie = document.documentMode;\n\nfunction urlParts(url) {\n var href = url;\n\n if (msie) {\n // Normalize before parse. Refer Implementation Notes on why this is\n // done in two steps on IE.\n urlParsingNode.setAttribute(\"href\", href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: utilities.isNotEmptyString(urlParsingNode.port)? urlParsingNode.port: 80,\n pathname: (urlParsingNode.pathname.charAt(0) === '/')\n ? urlParsingNode.pathname\n : '/' + urlParsingNode.pathname\n };\n}\n\n\n/**\n * This function accepts a query string (search part of a url) and returns a dictionary with\n * the different key value pairs\n * @param {string} qs queryString\n */\nfunction queryStringToObj(qs, cond) {\n var pairs, qsObj;\n\n cond = utilities.isFunction(cond)? cond : function() {\n return true;\n };\n\n qs = qs.trim().replace(/^\\?/, '');\n pairs = qs.split('&');\n qsObj = {};\n\n utilities.forEach(pairs, function (pair) {\n var keyValue, key, value;\n if (pair !== '') {\n keyValue = pair.split('=');\n key = keyValue[0];\n value = keyValue[1];\n if(cond(key, value)){\n qsObj[key] = value;\n }\n }\n });\n\n return qsObj;\n}\n\n/**\n * This function accepts an object and serializes it into a query string without the leading '?'\n * @param obj\n * @returns {string}\n */\nfunction objToQueryString(obj) {\n var pairs = [];\n utilities.forEach(obj, function (value, key) {\n pairs.push(key + '=' + value);\n });\n return pairs.join('&');\n}\n\nmodule.exports = {\n urlParts: urlParts,\n queryStringToObj: queryStringToObj,\n objToQueryString: objToQueryString\n};\n\n},{\"./utilityFunctions\":44}],44:[function(require,module,exports){\n/*jshint unused:false */\n\"use strict\";\n\nvar NODE_TYPE_ELEMENT = 1;\nvar SNAKE_CASE_REGEXP = /[A-Z]/g;\nvar EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i;\n/*jslint maxlen: 500 */\nvar ISO8086_REGEXP = /^([\\+-]?\\d{4}(?!\\d{2}\\b))((-?)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))?|W([0-4]\\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6])))([T\\s]((([01]\\d|2[0-3])((:?)[0-5]\\d)?|24\\:?00)([\\.,]\\d+(?!:))?)?(\\17[0-5]\\d([\\.,]\\d+)?)?([zZ]|([\\+-])([01]\\d|2[0-3]):?([0-5]\\d)?)?)?)?$/;\n\n\nfunction noop(){ }\n\nfunction isNull(o) {\n return o === null;\n}\n\nfunction isDefined(o){\n return o !== undefined;\n}\n\nfunction isUndefined(o){\n return o === undefined;\n}\n\nfunction isObject(obj) {\n return typeof obj === 'object';\n}\n\nfunction isFunction(str){\n return typeof str === 'function';\n}\n\nfunction isNumber(num){\n return typeof num === 'number';\n}\n\nfunction isWindow(obj) {\n return utilities.isObject(obj) && obj.window === obj;\n}\n\nfunction isArray(array){\n return Object.prototype.toString.call( array ) === '[object Array]';\n}\n\nfunction isArrayLike(obj) {\n if (obj === null || utilities.isWindow(obj) || utilities.isFunction(obj) || utilities.isUndefined(obj)) {\n return false;\n }\n\n var length = obj.length;\n\n if (obj.nodeType === NODE_TYPE_ELEMENT && length) {\n return true;\n }\n\n return utilities.isString(obj) || utilities.isArray(obj) || length === 0 ||\n typeof length === 'number' && length > 0 && (length - 1) in obj;\n}\n\nfunction isString(str){\n return typeof str === 'string';\n}\n\nfunction isEmptyString(str) {\n return utilities.isString(str) && str.length === 0;\n}\n\nfunction isNotEmptyString(str) {\n return utilities.isString(str) && str.length !== 0;\n}\n\nfunction arrayLikeObjToArray(args) {\n return Array.prototype.slice.call(args);\n}\n\nfunction forEach(obj, iterator, context) {\n var key, length;\n if (obj) {\n if (isFunction(obj)) {\n for (key in obj) {\n // Need to check if hasOwnProperty exists,\n // as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function\n if (key !== 'prototype' && key !== 'length' && key !== 'name' && (!obj.hasOwnProperty || obj.hasOwnProperty(key))) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n } else if (isArray(obj)) {\n var isPrimitive = typeof obj !== 'object';\n for (key = 0, length = obj.length; key < length; key++) {\n if (isPrimitive || key in obj) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n } else if (obj.forEach && obj.forEach !== forEach) {\n obj.forEach(iterator, context, obj);\n } else {\n for (key in obj) {\n if (obj.hasOwnProperty(key)) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n }\n }\n return obj;\n}\n\nfunction snake_case(name, separator) {\n separator = separator || '_';\n return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n}\n\nfunction isValidEmail(email){\n if(!utilities.isString(email)){\n return false;\n }\n\n return EMAIL_REGEXP.test(email.trim());\n}\n\nfunction extend (obj) {\n var arg, i, k;\n for (i = 1; i < arguments.length; i++) {\n arg = arguments[i];\n for (k in arg) {\n if (arg.hasOwnProperty(k)) {\n if(isObject(obj[k]) && !isNull(obj[k]) && isObject(arg[k])){\n obj[k] = extend({}, obj[k], arg[k]);\n }else {\n obj[k] = arg[k];\n }\n }\n }\n }\n return obj;\n}\n\nfunction capitalize(s){\n return s.charAt(0).toUpperCase() + s.slice(1);\n}\n\nfunction decapitalize(s) {\n return s.charAt(0).toLowerCase() + s.slice(1);\n}\n\n/**\n * This method works the same way array.prototype.map works but if the transformer returns undefine, then\n * it won't be added to the transformed Array.\n */\nfunction transformArray(array, transformer) {\n var transformedArray = [];\n\n array.forEach(function(item, index){\n var transformedItem = transformer(item, index);\n if(utilities.isDefined(transformedItem)) {\n transformedArray.push(transformedItem);\n }\n });\n\n return transformedArray;\n}\n\nfunction toFixedDigits(num, digits) {\n var formattedNum = num + '';\n digits = utilities.isNumber(digits) ? digits : 0;\n num = utilities.isNumber(num) ? num : parseInt(num, 10);\n if(utilities.isNumber(num) && !isNaN(num)){\n formattedNum = num + '';\n while(formattedNum.length < digits) {\n formattedNum = '0' + formattedNum;\n }\n return formattedNum;\n }\n return NaN + '';\n}\n\nfunction throttle(callback, delay) {\n var previousCall = new Date().getTime() - (delay + 1);\n return function() {\n var time = new Date().getTime();\n if ((time - previousCall) >= delay) {\n previousCall = time;\n callback.apply(this, arguments);\n }\n };\n}\n\nfunction debounce (callback, wait) {\n var timeoutId;\n\n return function (){\n if(timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(function(){\n callback.apply(this, arguments);\n timeoutId = undefined;\n }, wait);\n };\n}\n\n// a function designed to blow up the stack in a naive way\n// but it is ok for videoJs children components\nfunction treeSearch(root, getChildren, found){\n var children = getChildren(root);\n for (var i = 0; i < children.length; i++){\n if (found(children[i])) {\n return children[i];\n }\n else {\n var el = treeSearch(children[i], getChildren, found);\n if (el){\n return el;\n }\n }\n }\n}\n\nfunction echoFn(val) {\n return function () {\n return val;\n };\n}\n\n//Note: Supported formats come from http://www.w3.org/TR/NOTE-datetime\n// and the iso8601 regex comes from http://www.pelagodesign.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/\nfunction isISO8601(value) {\n if(utilities.isNumber(value)){\n value = value + ''; //we make sure that we are working with strings\n }\n\n if(!utilities.isString(value)){\n return false;\n }\n\n return ISO8086_REGEXP.test(value.trim());\n}\n\n/**\n * Checks if the Browser is IE9 and below\n * @returns {boolean}\n */\nfunction isOldIE() {\n var version = utilities.getInternetExplorerVersion(navigator);\n if (version === -1) {\n return false;\n }\n\n return version < 10;\n}\n\n/**\n * Returns the version of Internet Explorer or a -1 (indicating the use of another browser).\n * Source: https://msdn.microsoft.com/en-us/library/ms537509(v=vs.85).aspx\n * @returns {number} the version of Internet Explorer or a -1 (indicating the use of another browser).\n */\nfunction getInternetExplorerVersion(navigator) {\n var rv = -1;\n\n if (navigator.appName == 'Microsoft Internet Explorer') {\n var ua = navigator.userAgent;\n var re = new RegExp(\"MSIE ([0-9]{1,}[\\.0-9]{0,})\");\n var res = re.exec(ua);\n if (res !== null) {\n rv = parseFloat(res[1]);\n }\n }\n\n return rv;\n}\n\n/*** Mobile Utility functions ***/\nfunction isIDevice() {\n return /iP(hone|ad)/.test(utilities._UA);\n}\n\nfunction isMobile() {\n return /iP(hone|ad|od)|Android|Windows Phone/.test(utilities._UA);\n}\n\nfunction isIPhone() {\n return /iP(hone|od)/.test(utilities._UA);\n}\n\nfunction isAndroid() {\n return /Android/.test(utilities._UA);\n}\n\nvar utilities = {\n _UA: navigator.userAgent,\n noop: noop,\n isNull: isNull,\n isDefined: isDefined,\n isUndefined: isUndefined,\n isObject: isObject,\n isFunction: isFunction,\n isNumber: isNumber,\n isWindow: isWindow,\n isArray: isArray,\n isArrayLike: isArrayLike,\n isString: isString,\n isEmptyString: isEmptyString,\n isNotEmptyString: isNotEmptyString,\n arrayLikeObjToArray: arrayLikeObjToArray,\n forEach: forEach,\n snake_case: snake_case,\n isValidEmail: isValidEmail,\n extend: extend,\n capitalize: capitalize,\n decapitalize: decapitalize,\n transformArray: transformArray,\n toFixedDigits: toFixedDigits,\n throttle: throttle,\n debounce: debounce,\n treeSearch: treeSearch,\n echoFn: echoFn,\n isISO8601: isISO8601,\n isOldIE: isOldIE,\n getInternetExplorerVersion: getInternetExplorerVersion,\n isIDevice: isIDevice,\n isMobile: isMobile,\n isIPhone: isIPhone,\n isAndroid: isAndroid\n};\n\nmodule.exports = utilities;\n},{}],45:[function(require,module,exports){\n'use strict';\n\nvar utilities = require('./utilityFunctions');\n\nvar xml = {};\n\nxml.strToXMLDoc = function strToXMLDoc(stringContainingXMLSource){\n //IE 8\n if(typeof window.DOMParser === 'undefined'){\n var xmlDocument = new ActiveXObject('Microsoft.XMLDOM');\n xmlDocument.async = false;\n xmlDocument.loadXML(stringContainingXMLSource);\n return xmlDocument;\n }\n\n return parseString(stringContainingXMLSource);\n\n function parseString(stringContainingXMLSource){\n var parser = new DOMParser();\n var parsedDocument;\n\n //Note: This try catch is to deal with the fact that on IE parser.parseFromString does throw an error but the rest of the browsers don't.\n try {\n parsedDocument = parser.parseFromString(stringContainingXMLSource, \"application/xml\");\n\n if(isParseError(parsedDocument) || utilities.isEmptyString(stringContainingXMLSource)){\n throw new Error();\n }\n }catch(e){\n throw new Error(\"xml.strToXMLDOC: Error parsing the string: '\" + stringContainingXMLSource + \"'\");\n }\n\n return parsedDocument;\n }\n\n function isParseError(parsedDocument) {\n try { // parser and parsererrorNS could be cached on startup for efficiency\n var parser = new DOMParser(),\n erroneousParse = parser.parseFromString('INVALID', 'text/xml'),\n parsererrorNS = erroneousParse.getElementsByTagName(\"parsererror\")[0].namespaceURI;\n\n if (parsererrorNS === 'http://www.w3.org/1999/xhtml') {\n // In PhantomJS the parseerror element doesn't seem to have a special namespace, so we are just guessing here :(\n return parsedDocument.getElementsByTagName(\"parsererror\").length > 0;\n }\n\n return parsedDocument.getElementsByTagNameNS(parsererrorNS, 'parsererror').length > 0;\n } catch (e) {\n //Note on IE parseString throws an error by itself and it will never reach this code. Because it will have failed before\n }\n }\n};\n\nxml.parseText = function parseText (sValue) {\n if (/^\\s*$/.test(sValue)) { return null; }\n if (/^(?:true|false)$/i.test(sValue)) { return sValue.toLowerCase() === \"true\"; }\n if (isFinite(sValue)) { return parseFloat(sValue); }\n if (utilities.isISO8601(sValue)) { return new Date(sValue); }\n return sValue.trim();\n};\n\nxml.JXONTree = function JXONTree (oXMLParent) {\n var parseText = xml.parseText;\n\n //The document object is an especial object that it may miss some functions or attrs depending on the browser.\n //To prevent this problem with create the JXONTree using the root childNode which is a fully fleshed node on all supported\n //browsers.\n if(oXMLParent.documentElement){\n return new xml.JXONTree(oXMLParent.documentElement);\n }\n\n if (oXMLParent.hasChildNodes()) {\n var sCollectedTxt = \"\";\n for (var oNode, sProp, vContent, nItem = 0; nItem < oXMLParent.childNodes.length; nItem++) {\n oNode = oXMLParent.childNodes.item(nItem);\n /*jshint bitwise: false*/\n if ((oNode.nodeType - 1 | 1) === 3) { sCollectedTxt += oNode.nodeType === 3 ? oNode.nodeValue.trim() : oNode.nodeValue; }\n else if (oNode.nodeType === 1 && !oNode.prefix) {\n sProp = utilities.decapitalize(oNode.nodeName);\n vContent = new xml.JXONTree(oNode);\n if (this.hasOwnProperty(sProp)) {\n if (this[sProp].constructor !== Array) { this[sProp] = [this[sProp]]; }\n this[sProp].push(vContent);\n } else { this[sProp] = vContent; }\n }\n }\n if (sCollectedTxt) { this.keyValue = parseText(sCollectedTxt); }\n }\n\n //IE8 Stupid fix\n var hasAttr = typeof oXMLParent.hasAttributes === 'undefined'? oXMLParent.attributes.length > 0: oXMLParent.hasAttributes();\n if (hasAttr) {\n var oAttrib;\n for (var nAttrib = 0; nAttrib < oXMLParent.attributes.length; nAttrib++) {\n oAttrib = oXMLParent.attributes.item(nAttrib);\n this[\"@\" + utilities.decapitalize(oAttrib.name)] = parseText(oAttrib.value.trim());\n }\n }\n};\n\nxml.JXONTree.prototype.attr = function(attr) {\n return this['@' + utilities.decapitalize(attr)];\n};\n\nxml.toJXONTree = function toJXONTree(xmlString){\n var xmlDoc = xml.strToXMLDoc(xmlString);\n return new xml.JXONTree(xmlDoc);\n};\n\n/**\n * Helper function to extract the keyvalue of a JXONTree obj\n *\n * @param xmlObj {JXONTree}\n * return the key value or undefined;\n */\nxml.keyValue = function getKeyValue(xmlObj) {\n if(xmlObj){\n return xmlObj.keyValue;\n }\n return undefined;\n};\n\nxml.attr = function getAttrValue(xmlObj, attr) {\n if(xmlObj) {\n return xmlObj['@' + utilities.decapitalize(attr)];\n }\n return undefined;\n};\n\nxml.encode = function encodeXML(str) {\n return str.replace(/&/g, '&')\n .replace(//g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n};\n\nxml.decode = function decodeXML(str) {\n return str.replace(/'/g, \"'\")\n .replace(/"/g, '\"')\n .replace(/>/g, '>')\n .replace(/</g, '<')\n .replace(/&/g, '&');\n};\n\nmodule.exports = xml;\n},{\"./utilityFunctions\":44}],46:[function(require,module,exports){\n'use strict';\n\nrequire('./plugin/components/ads-label_5');\nrequire('./plugin/components/black-poster_5');\n\nvar videoJsVAST = require('./plugin/videojs.vast.vpaid');\n\nvideojs.plugin('vastClient', videoJsVAST);\n\n},{\"./plugin/components/ads-label_5\":35,\"./plugin/components/black-poster_5\":37,\"./plugin/videojs.vast.vpaid\":38}]},{},[46])\n\n","'use strict';\n\nlet IVPAIDAdUnit = require('./IVPAIDAdUnit').IVPAIDAdUnit;\nlet ALL_VPAID_METHODS = Object.getOwnPropertyNames(IVPAIDAdUnit.prototype).filter(function (property) {\n return ['constructor'].indexOf(property) === -1;\n});\n\nexport class VPAIDAdUnit extends IVPAIDAdUnit {\n constructor (flash) {\n super();\n this._destroyed = false;\n this._flash = flash;\n }\n\n _destroy() {\n this._destroyed = true;\n ALL_VPAID_METHODS.forEach((methodName) => {\n this._flash.removeCallbackByMethodName(methodName);\n });\n IVPAIDAdUnit.EVENTS.forEach((event) => {\n this._flash.offEvent(event);\n });\n\n this._flash = null;\n }\n\n isDestroyed () {\n return this._destroyed;\n }\n\n on(eventName, callback) {\n this._flash.on(eventName, callback);\n }\n\n off(eventName, callback) {\n this._flash.off(eventName, callback);\n }\n\n //VPAID interface\n handshakeVersion(playerVPAIDVersion = '2.0', callback = undefined) {\n this._flash.callFlashMethod('handshakeVersion', [playerVPAIDVersion], callback);\n }\n initAd (width, height, viewMode, desiredBitrate, creativeData = {AdParameters: ''}, environmentVars = {flashVars: ''}, callback = undefined) {\n //resize element that has the flash object\n this._flash.setSize(width, height);\n creativeData = creativeData || {AdParameters: ''};\n environmentVars = environmentVars || {flashVars: ''};\n\n this._flash.callFlashMethod('initAd', [this._flash.getWidth(), this._flash.getHeight(), viewMode, desiredBitrate, creativeData.AdParameters || '', environmentVars.flashVars || ''], callback);\n }\n resizeAd(width, height, viewMode, callback = undefined) {\n //resize element that has the flash object\n this._flash.setSize(width, height);\n\n //resize ad inside the flash\n this._flash.callFlashMethod('resizeAd', [this._flash.getWidth(), this._flash.getHeight(), viewMode], callback);\n }\n startAd(callback = undefined) {\n this._flash.callFlashMethod('startAd', [], callback);\n }\n stopAd(callback = undefined) {\n this._flash.callFlashMethod('stopAd', [], callback);\n }\n pauseAd(callback = undefined) {\n this._flash.callFlashMethod('pauseAd', [], callback);\n }\n resumeAd(callback = undefined) {\n this._flash.callFlashMethod('resumeAd', [], callback);\n }\n expandAd(callback = undefined) {\n this._flash.callFlashMethod('expandAd', [], callback);\n }\n collapseAd(callback = undefined) {\n this._flash.callFlashMethod('collapseAd', [], callback);\n }\n skipAd(callback = undefined) {\n this._flash.callFlashMethod('skipAd', [], callback);\n }\n\n //properties that will be treat as async methods\n getAdLinear(callback) {\n this._flash.callFlashMethod('getAdLinear', [], callback);\n }\n getAdWidth(callback) {\n this._flash.callFlashMethod('getAdWidth', [], callback);\n }\n getAdHeight(callback) {\n this._flash.callFlashMethod('getAdHeight', [], callback);\n }\n getAdExpanded(callback) {\n this._flash.callFlashMethod('getAdExpanded', [], callback);\n }\n getAdSkippableState(callback) {\n this._flash.callFlashMethod('getAdSkippableState', [], callback);\n }\n getAdRemainingTime(callback) {\n this._flash.callFlashMethod('getAdRemainingTime', [], callback);\n }\n getAdDuration(callback) {\n this._flash.callFlashMethod('getAdDuration', [], callback);\n }\n setAdVolume(volume, callback = undefined) {\n this._flash.callFlashMethod('setAdVolume', [volume], callback);\n }\n getAdVolume(callback) {\n this._flash.callFlashMethod('getAdVolume', [], callback);\n }\n getAdCompanions(callback) {\n this._flash.callFlashMethod('getAdCompanions', [], callback);\n }\n getAdIcons(callback) {\n this._flash.callFlashMethod('getAdIcons', [], callback);\n }\n}\n\n","'use strict';\n\nconst JSFlashBridge = require('./jsFlashBridge').JSFlashBridge;\nconst VPAIDAdUnit = require('./VPAIDAdUnit').VPAIDAdUnit;\n\nconst noop = require('./utils').noop;\nconst callbackTimeout = require('./utils').callbackTimeout;\nconst isPositiveInt = require('./utils').isPositiveInt;\nconst createElementWithID = require('./utils').createElementWithID;\nconst uniqueVPAID = require('./utils').unique('vpaid');\nconst createFlashTester = require('./flashTester.js').createFlashTester;\n\nconst ERROR = 'error';\nconst FLASH_VERSION = '10.1.0';\n\nlet flashTester = {isSupported: ()=> true}; // if the runFlashTest is not run the flashTester will always return true\n\nclass VPAIDFLASHClient {\n constructor (vpaidParentEl, callback, swfConfig = {data: 'VPAIDFlash.swf', width: 800, height: 400}, params = { wmode: 'transparent', salign: 'tl', align: 'left', allowScriptAccess: 'always', scale: 'noScale', allowFullScreen: 'true', quality: 'high'}, vpaidOptions = { debug: false, timeout: 10000 }) {\n\n if (!VPAIDFLASHClient.hasExternalDependencies()) {\n return onError('no swfobject in global scope. check: https://github.com/swfobject/swfobject or https://code.google.com/p/swfobject/');\n }\n\n this._vpaidParentEl = vpaidParentEl;\n this._flashID = uniqueVPAID();\n this._destroyed = false;\n callback = callback || noop;\n\n swfConfig.width = isPositiveInt(swfConfig.width, 800);\n swfConfig.height = isPositiveInt(swfConfig.height, 400);\n\n createElementWithID(vpaidParentEl, this._flashID, true);\n\n params.movie = swfConfig.data;\n params.FlashVars = `flashid=${this._flashID}&handler=${JSFlashBridge.VPAID_FLASH_HANDLER}&debug=${vpaidOptions.debug}&salign=${params.salign}`;\n\n if (!VPAIDFLASHClient.isSupported()) {\n return onError('user don\\'t support flash or doesn\\'t have the minimum required version of flash ' + FLASH_VERSION);\n }\n\n this.el = swfobject.createSWF(swfConfig, params, this._flashID);\n\n if (!this.el) {\n return onError( 'swfobject failed to create object in element' );\n }\n\n var handler = callbackTimeout(vpaidOptions.timeout,\n (err, data) => {\n $loadPendedAdUnit.call(this);\n callback(err, data);\n }, () => {\n callback('vpaid flash load timeout ' + vpaidOptions.timeout);\n }\n );\n\n this._flash = new JSFlashBridge(this.el, swfConfig.data, this._flashID, swfConfig.width, swfConfig.height, handler);\n\n function onError(error) {\n setTimeout(() => {\n callback(new Error(error));\n }, 0);\n return this;\n }\n\n }\n\n destroy () {\n this._destroyAdUnit();\n\n if (this._flash) {\n this._flash.destroy();\n this._flash = null;\n }\n this.el = null;\n this._destroyed = true;\n }\n\n isDestroyed () {\n return this._destroyed;\n }\n\n _destroyAdUnit() {\n delete this._loadLater;\n\n if (this._adUnitLoad) {\n this._adUnitLoad = null;\n this._flash.removeCallback(this._adUnitLoad);\n }\n\n if (this._adUnit) {\n this._adUnit._destroy();\n this._adUnit = null;\n }\n }\n\n loadAdUnit(adURL, callback) {\n $throwIfDestroyed.call(this);\n\n if (this._adUnit) {\n this._destroyAdUnit();\n }\n\n if (this._flash.isReady()) {\n this._adUnitLoad = (err, message) => {\n if (!err) {\n this._adUnit = new VPAIDAdUnit(this._flash);\n }\n this._adUnitLoad = null;\n callback(err, this._adUnit);\n };\n\n this._flash.callFlashMethod('loadAdUnit', [adURL], this._adUnitLoad);\n }else {\n this._loadLater = {url: adURL, callback};\n }\n }\n\n unloadAdUnit(callback = undefined) {\n $throwIfDestroyed.call(this);\n\n this._destroyAdUnit();\n this._flash.callFlashMethod('unloadAdUnit', [], callback);\n }\n getFlashID() {\n $throwIfDestroyed.call(this);\n return this._flash.getFlashID();\n }\n getFlashURL() {\n $throwIfDestroyed.call(this);\n return this._flash.getFlashURL();\n }\n}\n\nsetStaticProperty('isSupported', () => {\n return VPAIDFLASHClient.hasExternalDependencies() && swfobject.hasFlashPlayerVersion(FLASH_VERSION) && flashTester.isSupported();\n}, true);\n\nsetStaticProperty('hasExternalDependencies', () => {\n return !!window.swfobject;\n});\n\nsetStaticProperty('runFlashTest', (swfConfig) => {\n flashTester = createFlashTester(document.body, swfConfig);\n});\n\nfunction $throwIfDestroyed() {\n if(this._destroyed) {\n throw new Error('VPAIDFlashToJS is destroyed!');\n }\n}\n\nfunction $loadPendedAdUnit() {\n if (this._loadLater) {\n this.loadAdUnit(this._loadLater.url, this._loadLater.callback);\n delete this._loadLater;\n }\n}\n\nfunction setStaticProperty(propertyName, value, writable = false) {\n Object.defineProperty(VPAIDFLASHClient, propertyName, {\n writable: writable,\n configurable: false,\n value: value\n });\n}\n\nmodule.exports = VPAIDFLASHClient;\n","'use strict';\n\nconst FLASH_TEST = 'vpaid_video_flash_tester';\nconst FLASH_TEST_EL = 'vpaid_video_flash_tester_el';\nconst JSFlashBridge = require('./jsFlashBridge').JSFlashBridge;\nconst utils = require('./utils');\nconst MultipleValuesRegistry = require('./registry').MultipleValuesRegistry;\n\nclass FlashTester {\n constructor(parent, swfConfig = {data: 'VPAIDFlash.swf', width: 800, height: 400}) {\n this.parentEl = utils.createElementWithID(parent, FLASH_TEST_EL); // some browsers create global variables using the element id http://stackoverflow.com/questions/3434278/do-dom-tree-elements-with-ids-become-global-variables\n utils.hideFlashEl(this.parentEl);\n var params = {};\n params.movie = swfConfig.data;\n params.FlashVars = `flashid=${FLASH_TEST_EL}&handler=${JSFlashBridge.VPAID_FLASH_HANDLER}`;\n\n this.el = swfobject.createSWF(swfConfig, params, FLASH_TEST_EL);\n this._handlers = new MultipleValuesRegistry();\n this._isSupported = false;\n if (this.el) {\n utils.hideFlashEl(this.el);\n this._flash = new JSFlashBridge(this.el, swfConfig.data, FLASH_TEST_EL, 400, 400, ()=> {\n const support = true;\n this._isSupported = support;\n this._handlers.get('change').forEach((callback) => {\n setTimeout(()=> {\n callback('change', support);\n }, 0);\n });\n });\n }\n }\n isSupported() {\n return this._isSupported;\n }\n on(eventName, callback) {\n this._handlers.add(eventName, callback);\n }\n}\n\nexport var createFlashTester = function createFlashTester(el, swfConfig) {\n if (!window[FLASH_TEST]) {\n window[FLASH_TEST] = new FlashTester(el, swfConfig);\n }\n return window[FLASH_TEST];\n};\n","'use strict';\n\nlet unique = require('./utils').unique;\nlet isPositiveInt = require('./utils').isPositiveInt;\nlet stringEndsWith = require('./utils').stringEndsWith;\nlet SingleValueRegistry = require('./registry').SingleValueRegistry;\nlet MultipleValuesRegistry = require('./registry').MultipleValuesRegistry;\nconst registry = require('./jsFlashBridgeRegistry');\nconst VPAID_FLASH_HANDLER = 'vpaid_video_flash_handler';\nconst ERROR = 'AdError';\n\nexport class JSFlashBridge {\n constructor (el, flashURL, flashID, width, height, loadHandShake) {\n this._el = el;\n this._flashID = flashID;\n this._flashURL = flashURL;\n this._width = width;\n this._height = height;\n this._handlers = new MultipleValuesRegistry();\n this._callbacks = new SingleValueRegistry();\n this._uniqueMethodIdentifier = unique(this._flashID);\n this._ready = false;\n this._handShakeHandler = loadHandShake;\n\n registry.addInstance(this._flashID, this);\n }\n\n on(eventName, callback) {\n this._handlers.add(eventName, callback);\n }\n\n off(eventName, callback) {\n return this._handlers.remove(eventName, callback);\n }\n\n offEvent(eventName) {\n return this._handlers.removeByKey(eventName);\n }\n\n offAll() {\n return this._handlers.removeAll();\n }\n\n callFlashMethod(methodName, args = [], callback = undefined) {\n var callbackID = '';\n // if no callback, some methods the return is void so they don't need callback\n if (callback) {\n callbackID = `${this._uniqueMethodIdentifier()}_${methodName}`;\n this._callbacks.add(callbackID, callback);\n }\n\n\n try {\n //methods are created by ExternalInterface.addCallback in as3 code, if for some reason it failed\n //this code will throw an error\n this._el[methodName]([callbackID].concat(args));\n\n } catch (e) {\n if (callback) {\n $asyncCallback.call(this, callbackID, e);\n } else {\n\n //if there isn't any callback to return error use error event handler\n this._trigger(ERROR, e);\n }\n }\n }\n\n removeCallback(callback) {\n return this._callbacks.removeByValue(callback);\n }\n\n removeCallbackByMethodName(suffix) {\n this._callbacks.filterKeys((key) => {\n return stringEndsWith(key, suffix);\n }).forEach((key) => {\n this._callbacks.remove(key);\n });\n }\n\n removeAllCallbacks() {\n return this._callbacks.removeAll();\n }\n\n _trigger(eventName, event) {\n this._handlers.get(eventName).forEach((callback) => {\n //clickThru has to be sync, if not will be block by the popupblocker\n if (eventName === 'AdClickThru') {\n callback(event);\n } else {\n setTimeout(() => {\n if (this._handlers.get(eventName).length > 0) {\n callback(event);\n }\n }, 0);\n }\n });\n }\n\n _callCallback(methodName, callbackID, err, result) {\n\n let callback = this._callbacks.get(callbackID);\n\n //not all methods callback's are mandatory\n //but if there exist an error, fire the error event\n if (!callback) {\n if (err && callbackID === '') {\n this.trigger(ERROR, err);\n }\n return;\n }\n\n $asyncCallback.call(this, callbackID, err, result);\n\n }\n\n _handShake(err, data) {\n this._ready = true;\n if (this._handShakeHandler) {\n this._handShakeHandler(err, data);\n delete this._handShakeHandler;\n }\n }\n\n //methods like properties specific to this implementation of VPAID\n getSize() {\n return {width: this._width, height: this._height};\n }\n setSize(newWidth, newHeight) {\n this._width = isPositiveInt(newWidth, this._width);\n this._height = isPositiveInt(newHeight, this._height);\n this._el.setAttribute('width', this._width);\n this._el.setAttribute('height', this._height);\n }\n getWidth() {\n return this._width;\n }\n setWidth(newWidth) {\n this.setSize(newWidth, this._height);\n }\n getHeight() {\n return this._height;\n }\n setHeight(newHeight) {\n this.setSize(this._width, newHeight);\n }\n getFlashID() {\n return this._flashID;\n }\n getFlashURL() {\n return this._flashURL;\n }\n isReady() {\n return this._ready;\n }\n destroy() {\n this.offAll();\n this.removeAllCallbacks();\n registry.removeInstanceByID(this._flashID);\n if (this._el.parentElement) {\n this._el.parentElement.removeChild(this._el);\n }\n }\n}\n\nfunction $asyncCallback(callbackID, err, result) {\n setTimeout(() => {\n let callback = this._callbacks.get(callbackID);\n if (callback) {\n this._callbacks.remove(callbackID);\n callback(err, result);\n }\n }, 0);\n}\n\nObject.defineProperty(JSFlashBridge, 'VPAID_FLASH_HANDLER', {\n writable: false,\n configurable: false,\n value: VPAID_FLASH_HANDLER\n});\n\n/**\n * External interface handler\n *\n * @param {string} flashID identifier of the flash who call this\n * @param {string} typeID what type of message is, can be 'event' or 'callback'\n * @param {string} typeName if the typeID is a event the typeName will be the eventName, if is a callback the typeID is the methodName that is related this callback\n * @param {string} callbackID only applies when the typeID is 'callback', identifier of the callback to call\n * @param {object} error error object\n * @param {object} data\n */\nwindow[VPAID_FLASH_HANDLER] = (flashID, typeID, typeName, callbackID, error, data) => {\n let instance = registry.getInstanceByID(flashID);\n if (!instance) return;\n if (typeName === 'handShake') {\n instance._handShake(error, data);\n } else {\n if (typeID !== 'event') {\n instance._callCallback(typeName, callbackID, error, data);\n } else {\n instance._trigger(typeName, data);\n }\n }\n};\n\n","'use strict';\n\nlet SingleValueRegistry = require('./registry').SingleValueRegistry;\nlet instances = new SingleValueRegistry();\n\nconst JSFlashBridgeRegistry = {};\nObject.defineProperty(JSFlashBridgeRegistry, 'addInstance', {\n writable: false,\n configurable: false,\n value: function (id, instance) {\n instances.add(id, instance);\n }\n});\n\nObject.defineProperty(JSFlashBridgeRegistry, 'getInstanceByID', {\n writable: false,\n configurable: false,\n value: function (id) {\n return instances.get(id);\n }\n});\n\nObject.defineProperty(JSFlashBridgeRegistry, 'removeInstanceByID', {\n writable: false,\n configurable: false,\n value: function (id) {\n return instances.remove(id);\n }\n});\n\nmodule.exports = JSFlashBridgeRegistry;\n\n","'use strict';\n\nexport class MultipleValuesRegistry {\n constructor () {\n this._registries = {};\n }\n add (id, value) {\n if (!this._registries[id]) {\n this._registries[id] = [];\n }\n if (this._registries[id].indexOf(value) === -1) {\n this._registries[id].push(value);\n }\n }\n get (id) {\n return this._registries[id] || [];\n }\n filterKeys (handler) {\n return Object.keys(this._registries).filter(handler);\n }\n findByValue (value) {\n var keys = Object.keys(this._registries).filter((key) => {\n return this._registries[key].indexOf(value) !== -1;\n });\n\n return keys;\n }\n remove(key, value) {\n if (!this._registries[key]) { return; }\n\n var index = this._registries[key].indexOf(value);\n\n if (index < 0) { return; }\n return this._registries[key].splice(index, 1);\n }\n removeByKey (id) {\n let old = this._registries[id];\n delete this._registries[id];\n return old;\n }\n removeByValue (value) {\n let keys = this.findByValue(value);\n return keys.map((key) => {\n return this.remove(key, value);\n });\n }\n removeAll() {\n let old = this._registries;\n this._registries = {};\n return old;\n }\n size() {\n return Object.keys(this._registries).length;\n }\n}\n\nexport class SingleValueRegistry {\n constructor () {\n this._registries = {};\n }\n add (id, value) {\n this._registries[id] = value;\n }\n get (id) {\n return this._registries[id];\n }\n filterKeys (handler) {\n return Object.keys(this._registries).filter(handler);\n }\n findByValue (value) {\n var keys = Object.keys(this._registries).filter((key) => {\n return this._registries[key] === value;\n });\n\n return keys;\n }\n remove (id) {\n let old = this._registries[id];\n delete this._registries[id];\n return old;\n }\n removeByValue (value) {\n let keys = this.findByValue(value);\n return keys.map((key) => {\n return this.remove(key);\n });\n }\n removeAll() {\n let old = this._registries;\n this._registries = {};\n return old;\n }\n size() {\n return Object.keys(this._registries).length;\n }\n}\n\n","'use strict';\n\nexport function unique(prefix) {\n let count = -1;\n return f => {\n return `${prefix}_${++count}`;\n };\n}\n\nexport function noop() {\n}\n\n\nexport function callbackTimeout(timer, onSuccess, onTimeout) {\n\n let timeout = setTimeout(() => {\n\n onSuccess = noop;\n onTimeout();\n\n }, timer);\n\n return function () {\n clearTimeout(timeout);\n onSuccess.apply(this, arguments);\n };\n}\n\n\nexport function createElementWithID(parent, id, cleanContent = false) {\n var nEl = document.createElement('div');\n nEl.id = id;\n if (cleanContent) {\n parent.innerHTML = '';\n }\n parent.appendChild(nEl);\n return nEl;\n}\n\nexport function isPositiveInt(newVal, oldVal) {\n return !isNaN(parseFloat(newVal)) && isFinite(newVal) && newVal > 0 ? newVal : oldVal;\n}\n\nlet endsWith = (function () {\n if (String.prototype.endsWith) return String.prototype.endsWith;\n return function endsWith (searchString, position) {\n var subjectString = this.toString();\n if (position === undefined || position > subjectString.length) {\n position = subjectString.length;\n }\n position -= searchString.length;\n var lastIndex = subjectString.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n };\n})();\n\nexport function stringEndsWith(string, search) {\n return endsWith.call(string, search);\n}\n\nexport function hideFlashEl(el) {\n // can't use display none because will not run the flash\n el.style.position = 'absolute';\n el.style.left = '-1px';\n el.style.top = '-1px';\n el.style.width = '1px';\n el.style.height = '1px';\n el.style.visibility = 'hidden';\n}\n","'use strict';\n\nvar METHODS = [\n 'handshakeVersion',\n 'initAd',\n 'startAd',\n 'stopAd',\n 'skipAd', // VPAID 2.0 new method\n 'resizeAd',\n 'pauseAd',\n 'resumeAd',\n 'expandAd',\n 'collapseAd',\n 'subscribe',\n 'unsubscribe'\n];\n\nvar EVENTS = [\n 'AdLoaded',\n 'AdStarted',\n 'AdStopped',\n 'AdSkipped',\n 'AdSkippableStateChange', // VPAID 2.0 new event\n 'AdSizeChange', // VPAID 2.0 new event\n 'AdLinearChange',\n 'AdDurationChange', // VPAID 2.0 new event\n 'AdExpandedChange',\n 'AdRemainingTimeChange', // [Deprecated in 2.0] but will be still fired for backwards compatibility\n 'AdVolumeChange',\n 'AdImpression',\n 'AdVideoStart',\n 'AdVideoFirstQuartile',\n 'AdVideoMidpoint',\n 'AdVideoThirdQuartile',\n 'AdVideoComplete',\n 'AdClickThru',\n 'AdInteraction', // VPAID 2.0 new event\n 'AdUserAcceptInvitation',\n 'AdUserMinimize',\n 'AdUserClose',\n 'AdPaused',\n 'AdPlaying',\n 'AdLog',\n 'AdError'\n];\n\nvar GETTERS = [\n 'getAdLinear',\n 'getAdWidth', // VPAID 2.0 new getter\n 'getAdHeight', // VPAID 2.0 new getter\n 'getAdExpanded',\n 'getAdSkippableState', // VPAID 2.0 new getter\n 'getAdRemainingTime',\n 'getAdDuration', // VPAID 2.0 new getter\n 'getAdVolume',\n 'getAdCompanions', // VPAID 2.0 new getter\n 'getAdIcons' // VPAID 2.0 new getter\n];\n\nvar SETTERS = [\n 'setAdVolume'\n];\n\n\n/**\n * This callback is displayed as global member. The callback use nodejs error-first callback style\n * @callback NodeStyleCallback\n * @param {string|null}\n * @param {undefined|object}\n */\n\n\n/**\n * IVPAIDAdUnit\n *\n * @class\n *\n * @param {object} creative\n * @param {HTMLElement} el\n * @param {HTMLVideoElement} video\n */\nfunction IVPAIDAdUnit(creative, el, video) {}\n\n\n/**\n * handshakeVersion\n *\n * @param {string} VPAIDVersion\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.handshakeVersion = function (VPAIDVersion, callback) {};\n\n/**\n * initAd\n *\n * @param {number} width\n * @param {number} height\n * @param {string} viewMode can be 'normal', 'thumbnail' or 'fullscreen'\n * @param {number} desiredBitrate indicates the desired bitrate in kbps\n * @param {object} [creativeData] used for additional initialization data\n * @param {object} [environmentVars] used for passing implementation-specific of js version\n * @param {NodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.initAd = function(width, height, viewMode, desiredBitrate, creativeData, environmentVars, callback) {};\n\n/**\n * startAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.startAd = function(callback) {};\n\n/**\n * stopAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.stopAd = function(callback) {};\n\n/**\n * skipAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.skipAd = function(callback) {};\n\n/**\n * resizeAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.resizeAd = function(width, height, viewMode, callback) {};\n\n/**\n * pauseAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.pauseAd = function(callback) {};\n\n/**\n * resumeAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.resumeAd = function(callback) {};\n\n/**\n * expandAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.expandAd = function(callback) {};\n\n/**\n * collapseAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.collapseAd = function(callback) {};\n\n/**\n * subscribe\n *\n * @param {string} event\n * @param {nodeStyleCallback} handler\n * @param {object} context\n */\nIVPAIDAdUnit.prototype.subscribe = function(event, handler, context) {};\n\n/**\n * startAd\n *\n * @param {string} event\n * @param {function} handler\n */\nIVPAIDAdUnit.prototype.unsubscribe = function(event, handler) {};\n\n\n\n/**\n * getAdLinear\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdLinear = function(callback) {};\n\n/**\n * getAdWidth\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdWidth = function(callback) {};\n\n/**\n * getAdHeight\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdHeight = function(callback) {};\n\n/**\n * getAdExpanded\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdExpanded = function(callback) {};\n\n/**\n * getAdSkippableState\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdSkippableState = function(callback) {};\n\n/**\n * getAdRemainingTime\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdRemainingTime = function(callback) {};\n\n/**\n * getAdDuration\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdDuration = function(callback) {};\n\n/**\n * getAdVolume\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdVolume = function(callback) {};\n\n/**\n * getAdCompanions\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdCompanions = function(callback) {};\n\n/**\n * getAdIcons\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdIcons = function(callback) {};\n\n/**\n * setAdVolume\n *\n * @param {number} volume\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.setAdVolume = function(volume, callback) {};\n\naddStaticToInterface(IVPAIDAdUnit, 'METHODS', METHODS);\naddStaticToInterface(IVPAIDAdUnit, 'GETTERS', GETTERS);\naddStaticToInterface(IVPAIDAdUnit, 'SETTERS', SETTERS);\naddStaticToInterface(IVPAIDAdUnit, 'EVENTS', EVENTS);\n\n\nvar VPAID1_METHODS = METHODS.filter(function(method) {\n return ['skipAd'].indexOf(method) === -1;\n});\n\naddStaticToInterface(IVPAIDAdUnit, 'checkVPAIDInterface', function checkVPAIDInterface (creative) {\n var result = VPAID1_METHODS.every(function(key) {\n return typeof creative[key] === 'function';\n });\n return result;\n});\n\nmodule.exports = IVPAIDAdUnit;\n\nfunction addStaticToInterface(Interface, name, value) {\n Object.defineProperty(Interface, name, {\n writable: false,\n configurable: false,\n value: value\n });\n}\n\n","'use strict';\n\nvar IVPAIDAdUnit = require('./IVPAIDAdUnit');\nvar Subscriber = require('./subscriber');\nvar checkVPAIDInterface = IVPAIDAdUnit.checkVPAIDInterface;\nvar utils = require('./utils');\nvar METHODS = IVPAIDAdUnit.METHODS;\nvar ERROR = 'AdError';\nvar AD_CLICK = 'AdClickThru';\nvar FILTERED_EVENTS = IVPAIDAdUnit.EVENTS.filter(function (event) {\n return event != AD_CLICK;\n});\n\n/**\n * This callback is displayed as global member. The callback use nodejs error-first callback style\n * @callback NodeStyleCallback\n * @param {string|null}\n * @param {undefined|object}\n */\n\n\n/**\n * VPAIDAdUnit\n * @class\n *\n * @param VPAIDCreative\n * @param {HTMLElement} [el] this will be used in initAd environmentVars.slot if defined\n * @param {HTMLVideoElement} [video] this will be used in initAd environmentVars.videoSlot if defined\n */\nfunction VPAIDAdUnit(VPAIDCreative, el, video, iframe) {\n this._isValid = checkVPAIDInterface(VPAIDCreative);\n if (this._isValid) {\n this._creative = VPAIDCreative;\n this._el = el;\n this._videoEl = video;\n this._iframe = iframe;\n this._subscribers = new Subscriber();\n $addEventsSubscribers.call(this);\n }\n}\n\nVPAIDAdUnit.prototype = Object.create(IVPAIDAdUnit.prototype);\n\n/**\n * isValidVPAIDAd will return if the VPAIDCreative passed in constructor is valid or not\n *\n * @return {boolean}\n */\nVPAIDAdUnit.prototype.isValidVPAIDAd = function isValidVPAIDAd() {\n return this._isValid;\n};\n\nIVPAIDAdUnit.METHODS.forEach(function(method) {\n //NOTE: this methods arguments order are implemented differently from the spec\n var ignores = [\n 'subscribe',\n 'unsubscribe',\n 'initAd'\n ];\n\n if (ignores.indexOf(method) !== -1) return;\n\n VPAIDAdUnit.prototype[method] = function () {\n var ariaty = IVPAIDAdUnit.prototype[method].length;\n // TODO avoid leaking arguments\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n var args = Array.prototype.slice.call(arguments);\n var callback = (ariaty === args.length) ? args.pop() : undefined;\n\n setTimeout(function () {\n var result, error = null;\n try {\n result = this._creative[method].apply(this._creative, args);\n } catch(e) {\n error = e;\n }\n\n callOrTriggerEvent(callback, this._subscribers, error, result);\n }.bind(this), 0);\n };\n});\n\n\n/**\n * initAd concreate implementation\n *\n * @param {number} width\n * @param {number} height\n * @param {string} viewMode can be 'normal', 'thumbnail' or 'fullscreen'\n * @param {number} desiredBitrate indicates the desired bitrate in kbps\n * @param {object} [creativeData] used for additional initialization data\n * @param {object} [environmentVars] used for passing implementation-specific of js version, if el & video was used in constructor slot & videoSlot will be added to the object\n * @param {NodeStyleCallback} callback\n */\nVPAIDAdUnit.prototype.initAd = function initAd(width, height, viewMode, desiredBitrate, creativeData, environmentVars, callback) {\n creativeData = creativeData || {};\n environmentVars = utils.extend({\n slot: this._el,\n videoSlot: this._videoEl\n }, environmentVars || {});\n\n setTimeout(function () {\n var error;\n try {\n this._creative.initAd(width, height, viewMode, desiredBitrate, creativeData, environmentVars);\n } catch (e) {\n error = e;\n }\n\n callOrTriggerEvent(callback, this._subscribers, error);\n }.bind(this), 0);\n};\n\n/**\n * subscribe\n *\n * @param {string} event\n * @param {nodeStyleCallback} handler\n * @param {object} context\n */\nVPAIDAdUnit.prototype.subscribe = function subscribe(event, handler, context) {\n this._subscribers.subscribe(handler, event, context);\n};\n\n\n/**\n * unsubscribe\n *\n * @param {string} event\n * @param {nodeStyleCallback} handler\n */\nVPAIDAdUnit.prototype.unsubscribe = function unsubscribe(event, handler) {\n this._subscribers.unsubscribe(handler, event);\n};\n\n//alias\nVPAIDAdUnit.prototype.on = VPAIDAdUnit.prototype.subscribe;\nVPAIDAdUnit.prototype.off = VPAIDAdUnit.prototype.unsubscribe;\n\nIVPAIDAdUnit.GETTERS.forEach(function(getter) {\n VPAIDAdUnit.prototype[getter] = function (callback) {\n setTimeout(function () {\n\n var result, error = null;\n try {\n result = this._creative[getter]();\n } catch(e) {\n error = e;\n }\n\n callOrTriggerEvent(callback, this._subscribers, error, result);\n }.bind(this), 0);\n };\n});\n\n/**\n * setAdVolume\n *\n * @param volume\n * @param {nodeStyleCallback} callback\n */\nVPAIDAdUnit.prototype.setAdVolume = function setAdVolume(volume, callback) {\n setTimeout(function () {\n\n var result, error = null;\n try {\n this._creative.setAdVolume(volume);\n result = this._creative.getAdVolume();\n } catch(e) {\n error = e;\n }\n\n if (!error) {\n error = utils.validate(result === volume, 'failed to apply volume: ' + volume);\n }\n callOrTriggerEvent(callback, this._subscribers, error, result);\n }.bind(this), 0);\n};\n\nVPAIDAdUnit.prototype._destroy = function destroy() {\n this.stopAd();\n this._subscribers.unsubscribeAll();\n};\n\nfunction $addEventsSubscribers() {\n // some ads implement\n // so they only handle one subscriber\n // to handle this we create our one\n FILTERED_EVENTS.forEach(function (event) {\n this._creative.subscribe($trigger.bind(this, event), event);\n }.bind(this));\n\n // map the click event to be an object instead of depending of the order of the arguments\n // and to be consistent with the flash\n this._creative.subscribe($clickThruHook.bind(this), AD_CLICK);\n\n // because we are adding the element inside the iframe\n // the user is not able to click in the video\n if (this._videoEl) {\n var documentElement = this._iframe.contentDocument.documentElement;\n var videoEl = this._videoEl;\n documentElement.addEventListener('click', function(e) {\n if (e.target === documentElement) {\n videoEl.click();\n }\n });\n }\n}\n\nfunction $clickThruHook(url, id, playerHandles) {\n this._subscribers.triggerSync(AD_CLICK, {url: url, id: id, playerHandles: playerHandles});\n}\n\nfunction $trigger(event) {\n // TODO avoid leaking arguments\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n this._subscribers.trigger(event, Array.prototype.slice(arguments, 1));\n}\n\nfunction callOrTriggerEvent(callback, subscribers, error, result) {\n if (callback) {\n callback(error, result);\n } else if (error) {\n subscribers.trigger(ERROR, error);\n }\n}\n\nmodule.exports = VPAIDAdUnit;\n\n","'use strict';\n\nvar utils = require('./utils');\nvar unique = utils.unique('vpaidIframe');\nvar VPAIDAdUnit = require('./VPAIDAdUnit');\n\nvar defaultTemplate = '' +\n '' +\n '' +\n '
' +\n '' +\n '' +\n '' +\n '';\n\nvar AD_STOPPED = 'AdStopped';\n\n/**\n * This callback is displayed as global member. The callback use nodejs error-first callback style\n * @callback NodeStyleCallback\n * @param {string|null}\n * @param {undefined|object}\n */\n\n/**\n * VPAIDHTML5Client\n * @class\n *\n * @param {HTMLElement} el that will contain the iframe to load adUnit and a el to add to adUnit slot\n * @param {HTMLVideoElement} video default video element to be used by adUnit\n * @param {object} [templateConfig] template: html template to be used instead of the default, extraOptions: to be used when rendering the template\n * @param {object} [vpaidOptions] timeout: when loading adUnit\n */\nfunction VPAIDHTML5Client(el, video, templateConfig, vpaidOptions) {\n templateConfig = templateConfig || {};\n\n this._id = unique();\n this._destroyed = false;\n\n this._frameContainer = utils.createElementInEl(el, 'div');\n this._videoEl = video;\n this._vpaidOptions = vpaidOptions || {timeout: 10000};\n\n this._templateConfig = {\n template: templateConfig.template || defaultTemplate,\n extraOptions: templateConfig.extraOptions || {}\n };\n}\n\n/**\n * destroy\n *\n */\nVPAIDHTML5Client.prototype.destroy = function destroy() {\n if (this._destroyed) {\n return;\n }\n this._destroyed = true;\n $unloadPreviousAdUnit.call(this);\n};\n\n/**\n * isDestroyed\n *\n * @return {boolean}\n */\nVPAIDHTML5Client.prototype.isDestroyed = function isDestroyed() {\n return this._destroyed;\n};\n\n/**\n * loadAdUnit\n *\n * @param {string} adURL url of the js of the adUnit\n * @param {nodeStyleCallback} callback\n */\nVPAIDHTML5Client.prototype.loadAdUnit = function loadAdUnit(adURL, callback) {\n $throwIfDestroyed.call(this);\n $unloadPreviousAdUnit.call(this);\n var that = this;\n\n var frame = utils.createIframeWithContent(\n this._frameContainer,\n this._templateConfig.template,\n utils.extend({\n iframeURL_JS: adURL,\n iframeID: this.getID(),\n origin: getOrigin()\n }, this._templateConfig.extraOptions)\n );\n\n this._frame = frame;\n\n this._onLoad = utils.callbackTimeout(\n this._vpaidOptions.timeout,\n onLoad.bind(this),\n onTimeout.bind(this)\n );\n\n window.addEventListener('message', this._onLoad);\n\n function onLoad (e) {\n /*jshint validthis: false */\n //don't clear timeout\n if (e.origin !== getOrigin()) return;\n var result = JSON.parse(e.data);\n\n //don't clear timeout\n if (result.id !== that.getID()) return;\n\n var adUnit, error, createAd;\n if (!that._frame.contentWindow) {\n\n error = 'the iframe is not anymore in the DOM tree';\n\n } else {\n createAd = that._frame.contentWindow.getVPAIDAd;\n error = utils.validate(typeof createAd === 'function', 'the ad didn\\'t return a function to create an ad');\n }\n\n if (!error) {\n var adEl = that._frame.contentWindow.document.querySelector('.ad-element');\n adUnit = new VPAIDAdUnit(createAd(), adEl, that._videoEl, that._frame);\n adUnit.subscribe(AD_STOPPED, $adDestroyed.bind(that));\n error = utils.validate(adUnit.isValidVPAIDAd(), 'the add is not fully complaint with VPAID specification');\n }\n\n that._adUnit = adUnit;\n $destroyLoadListener.call(that);\n callback(error, error ? null : adUnit);\n\n //clear timeout\n return true;\n }\n\n function onTimeout() {\n callback('timeout', null);\n }\n};\n\n/**\n * unloadAdUnit\n *\n */\nVPAIDHTML5Client.prototype.unloadAdUnit = function unloadAdUnit() {\n $unloadPreviousAdUnit.call(this);\n};\n\n/**\n * getID will return the unique id\n *\n * @return {string}\n */\nVPAIDHTML5Client.prototype.getID = function () {\n return this._id;\n};\n\n\n/**\n * $removeEl\n *\n * @param {string} key\n */\nfunction $removeEl(key) {\n var el = this[key];\n if (el) {\n el.remove();\n delete this[key];\n }\n}\n\nfunction $adDestroyed() {\n $removeAdElements.call(this);\n delete this._adUnit;\n}\n\nfunction $unloadPreviousAdUnit() {\n $removeAdElements.call(this);\n $destroyAdUnit.call(this);\n}\n\nfunction $removeAdElements() {\n $removeEl.call(this, '_frame');\n $destroyLoadListener.call(this);\n}\n\n/**\n * $destroyLoadListener\n *\n */\nfunction $destroyLoadListener() {\n if (this._onLoad) {\n window.removeEventListener('message', this._onLoad);\n utils.clearCallbackTimeout(this._onLoad);\n delete this._onLoad;\n }\n}\n\n\nfunction $destroyAdUnit() {\n if (this._adUnit) {\n this._adUnit.stopAd();\n delete this._adUnit;\n }\n}\n\n/**\n * $throwIfDestroyed\n *\n */\nfunction $throwIfDestroyed() {\n if (this._destroyed) {\n throw new Error ('VPAIDHTML5Client already destroyed!');\n }\n}\n\nfunction getOrigin() {\n if( window.location.origin ) {\n return window.location.origin;\n }\n else {\n return window.location.protocol + \"//\" +\n window.location.hostname +\n (window.location.port ? ':' + window.location.port: '');\n }\n}\n\nmodule.exports = VPAIDHTML5Client;\nwindow.VPAIDHTML5Client = VPAIDHTML5Client;\n\n","'use strict';\n\nfunction Subscriber() {\n this._subscribers = {};\n}\n\nSubscriber.prototype.subscribe = function subscribe(handler, eventName, context) {\n if (!this.isHandlerAttached(handler, eventName)) {\n this.get(eventName).push({handler: handler, context: context, eventName: eventName});\n }\n};\n\nSubscriber.prototype.unsubscribe = function unsubscribe(handler, eventName) {\n this._subscribers[eventName] = this.get(eventName).filter(function (subscriber) {\n return handler !== subscriber.handler;\n });\n};\n\nSubscriber.prototype.unsubscribeAll = function unsubscribeAll() {\n this._subscribers = {};\n};\n\nSubscriber.prototype.trigger = function(eventName, data) {\n var that = this;\n var subscribers = this.get(eventName)\n .concat(this.get('*'));\n\n subscribers.forEach(function (subscriber) {\n setTimeout(function () {\n if (that.isHandlerAttached(subscriber.handler, subscriber.eventName)) {\n subscriber.handler.call(subscriber.context, data);\n }\n }, 0);\n });\n};\n\nSubscriber.prototype.triggerSync = function(eventName, data) {\n var subscribers = this.get(eventName)\n .concat(this.get('*'));\n\n subscribers.forEach(function (subscriber) {\n subscriber.handler.call(subscriber.context, data);\n });\n};\n\nSubscriber.prototype.get = function get(eventName) {\n if (!this._subscribers[eventName]) {\n this._subscribers[eventName] = [];\n }\n return this._subscribers[eventName];\n};\n\nSubscriber.prototype.isHandlerAttached = function isHandlerAttached(handler, eventName) {\n return this.get(eventName).some(function(subscriber) {\n return handler === subscriber.handler;\n })\n};\n\nmodule.exports = Subscriber;\n\n","'use strict';\n\n/**\n * noop a empty function\n */\nfunction noop() {}\n\n/**\n * validate if is not validate will return an Error with the message\n *\n * @param {boolean} isValid\n * @param {string} message\n */\nfunction validate(isValid, message) {\n return isValid ? null : new Error(message);\n}\n\nvar timeouts = {};\n/**\n * clearCallbackTimeout\n *\n * @param {function} func handler to remove\n */\nfunction clearCallbackTimeout(func) {\n var timeout = timeouts[func];\n if (timeout) {\n clearTimeout(timeout);\n delete timeouts[func];\n }\n}\n\n/**\n * callbackTimeout if the onSuccess is not called and returns true in the timelimit then onTimeout will be called\n *\n * @param {number} timer\n * @param {function} onSuccess\n * @param {function} onTimeout\n */\nfunction callbackTimeout(timer, onSuccess, onTimeout) {\n var callback, timeout;\n\n timeout = setTimeout(function () {\n onSuccess = noop;\n delete timeout[callback];\n onTimeout();\n }, timer);\n\n callback = function () {\n // TODO avoid leaking arguments\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n if (onSuccess.apply(this, arguments)) {\n clearCallbackTimeout(callback);\n }\n };\n\n timeouts[callback] = timeout;\n\n return callback;\n}\n\n\n/**\n * createElementInEl\n *\n * @param {HTMLElement} parent\n * @param {string} tagName\n * @param {string} id\n */\nfunction createElementInEl(parent, tagName, id) {\n var nEl = document.createElement(tagName);\n if (id) nEl.id = id;\n parent.appendChild(nEl);\n return nEl;\n}\n\n/**\n * createIframeWithContent\n *\n * @param {HTMLElement} parent\n * @param {string} template simple template using {{var}}\n * @param {object} data\n */\nfunction createIframeWithContent(parent, template, data) {\n var iframe = createIframe(parent, null, data.zIndex);\n if (!setIframeContent(iframe, simpleTemplate(template, data))) return;\n return iframe;\n}\n\n/**\n * createIframe\n *\n * @param {HTMLElement} parent\n * @param {string} url\n */\nfunction createIframe(parent, url, zIndex) {\n var nEl = document.createElement('iframe');\n nEl.src = url || 'about:blank';\n nEl.marginWidth = '0';\n nEl.marginHeight = '0';\n nEl.frameBorder = '0';\n nEl.width = '100%';\n nEl.height = '100%';\n nEl.style.position = 'absolute';\n nEl.style.left = '0';\n nEl.style.top = '0';\n nEl.style.margin = '0px';\n nEl.style.padding = '0px';\n nEl.style.border = 'none';\n\n if(zIndex){\n nEl.style.zIndex = zIndex;\n }\n\n nEl.setAttribute('SCROLLING','NO');\n parent.innerHTML = '';\n parent.appendChild(nEl);\n return nEl;\n}\n\n/**\n * simpleTemplate\n *\n * @param {string} template\n * @param {object} data\n */\nfunction simpleTemplate(template, data) {\n Object.keys(data).forEach(function (key) {\n var value = (typeof value === 'object') ? JSON.stringify(data[key]) : data[key];\n template = template.replace(new RegExp('{{' + key + '}}', 'g'), value);\n });\n return template;\n}\n\n/**\n * setIframeContent\n *\n * @param {HTMLIframeElement} iframeEl\n * @param content\n */\nfunction setIframeContent(iframeEl, content) {\n var iframeDoc = iframeEl.contentWindow && iframeEl.contentWindow.document;\n if (!iframeDoc) return false;\n\n iframeDoc.write(content);\n\n return true;\n}\n\n\n/**\n * extend object with keys from another object\n *\n * @param {object} toExtend\n * @param {object} fromSource\n */\nfunction extend(toExtend, fromSource) {\n Object.keys(fromSource).forEach(function(key) {\n toExtend[key] = fromSource[key];\n });\n return toExtend;\n}\n\n\n/**\n * unique will create a unique string everytime is called, sequentially and prefixed\n *\n * @param {string} prefix\n */\nfunction unique(prefix) {\n var count = -1;\n return function () {\n return prefix + '_' + (++count);\n };\n}\n\nmodule.exports = {\n noop: noop,\n validate: validate,\n clearCallbackTimeout: clearCallbackTimeout,\n callbackTimeout: callbackTimeout,\n createElementInEl: createElementInEl,\n createIframeWithContent: createIframeWithContent,\n createIframe: createIframe,\n simpleTemplate: simpleTemplate,\n setIframeContent: setIframeContent,\n extend: extend,\n unique: unique\n};\n\n","'use strict';\n\nvar InLine = require('./InLine');\nvar Wrapper = require('./Wrapper');\n\nfunction Ad(adJTree) {\n if (!(this instanceof Ad)) {\n return new Ad(adJTree);\n }\n this.initialize(adJTree);\n}\n\nAd.prototype.initialize = function(adJTree) {\n this.id = adJTree.attr('id');\n this.sequence = adJTree.attr('sequence');\n\n if(adJTree.inLine) {\n this.inLine = new InLine(adJTree.inLine);\n }\n\n if(adJTree.wrapper){\n this.wrapper = new Wrapper(adJTree.wrapper);\n }\n};\n\nmodule.exports = Ad;","'use strict';\n\nvar TrackingEvent = require('./TrackingEvent');\n\nvar utilities = require('../../utils/utilityFunctions');\n\nvar xml = require('../../utils/xml');\n\n\nfunction Companion(companionJTree) {\n if (!(this instanceof Companion)) {\n return new Companion(companionJTree);\n }\n\n //Required Elements\n this.creativeType = xml.attr(companionJTree.staticResource, 'creativeType');\n this.staticResource = xml.keyValue(companionJTree.staticResource);\n\n // Weird bug when the JXON tree is built it doesn't handle casing properly in this situation...\n var htmlResource = null;\n if (xml.keyValue(companionJTree.HTMLResource)) {\n htmlResource = xml.keyValue(companionJTree.HTMLResource);\n } else if (xml.keyValue(companionJTree.hTMLResource)) {\n htmlResource = xml.keyValue(companionJTree.hTMLResource);\n }\n this.htmlResource = htmlResource;\n\n var iframeResource = null;\n if (xml.keyValue(companionJTree.IFrameResource)) {\n iframeResource = xml.keyValue(companionJTree.IFrameResource);\n } else if (xml.keyValue(companionJTree.iFrameresource)) {\n iframeResource = xml.keyValue(companionJTree.iFrameresource);\n }\n this.iframeResource = iframeResource;\n\n //Optional fields\n this.id = xml.attr(companionJTree, 'id');\n this.width = xml.attr(companionJTree, 'width');\n this.height = xml.attr(companionJTree, 'height');\n this.expandedWidth = xml.attr(companionJTree, 'expandedWidth');\n this.expandedHeight = xml.attr(companionJTree, 'expandedHeight');\n this.scalable = xml.attr(companionJTree, 'scalable');\n this.maintainAspectRatio = xml.attr(companionJTree, 'maintainAspectRatio');\n this.minSuggestedDuration = xml.attr(companionJTree, 'minSuggestedDuration');\n this.apiFramework = xml.attr(companionJTree, 'apiFramework');\n this.companionClickThrough = xml.keyValue(companionJTree.companionClickThrough);\n this.trackingEvents = parseTrackingEvents(companionJTree.trackingEvents && companionJTree.trackingEvents.tracking);\n\n /*** Local functions ***/\n function parseTrackingEvents(trackingEvents) {\n var trackings = [];\n if (utilities.isDefined(trackingEvents)) {\n trackingEvents = utilities.isArray(trackingEvents) ? trackingEvents : [trackingEvents];\n trackingEvents.forEach(function (trackingData) {\n trackings.push(new TrackingEvent(trackingData));\n });\n }\n return trackings;\n }\n}\n\nmodule.exports = Companion;","'use strict';\n\nvar Linear = require('./Linear');\nvar Companion = require('./Companion');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction Creative(creativeJTree) {\n if(!(this instanceof Creative)) {\n return new Creative(creativeJTree);\n }\n\n this.id = creativeJTree.attr('id');\n this.sequence = creativeJTree.attr('sequence');\n this.adId = creativeJTree.attr('adId');\n this.apiFramework = creativeJTree.attr('apiFramework');\n\n if(creativeJTree.linear) {\n this.linear = new Linear(creativeJTree.linear);\n }\n\n if (creativeJTree.companionAds) {\n var companions = [];\n var companionAds = creativeJTree.companionAds && creativeJTree.companionAds.companion;\n if (utilities.isDefined(companionAds)) {\n companionAds = utilities.isArray(companionAds) ? companionAds : [companionAds];\n companionAds.forEach(function (companionData) {\n companions.push(new Companion(companionData));\n });\n }\n this.companionAds = companions;\n }\n}\n\n/**\n * Returns true if the browser supports at the creative.\n */\nCreative.prototype.isSupported = function(){\n if(this.linear) {\n return this.linear.isSupported();\n }\n\n return true;\n};\n\nCreative.parseCreatives = function parseCreatives(creativesJTree) {\n var creatives = [];\n var creativesData;\n if (utilities.isDefined(creativesJTree) && utilities.isDefined(creativesJTree.creative)) {\n creativesData = utilities.isArray(creativesJTree.creative) ? creativesJTree.creative : [creativesJTree.creative];\n creativesData.forEach(function (creative) {\n creatives.push(new Creative(creative));\n });\n }\n return creatives;\n};\n\nmodule.exports = Creative;\n","'use strict';\n\nvar vastUtil = require('./vastUtil');\nvar Creative = require('./Creative');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nfunction InLine(inlineJTree) {\n if (!(this instanceof InLine)) {\n return new InLine(inlineJTree);\n }\n\n //Required Fields\n this.adTitle = xml.keyValue(inlineJTree.adTitle);\n this.adSystem = xml.keyValue(inlineJTree.adSystem);\n this.impressions = vastUtil.parseImpressions(inlineJTree.impression);\n this.creatives = Creative.parseCreatives(inlineJTree.creatives);\n\n //Optional Fields\n this.description = xml.keyValue(inlineJTree.description);\n this.advertiser = xml.keyValue(inlineJTree.advertiser);\n this.surveys = parseSurveys(inlineJTree.survey);\n this.error = xml.keyValue(inlineJTree.error);\n this.pricing = xml.keyValue(inlineJTree.pricing);\n this.extensions = inlineJTree.extensions;\n\n /*** Local Functions ***/\n function parseSurveys(inlineSurveys) {\n if (inlineSurveys) {\n return utilities.transformArray(utilities.isArray(inlineSurveys) ? inlineSurveys : [inlineSurveys], function (survey) {\n if(utilities.isNotEmptyString(survey.keyValue)){\n return {\n uri: survey.keyValue,\n type: survey.attr('type')\n };\n }\n\n return undefined;\n });\n }\n return [];\n }\n}\n\n\n/**\n * Returns true if the browser supports all the creatives.\n */\nInLine.prototype.isSupported = function(){\n var i,len;\n\n if(this.creatives.length === 0) {\n return false;\n }\n\n for(i = 0, len = this.creatives.length; i< len; i+=1){\n if(!this.creatives[i].isSupported()){\n return false;\n }\n }\n return true;\n};\n\nmodule.exports = InLine;\n","'use strict';\n\nvar TrackingEvent = require('./TrackingEvent');\nvar MediaFile = require('./MediaFile');\nvar VideoClicks = require('./VideoClicks');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar parsers = require('./parsers');\n\nvar xml = require('../../utils/xml');\n\n\nfunction Linear(linearJTree) {\n if (!(this instanceof Linear)) {\n return new Linear(linearJTree);\n }\n\n //Required Elements\n this.duration = parsers.duration(xml.keyValue(linearJTree.duration));\n this.mediaFiles = parseMediaFiles(linearJTree.mediaFiles && linearJTree.mediaFiles.mediaFile);\n\n //Optional fields\n this.trackingEvents = parseTrackingEvents(linearJTree.trackingEvents && linearJTree.trackingEvents.tracking, this.duration);\n this.skipoffset = parsers.offset(xml.attr(linearJTree, 'skipoffset'), this.duration);\n\n if (linearJTree.videoClicks) {\n this.videoClicks = new VideoClicks(linearJTree.videoClicks);\n }\n\n if(linearJTree.adParameters) {\n this.adParameters = xml.keyValue(linearJTree.adParameters);\n\n if(xml.attr(linearJTree.adParameters, 'xmlEncoded')){\n this.adParameters = xml.decode(this.adParameters);\n }\n }\n\n /*** Local functions ***/\n function parseTrackingEvents(trackingEvents, duration) {\n var trackings = [];\n if (utilities.isDefined(trackingEvents)) {\n trackingEvents = utilities.isArray(trackingEvents) ? trackingEvents : [trackingEvents];\n trackingEvents.forEach(function (trackingData) {\n trackings.push(new TrackingEvent(trackingData, duration));\n });\n }\n return trackings;\n }\n\n function parseMediaFiles(mediaFilesJxonTree) {\n var mediaFiles = [];\n if (utilities.isDefined(mediaFilesJxonTree)) {\n mediaFilesJxonTree = utilities.isArray(mediaFilesJxonTree) ? mediaFilesJxonTree : [mediaFilesJxonTree];\n\n mediaFilesJxonTree.forEach(function (mfData) {\n mediaFiles.push(new MediaFile(mfData));\n });\n }\n return mediaFiles;\n }\n}\n\n/**\n * Must return true if at least one of the MediaFiles' type is supported\n */\nLinear.prototype.isSupported = function () {\n var i, len;\n for(i=0, len=this.mediaFiles.length; i 0) {\n getAd(waterfallAds.shift(),[], waterfallHandler);\n } else {\n callback(error, adChain);\n }\n } else {\n callback(null, adChain);\n }\n }\n });\n\n /*** Local functions ***/\n function getAdWaterfall(adTagUrl, callback) {\n var requestVastXML = that._requestVASTXml.bind(that, adTagUrl);\n async.waterfall([\n requestVastXML,\n buildVastWaterfall\n ], callback);\n }\n\n function buildVastWaterfall(xmlStr, callback) {\n var vastTree;\n try {\n vastTree = xml.toJXONTree(xmlStr);\n\n if(utilities.isArray(vastTree.ad)) {\n vastTree.ads = vastTree.ad;\n } else if(vastTree.ad){\n vastTree.ads = [vastTree.ad];\n } else {\n vastTree.ads = [];\n }\n callback(validateVASTTree(vastTree), vastTree);\n\n } catch (e) {\n callback(new VASTError(\"on VASTClient.getVASTAd.buildVastWaterfall, error parsing xml\", 100), null);\n }\n }\n\n function validateVASTTree(vastTree) {\n var vastVersion = xml.attr(vastTree, 'version');\n\n if (!vastTree.ad) {\n return new VASTError('on VASTClient.getVASTAd.validateVASTTree, no Ad in VAST tree', 303);\n }\n\n if (vastVersion && (vastVersion != 3 && vastVersion != 2)) {\n return new VASTError('on VASTClient.getVASTAd.validateVASTTree, not supported VAST version \"' + vastVersion + '\"', 102);\n }\n\n return null;\n }\n\n function getAd(adTagUrl, adChain, callback) {\n if (adChain.length >= that.WRAPPER_LIMIT) {\n return callback(new VASTError(\"on VASTClient.getVASTAd.getAd, players wrapper limit reached (the limit is \" + that.WRAPPER_LIMIT + \")\", 302), adChain);\n }\n\n async.waterfall([\n function (next) {\n if (utilities.isString(adTagUrl)) {\n requestVASTAd(adTagUrl, next);\n } else {\n next(null, adTagUrl);\n }\n },\n buildAd\n ], function (error, ad) {\n if (ad) {\n adChain.push(ad);\n }\n\n if (error) {\n return callback(error, adChain);\n }\n\n if (ad.wrapper) {\n return getAd(ad.wrapper.VASTAdTagURI, adChain, callback);\n }\n\n return callback(null, adChain);\n });\n }\n\n function buildAd(adJxonTree, callback) {\n try {\n var ad = new Ad(adJxonTree);\n callback(validateAd(ad), ad);\n } catch (e) {\n callback(new VASTError('on VASTClient.getVASTAd.buildAd, error parsing xml', 100), null);\n }\n }\n\n function validateAd(ad) {\n var wrapper = ad.wrapper;\n var inLine = ad.inLine;\n var errMsgPrefix = 'on VASTClient.getVASTAd.validateAd, ';\n\n if (inLine && wrapper) {\n return new VASTError(errMsgPrefix +\"InLine and Wrapper both found on the same Ad\", 101);\n }\n\n if (!inLine && !wrapper) {\n return new VASTError(errMsgPrefix + \"nor wrapper nor inline elements found on the Ad\", 101);\n }\n\n if (inLine && !inLine.isSupported()) {\n return new VASTError(errMsgPrefix + \"could not find MediaFile that is supported by this video player\", 403);\n }\n\n if (wrapper && !wrapper.VASTAdTagURI) {\n return new VASTError(errMsgPrefix + \"missing 'VASTAdTagURI' in wrapper\", 101);\n }\n\n return null;\n }\n\n function requestVASTAd(adTagUrl, callback) {\n that._requestVASTXml(adTagUrl, function (error, xmlStr) {\n if (error) {\n return callback(error);\n }\n try {\n var vastTree = xml.toJXONTree(xmlStr);\n callback(validateVASTTree(vastTree), vastTree.ad);\n } catch (e) {\n callback(new VASTError(\"on VASTClient.getVASTAd.requestVASTAd, error parsing xml\", 100));\n }\n });\n }\n};\n\nVASTClient.prototype._requestVASTXml = function requestVASTXml(adTagUrl, callback) {\n try {\n if (utilities.isFunction(adTagUrl)) {\n adTagUrl(requestHandler);\n } else {\n http.get(adTagUrl, requestHandler, {\n withCredentials: true\n });\n }\n } catch (e) {\n callback(e);\n }\n\n /*** Local functions ***/\n function requestHandler(error, response, status) {\n if (error) {\n var errMsg = utilities.isDefined(status) ?\n \"on VASTClient.requestVastXML, HTTP request error with status '\" + status + \"'\" :\n \"on VASTClient.requestVastXML, Error getting the the VAST XML with he passed adTagXML fn\";\n return callback(new VASTError(errMsg, 301), null);\n }\n\n callback(null, response);\n }\n};\n\nVASTClient.prototype._buildVASTResponse = function buildVASTResponse(adsChain) {\n var response = new VASTResponse();\n addAdsToResponse(response, adsChain);\n validateResponse(response);\n\n return response;\n\n //*** Local function ****\n function addAdsToResponse(response, ads) {\n ads.forEach(function (ad) {\n response.addAd(ad);\n });\n }\n\n function validateResponse(response) {\n var progressEvents = response.trackingEvents.progress;\n\n if (!response.hasLinear()) {\n throw new VASTError(\"on VASTClient._buildVASTResponse, Received an Ad type that is not supported\", 200);\n }\n\n if (response.duration === undefined) {\n throw new VASTError(\"on VASTClient._buildVASTResponse, Missing duration field in VAST response\", 101);\n }\n\n if (progressEvents) {\n progressEvents.forEach(function (progressEvent) {\n if (!utilities.isNumber(progressEvent.offset)) {\n throw new VASTError(\"on VASTClient._buildVASTResponse, missing or wrong offset attribute on progress tracking event\", 101);\n }\n });\n }\n }\n};\n\nVASTClient.prototype._trackError = function (error, adChain) {\n if (!utilities.isArray(adChain) || adChain.length === 0) { //There is nothing to track\n return;\n }\n\n var errorURLMacros = [];\n adChain.forEach(addErrorUrlMacros);\n vastUtil.track(errorURLMacros, {ERRORCODE: error.code || 900}); //900 <== Undefined error\n\n /*** Local functions ***/\n function addErrorUrlMacros(ad) {\n if (ad.wrapper && ad.wrapper.error) {\n errorURLMacros.push(ad.wrapper.error);\n }\n\n if (ad.inLine && ad.inLine.error) {\n errorURLMacros.push(ad.inLine.error);\n }\n }\n};\n\nmodule.exports = VASTClient;\n","'use strict';\n\nfunction VASTError(message, code) {\n this.message = 'VAST Error: ' + (message || '');\n if (code) {\n this.code = code;\n }\n}\n\nVASTError.prototype = new Error();\nVASTError.prototype.name = \"VAST Error\";\n\nmodule.exports = VASTError;","'use strict';\n\n/**\n * Inner helper class that deals with the logic of the individual steps needed to setup an ad in the player.\n *\n * @param player {object} instance of the player that will play the ad. It assumes that the videojs-contrib-ads plugin\n * has been initialized when you use its utility functions.\n *\n * @constructor\n */\n\nvar VASTResponse = require('./VASTResponse');\nvar VASTError = require('./VASTError');\nvar VASTTracker = require('./VASTTracker');\nvar vastUtil = require('./vastUtil');\n\nvar async = require('../../utils/async');\nvar dom = require('../../utils/dom');\nvar playerUtils = require('../../utils/playerUtils');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VASTIntegrator(player) {\n if (!(this instanceof VASTIntegrator)) {\n return new VASTIntegrator(player);\n }\n\n this.player = player;\n}\n\nVASTIntegrator.prototype.playAd = function playAd(vastResponse, callback) {\n var that = this;\n callback = callback || utilities.noop;\n\n if (!(vastResponse instanceof VASTResponse)) {\n return callback(new VASTError('On VASTIntegrator, missing required VASTResponse'));\n }\n\n async.waterfall([\n function (next) {\n next(null, vastResponse);\n },\n this._selectAdSource.bind(this),\n this._createVASTTracker.bind(this),\n this._addClickThrough.bind(this),\n this._addSkipButton.bind(this),\n this._setupEvents.bind(this),\n this._playSelectedAd.bind(this)\n ], function (error, response) {\n if (error && response) {\n that._trackError(error, response);\n }\n callback(error, response);\n });\n\n this._adUnit = {\n _src: null,\n type: 'VAST',\n pauseAd: function () {\n that.player.pause(true);\n },\n\n resumeAd: function () {\n that.player.play(true);\n },\n\n isPaused: function () {\n return that.player.paused(true);\n },\n\n getSrc: function () {\n return this._src;\n }\n };\n\n return this._adUnit;\n};\n\nVASTIntegrator.prototype._selectAdSource = function selectAdSource(response, callback) {\n var source;\n\n var playerWidth = dom.getDimension(this.player.el()).width;\n response.mediaFiles.sort(function compareTo(a, b) {\n var deltaA = Math.abs(playerWidth - a.width);\n var deltaB = Math.abs(playerWidth - b.width);\n return deltaA - deltaB;\n });\n\n source = this.player.selectSource(response.mediaFiles).source;\n\n if (source) {\n if (this._adUnit) {\n this._adUnit._src = source;\n }\n return callback(null, source, response);\n }\n\n // code 403 <== Couldn't find MediaFile that is supported by this video player\n callback(new VASTError(\"Could not find Ad mediafile supported by this player\", 403), response);\n};\n\nVASTIntegrator.prototype._createVASTTracker = function createVASTTracker(adMediaFile, response, callback) {\n try {\n callback(null, adMediaFile, new VASTTracker(adMediaFile.src, response), response);\n } catch (e) {\n callback(e, response);\n }\n};\n\nVASTIntegrator.prototype._setupEvents = function setupEvents(adMediaFile, tracker, response, callback) {\n var previouslyMuted;\n var player = this.player;\n player.on('fullscreenchange', trackFullscreenChange);\n player.on('vast.adStart', trackImpressions);\n player.on('pause', trackPause);\n player.on('timeupdate', trackProgress);\n player.on('volumechange', trackVolumeChange);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], unbindEvents);\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel', 'vast.adSkip'], function(evt){\n if(evt.type === 'vast.adEnd'){\n tracker.trackComplete();\n }\n });\n\n return callback(null, adMediaFile, response);\n\n /*** Local Functions ***/\n function unbindEvents() {\n player.off('fullscreenchange', trackFullscreenChange);\n player.off('vast.adStart', trackImpressions);\n player.off('pause', trackPause);\n player.off('timeupdate', trackProgress);\n player.off('volumechange', trackVolumeChange);\n }\n\n function trackFullscreenChange() {\n if (player.isFullscreen()) {\n tracker.trackFullscreen();\n } else {\n tracker.trackExitFullscreen();\n }\n }\n\n function trackPause() {\n //NOTE: whenever a video ends the video Element triggers a 'pause' event before the 'ended' event.\n // We should not track this pause event because it makes the VAST tracking confusing again we use a\n // Threshold of 2 seconds to prevent false positives on IOS.\n if (Math.abs(player.duration() - player.currentTime()) < 2) {\n return;\n }\n\n tracker.trackPause();\n playerUtils.once(player, ['play', 'vast.adEnd', 'vast.adsCancel'], function (evt) {\n if(evt.type === 'play'){\n tracker.trackResume();\n }\n });\n }\n\n function trackProgress() {\n var currentTimeInMs = player.currentTime() * 1000;\n tracker.trackProgress(currentTimeInMs);\n }\n\n function trackImpressions() {\n tracker.trackImpressions();\n tracker.trackCreativeView();\n }\n\n function trackVolumeChange() {\n var muted = player.muted();\n if (muted) {\n tracker.trackMute();\n } else if (previouslyMuted) {\n tracker.trackUnmute();\n }\n previouslyMuted = muted;\n }\n};\n\nVASTIntegrator.prototype._addSkipButton = function addSkipButton(source, tracker, response, callback) {\n var skipOffsetInSec;\n var that = this;\n\n if (utilities.isNumber(response.skipoffset)) {\n skipOffsetInSec = response.skipoffset / 1000;\n addSkipButtonToPlayer(this.player, skipOffsetInSec);\n }\n callback(null, source, tracker, response);\n\n /*** Local function ***/\n function addSkipButtonToPlayer(player, skipOffset) {\n var skipButton = createSkipButton(player);\n var updateSkipButton = updateSkipButtonState.bind(that, skipButton, skipOffset, player);\n\n player.el().appendChild(skipButton);\n player.on('timeupdate', updateSkipButton);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeSkipButton);\n\n function removeSkipButton() {\n player.off('timeupdate', updateSkipButton);\n dom.remove(skipButton);\n }\n }\n\n function createSkipButton(player) {\n var skipButton = window.document.createElement(\"div\");\n dom.addClass(skipButton, \"vast-skip-button\");\n\n skipButton.onclick = function (e) {\n if (dom.hasClass(skipButton, 'enabled')) {\n tracker.trackSkip();\n player.trigger('vast.adSkip');\n }\n\n //We prevent event propagation to avoid problems with the clickThrough and so on\n if (window.Event.prototype.stopPropagation !== undefined) {\n e.stopPropagation();\n } else {\n return false;\n }\n };\n\n return skipButton;\n }\n\n function updateSkipButtonState(skipButton, skipOffset, player) {\n var timeLeft = Math.ceil(skipOffset - player.currentTime());\n if (timeLeft > 0) {\n skipButton.innerHTML = \"Skip in \" + utilities.toFixedDigits(timeLeft, 2) + \"...\";\n } else {\n if (!dom.hasClass(skipButton, 'enabled')) {\n dom.addClass(skipButton, 'enabled');\n skipButton.innerHTML = \"Skip ad\";\n }\n }\n }\n};\n\nVASTIntegrator.prototype._addClickThrough = function addClickThrough(mediaFile, tracker, response, callback) {\n var player = this.player;\n var blocker = createClickThroughBlocker(player, tracker, response);\n var updateBlocker = updateBlockerURL.bind(this, blocker, response, player);\n\n player.el().insertBefore(blocker, player.controlBar.el());\n player.on('timeupdate', updateBlocker);\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeBlocker);\n\n return callback(null, mediaFile, tracker, response);\n\n /*** Local Functions ***/\n\n function createClickThroughBlocker(player, tracker, response) {\n var blocker = window.document.createElement(\"a\");\n var clickThroughMacro = response.clickThrough;\n\n dom.addClass(blocker, 'vast-blocker');\n blocker.href = generateClickThroughURL(clickThroughMacro, player);\n\n if (utilities.isString(clickThroughMacro)) {\n blocker.target = \"_blank\";\n }\n\n blocker.onclick = function (e) {\n if (player.paused()) {\n player.play();\n\n //We prevent event propagation to avoid problems with the player's normal pause mechanism\n if (window.Event.prototype.stopPropagation !== undefined) {\n e.stopPropagation();\n }\n return false;\n }\n\n player.pause();\n tracker.trackClick();\n };\n\n return blocker;\n }\n\n function updateBlockerURL(blocker, response, player) {\n blocker.href = generateClickThroughURL(response.clickThrough, player);\n }\n\n function generateClickThroughURL(clickThroughMacro, player) {\n var variables = {\n ASSETURI: mediaFile.src,\n CONTENTPLAYHEAD: vastUtil.formatProgress(player.currentTime() * 1000)\n };\n\n return clickThroughMacro ? vastUtil.parseURLMacro(clickThroughMacro, variables) : '#';\n }\n\n function removeBlocker() {\n player.off('timeupdate', updateBlocker);\n dom.remove(blocker);\n }\n};\n\nVASTIntegrator.prototype._playSelectedAd = function playSelectedAd(source, response, callback) {\n var player = this.player;\n\n player.preload(\"auto\"); //without preload=auto the durationchange event is never fired\n player.src(source);\n\n playerUtils.once(player, ['durationchange', 'error', 'vast.adsCancel'], function (evt) {\n if (evt.type === 'durationchange') {\n playAd();\n } else if(evt.type === 'error') {\n callback(new VASTError(\"on VASTIntegrator, Player is unable to play the Ad\", 400), response);\n }\n //NOTE: If the ads get canceled we do nothing/\n });\n\n /**** local functions ******/\n function playAd() {\n\n playerUtils.once(player, ['playing', 'vast.adsCancel'], function (evt) {\n if(evt.type === 'vast.adsCancel'){\n return;\n }\n\n player.trigger('vast.adStart');\n\n player.on('ended', proceed);\n player.on('vast.adsCancel', proceed);\n player.on('vast.adSkip', proceed);\n\n function proceed(evt) {\n\n if(evt.type === 'ended' && (player.duration() - player.currentTime()) > 3 ) {\n // Ignore ended event if the Ad time was not 'near' the end\n // avoids issues where IOS controls could skip the Ad\n return;\n }\n\n player.off('ended', proceed);\n player.off('vast.adsCancel', proceed);\n player.off('vast.adSkip', proceed);\n\n //NOTE: if the ads get cancel we do nothing apart removing the listners\n if(evt.type === 'ended' || evt.type === 'vast.adSkip'){\n callback(null, response);\n }\n }\n });\n\n player.play();\n }\n};\n\nVASTIntegrator.prototype._trackError = function trackError(error, response) {\n vastUtil.track(response.errorURLMacros, {ERRORCODE: error.code || 900});\n};\n\nmodule.exports = VASTIntegrator;","'use strict';\n\nvar Ad = require('./Ad');\nvar VideoClicks = require('./VideoClicks');\nvar Linear = require('./Linear');\nvar InLine = require('./InLine');\nvar Wrapper = require('./Wrapper');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nwindow.InLine__A = InLine;\nfunction VASTResponse() {\n if (!(this instanceof VASTResponse)) {\n return new VASTResponse();\n }\n\n this._linearAdded = false;\n this.ads = [];\n this.errorURLMacros = [];\n this.impressions = [];\n this.clickTrackings = [];\n this.customClicks = [];\n this.trackingEvents = {};\n this.mediaFiles = [];\n this.clickThrough = undefined;\n this.adTitle = '';\n this.duration = undefined;\n this.skipoffset = undefined;\n}\n\nVASTResponse.prototype.addAd = function (ad) {\n var inLine, wrapper;\n if (ad instanceof Ad) {\n inLine = ad.inLine;\n wrapper = ad.wrapper;\n\n this.ads.push(ad);\n\n if (inLine) {\n this._addInLine(inLine);\n }\n\n if (wrapper) {\n this._addWrapper(wrapper);\n }\n }\n};\n\nVASTResponse.prototype._addErrorTrackUrl = function (error) {\n var errorURL = error instanceof xml.JXONTree ? xml.keyValue(error) : error;\n if (errorURL) {\n this.errorURLMacros.push(errorURL);\n }\n};\n\nVASTResponse.prototype._addImpressions = function (impressions) {\n utilities.isArray(impressions) && appendToArray(this.impressions, impressions);\n};\n\nVASTResponse.prototype._addClickThrough = function (clickThrough) {\n if (utilities.isNotEmptyString(clickThrough)) {\n this.clickThrough = clickThrough;\n }\n};\n\nVASTResponse.prototype._addClickTrackings = function (clickTrackings) {\n utilities.isArray(clickTrackings) && appendToArray(this.clickTrackings, clickTrackings);\n};\n\nVASTResponse.prototype._addCustomClicks = function (customClicks) {\n utilities.isArray(customClicks) && appendToArray(this.customClicks, customClicks);\n};\n\nVASTResponse.prototype._addTrackingEvents = function (trackingEvents) {\n var eventsMap = this.trackingEvents;\n\n if (trackingEvents) {\n trackingEvents = utilities.isArray(trackingEvents) ? trackingEvents : [trackingEvents];\n trackingEvents.forEach(function (trackingEvent) {\n if (!eventsMap[trackingEvent.name]) {\n eventsMap[trackingEvent.name] = [];\n }\n eventsMap[trackingEvent.name].push(trackingEvent);\n });\n }\n};\n\nVASTResponse.prototype._addTitle = function (title) {\n if (utilities.isNotEmptyString(title)) {\n this.adTitle = title;\n }\n};\n\nVASTResponse.prototype._addDuration = function (duration) {\n if (utilities.isNumber(duration)) {\n this.duration = duration;\n }\n};\n\nVASTResponse.prototype._addVideoClicks = function (videoClicks) {\n if (videoClicks instanceof VideoClicks) {\n this._addClickThrough(videoClicks.clickThrough);\n this._addClickTrackings(videoClicks.clickTrackings);\n this._addCustomClicks(videoClicks.customClicks);\n }\n};\n\nVASTResponse.prototype._addMediaFiles = function (mediaFiles) {\n utilities.isArray(mediaFiles) && appendToArray(this.mediaFiles, mediaFiles);\n};\n\nVASTResponse.prototype._addSkipoffset = function (offset) {\n if (offset) {\n this.skipoffset = offset;\n }\n};\n\nVASTResponse.prototype._addAdParameters = function (adParameters) {\n if (adParameters) {\n this.adParameters = adParameters;\n }\n};\n\nVASTResponse.prototype._addLinear = function (linear) {\n if (linear instanceof Linear) {\n this._addDuration(linear.duration);\n this._addTrackingEvents(linear.trackingEvents);\n this._addVideoClicks(linear.videoClicks);\n this._addMediaFiles(linear.mediaFiles);\n this._addSkipoffset(linear.skipoffset);\n this._addAdParameters(linear.adParameters);\n this._linearAdded = true;\n }\n};\n\nVASTResponse.prototype._addInLine = function (inLine) {\n var that = this;\n\n if (inLine instanceof InLine) {\n this._addTitle(inLine.adTitle);\n this._addErrorTrackUrl(inLine.error);\n this._addImpressions(inLine.impressions);\n\n inLine.creatives.forEach(function (creative) {\n if (creative.linear) {\n that._addLinear(creative.linear);\n }\n });\n }\n};\n\nVASTResponse.prototype._addWrapper = function (wrapper) {\n var that = this;\n\n if (wrapper instanceof Wrapper) {\n this._addErrorTrackUrl(wrapper.error);\n this._addImpressions(wrapper.impressions);\n\n wrapper.creatives.forEach(function (creative) {\n var linear = creative.linear;\n if (linear) {\n that._addVideoClicks(linear.videoClicks);\n that.clickThrough = undefined;//We ensure that no clickThrough has been added\n that._addTrackingEvents(linear.trackingEvents);\n }\n });\n }\n};\n\nVASTResponse.prototype.hasLinear = function(){\n return this._linearAdded;\n};\n\nfunction appendToArray(array, items) {\n items.forEach(function (item) {\n array.push(item);\n });\n}\n\nmodule.exports = VASTResponse;\n\n","'use strict';\n\nvar VASTError = require('./VASTError');\nvar VASTResponse = require('./VASTResponse');\nvar vastUtil = require('./vastUtil');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VASTTracker(assetURI, vastResponse) {\n if (!(this instanceof VASTTracker)) {\n return new VASTTracker(assetURI, vastResponse);\n }\n\n this.sanityCheck(assetURI, vastResponse);\n this.initialize(assetURI, vastResponse);\n\n}\n\nVASTTracker.prototype.initialize = function(assetURI, vastResponse) {\n this.response = vastResponse;\n this.assetURI = assetURI;\n this.progress = 0;\n this.quartiles = {\n firstQuartile: {tracked: false, time: Math.round(25 * vastResponse.duration) / 100},\n midpoint: {tracked: false, time: Math.round(50 * vastResponse.duration) / 100},\n thirdQuartile: {tracked: false, time: Math.round(75 * vastResponse.duration) / 100}\n };\n};\n\nVASTTracker.prototype.sanityCheck = function(assetURI, vastResponse) {\n if (!utilities.isString(assetURI) || utilities.isEmptyString(assetURI)) {\n throw new VASTError('on VASTTracker constructor, missing required the URI of the ad asset being played');\n }\n\n if (!(vastResponse instanceof VASTResponse)) {\n throw new VASTError('on VASTTracker constructor, missing required VAST response');\n }\n};\n\nVASTTracker.prototype.trackURLs = function trackURLs(urls, variables) {\n if (utilities.isArray(urls) && urls.length > 0) {\n variables = utilities.extend({\n ASSETURI: this.assetURI,\n CONTENTPLAYHEAD: vastUtil.formatProgress(this.progress)\n }, variables || {});\n\n vastUtil.track(urls, variables);\n }\n};\n\nVASTTracker.prototype.trackEvent = function trackEvent(eventName, trackOnce) {\n this.trackURLs(getEventUris(this.response.trackingEvents[eventName]));\n if (trackOnce) {\n this.response.trackingEvents[eventName] = undefined;\n }\n\n /*** Local function ***/\n function getEventUris(trackingEvents) {\n var uris;\n\n if (trackingEvents) {\n uris = [];\n trackingEvents.forEach(function (event) {\n uris.push(event.uri);\n });\n }\n return uris;\n }\n};\n\nVASTTracker.prototype.trackProgress = function trackProgress(newProgressInMs) {\n var that = this;\n var events = [];\n var ONCE = true;\n var ALWAYS = false;\n var trackingEvents = this.response.trackingEvents;\n\n if (utilities.isNumber(newProgressInMs)) {\n addTrackEvent('start', ONCE, newProgressInMs > 0);\n addTrackEvent('rewind', ALWAYS, hasRewound(this.progress, newProgressInMs));\n addQuartileEvents(newProgressInMs);\n trackProgressEvents(newProgressInMs);\n trackEvents();\n this.progress = newProgressInMs;\n }\n\n /*** Local function ***/\n function hasRewound(currentProgress, newProgress) {\n var REWIND_THRESHOLD = 3000; //IOS video clock is very unreliable and we need a 3 seconds threshold to ensure that there was a rewind an that it was on purpose.\n return currentProgress > newProgressInMs && Math.abs(newProgress - currentProgress) > REWIND_THRESHOLD;\n }\n\n function addTrackEvent(eventName, trackOnce, canBeAdded) {\n if (trackingEvents[eventName] && canBeAdded) {\n events.push({\n name: eventName,\n trackOnce: !!trackOnce\n });\n }\n }\n\n function addQuartileEvents(progress) {\n var quartiles = that.quartiles;\n var firstQuartile = that.quartiles.firstQuartile;\n var midpoint = that.quartiles.midpoint;\n var thirdQuartile = that.quartiles.thirdQuartile;\n\n if (!firstQuartile.tracked) {\n trackQuartile('firstQuartile', progress);\n } else if (!midpoint.tracked) {\n trackQuartile('midpoint', progress);\n } else if (!thirdQuartile.tracked){\n trackQuartile('thirdQuartile', progress);\n }\n\n /*** Local function ***/\n function trackQuartile(quartileName, progress){\n var quartile = quartiles[quartileName];\n if(canBeTracked(quartile, progress)){\n quartile.tracked = true;\n addTrackEvent(quartileName, ONCE, true);\n }\n }\n }\n\n function canBeTracked(quartile, progress) {\n var quartileTime = quartile.time;\n //We only fire the quartile event if the progress is bigger than the quartile time by 5 seconds at most.\n return progress >= quartileTime && progress <= (quartileTime + 5000);\n }\n\n function trackProgressEvents(progress) {\n if (!utilities.isArray(trackingEvents.progress)) {\n return; //Nothing to track\n }\n\n var pendingProgressEvts = [];\n\n trackingEvents.progress.forEach(function (evt) {\n if (evt.offset <= progress) {\n that.trackURLs([evt.uri]);\n } else {\n pendingProgressEvts.push(evt);\n }\n });\n trackingEvents.progress = pendingProgressEvts;\n }\n\n function trackEvents() {\n events.forEach(function (event) {\n that.trackEvent(event.name, event.trackOnce);\n });\n }\n};\n\n[\n 'rewind',\n 'fullscreen',\n 'exitFullscreen',\n 'pause',\n 'resume',\n 'mute',\n 'unmute',\n 'acceptInvitation',\n 'acceptInvitationLinear',\n 'collapse',\n 'expand'\n].forEach(function (eventName) {\n VASTTracker.prototype['track' + utilities.capitalize(eventName)] = function () {\n this.trackEvent(eventName);\n };\n });\n\n[\n 'start',\n 'skip',\n 'close',\n 'closeLinear'\n].forEach(function (eventName) {\n VASTTracker.prototype['track' + utilities.capitalize(eventName)] = function () {\n this.trackEvent(eventName, true);\n };\n });\n\n[\n 'firstQuartile',\n 'midpoint',\n 'thirdQuartile'\n].forEach(function (quartile) {\n VASTTracker.prototype['track' + utilities.capitalize(quartile)] = function () {\n this.quartiles[quartile].tracked = true;\n this.trackEvent(quartile, true);\n };\n });\n\nVASTTracker.prototype.trackComplete = function () {\n if(this.quartiles.thirdQuartile.tracked){\n this.trackEvent('complete', true);\n }\n};\n\nVASTTracker.prototype.trackErrorWithCode = function trackErrorWithCode(errorcode) {\n if (utilities.isNumber(errorcode)) {\n this.trackURLs(this.response.errorURLMacros, {ERRORCODE: errorcode});\n }\n};\n\nVASTTracker.prototype.trackImpressions = function trackImpressions() {\n this.trackURLs(this.response.impressions);\n};\n\nVASTTracker.prototype.trackCreativeView = function trackCreativeView() {\n this.trackEvent('creativeView');\n};\n\nVASTTracker.prototype.trackClick = function trackClick() {\n this.trackURLs(this.response.clickTrackings);\n};\n\nmodule.exports = VASTTracker;\n","'use strict';\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nfunction VideoClicks(videoClickJTree) {\n if (!(this instanceof VideoClicks)) {\n return new VideoClicks(videoClickJTree);\n }\n\n this.clickThrough = xml.keyValue(videoClickJTree.clickThrough);\n this.clickTrackings = parseClickTrackings(videoClickJTree.clickTracking);\n this.customClicks = parseClickTrackings(videoClickJTree.customClick);\n\n /*** Local functions ***/\n function parseClickTrackings(trackingData) {\n var clickTrackings = [];\n if (trackingData) {\n trackingData = utilities.isArray(trackingData) ? trackingData : [trackingData];\n trackingData.forEach(function (clickTrackingData) {\n clickTrackings.push(xml.keyValue(clickTrackingData));\n });\n }\n return clickTrackings;\n }\n}\n\nmodule.exports = VideoClicks;","'use strict';\n\nvar vastUtil = require('./vastUtil');\nvar Creative = require('./Creative');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nfunction Wrapper(wrapperJTree) {\n if(!(this instanceof Wrapper)) {\n return new Wrapper(wrapperJTree);\n }\n\n //Required elements\n this.adSystem = xml.keyValue(wrapperJTree.adSystem);\n this.impressions = vastUtil.parseImpressions(wrapperJTree.impression);\n this.VASTAdTagURI = xml.keyValue(wrapperJTree.vASTAdTagURI);\n\n //Optional elements\n this.creatives = Creative.parseCreatives(wrapperJTree.creatives);\n this.error = xml.keyValue(wrapperJTree.error);\n this.extensions = wrapperJTree.extensions;\n\n //Optional attrs\n this.followAdditionalWrappers = utilities.isDefined(xml.attr(wrapperJTree, 'followAdditionalWrappers'))? xml.attr(wrapperJTree, 'followAdditionalWrappers'): true;\n this.allowMultipleAds = xml.attr(wrapperJTree, 'allowMultipleAds');\n this.fallbackOnNoAd = xml.attr(wrapperJTree, 'fallbackOnNoAd');\n}\n\nmodule.exports = Wrapper;\n","'use strict';\n\nvar utilities = require('../../utils/utilityFunctions');\n\nvar durationRegex = /(\\d\\d):(\\d\\d):(\\d\\d)(\\.(\\d\\d\\d))?/;\n\nvar parsers = {\n\n duration: function parseDuration(durationStr) {\n\n var match, durationInMs;\n\n if (utilities.isString(durationStr)) {\n match = durationStr.match(durationRegex);\n if (match) {\n durationInMs = parseHoursToMs(match[1]) + parseMinToMs(match[2]) + parseSecToMs(match[3]) + parseInt(match[5] || 0);\n }\n }\n\n return isNaN(durationInMs) ? null : durationInMs;\n\n /*** local functions ***/\n function parseHoursToMs(hourStr) {\n return parseInt(hourStr, 10) * 60 * 60 * 1000;\n }\n\n function parseMinToMs(minStr) {\n return parseInt(minStr, 10) * 60 * 1000;\n }\n\n function parseSecToMs(secStr) {\n return parseInt(secStr, 10) * 1000;\n }\n },\n\n offset: function parseOffset(offset, duration) {\n if(isPercentage(offset)){\n return calculatePercentage(offset, duration);\n }\n return parsers.duration(offset);\n\n /*** Local function ***/\n function isPercentage(offset) {\n var percentageRegex = /^\\d+(\\.\\d+)?%$/g;\n return percentageRegex.test(offset);\n }\n\n function calculatePercentage(percentStr, duration) {\n if(duration) {\n return calcPercent(duration, parseFloat(percentStr.replace('%', '')));\n }\n return null;\n }\n\n function calcPercent(quantity, percent){\n return quantity * percent / 100;\n }\n }\n\n};\n\n\nmodule.exports = parsers;","'use strict';\n\nvar utilities = require('../../utils/utilityFunctions');\nvar VPAIDHTML5Tech = require('../vpaid/VPAIDHTML5Tech');\nvar VPAIDFlashTech = require('../vpaid/VPAIDFlashTech');\nvar VPAIDFLASHClient = require('VPAIDFLASHClient/js/VPAIDFLASHClient');\n\nvar vastUtil = {\n\n track: function track(URLMacros, variables) {\n var sources = vastUtil.parseURLMacros(URLMacros, variables);\n var trackImgs = [];\n sources.forEach(function (src) {\n var img = new Image();\n img.src = src;\n trackImgs.push(img);\n });\n return trackImgs;\n },\n\n parseURLMacros: function parseMacros(URLMacros, variables) {\n var parsedURLs = [];\n\n variables = variables || {};\n\n if (!(variables[\"CACHEBUSTING\"])) {\n variables[\"CACHEBUSTING\"] = Math.round(Math.random() * 1.0e+10);\n }\n\n URLMacros.forEach(function (URLMacro) {\n parsedURLs.push(vastUtil._parseURLMacro(URLMacro, variables));\n });\n\n return parsedURLs;\n },\n\n parseURLMacro: function parseMacro(URLMacro, variables) {\n variables = variables || {};\n\n if (!(variables[\"CACHEBUSTING\"])) {\n variables[\"CACHEBUSTING\"] = Math.round(Math.random() * 1.0e+10);\n }\n\n return vastUtil._parseURLMacro(URLMacro, variables);\n },\n\n _parseURLMacro: function parseMacro(URLMacro, variables) {\n variables = variables || {};\n\n utilities.forEach(variables, function (value, key) {\n URLMacro = URLMacro.replace(new RegExp(\"\\\\[\" + key + \"\\\\\\]\", 'gm'), value);\n });\n\n return URLMacro;\n },\n\n parseDuration: function parseDuration(durationStr) {\n var durationRegex = /(\\d\\d):(\\d\\d):(\\d\\d)(\\.(\\d\\d\\d))?/;\n var match, durationInMs;\n\n if (utilities.isString(durationStr)) {\n match = durationStr.match(durationRegex);\n if (match) {\n durationInMs = parseHoursToMs(match[1]) + parseMinToMs(match[2]) + parseSecToMs(match[3]) + parseInt(match[5] || 0);\n }\n }\n\n return isNaN(durationInMs) ? null : durationInMs;\n\n /*** local functions ***/\n function parseHoursToMs(hourStr) {\n return parseInt(hourStr, 10) * 60 * 60 * 1000;\n }\n\n function parseMinToMs(minStr) {\n return parseInt(minStr, 10) * 60 * 1000;\n }\n\n function parseSecToMs(secStr) {\n return parseInt(secStr, 10) * 1000;\n }\n },\n\n parseImpressions: function parseImpressions(impressions) {\n if (impressions) {\n impressions = utilities.isArray(impressions) ? impressions : [impressions];\n return utilities.transformArray(impressions, function (impression) {\n if (utilities.isNotEmptyString(impression.keyValue)) {\n return impression.keyValue;\n }\n return undefined;\n });\n }\n return [];\n },\n\n\n //We assume that the progress is going to arrive in milliseconds\n formatProgress: function formatProgress(progress) {\n var hours, minutes, seconds, milliseconds;\n hours = progress / (60 * 60 * 1000);\n hours = Math.floor(hours);\n minutes = (progress / (60 * 1000)) % 60;\n minutes = Math.floor(minutes);\n seconds = (progress / 1000) % 60;\n seconds = Math.floor(seconds);\n milliseconds = progress % 1000;\n return utilities.toFixedDigits(hours, 2) + ':' + utilities.toFixedDigits(minutes, 2) + ':' + utilities.toFixedDigits(seconds, 2) + '.' + utilities.toFixedDigits(milliseconds, 3);\n },\n\n parseOffset: function parseOffset(offset, duration) {\n if (isPercentage(offset)) {\n return calculatePercentage(offset, duration);\n }\n return vastUtil.parseDuration(offset);\n\n /*** Local function ***/\n function isPercentage(offset) {\n var percentageRegex = /^\\d+(\\.\\d+)?%$/g;\n return percentageRegex.test(offset);\n }\n\n function calculatePercentage(percentStr, duration) {\n if (duration) {\n return calcPercent(duration, parseFloat(percentStr.replace('%', '')));\n }\n return null;\n }\n\n function calcPercent(quantity, percent) {\n return quantity * percent / 100;\n }\n },\n\n\n //List of supported VPAID technologies\n VPAID_techs: [\n VPAIDFlashTech,\n VPAIDHTML5Tech\n ],\n\n isVPAID: function isVPAIDMediaFile(mediaFile) {\n return !!mediaFile && mediaFile.apiFramework === 'VPAID';\n },\n\n findSupportedVPAIDTech: function findSupportedVPAIDTech(mimeType) {\n var i, len, VPAIDTech;\n\n for (i = 0, len = this.VPAID_techs.length; i < len; i += 1) {\n VPAIDTech = this.VPAID_techs[i];\n if (VPAIDTech.supports(mimeType)) {\n return VPAIDTech;\n }\n }\n return null;\n },\n\n isFlashSupported: function isFlashSupported() {\n return VPAIDFLASHClient.isSupported();\n },\n\n /**\n * Necessary step for VPAIDFLAShClient to know if flash is supported and not blocked.\n * IMPORTANT NOTE: This is an async test and needs to be run as soon as possible.\n *\n * @param vpaidFlashLoaderPath the path to the vpaidFlashLoader swf obj.\n */\n runFlashSupportCheck: function runFlashSupportCheck(vpaidFlashLoaderPath) {\n VPAIDFLASHClient.runFlashTest({data: vpaidFlashLoaderPath});\n }\n\n};\n\nmodule.exports = vastUtil;\n","'use strict';\n\nvar VASTError = require('../vast/VASTError');\n\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VPAIDAdUnitWrapper(vpaidAdUnit, opts) {\n if (!(this instanceof VPAIDAdUnitWrapper)) {\n return new VPAIDAdUnitWrapper(vpaidAdUnit, opts);\n }\n sanityCheck(vpaidAdUnit, opts);\n\n this.options = utilities.extend({}, opts);\n\n this._adUnit = vpaidAdUnit;\n\n /*** Local Functions ***/\n function sanityCheck(adUnit, opts) {\n if (!adUnit || !VPAIDAdUnitWrapper.checkVPAIDInterface(adUnit)) {\n throw new VASTError('on VPAIDAdUnitWrapper, the passed VPAID adUnit does not fully implement the VPAID interface');\n }\n\n if (!utilities.isObject(opts)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper, expected options hash but got '\" + opts + \"'\");\n }\n\n if (!(\"responseTimeout\" in opts) || !utilities.isNumber(opts.responseTimeout) ){\n throw new VASTError(\"on VPAIDAdUnitWrapper, expected responseTimeout in options\");\n }\n }\n}\n\nVPAIDAdUnitWrapper.checkVPAIDInterface = function checkVPAIDInterface(VPAIDAdUnit) {\n //NOTE: skipAd is not part of the method list because it only appears in VPAID 2.0 and we support VPAID 1.0\n var VPAIDInterfaceMethods = [\n 'handshakeVersion', 'initAd', 'startAd', 'stopAd', 'resizeAd', 'pauseAd', 'expandAd', 'collapseAd'\n ];\n\n for (var i = 0, len = VPAIDInterfaceMethods.length; i < len; i++) {\n if (!VPAIDAdUnit || !utilities.isFunction(VPAIDAdUnit[VPAIDInterfaceMethods[i]])) {\n return false;\n }\n }\n\n\n return canSubscribeToEvents(VPAIDAdUnit) && canUnsubscribeFromEvents(VPAIDAdUnit);\n\n /*** Local Functions ***/\n\n function canSubscribeToEvents(adUnit) {\n return utilities.isFunction(adUnit.subscribe) || utilities.isFunction(adUnit.addEventListener) || utilities.isFunction(adUnit.on);\n }\n\n function canUnsubscribeFromEvents(adUnit) {\n return utilities.isFunction(adUnit.unsubscribe) || utilities.isFunction(adUnit.removeEventListener) || utilities.isFunction(adUnit.off);\n\n }\n};\n\nVPAIDAdUnitWrapper.prototype.adUnitAsyncCall = function () {\n var args = utilities.arrayLikeObjToArray(arguments);\n var method = args.shift();\n var cb = args.pop();\n var timeoutId;\n\n sanityCheck(method, cb, this._adUnit);\n args.push(wrapCallback());\n\n this._adUnit[method].apply(this._adUnit, args);\n timeoutId = setTimeout(function () {\n timeoutId = null;\n cb(new VASTError(\"on VPAIDAdUnitWrapper, timeout while waiting for a response on call '\" + method + \"'\"));\n cb = utilities.noop;\n }, this.options.responseTimeout);\n\n /*** Local functions ***/\n function sanityCheck(method, cb, adUnit) {\n if (!utilities.isString(method) || !utilities.isFunction(adUnit[method])) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.adUnitAsyncCall, invalid method name\");\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.adUnitAsyncCall, missing callback\");\n }\n }\n\n function wrapCallback() {\n return function () {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n cb.apply(this, arguments);\n };\n }\n};\n\nVPAIDAdUnitWrapper.prototype.on = function (evtName, handler) {\n var addEventListener = this._adUnit.addEventListener || this._adUnit.subscribe || this._adUnit.on;\n addEventListener.call(this._adUnit, evtName, handler);\n};\n\nVPAIDAdUnitWrapper.prototype.off = function (evtName, handler) {\n var removeEventListener = this._adUnit.removeEventListener || this._adUnit.unsubscribe || this._adUnit.off;\n removeEventListener.call(this._adUnit, evtName, handler);\n};\n\nVPAIDAdUnitWrapper.prototype.waitForEvent = function (evtName, cb, context) {\n var timeoutId;\n sanityCheck(evtName, cb);\n context = context || null;\n\n this.on(evtName, responseListener);\n\n timeoutId = setTimeout(function () {\n cb(new VASTError(\"on VPAIDAdUnitWrapper.waitForEvent, timeout while waiting for event '\" + evtName + \"'\"));\n timeoutId = null;\n cb = utilities.noop;\n }, this.options.responseTimeout);\n\n /*** Local functions ***/\n function sanityCheck(evtName, cb) {\n if (!utilities.isString(evtName)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.waitForEvent, missing evt name\");\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.waitForEvent, missing callback\");\n }\n }\n\n function responseListener() {\n var args = utilities.arrayLikeObjToArray(arguments);\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n\n args.unshift(null);\n cb.apply(context, args);\n }\n};\n\n// VPAID METHODS\nVPAIDAdUnitWrapper.prototype.handshakeVersion = function (version, cb) {\n this.adUnitAsyncCall('handshakeVersion', version, cb);\n};\n\n/* jshint maxparams:6 */\nVPAIDAdUnitWrapper.prototype.initAd = function (width, height, viewMode, desiredBitrate, adUnitData, cb) {\n this.waitForEvent('AdLoaded', cb);\n this._adUnit.initAd(width, height, viewMode, desiredBitrate, adUnitData);\n};\n\nVPAIDAdUnitWrapper.prototype.resizeAd = function (width, height, viewMode, cb) {\n // NOTE: AdSizeChange event is only supported on VPAID 2.0 so for the moment we are not going to use it\n // and will assume that everything is fine after the async call\n this.adUnitAsyncCall('resizeAd', width, height, viewMode, cb);\n};\n\nVPAIDAdUnitWrapper.prototype.startAd = function (cb) {\n this.waitForEvent('AdStarted', cb);\n this._adUnit.startAd();\n};\n\nVPAIDAdUnitWrapper.prototype.stopAd = function (cb) {\n this.waitForEvent('AdStopped', cb);\n this._adUnit.stopAd();\n};\n\nVPAIDAdUnitWrapper.prototype.pauseAd = function (cb) {\n this.waitForEvent('AdPaused', cb);\n this._adUnit.pauseAd();\n};\n\nVPAIDAdUnitWrapper.prototype.resumeAd = function (cb) {\n this.waitForEvent('AdPlaying', cb);\n this._adUnit.resumeAd();\n};\n\nVPAIDAdUnitWrapper.prototype.expandAd = function (cb) {\n this.waitForEvent('AdExpandedChange', cb);\n this._adUnit.expandAd();\n};\n\nVPAIDAdUnitWrapper.prototype.collapseAd = function (cb) {\n this.waitForEvent('AdExpandedChange', cb);\n this._adUnit.collapseAd();\n};\n\nVPAIDAdUnitWrapper.prototype.skipAd = function (cb) {\n this.waitForEvent('AdSkipped', cb);\n this._adUnit.skipAd();\n};\n\n//VPAID property getters\n[\n 'adLinear',\n 'adWidth',\n 'adHeight',\n 'adExpanded',\n 'adSkippableState',\n 'adRemainingTime',\n 'adDuration',\n 'adVolume',\n 'adCompanions',\n 'adIcons'\n].forEach(function (property) {\n var getterName = 'get' + utilities.capitalize(property);\n\n VPAIDAdUnitWrapper.prototype[getterName] = function (cb) {\n this.adUnitAsyncCall(getterName, cb);\n };\n});\n\n//VPAID property setters\nVPAIDAdUnitWrapper.prototype.setAdVolume = function(volume, cb){\n this.adUnitAsyncCall('setAdVolume',volume, cb);\n};\n\nmodule.exports = VPAIDAdUnitWrapper;\n","'use strict';\n\nvar VASTError = require('../vast/VASTError');\n\nvar VPAIDFLASHClient = require('VPAIDFLASHClient/js/VPAIDFLASHClient');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar dom = require('../../utils/dom');\n\nfunction VPAIDFlashTech(mediaFile, settings) {\n if (!(this instanceof VPAIDFlashTech)) {\n return new VPAIDFlashTech(mediaFile);\n }\n sanityCheck(mediaFile);\n this.name = 'vpaid-flash';\n this.mediaFile = mediaFile;\n this.containerEl = null;\n this.vpaidFlashClient = null;\n this.settings = settings;\n\n /*** local functions ***/\n function sanityCheck(mediaFile) {\n if (!mediaFile || !utilities.isString(mediaFile.src)) {\n throw new VASTError('on VPAIDFlashTech, invalid MediaFile');\n }\n }\n}\n\nVPAIDFlashTech.VPAIDFLASHClient = VPAIDFLASHClient;\n\nVPAIDFlashTech.supports = function (type) {\n return type === 'application/x-shockwave-flash' && VPAIDFlashTech.VPAIDFLASHClient.isSupported();\n};\n\nVPAIDFlashTech.prototype.loadAdUnit = function loadFlashCreative(containerEl, objectEl, callback) {\n var that = this;\n var flashClientOpts = this.settings && this.settings.vpaidFlashLoaderPath ? {data: this.settings.vpaidFlashLoaderPath} : undefined;\n sanityCheck(containerEl, callback);\n\n this.containerEl = containerEl;\n this.vpaidFlashClient = new VPAIDFlashTech.VPAIDFLASHClient(containerEl, function (error) {\n if (error) {\n return callback(error);\n }\n\n that.vpaidFlashClient.loadAdUnit(that.mediaFile.src, callback);\n }, flashClientOpts);\n\n /*** Local Functions ***/\n function sanityCheck(container, cb) {\n\n if (!dom.isDomElement(container)) {\n throw new VASTError('on VPAIDFlashTech.loadAdUnit, invalid dom container element');\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError('on VPAIDFlashTech.loadAdUnit, missing valid callback');\n }\n }\n};\n\nVPAIDFlashTech.prototype.unloadAdUnit = function () {\n if (this.vpaidFlashClient) {\n try{\n this.vpaidFlashClient.destroy();\n } catch(e){\n if(console && utilities.isFunction(console.log)){\n console.log('VAST ERROR: trying to unload the VPAID adunit');\n }\n }\n this.vpaidFlashClient = null;\n }\n\n if (this.containerEl) {\n dom.remove(this.containerEl);\n this.containerEl = null;\n }\n};\n\nmodule.exports = VPAIDFlashTech;\n","'use strict';\n\nvar VASTError = require('../vast/VASTError');\n\nvar VPAIDHTML5Client = require('VPAIDHTML5Client/js/VPAIDHTML5Client');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar dom = require('../../utils/dom');\n\nfunction VPAIDHTML5Tech(mediaFile) {\n\n if(!(this instanceof VPAIDHTML5Tech)) {\n return new VPAIDHTML5Tech(mediaFile);\n }\n\n sanityCheck(mediaFile);\n\n this.name = 'vpaid-html5';\n this.containerEl = null;\n this.videoEl = null;\n this.vpaidHTMLClient = null;\n\n this.mediaFile = mediaFile;\n\n function sanityCheck(mediaFile) {\n if (!mediaFile || !utilities.isString(mediaFile.src)) {\n throw new VASTError(VPAIDHTML5Tech.INVALID_MEDIA_FILE);\n }\n }\n}\n\nVPAIDHTML5Tech.VPAIDHTML5Client = VPAIDHTML5Client;\n\nVPAIDHTML5Tech.supports = function (type) {\n return !utilities.isOldIE() && type === 'application/javascript';\n};\n\nVPAIDHTML5Tech.prototype.loadAdUnit = function loadAdUnit(containerEl, videoEl, callback) {\n sanityCheck(containerEl, videoEl, callback);\n\n this.containerEl = containerEl;\n this.videoEl = videoEl;\n this.vpaidHTMLClient = new VPAIDHTML5Tech.VPAIDHTML5Client(containerEl, videoEl, {});\n this.vpaidHTMLClient.loadAdUnit(this.mediaFile.src, callback);\n\n function sanityCheck(container, video, cb) {\n if (!dom.isDomElement(container)) {\n throw new VASTError(VPAIDHTML5Tech.INVALID_DOM_CONTAINER_EL);\n }\n\n if (!dom.isDomElement(video) || video.tagName.toLowerCase() !== 'video') {\n throw new VASTError(VPAIDHTML5Tech.INVALID_DOM_CONTAINER_EL);\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError(VPAIDHTML5Tech.MISSING_CALLBACK);\n }\n }\n};\n\nVPAIDHTML5Tech.prototype.unloadAdUnit = function unloadAdUnit() {\n if (this.vpaidHTMLClient) {\n try {\n this.vpaidHTMLClient.destroy();\n } catch(e) {\n if (console && utilities.isFunction(console.log)) {\n console.log('VAST ERROR: trying to unload the VPAID adunit');\n }\n }\n\n this.vpaidHTMLClient = null;\n }\n\n if (this.containerEl) {\n dom.remove(this.containerEl);\n this.containerEl = null;\n }\n};\n\nvar PREFIX = 'on VPAIDHTML5Tech';\nVPAIDHTML5Tech.INVALID_MEDIA_FILE = PREFIX + ', invalid MediaFile';\nVPAIDHTML5Tech.INVALID_DOM_CONTAINER_EL = PREFIX + ', invalid container HtmlElement';\nVPAIDHTML5Tech.INVALID_DOM_VIDEO_EL = PREFIX + ', invalid HTMLVideoElement';\nVPAIDHTML5Tech.MISSING_CALLBACK = PREFIX + ', missing valid callback';\n\nmodule.exports = VPAIDHTML5Tech;","'use strict';\n\nvar VASTError = require('../vast/VASTError');\nvar VASTResponse = require('../vast/VASTResponse');\nvar VASTTracker = require('../vast/VASTTracker');\nvar vastUtil = require('../vast/vastUtil');\n\nvar VPAIDAdUnitWrapper = require('./VPAIDAdUnitWrapper');\n\nvar async = require('../../utils/async');\nvar dom = require('../../utils/dom');\nvar playerUtils = require('../../utils/playerUtils');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VPAIDIntegrator(player, settings) {\n if (!(this instanceof VPAIDIntegrator)) {\n return new VPAIDIntegrator(player);\n }\n\n this.VIEW_MODE = {\n NORMAL: 'normal',\n FULLSCREEN: \"fullscreen\",\n THUMBNAIL: \"thumbnail\"\n };\n this.player = player;\n this.containerEl = createVPAIDContainerEl(player);\n this.options = {\n responseTimeout: 5000,\n VPAID_VERSION: '2.0'\n };\n this.settings = settings;\n\n /*** Local functions ***/\n\n function createVPAIDContainerEl() {\n var containerEl = document.createElement('div');\n dom.addClass(containerEl, 'VPAID-container');\n player.el().insertBefore(containerEl, player.controlBar.el());\n return containerEl;\n\n }\n}\n\nVPAIDIntegrator.prototype.playAd = function playVPaidAd(vastResponse, callback) {\n if (!(vastResponse instanceof VASTResponse)) {\n return callback(new VASTError('on VASTIntegrator.playAd, missing required VASTResponse'));\n }\n\n var that = this;\n var player = this.player;\n var tech = this._findSupportedTech(vastResponse, this.settings);\n\n callback = callback || utilities.noop;\n\n this._adUnit = null;\n\n dom.addClass(player.el(), 'vjs-vpaid-ad');\n\n player.on('vast.adsCancel', triggerVpaidAdEnd);\n player.one('vpaid.adEnd', function(){\n player.off('vast.adsCancel', triggerVpaidAdEnd);\n removeAdUnit();\n });\n\n if (tech) {\n async.waterfall([\n function (next) {\n next(null, tech, vastResponse);\n },\n this._loadAdUnit.bind(this),\n this._playAdUnit.bind(this),\n this._finishPlaying.bind(this)\n\n ], adComplete);\n\n this._adUnit = {\n _paused: true,\n type: 'VPAID',\n pauseAd: function() {\n player.trigger('vpaid.pauseAd');\n player.pause(true);//we make sure that the video content gets stopped.\n },\n resumeAd: function() {\n player.trigger('vpaid.resumeAd');\n },\n isPaused: function() {\n return this._paused;\n },\n getSrc: function() {\n return tech.mediaFile;\n }\n };\n\n } else {\n var error = new VASTError('on VPAIDIntegrator.playAd, could not find a supported mediaFile', 403);\n adComplete(error, this._adUnit, vastResponse);\n }\n\n return this._adUnit;\n\n /*** Local functions ***/\n function adComplete(error, adUnit, vastResponse) {\n if (error && vastResponse) {\n that._trackError(vastResponse, error.code);\n }\n player.trigger('vpaid.adEnd');\n callback(error, vastResponse);\n }\n\n function triggerVpaidAdEnd(){\n player.trigger('vpaid.adEnd');\n }\n\n function removeAdUnit() {\n if (tech) {\n tech.unloadAdUnit();\n }\n dom.removeClass(player.el(), 'vjs-vpaid-ad');\n }\n};\n\nVPAIDIntegrator.prototype._findSupportedTech = function (vastResponse, settings) {\n if (!(vastResponse instanceof VASTResponse)) {\n return null;\n }\n\n var vpaidMediaFiles = vastResponse.mediaFiles.filter(vastUtil.isVPAID);\n var i, len, mediaFile, VPAIDTech;\n\n for (i = 0, len = vpaidMediaFiles.length; i < len; i += 1) {\n mediaFile = vpaidMediaFiles[i];\n VPAIDTech = vastUtil.findSupportedVPAIDTech(mediaFile.type);\n if (VPAIDTech) {\n return new VPAIDTech(mediaFile, settings);\n }\n }\n return null;\n};\n\nVPAIDIntegrator.prototype._createVPAIDAdUnitWrapper = function(adUnit, src, responseTimeout) {\n return new VPAIDAdUnitWrapper(adUnit, {src: src, responseTimeout: responseTimeout});\n};\n\nVPAIDIntegrator.prototype._loadAdUnit = function (tech, vastResponse, next) {\n var that = this;\n var player = this.player;\n var vjsTechEl = player.el().querySelector('.vjs-tech');\n var responseTimeout = this.settings.responseTimeout || this.options.responseTimeout;\n tech.loadAdUnit(this.containerEl, vjsTechEl, function (error, adUnit) {\n if (error) {\n return next(error, adUnit, vastResponse);\n }\n\n try {\n var WrappedAdUnit = that._createVPAIDAdUnitWrapper(adUnit, tech.mediaFile.src, responseTimeout);\n var techClass = 'vjs-' + tech.name + '-ad';\n dom.addClass(player.el(), techClass);\n player.one('vpaid.adEnd', function() {\n dom.removeClass(player.el(),techClass);\n });\n next(null, WrappedAdUnit, vastResponse);\n } catch (e) {\n next(e, adUnit, vastResponse);\n }\n });\n};\n\nVPAIDIntegrator.prototype._playAdUnit = function (adUnit, vastResponse, callback) {\n async.waterfall([\n function (next) {\n next(null, adUnit, vastResponse);\n },\n this._handshake.bind(this),\n this._initAd.bind(this),\n this._setupEvents.bind(this),\n this._addSkipButton.bind(this),\n this._linkPlayerControls.bind(this),\n this._startAd.bind(this)\n ], callback);\n};\n\nVPAIDIntegrator.prototype._handshake = function handshake(adUnit, vastResponse, next) {\n adUnit.handshakeVersion(this.options.VPAID_VERSION, function (error, version) {\n if (error) {\n return next(error, adUnit, vastResponse);\n }\n\n if (version && isSupportedVersion(version)) {\n return next(null, adUnit, vastResponse);\n }\n\n return next(new VASTError('on VPAIDIntegrator._handshake, unsupported version \"' + version + '\"'), adUnit, vastResponse);\n });\n\n function isSupportedVersion(version) {\n var majorNum = major(version);\n return majorNum >= 1 && majorNum <= 2;\n }\n\n function major(version) {\n var parts = version.split('.');\n return parseInt(parts[0], 10);\n }\n};\n\nVPAIDIntegrator.prototype._initAd = function (adUnit, vastResponse, next) {\n var tech = this.player.el().querySelector('.vjs-tech');\n var dimension = dom.getDimension(tech);\n adUnit.initAd(dimension.width, dimension.height, this.VIEW_MODE.NORMAL, -1, {AdParameters: vastResponse.adParameters || ''}, function (error) {\n next(error, adUnit, vastResponse);\n });\n};\n\nVPAIDIntegrator.prototype._createVASTTracker = function(adUnitSrc, vastResponse) {\n return new VASTTracker(adUnitSrc, vastResponse);\n};\n\nVPAIDIntegrator.prototype._setupEvents = function (adUnit, vastResponse, next) {\n var adUnitSrc = adUnit.options.src;\n var tracker = this._createVASTTracker(adUnitSrc, vastResponse);\n var player = this.player;\n var that = this;\n\n adUnit.on('AdSkipped', function () {\n player.trigger('vpaid.AdSkipped');\n tracker.trackSkip();\n });\n\n adUnit.on('AdImpression', function () {\n player.trigger('vpaid.AdImpression');\n tracker.trackImpressions();\n });\n\n adUnit.on('AdStarted', function () {\n player.trigger('vpaid.AdStarted');\n tracker.trackCreativeView();\n notifyPlayToPlayer();\n });\n\n adUnit.on('AdVideoStart', function () {\n player.trigger('vpaid.AdVideoStart');\n tracker.trackStart();\n notifyPlayToPlayer();\n });\n\n adUnit.on('AdPlaying', function () {\n player.trigger('vpaid.AdPlaying');\n tracker.trackResume();\n notifyPlayToPlayer();\n });\n\n adUnit.on('AdPaused', function () {\n player.trigger('vpaid.AdPaused');\n tracker.trackPause();\n notifyPauseToPlayer();\n });\n\n function notifyPlayToPlayer(){\n if(that._adUnit && that._adUnit.isPaused()){\n that._adUnit._paused = false;\n }\n player.trigger('play');\n\n }\n\n function notifyPauseToPlayer() {\n if(that._adUnit){\n that._adUnit._paused = true;\n }\n player.trigger('pause');\n }\n\n adUnit.on('AdVideoFirstQuartile', function () {\n player.trigger('vpaid.AdVideoFirstQuartile');\n tracker.trackFirstQuartile();\n });\n\n adUnit.on('AdVideoMidpoint', function () {\n player.trigger('vpaid.AdVideoMidpoint');\n tracker.trackMidpoint();\n });\n\n adUnit.on('AdVideoThirdQuartile', function () {\n player.trigger('vpaid.AdVideoThirdQuartile');\n tracker.trackThirdQuartile();\n });\n\n adUnit.on('AdVideoComplete', function () {\n player.trigger('vpaid.AdVideoComplete');\n tracker.trackComplete();\n });\n\n adUnit.on('AdClickThru', function (data) {\n player.trigger('vpaid.AdClickThru');\n var url = data.url;\n var playerHandles = data.playerHandles;\n var clickThruUrl = utilities.isNotEmptyString(url) ? url : generateClickThroughURL(vastResponse.clickThrough);\n\n tracker.trackClick();\n if (playerHandles && clickThruUrl) {\n window.open(clickThruUrl, '_blank');\n }\n\n function generateClickThroughURL(clickThroughMacro) {\n var variables = {\n ASSETURI: adUnit.options.src,\n CONTENTPLAYHEAD: 0 //In VPAID there is no method to know the current time from the adUnit\n };\n\n return clickThroughMacro ? vastUtil.parseURLMacro(clickThroughMacro, variables) : null;\n }\n });\n\n adUnit.on('AdUserAcceptInvitation', function () {\n player.trigger('vpaid.AdUserAcceptInvitation');\n tracker.trackAcceptInvitation();\n tracker.trackAcceptInvitationLinear();\n });\n\n adUnit.on('AdUserClose', function () {\n player.trigger('vpaid.AdUserClose');\n tracker.trackClose();\n tracker.trackCloseLinear();\n });\n\n adUnit.on('AdUserMinimize', function () {\n player.trigger('vpaid.AdUserMinimize');\n tracker.trackCollapse();\n });\n\n adUnit.on('AdError', function () {\n player.trigger('vpaid.AdError');\n //NOTE: we track errors code 901, as noted in VAST 3.0\n tracker.trackErrorWithCode(901);\n });\n\n adUnit.on('AdVolumeChange', function () {\n player.trigger('vpaid.AdVolumeChange');\n var lastVolume = player.volume();\n adUnit.getAdVolume(function (error, currentVolume) {\n if (currentVolume === 0 && lastVolume > 0) {\n tracker.trackMute();\n }\n\n if (currentVolume > 0 && lastVolume === 0) {\n tracker.trackUnmute();\n }\n\n player.volume(currentVolume);\n });\n });\n\n var updateViewSize = resizeAd.bind(this, player, adUnit, this.VIEW_MODE);\n var updateViewSizeThrottled = utilities.throttle(updateViewSize, 100);\n var autoResize = this.settings.autoResize;\n\n if (autoResize) {\n dom.addEventListener(window, 'resize', updateViewSizeThrottled);\n dom.addEventListener(window, 'orientationchange', updateViewSizeThrottled);\n }\n\n player.on('vast.resize', updateViewSize);\n player.on('vpaid.pauseAd', pauseAdUnit);\n player.on('vpaid.resumeAd', resumeAdUnit);\n\n player.one('vpaid.adEnd', function () {\n player.off('vast.resize', updateViewSize);\n player.off('vpaid.pauseAd', pauseAdUnit);\n player.off('vpaid.resumeAd', resumeAdUnit);\n\n if (autoResize) {\n dom.removeEventListener(window, 'resize', updateViewSizeThrottled);\n dom.removeEventListener(window, 'orientationchange', updateViewSizeThrottled);\n }\n });\n\n next(null, adUnit, vastResponse);\n\n /*** Local Functions ***/\n function pauseAdUnit() {\n adUnit.pauseAd(utilities.noop);\n }\n\n function resumeAdUnit() {\n adUnit.resumeAd(utilities.noop);\n }\n};\n\nVPAIDIntegrator.prototype._addSkipButton = function (adUnit, vastResponse, next) {\n var skipButton;\n var player = this.player;\n\n adUnit.on('AdSkippableStateChange', updateSkipButtonState);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeSkipButton);\n\n next(null, adUnit, vastResponse);\n\n /*** Local function ***/\n function updateSkipButtonState() {\n player.trigger('vpaid.AdSkippableStateChange');\n adUnit.getAdSkippableState(function (error, isSkippable) {\n if (isSkippable) {\n if (!skipButton) {\n addSkipButton(player);\n }\n } else {\n removeSkipButton(player);\n }\n });\n }\n\n function addSkipButton(player) {\n skipButton = createSkipButton(player);\n player.el().appendChild(skipButton);\n }\n\n function removeSkipButton() {\n dom.remove(skipButton);\n skipButton = null;\n }\n\n function createSkipButton() {\n var skipButton = window.document.createElement(\"div\");\n dom.addClass(skipButton, \"vast-skip-button\");\n dom.addClass(skipButton, \"enabled\");\n skipButton.innerHTML = \"Skip ad\";\n\n skipButton.onclick = function (e) {\n adUnit.skipAd(utilities.noop);//We skip the adUnit\n\n //We prevent event propagation to avoid problems with the clickThrough and so on\n if (window.Event.prototype.stopPropagation !== undefined) {\n e.stopPropagation();\n } else {\n return false;\n }\n };\n\n return skipButton;\n }\n};\n\nVPAIDIntegrator.prototype._linkPlayerControls = function (adUnit, vastResponse, next) {\n var that = this;\n linkVolumeControl(this.player, adUnit);\n linkFullScreenControl(this.player, adUnit, this.VIEW_MODE);\n\n next(null, adUnit, vastResponse);\n\n /*** Local functions ***/\n function linkVolumeControl(player, adUnit) {\n player.on('volumechange', updateAdUnitVolume);\n adUnit.on('AdVolumeChange', updatePlayerVolume);\n\n player.one('vpaid.adEnd', function () {\n player.off('volumechange', updateAdUnitVolume);\n });\n\n\n /*** local functions ***/\n function updateAdUnitVolume() {\n var vol = player.muted() ? 0 : player.volume();\n adUnit.setAdVolume(vol, logError);\n }\n\n function updatePlayerVolume() {\n player.trigger('vpaid.AdVolumeChange');\n adUnit.getAdVolume(function (error, vol) {\n if (error) {\n logError(error);\n } else {\n player.volume(vol);\n }\n });\n }\n }\n\n function linkFullScreenControl(player, adUnit, VIEW_MODE) {\n var updateViewSize = resizeAd.bind(that, player, adUnit, VIEW_MODE);\n\n player.on('fullscreenchange', updateViewSize);\n\n player.one('vpaid.adEnd', function () {\n player.off('fullscreenchange', updateViewSize);\n });\n }\n};\n\nVPAIDIntegrator.prototype._startAd = function (adUnit, vastResponse, next) {\n var player = this.player;\n\n adUnit.startAd(function (error) {\n if (!error) {\n player.trigger('vast.adStart');\n }\n next(error, adUnit, vastResponse);\n });\n};\n\nVPAIDIntegrator.prototype._finishPlaying = function (adUnit, vastResponse, next) {\n var player = this.player;\n adUnit.on('AdStopped', function () {\n player.trigger('vpaid.AdStopped');\n finishPlayingAd(null);\n });\n\n adUnit.on('AdError', function (error) {\n var errMsg = error? error.message : 'on VPAIDIntegrator, error while waiting for the adUnit to finish playing';\n finishPlayingAd(new VASTError(errMsg));\n });\n\n /*** local functions ***/\n function finishPlayingAd(error) {\n next(error, adUnit, vastResponse);\n }\n};\n\nVPAIDIntegrator.prototype._trackError = function trackError(response, errorCode) {\n vastUtil.track(response.errorURLMacros, {ERRORCODE: errorCode || 901});\n};\n\nfunction resizeAd(player, adUnit, VIEW_MODE) {\n var tech = player.el().querySelector('.vjs-tech');\n var dimension = dom.getDimension(tech);\n var MODE = player.isFullscreen() ? VIEW_MODE.FULLSCREEN : VIEW_MODE.NORMAL;\n adUnit.resizeAd(dimension.width, dimension.height, MODE, logError);\n}\n\nfunction logError(error) {\n if (error && console && console.log) {\n console.log('ERROR: ' + error.message, error);\n }\n}\n\nmodule.exports = VPAIDIntegrator;","'use strict';\n\nvar dom = require('../../utils/dom');\n\nvar element = document.createElement('div');\nelement.className = 'vjs-ads-label vjs-control vjs-label-hidden';\nelement.innerHTML = 'Advertisement';\n\nvar AdsLabelFactory = function(baseComponent) {\n return {\n /** @constructor */\n init: function init(player, options) {\n options.el = element;\n baseComponent.call(this, player, options);\n\n // We asynchronously reposition the ads label element\n setTimeout(function () {\n var currentTimeComp = player.controlBar &&( player.controlBar.getChild(\"timerControls\") || player.controlBar.getChild(\"currentTimeDisplay\") );\n if(currentTimeComp) {\n player.controlBar.el().insertBefore(element, currentTimeComp.el());\n }\n dom.removeClass(element, 'vjs-label-hidden');\n }, 0);\n },\n\n el: function getElement() {\n return element;\n }\n };\n};\n\nmodule.exports = AdsLabelFactory;","'use strict';\n\nvar baseVideoJsComponent = videojs.getComponent('Component');\n\nvar AdsLabel = require('./ads-label')(baseVideoJsComponent);\n\nvideojs.registerComponent('AdsLabel', videojs.extend(baseVideoJsComponent, AdsLabel));\n","'use strict';\n\n/**\n * The component that shows a black screen until the ads plugin has decided if it can or it can not play the ad.\n *\n * Note: In case you wonder why instead of this black poster we don't just show the spinner loader.\n * IOS devices do not work well with animations and the browser chrashes from time to time That is why we chose to\n * have a secondary black poster.\n *\n * It also makes it much more easier for the users of the plugin since it does not change the default behaviour of the\n * spinner and the player works the same way with and without the plugin.\n *\n * @param {vjs.Player|Object} player\n * @param {Object=} options\n * @constructor\n */\nvar element = document.createElement('div');\n\nvar BlackPosterFactory = function(baseComponent) {\n return {\n /** @constructor */\n init: function init(player, options) {\n options.el = element;\n element.className = 'vjs-black-poster';\n baseComponent.call(this, player, options);\n\n var posterImg = player.getChild('posterImage');\n\n //We need to do it asynchronously to be sure that the black poster el is on the dom.\n setTimeout(function() {\n if(posterImg && player && player.el()) {\n player.el().insertBefore(element, posterImg.el());\n }\n }, 0);\n },\n el: function getElement() {\n return element;\n }\n };\n};\n\nmodule.exports = BlackPosterFactory;","'use strict';\n\nvar baseVideoJsComponent = videojs.getComponent('Component');\n\nvar BlackPoster = require('./black-poster')(baseVideoJsComponent);\n\nvideojs.registerComponent('BlackPoster', videojs.extend(baseVideoJsComponent, BlackPoster));\n","'use strict';\n\nvar VASTClient = require('../ads/vast/VASTClient');\nvar VASTError = require('../ads/vast/VASTError');\nvar vastUtil = require('../ads/vast/vastUtil');\n\nvar VASTIntegrator = require('../ads/vast/VASTIntegrator');\nvar VPAIDIntegrator = require('../ads/vpaid/VPAIDIntegrator');\n\nvar async = require('../utils/async');\nvar dom = require('../utils/dom');\nvar playerUtils = require('../utils/playerUtils');\nvar utilities = require('../utils/utilityFunctions');\n\nmodule.exports = function VASTPlugin(options) {\n var snapshot;\n var player = this;\n var vast = new VASTClient();\n var adsCanceled = false;\n var defaultOpts = {\n // maximum amount of time in ms to wait to receive `adsready` from the ad\n // implementation after play has been requested. Ad implementations are\n // expected to load any dynamic libraries and make any requests to determine\n // ad policies for a video during this time.\n timeout: 500,\n\n //TODO:finish this IOS FIX\n //Whenever you play an add on IOS, the native player kicks in and we loose control of it. On very heavy pages the 'play' event\n // May occur after the video content has already started. This is wrong if you want to play a preroll ad that needs to happen before the user\n // starts watching the content. To prevent this usec\n iosPrerollCancelTimeout: 2000,\n\n // maximun amount of time for the ad to actually start playing. If this timeout gets\n // triggered the ads will be cancelled\n adCancelTimeout: 3000,\n\n // Boolean flag that configures the player to play a new ad before the user sees the video again\n // the current video\n playAdAlways: false,\n\n // Flag to enable or disable the ads by default.\n adsEnabled: true,\n\n // Boolean flag to enable or disable the resize with window.resize or orientationchange\n autoResize: true,\n\n // Path to the VPAID flash ad's loader\n vpaidFlashLoaderPath: '/VPAIDFlash.swf'\n };\n\n var settings = utilities.extend({}, defaultOpts, options || {});\n\n if(utilities.isUndefined(settings.adTagUrl) && utilities.isDefined(settings.url)){\n settings.adTagUrl = settings.url;\n }\n\n if (utilities.isString(settings.adTagUrl)) {\n settings.adTagUrl = utilities.echoFn(settings.adTagUrl);\n }\n\n if (utilities.isDefined(settings.adTagXML) && !utilities.isFunction(settings.adTagXML)) {\n return trackAdError(new VASTError('on VideoJS VAST plugin, the passed adTagXML option does not contain a function'));\n }\n\n if (!utilities.isDefined(settings.adTagUrl) && !utilities.isFunction(settings.adTagXML)) {\n return trackAdError(new VASTError('on VideoJS VAST plugin, missing adTagUrl on options object'));\n }\n\n vastUtil.runFlashSupportCheck(settings.vpaidFlashLoaderPath);// Necessary step for VPAIDFLASHClient to work.\n\n playerUtils.prepareForAds(player);\n\n if (settings.playAdAlways) {\n // No matter what happens we play a new ad before the user sees the video again.\n player.on('vast.contentEnd', function () {\n setTimeout(function () {\n player.trigger('vast.reset');\n }, 0);\n });\n }\n\n player.on('vast.firstPlay', tryToPlayPrerollAd);\n\n player.on('vast.reset', function () {\n //If we are reseting the plugin, we don't want to restore the content\n snapshot = null;\n cancelAds();\n });\n\n player.vast = {\n isEnabled: function () {\n return settings.adsEnabled;\n },\n\n enable: function () {\n settings.adsEnabled = true;\n },\n\n disable: function () {\n settings.adsEnabled = false;\n }\n };\n\n return player.vast;\n\n /**** Local functions ****/\n function tryToPlayPrerollAd() {\n //We remove the poster to prevent flickering whenever the content starts playing\n playerUtils.removeNativePoster(player);\n\n playerUtils.once(player, ['vast.adsCancel', 'vast.adEnd'], function () {\n removeAdUnit();\n restoreVideoContent();\n });\n\n async.waterfall([\n checkAdsEnabled,\n preparePlayerForAd,\n startAdCancelTimeout,\n playPrerollAd\n ], function (error, response) {\n if (error) {\n trackAdError(error, response);\n } else {\n player.trigger('vast.adEnd');\n }\n });\n\n /*** Local functions ***/\n\n function removeAdUnit() {\n if (player.vast && player.vast.adUnit) {\n player.vast.adUnit = null; //We remove the adUnit\n }\n }\n\n function restoreVideoContent() {\n setupContentEvents();\n if (snapshot) {\n playerUtils.restorePlayerSnapshot(player, snapshot);\n snapshot = null;\n }\n }\n\n function setupContentEvents() {\n playerUtils.once(player, ['playing', 'vast.reset', 'vast.firstPlay'], function (evt) {\n if (evt.type !== 'playing') {\n return;\n }\n\n player.trigger('vast.contentStart');\n\n playerUtils.once(player, ['ended', 'vast.reset', 'vast.firstPlay'], function (evt) {\n if (evt.type === 'ended') {\n player.trigger('vast.contentEnd');\n }\n });\n });\n }\n\n function checkAdsEnabled(next) {\n if (settings.adsEnabled) {\n return next(null);\n }\n next(new VASTError('Ads are not enabled'));\n }\n\n function preparePlayerForAd(next) {\n if (canPlayPrerollAd()) {\n snapshot = playerUtils.getPlayerSnapshot(player);\n player.pause();\n addSpinnerIcon();\n\n if(player.paused()) {\n next(null);\n } else {\n playerUtils.once(player, ['playing'], function() {\n player.pause();\n next(null);\n });\n }\n } else {\n next(new VASTError('video content has been playing before preroll ad'));\n }\n }\n\n function canPlayPrerollAd() {\n return !utilities.isIPhone() || player.currentTime() <= settings.iosPrerollCancelTimeout;\n }\n\n function startAdCancelTimeout(next) {\n var adCancelTimeoutId;\n adsCanceled = false;\n\n adCancelTimeoutId = setTimeout(function () {\n trackAdError(new VASTError('timeout while waiting for the video to start playing', 402));\n }, settings.adCancelTimeout);\n\n playerUtils.once(player, ['vast.adStart', 'vast.adsCancel'], clearAdCancelTimeout);\n\n /*** local functions ***/\n function clearAdCancelTimeout() {\n if (adCancelTimeoutId) {\n clearTimeout(adCancelTimeoutId);\n adCancelTimeoutId = null;\n }\n }\n\n next(null);\n }\n\n function addSpinnerIcon() {\n dom.addClass(player.el(), 'vjs-vast-ad-loading');\n playerUtils.once(player, ['vast.adStart', 'vast.adsCancel'], removeSpinnerIcon);\n }\n\n function removeSpinnerIcon() {\n //IMPORTANT NOTE: We remove the spinnerIcon asynchronously to give time to the browser to start the video.\n // If we remove it synchronously we see a flash of the content video before the ad starts playing.\n setTimeout(function () {\n dom.removeClass(player.el(), 'vjs-vast-ad-loading');\n }, 100);\n }\n\n }\n\n function cancelAds() {\n player.trigger('vast.adsCancel');\n adsCanceled = true;\n }\n\n function playPrerollAd(callback) {\n async.waterfall([\n getVastResponse,\n playAd\n ], callback);\n }\n\n function getVastResponse(callback) {\n vast.getVASTResponse(settings.adTagUrl ? settings.adTagUrl() : settings.adTagXML, callback);\n }\n\n function playAd(vastResponse, callback) {\n //TODO: Find a better way to stop the play. The 'playPrerollWaterfall' ends in an inconsistent situation\n //If the state is not 'preroll?' it means the ads were canceled therefore, we break the waterfall\n if (adsCanceled) {\n return;\n }\n\n var adIntegrator = isVPAID(vastResponse) ? new VPAIDIntegrator(player, settings) : new VASTIntegrator(player);\n var adFinished = false;\n\n playerUtils.once(player, ['vast.adStart', 'vast.adsCancel'], function (evt) {\n if (evt.type === 'vast.adStart') {\n addAdsLabel();\n }\n });\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeAdsLabel);\n\n if (utilities.isIDevice()) {\n preventManualProgress();\n }\n\n player.vast.vastResponse = vastResponse;\n player.vast.adUnit = adIntegrator.playAd(vastResponse, callback);\n\n /*** Local functions ****/\n function addAdsLabel() {\n if (adFinished || player.controlBar.getChild('AdsLabel')) {\n return;\n }\n\n player.controlBar.addChild('AdsLabel');\n }\n\n function removeAdsLabel() {\n player.controlBar.removeChild('AdsLabel');\n adFinished = true;\n }\n\n function preventManualProgress() {\n //IOS video clock is very unreliable and we need a 3 seconds threshold to ensure that the user forwarded/rewound the ad\n var PROGRESS_THRESHOLD = 3;\n var previousTime = 0;\n var skipad_attempts = 0;\n\n player.on('timeupdate', preventAdSeek);\n player.on('ended', preventAdSkip);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel', 'vast.adError'], stopPreventManualProgress);\n\n /*** Local functions ***/\n function preventAdSkip() {\n // Ignore ended event if the Ad time was not 'near' the end\n // and revert time to the previous 'valid' time\n if ((player.duration() - previousTime) > PROGRESS_THRESHOLD) {\n player.pause(true); // this reduce the video jitter if the IOS skip button is pressed\n player.play(true); // we need to trigger the play to put the video element back in a valid state\n player.currentTime(previousTime);\n }\n }\n\n function preventAdSeek() {\n var currentTime = player.currentTime();\n var progressDelta = Math.abs(currentTime - previousTime);\n if (progressDelta > PROGRESS_THRESHOLD) {\n skipad_attempts += 1;\n if (skipad_attempts >= 2) {\n player.pause(true);\n }\n player.currentTime(previousTime);\n } else {\n previousTime = currentTime;\n }\n }\n\n function stopPreventManualProgress() {\n player.off('timeupdate', preventAdSeek);\n player.off('ended', preventAdSkip);\n }\n }\n }\n\n function trackAdError(error, vastResponse) {\n player.trigger({type: 'vast.adError', error: error});\n cancelAds();\n if (console && console.log) {\n console.log('AD ERROR:', error.message, error, vastResponse);\n }\n }\n\n function isVPAID(vastResponse) {\n var i, len;\n var mediaFiles = vastResponse.mediaFiles;\n for (i = 0, len = mediaFiles.length; i < len; i++) {\n if (vastUtil.isVPAID(mediaFiles[i])) {\n return true;\n }\n }\n return false;\n }\n};\n","//Small subset of async\n\nvar utilities = require('./utilityFunctions');\n\nvar async = {};\n\nasync.setImmediate = function (fn) {\n setTimeout(fn, 0);\n};\n\nasync.iterator = function (tasks) {\n var makeCallback = function (index) {\n var fn = function () {\n if (tasks.length) {\n tasks[index].apply(null, arguments);\n }\n return fn.next();\n };\n fn.next = function () {\n return (index < tasks.length - 1) ? makeCallback(index + 1) : null;\n };\n return fn;\n };\n return makeCallback(0);\n};\n\n\nasync.waterfall = function (tasks, callback) {\n callback = callback || function () { };\n if (!utilities.isArray(tasks)) {\n var err = new Error('First argument to waterfall must be an array of functions');\n return callback(err);\n }\n if (!tasks.length) {\n return callback();\n }\n var wrapIterator = function (iterator) {\n return function (err) {\n if (err) {\n callback.apply(null, arguments);\n callback = function () {\n };\n }\n else {\n var args = Array.prototype.slice.call(arguments, 1);\n var next = iterator.next();\n if (next) {\n args.push(wrapIterator(next));\n }\n else {\n args.push(callback);\n }\n async.setImmediate(function () {\n iterator.apply(null, args);\n });\n }\n };\n };\n wrapIterator(async.iterator(tasks))();\n};\n\nasync.when = function (condition, callback) {\n if (!utilities.isFunction(callback)) {\n throw new Error(\"async.when error: missing callback argument\");\n }\n\n var isAllowed = utilities.isFunction(condition) ? condition : function () {\n return !!condition;\n };\n\n return function () {\n var args = utilities.arrayLikeObjToArray(arguments);\n var next = args.pop();\n\n if (isAllowed.apply(null, args)) {\n return callback.apply(this, arguments);\n }\n\n args.unshift(null);\n return next.apply(null, args);\n };\n};\n\nmodule.exports = async;\n\n","'use strict';\n\nvar utilities = require('./utilityFunctions');\n\nvar dom = {};\n\ndom.isVisible = function isVisible(el) {\n var style = window.getComputedStyle(el);\n return style.visibility !== 'hidden';\n};\n\ndom.isHidden = function isHidden(el) {\n var style = window.getComputedStyle(el);\n return style.display === 'none';\n};\n\ndom.isShown = function isShown(el) {\n return !dom.isHidden(el);\n};\n\ndom.hide = function hide(el) {\n el.__prev_style_display_ = el.style.display;\n el.style.display = 'none';\n};\n\ndom.show = function show(el) {\n if (dom.isHidden(el)) {\n el.style.display = el.__prev_style_display_;\n }\n el.__prev_style_display_ = undefined;\n};\n\ndom.hasClass = function hasClass(el, cssClass) {\n var classes, i, len;\n\n if (utilities.isNotEmptyString(cssClass)) {\n if (el.classList) {\n return el.classList.contains(cssClass);\n }\n\n classes = utilities.isString(el.getAttribute('class')) ? el.getAttribute('class').split(/\\s+/) : [];\n cssClass = (cssClass || '');\n\n for (i = 0, len = classes.length; i < len; i += 1) {\n if (classes[i] === cssClass) {\n return true;\n }\n }\n }\n return false;\n};\n\ndom.addClass = function (el, cssClass) {\n var classes;\n\n if (utilities.isNotEmptyString(cssClass)) {\n if (el.classList) {\n return el.classList.add(cssClass);\n }\n\n classes = utilities.isString(el.getAttribute('class')) ? el.getAttribute('class').split(/\\s+/) : [];\n if (utilities.isString(cssClass) && utilities.isNotEmptyString(cssClass.replace(/\\s+/, ''))) {\n classes.push(cssClass);\n el.setAttribute('class', classes.join(' '));\n }\n }\n};\n\ndom.removeClass = function (el, cssClass) {\n var classes;\n\n if (utilities.isNotEmptyString(cssClass)) {\n if (el.classList) {\n return el.classList.remove(cssClass);\n }\n\n classes = utilities.isString(el.getAttribute('class')) ? el.getAttribute('class').split(/\\s+/) : [];\n var newClasses = [];\n var i, len;\n if (utilities.isString(cssClass) && utilities.isNotEmptyString(cssClass.replace(/\\s+/, ''))) {\n\n for (i = 0, len = classes.length; i < len; i += 1) {\n if (cssClass !== classes[i]) {\n newClasses.push(classes[i]);\n }\n }\n el.setAttribute('class', newClasses.join(' '));\n }\n }\n};\n\ndom.addEventListener = function addEventListener(el, type, handler) {\n if(utilities.isArray(el)){\n utilities.forEach(el, function(e) {\n dom.addEventListener(e, type, handler);\n });\n return;\n }\n\n if(utilities.isArray(type)){\n utilities.forEach(type, function(t) {\n dom.addEventListener(el, t, handler);\n });\n return;\n }\n\n if (el.addEventListener) {\n el.addEventListener(type, handler, false);\n } else if (el.attachEvent) {\n // WARNING!!! this is a very naive implementation !\n // the event object that should be passed to the handler\n // would not be there for IE8\n // we should use \"window.event\" and then \"event.srcElement\"\n // instead of \"event.target\"\n el.attachEvent(\"on\" + type, handler);\n }\n};\n\ndom.removeEventListener = function removeEventListener(el, type, handler) {\n if(utilities.isArray(el)){\n utilities.forEach(el, function(e) {\n dom.removeEventListener(e, type, handler);\n });\n return;\n }\n\n if(utilities.isArray(type)){\n utilities.forEach(type, function(t) {\n dom.removeEventListener(el, t, handler);\n });\n return;\n }\n\n if (el.removeEventListener) {\n el.removeEventListener(type, handler, false);\n } else if (el.detachEvent) {\n el.detachEvent(\"on\" + type, handler);\n } else {\n el[\"on\" + type] = null;\n }\n};\n\ndom.dispatchEvent = function dispatchEvent(el, event) {\n if (el.dispatchEvent) {\n el.dispatchEvent(event);\n } else {\n el.fireEvent(\"on\" + event.eventType, event);\n }\n};\n\ndom.isDescendant = function isDescendant(parent, child) {\n var node = child.parentNode;\n while (node !== null) {\n if (node === parent) {\n return true;\n }\n node = node.parentNode;\n }\n return false;\n};\n\ndom.getTextContent = function getTextContent(el){\n return el.textContent || el.text;\n};\n\ndom.prependChild = function prependChild(parent, child) {\n if(child.parentNode){\n child.parentNode.removeChild(child);\n }\n return parent.insertBefore(child, parent.firstChild);\n};\n\ndom.remove = function removeNode(node){\n if(node && node.parentNode){\n node.parentNode.removeChild(node);\n }\n};\n\ndom.isDomElement = function isDomElement(o) {\n return o instanceof Element;\n};\n\ndom.click = function(el, handler) {\n dom.addEventListener(el, 'click', handler);\n};\n\ndom.once = function(el, type, handler) {\n function handlerWrap() {\n handler.apply(null, arguments);\n dom.removeEventListener(el, type, handlerWrap);\n }\n\n dom.addEventListener(el, type, handlerWrap);\n};\n\n//Note: there is no getBoundingClientRect on iPad so we need a fallback\ndom.getDimension = function getDimension(element) {\n var rect;\n\n //On IE9 and below getBoundingClientRect does not work consistently\n if(!utilities.isOldIE() && element.getBoundingClientRect) {\n rect = element.getBoundingClientRect();\n return {\n width: rect.width,\n height: rect.height\n };\n }\n\n return {\n width: element.offsetWidth,\n height: element.offsetHeight\n };\n};\n\nmodule.exports = dom;","'use strict';\n\nvar urlUtils = require('./urlUtils');\nvar utilities = require('./utilityFunctions');\n\nfunction HttpRequestError(message) {\n this.message = 'HttpRequest Error: ' + (message || '');\n}\nHttpRequestError.prototype = new Error();\nHttpRequestError.prototype.name = \"HttpRequest Error\";\n\nfunction HttpRequest(createXhr) {\n if (!utilities.isFunction(createXhr)) {\n throw new HttpRequestError('Missing XMLHttpRequest factory method');\n }\n\n this.createXhr = createXhr;\n}\n\nHttpRequest.prototype.run = function (method, url, callback, options) {\n sanityCheck(url, callback, options);\n var timeout, timeoutId;\n var xhr = this.createXhr();\n options = options || {};\n timeout = utilities.isNumber(options.timeout) ? options.timeout : 0;\n\n xhr.open(method, urlUtils.urlParts(url).href, true);\n\n if (options.headers) {\n setHeaders(xhr, options.headers);\n }\n\n if (options.withCredentials) {\n xhr.withCredentials = true;\n }\n\n xhr.onload = function () {\n var statusText, response, status;\n\n /**\n * The only way to do a secure request on IE8 and IE9 is with the XDomainRequest object. Unfortunately, microsoft is\n * so nice that decided that the status property and the 'getAllResponseHeaders' method where not needed so we have to\n * fake them. If the request gets done with an XDomainRequest instance, we will assume that there are no headers and\n * the status will always be 200. If you don't like it, DO NOT USE ANCIENT BROWSERS!!!\n *\n * For mor info go to: https://msdn.microsoft.com/en-us/library/cc288060(v=vs.85).aspx\n */\n if (!xhr.getAllResponseHeaders) {\n xhr.getAllResponseHeaders = function () {\n return null;\n };\n }\n\n if (!xhr.status) {\n xhr.status = 200;\n }\n\n if (utilities.isDefined(timeoutId)) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n\n statusText = xhr.statusText || '';\n\n // responseText is the old-school way of retrieving response (supported by IE8 & 9)\n // response/responseType properties were introduced in XHR Level2 spec (supported by IE10)\n response = ('response' in xhr) ? xhr.response : xhr.responseText;\n\n // normalize IE9 bug (http://bugs.jquery.com/ticket/1450)\n status = xhr.status === 1223 ? 204 : xhr.status;\n\n callback(\n status,\n response,\n xhr.getAllResponseHeaders(),\n statusText);\n };\n\n xhr.onerror = requestError;\n xhr.onabort = requestError;\n\n xhr.send();\n\n if (timeout > 0) {\n timeoutId = setTimeout(function () {\n xhr && xhr.abort();\n }, timeout);\n }\n\n function sanityCheck(url, callback, options) {\n if (!utilities.isString(url) || utilities.isEmptyString(url)) {\n throw new HttpRequestError(\"Invalid url '\" + url + \"'\");\n }\n\n if (!utilities.isFunction(callback)) {\n throw new HttpRequestError(\"Invalid handler '\" + callback + \"' for the http request\");\n }\n\n if (utilities.isDefined(options) && !utilities.isObject(options)) {\n throw new HttpRequestError(\"Invalid options map '\" + options + \"'\");\n }\n }\n\n function setHeaders(xhr, headers) {\n utilities.forEach(headers, function (value, key) {\n if (utilities.isDefined(value)) {\n xhr.setRequestHeader(key, value);\n }\n });\n }\n\n function requestError() {\n callback(-1, null, null, '');\n }\n};\n\nHttpRequest.prototype.get = function (url, callback, options) {\n this.run('GET', url, processResponse, options);\n\n function processResponse(status, response, headersString, statusText) {\n if (isSuccess(status)) {\n callback(null, response, status, headersString, statusText);\n } else {\n callback(new HttpRequestError(statusText), response, status, headersString, statusText);\n }\n }\n\n function isSuccess(status) {\n return 200 <= status && status < 300;\n }\n};\n\nfunction createXhr() {\n var xhr = new XMLHttpRequest();\n if (!(\"withCredentials\" in xhr)) {\n // XDomainRequest for IE.\n xhr = new XDomainRequest();\n }\n return xhr;\n}\n\nvar http = new HttpRequest(createXhr);\n\nmodule.exports = {\n http: http,\n HttpRequest: HttpRequest,\n HttpRequestError: HttpRequestError,\n createXhr: createXhr\n};\n","'use strict';\n\nvar dom = require('./dom');\nvar utilities = require('./utilityFunctions');\n\nvar playerUtils = {};\n\n/**\n * Returns an object that captures the portions of player state relevant to\n * video playback. The result of this function can be passed to\n * restorePlayerSnapshot with a player to return the player to the state it\n * was in when this function was invoked.\n * @param {object} player The videojs player object\n */\nplayerUtils.getPlayerSnapshot = function getPlayerSnapshot(player) {\n var tech = player.el().querySelector('.vjs-tech');\n\n var snapshot = {\n ended: player.ended(),\n src: player.currentSrc(),\n currentTime: player.currentTime(),\n type: player.currentType(),\n playing: !player.paused(),\n suppressedTracks: getSuppressedTracks(player)\n };\n\n if (tech) {\n snapshot.nativePoster = tech.poster;\n snapshot.style = tech.getAttribute('style');\n }\n return snapshot;\n\n /**** Local Functions ****/\n function getSuppressedTracks(player) {\n var tracks = player.remoteTextTracks ? player.remoteTextTracks() : [];\n\n if (tracks && utilities.isArray(tracks.tracks_)) {\n tracks = tracks.tracks_;\n }\n\n if (!utilities.isArray(tracks)) {\n tracks = [];\n }\n\n var suppressedTracks = [];\n tracks.forEach(function (track) {\n suppressedTracks.push({\n track: track,\n mode: track.mode\n });\n track.mode = 'disabled';\n });\n\n return suppressedTracks;\n }\n};\n\n/**\n * Attempts to modify the specified player so that its state is equivalent to\n * the state of the snapshot.\n * @param {object} snapshot - the player state to apply\n */\nplayerUtils.restorePlayerSnapshot = function restorePlayerSnapshot(player, snapshot) {\n var tech = player.el().querySelector('.vjs-tech');\n var attempts = 20; // the number of remaining attempts to restore the snapshot\n\n if (snapshot.nativePoster) {\n tech.poster = snapshot.nativePoster;\n }\n\n if ('style' in snapshot) {\n // overwrite all css style properties to restore state precisely\n tech.setAttribute('style', snapshot.style || '');\n }\n\n if (hasSrcChanged(player, snapshot)) {\n\n // on ios7, fiddling with textTracks too early will cause safari to crash\n player.one('contentloadedmetadata', restoreTracks);\n\n player.one('canplay', tryToResume);\n ensureCanplayEvtGetsFired();\n\n // if the src changed for ad playback, reset it\n player.src({src: snapshot.src, type: snapshot.type});\n\n // safari requires a call to `load` to pick up a changed source\n player.load();\n\n } else {\n restoreTracks();\n\n if (snapshot.playing) {\n player.play();\n }\n }\n\n /*** Local Functions ***/\n\n /**\n * Sometimes firefox does not trigger the 'canplay' evt.\n * This code ensure that it always gets triggered triggered.\n */\n function ensureCanplayEvtGetsFired() {\n var timeoutId = setTimeout(function() {\n player.trigger('canplay');\n }, 1000);\n\n player.one('canplay', function(){\n clearTimeout(timeoutId);\n });\n }\n\n /**\n * Determine whether the player needs to be restored to its state\n * before ad playback began. With a custom ad display or burned-in\n * ads, the content player state hasn't been modified and so no\n * restoration is required\n */\n function hasSrcChanged(player, snapshot) {\n if (player.src()) {\n return player.src() !== snapshot.src;\n }\n // the player was configured through source element children\n return player.currentSrc() !== snapshot.src;\n }\n\n function restoreTracks() {\n var suppressedTracks = snapshot.suppressedTracks;\n suppressedTracks.forEach(function (trackSnapshot) {\n trackSnapshot.track.mode = trackSnapshot.mode;\n });\n }\n\n /**\n * Determine if the video element has loaded enough of the snapshot source\n * to be ready to apply the rest of the state\n */\n function tryToResume() {\n\n // if some period of the video is seekable, resume playback\n // otherwise delay a bit and then check again unless we're out of attempts\n\n if (!playerUtils.isReadyToResume(player) && attempts--) {\n setTimeout(tryToResume, 50);\n } else {\n try {\n if(player.currentTime() !== snapshot.currentTime) {\n if (snapshot.playing) { // if needed restore playing status after seek completes\n player.one('seeked', function() {\n player.play();\n });\n }\n player.currentTime(snapshot.currentTime);\n\n } else if (snapshot.playing) {\n // if needed and no seek has been performed, restore playing status immediately\n player.play();\n }\n\n } catch (e) {\n videojs.log.warn('Failed to resume the content after an advertisement', e);\n }\n }\n }\n};\n\nplayerUtils.isReadyToResume = function (player) {\n\n if (player.readyState() > 1) {\n // some browsers and media aren't \"seekable\".\n // readyState greater than 1 allows for seeking without exceptions\n return true;\n }\n\n if (player.seekable() === undefined) {\n // if the player doesn't expose the seekable time ranges, try to\n // resume playback immediately\n return true;\n }\n\n if (player.seekable().length > 0) {\n // if some period of the video is seekable, resume playback\n return true;\n }\n\n return false;\n};\n\n/**\n * This function prepares the player to display ads.\n * Adding convenience events like the 'vast.firsPlay' that gets fired when the video is first played\n * and ads the blackPoster to the player to prevent content from being displayed before the preroll ad.\n *\n * @param player\n */\nplayerUtils.prepareForAds = function (player) {\n var blackPoster = player.addChild('blackPoster');\n var _firstPlay = true;\n var volumeSnapshot;\n\n\n monkeyPatchPlayerApi();\n\n player.on('play', tryToTriggerFirstPlay);\n player.on('vast.reset', resetFirstPlay);//Every time we change the sources we reset the first play.\n player.on('vast.firstPlay', restoreContentVolume);\n player.on('error', hideBlackPoster);//If there is an error in the player we remove the blackposter to show the err msg\n player.on('vast.adStart', hideBlackPoster);\n player.on('vast.adsCancel', hideBlackPoster);\n player.on('vast.adError', hideBlackPoster);\n player.on('vast.adStart', addStyles);\n player.on('vast.adEnd', removeStyles);\n player.on('vast.adsCancel', removeStyles);\n\n /*** Local Functions ***/\n\n /**\n What this function does is ugly and horrible and I should think twice before calling myself a good developer. With that said,\n it is the best solution I could find to mute the video until the 'play' event happens (on mobile devices) and the plugin can decide whether\n to play the ad or not.\n\n We also need this monkeypatch to be able to pause and resume an ad using the player's API\n\n If you have a better solution please do tell me.\n */\n function monkeyPatchPlayerApi() {\n\n /**\n * Monkey patch needed to handle firstPlay and resume of playing ad.\n *\n * @param callOrigPlay necessary flag to prevent infinite loop when you are restoring a VAST ad.\n * @returns {player}\n */\n var origPlay = player.play;\n player.play = function (callOrigPlay) {\n var that = this;\n\n if (isFirstPlay()) {\n firstPlay();\n } else {\n resume(callOrigPlay);\n }\n\n return this;\n\n /*** local functions ***/\n function firstPlay() {\n if (!utilities.isIPhone()) {\n volumeSnapshot = saveVolumeSnapshot();\n player.muted(true);\n }\n\n origPlay.apply(that, arguments);\n }\n\n function resume(callOrigPlay) {\n if (isAdPlaying() && !callOrigPlay) {\n player.vast.adUnit.resumeAd();\n } else {\n origPlay.apply(that, arguments);\n }\n }\n };\n\n\n /**\n * Needed monkey patch to handle pause of playing ad.\n *\n * @param callOrigPlay necessary flag to prevent infinite loop when you are pausing a VAST ad.\n * @returns {player}\n */\n var origPause = player.pause;\n player.pause = function (callOrigPause) {\n if (isAdPlaying() && !callOrigPause) {\n player.vast.adUnit.pauseAd();\n } else {\n origPause.apply(this, arguments);\n }\n return this;\n };\n\n\n /**\n * Needed monkey patch to handle paused state of the player when ads are playing.\n *\n * @param callOrigPlay necessary flag to prevent infinite loop when you are pausing a VAST ad.\n * @returns {player}\n */\n var origPaused = player.paused;\n player.paused = function (callOrigPaused) {\n if (isAdPlaying() && !callOrigPaused) {\n return player.vast.adUnit.isPaused();\n }\n return origPaused.apply(this, arguments);\n };\n }\n\n function isAdPlaying() {\n return player.vast && player.vast.adUnit;\n }\n\n function tryToTriggerFirstPlay() {\n if (isFirstPlay()) {\n _firstPlay = false;\n player.trigger('vast.firstPlay');\n }\n }\n\n function resetFirstPlay() {\n _firstPlay = true;\n blackPoster.show();\n restoreContentVolume();\n }\n\n function isFirstPlay() {\n return _firstPlay;\n }\n\n function saveVolumeSnapshot() {\n return {\n muted: player.muted(),\n volume: player.volume()\n };\n }\n\n function restoreContentVolume() {\n if (volumeSnapshot) {\n player.currentTime(0);\n restoreVolumeSnapshot(volumeSnapshot);\n volumeSnapshot = null;\n }\n }\n\n function restoreVolumeSnapshot(snapshot) {\n if (utilities.isObject(snapshot)) {\n player.volume(snapshot.volume);\n player.muted(snapshot.muted);\n }\n }\n\n function hideBlackPoster() {\n if (!dom.hasClass(blackPoster.el(), 'vjs-hidden')) {\n blackPoster.hide();\n }\n }\n\n function addStyles() {\n dom.addClass(player.el(), 'vjs-ad-playing');\n }\n\n function removeStyles() {\n dom.removeClass(player.el(), 'vjs-ad-playing');\n }\n};\n\n/**\n * Remove the poster attribute from the video element tech, if present. When\n * reusing a video element for multiple videos, the poster image will briefly\n * reappear while the new source loads. Removing the attribute ahead of time\n * prevents the poster from showing up between videos.\n * @param {object} player The videojs player object\n */\nplayerUtils.removeNativePoster = function (player) {\n var tech = player.el().querySelector('.vjs-tech');\n if (tech) {\n tech.removeAttribute('poster');\n }\n};\n\n/**\n * Helper function to listen to many events until one of them gets fired, then we\n * execute the handler and unsubscribe all the event listeners;\n *\n * @param player specific player from where to listen for the events\n * @param events array of events\n * @param handler function to execute once one of the events fires\n */\nplayerUtils.once = function once(player, events, handler) {\n function listener() {\n handler.apply(null, arguments);\n\n events.forEach(function (event) {\n player.off(event, listener);\n });\n }\n\n events.forEach(function (event) {\n player.on(event, listener);\n });\n};\n\n\nmodule.exports = playerUtils;","'use strict';\n\nvar utilities = require('./utilityFunctions');\n\n/**\n *\n * IMPORTANT NOTE: This function comes from angularJs and was originally called urlResolve\n * you can take a look at the original code here https://github.com/angular/angular.js/blob/master/src/ng/urlUtils.js\n *\n * Implementation Notes for non-IE browsers\n * ----------------------------------------\n * Assigning a URL to the href property of an anchor DOM node, even one attached to the DOM,\n * results both in the normalizing and parsing of the URL. Normalizing means that a relative\n * URL will be resolved into an absolute URL in the context of the application document.\n * Parsing means that the anchor node's host, hostname, protocol, port, pathname and related\n * properties are all populated to reflect the normalized URL. This approach has wide\n * compatibility - Safari 1+, Mozilla 1+, Opera 7+,e etc. See\n * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html\n *\n * Implementation Notes for IE\n * ---------------------------\n * IE >= 8 and <= 10 normalizes the URL when assigned to the anchor node similar to the other\n * browsers. However, the parsed components will not be set if the URL assigned did not specify\n * them. (e.g. if you assign a.href = \"foo\", then a.protocol, a.host, etc. will be empty.) We\n * work around that by performing the parsing in a 2nd step by taking a previously normalized\n * URL (e.g. by assigning to a.href) and assigning it a.href again. This correctly populates the\n * properties such as protocol, hostname, port, etc.\n *\n * IE7 does not normalize the URL when assigned to an anchor node. (Apparently, it does, if one\n * uses the inner HTML approach to assign the URL as part of an HTML snippet -\n * http://stackoverflow.com/a/472729) However, setting img[src] does normalize the URL.\n * Unfortunately, setting img[src] to something like \"javascript:foo\" on IE throws an exception.\n * Since the primary usage for normalizing URLs is to sanitize such URLs, we can't use that\n * method and IE < 8 is unsupported.\n *\n * References:\n * http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement\n * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html\n * http://url.spec.whatwg.org/#urlutils\n * https://github.com/angular/angular.js/pull/2902\n * http://james.padolsey.com/javascript/parsing-urls-with-the-dom/\n *\n * @kind function\n * @param {string} url The URL to be parsed.\n * @description Normalizes and parses a URL.\n * @returns {object} Returns the normalized URL as a dictionary.\n *\n * | member name | Description |\n * |---------------|----------------|\n * | href | A normalized version of the provided URL if it was not an absolute URL |\n * | protocol | The protocol including the trailing colon |\n * | host | The host and port (if the port is non-default) of the normalizedUrl |\n * | search | The search params, minus the question mark |\n * | hash | The hash string, minus the hash symbol\n * | hostname | The hostname\n * | port | The port, without \":\"\n * | pathname | The pathname, beginning with \"/\"\n *\n */\n\nvar urlParsingNode = document.createElement(\"a\");\n/**\n * documentMode is an IE-only property\n * http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx\n */\nvar msie = document.documentMode;\n\nfunction urlParts(url) {\n var href = url;\n\n if (msie) {\n // Normalize before parse. Refer Implementation Notes on why this is\n // done in two steps on IE.\n urlParsingNode.setAttribute(\"href\", href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: utilities.isNotEmptyString(urlParsingNode.port)? urlParsingNode.port: 80,\n pathname: (urlParsingNode.pathname.charAt(0) === '/')\n ? urlParsingNode.pathname\n : '/' + urlParsingNode.pathname\n };\n}\n\n\n/**\n * This function accepts a query string (search part of a url) and returns a dictionary with\n * the different key value pairs\n * @param {string} qs queryString\n */\nfunction queryStringToObj(qs, cond) {\n var pairs, qsObj;\n\n cond = utilities.isFunction(cond)? cond : function() {\n return true;\n };\n\n qs = qs.trim().replace(/^\\?/, '');\n pairs = qs.split('&');\n qsObj = {};\n\n utilities.forEach(pairs, function (pair) {\n var keyValue, key, value;\n if (pair !== '') {\n keyValue = pair.split('=');\n key = keyValue[0];\n value = keyValue[1];\n if(cond(key, value)){\n qsObj[key] = value;\n }\n }\n });\n\n return qsObj;\n}\n\n/**\n * This function accepts an object and serializes it into a query string without the leading '?'\n * @param obj\n * @returns {string}\n */\nfunction objToQueryString(obj) {\n var pairs = [];\n utilities.forEach(obj, function (value, key) {\n pairs.push(key + '=' + value);\n });\n return pairs.join('&');\n}\n\nmodule.exports = {\n urlParts: urlParts,\n queryStringToObj: queryStringToObj,\n objToQueryString: objToQueryString\n};\n","/*jshint unused:false */\n\"use strict\";\n\nvar NODE_TYPE_ELEMENT = 1;\nvar SNAKE_CASE_REGEXP = /[A-Z]/g;\nvar EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i;\n/*jslint maxlen: 500 */\nvar ISO8086_REGEXP = /^([\\+-]?\\d{4}(?!\\d{2}\\b))((-?)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))?|W([0-4]\\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6])))([T\\s]((([01]\\d|2[0-3])((:?)[0-5]\\d)?|24\\:?00)([\\.,]\\d+(?!:))?)?(\\17[0-5]\\d([\\.,]\\d+)?)?([zZ]|([\\+-])([01]\\d|2[0-3]):?([0-5]\\d)?)?)?)?$/;\n\n\nfunction noop(){ }\n\nfunction isNull(o) {\n return o === null;\n}\n\nfunction isDefined(o){\n return o !== undefined;\n}\n\nfunction isUndefined(o){\n return o === undefined;\n}\n\nfunction isObject(obj) {\n return typeof obj === 'object';\n}\n\nfunction isFunction(str){\n return typeof str === 'function';\n}\n\nfunction isNumber(num){\n return typeof num === 'number';\n}\n\nfunction isWindow(obj) {\n return utilities.isObject(obj) && obj.window === obj;\n}\n\nfunction isArray(array){\n return Object.prototype.toString.call( array ) === '[object Array]';\n}\n\nfunction isArrayLike(obj) {\n if (obj === null || utilities.isWindow(obj) || utilities.isFunction(obj) || utilities.isUndefined(obj)) {\n return false;\n }\n\n var length = obj.length;\n\n if (obj.nodeType === NODE_TYPE_ELEMENT && length) {\n return true;\n }\n\n return utilities.isString(obj) || utilities.isArray(obj) || length === 0 ||\n typeof length === 'number' && length > 0 && (length - 1) in obj;\n}\n\nfunction isString(str){\n return typeof str === 'string';\n}\n\nfunction isEmptyString(str) {\n return utilities.isString(str) && str.length === 0;\n}\n\nfunction isNotEmptyString(str) {\n return utilities.isString(str) && str.length !== 0;\n}\n\nfunction arrayLikeObjToArray(args) {\n return Array.prototype.slice.call(args);\n}\n\nfunction forEach(obj, iterator, context) {\n var key, length;\n if (obj) {\n if (isFunction(obj)) {\n for (key in obj) {\n // Need to check if hasOwnProperty exists,\n // as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function\n if (key !== 'prototype' && key !== 'length' && key !== 'name' && (!obj.hasOwnProperty || obj.hasOwnProperty(key))) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n } else if (isArray(obj)) {\n var isPrimitive = typeof obj !== 'object';\n for (key = 0, length = obj.length; key < length; key++) {\n if (isPrimitive || key in obj) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n } else if (obj.forEach && obj.forEach !== forEach) {\n obj.forEach(iterator, context, obj);\n } else {\n for (key in obj) {\n if (obj.hasOwnProperty(key)) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n }\n }\n return obj;\n}\n\nfunction snake_case(name, separator) {\n separator = separator || '_';\n return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n}\n\nfunction isValidEmail(email){\n if(!utilities.isString(email)){\n return false;\n }\n\n return EMAIL_REGEXP.test(email.trim());\n}\n\nfunction extend (obj) {\n var arg, i, k;\n for (i = 1; i < arguments.length; i++) {\n arg = arguments[i];\n for (k in arg) {\n if (arg.hasOwnProperty(k)) {\n if(isObject(obj[k]) && !isNull(obj[k]) && isObject(arg[k])){\n obj[k] = extend({}, obj[k], arg[k]);\n }else {\n obj[k] = arg[k];\n }\n }\n }\n }\n return obj;\n}\n\nfunction capitalize(s){\n return s.charAt(0).toUpperCase() + s.slice(1);\n}\n\nfunction decapitalize(s) {\n return s.charAt(0).toLowerCase() + s.slice(1);\n}\n\n/**\n * This method works the same way array.prototype.map works but if the transformer returns undefine, then\n * it won't be added to the transformed Array.\n */\nfunction transformArray(array, transformer) {\n var transformedArray = [];\n\n array.forEach(function(item, index){\n var transformedItem = transformer(item, index);\n if(utilities.isDefined(transformedItem)) {\n transformedArray.push(transformedItem);\n }\n });\n\n return transformedArray;\n}\n\nfunction toFixedDigits(num, digits) {\n var formattedNum = num + '';\n digits = utilities.isNumber(digits) ? digits : 0;\n num = utilities.isNumber(num) ? num : parseInt(num, 10);\n if(utilities.isNumber(num) && !isNaN(num)){\n formattedNum = num + '';\n while(formattedNum.length < digits) {\n formattedNum = '0' + formattedNum;\n }\n return formattedNum;\n }\n return NaN + '';\n}\n\nfunction throttle(callback, delay) {\n var previousCall = new Date().getTime() - (delay + 1);\n return function() {\n var time = new Date().getTime();\n if ((time - previousCall) >= delay) {\n previousCall = time;\n callback.apply(this, arguments);\n }\n };\n}\n\nfunction debounce (callback, wait) {\n var timeoutId;\n\n return function (){\n if(timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(function(){\n callback.apply(this, arguments);\n timeoutId = undefined;\n }, wait);\n };\n}\n\n// a function designed to blow up the stack in a naive way\n// but it is ok for videoJs children components\nfunction treeSearch(root, getChildren, found){\n var children = getChildren(root);\n for (var i = 0; i < children.length; i++){\n if (found(children[i])) {\n return children[i];\n }\n else {\n var el = treeSearch(children[i], getChildren, found);\n if (el){\n return el;\n }\n }\n }\n}\n\nfunction echoFn(val) {\n return function () {\n return val;\n };\n}\n\n//Note: Supported formats come from http://www.w3.org/TR/NOTE-datetime\n// and the iso8601 regex comes from http://www.pelagodesign.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/\nfunction isISO8601(value) {\n if(utilities.isNumber(value)){\n value = value + ''; //we make sure that we are working with strings\n }\n\n if(!utilities.isString(value)){\n return false;\n }\n\n return ISO8086_REGEXP.test(value.trim());\n}\n\n/**\n * Checks if the Browser is IE9 and below\n * @returns {boolean}\n */\nfunction isOldIE() {\n var version = utilities.getInternetExplorerVersion(navigator);\n if (version === -1) {\n return false;\n }\n\n return version < 10;\n}\n\n/**\n * Returns the version of Internet Explorer or a -1 (indicating the use of another browser).\n * Source: https://msdn.microsoft.com/en-us/library/ms537509(v=vs.85).aspx\n * @returns {number} the version of Internet Explorer or a -1 (indicating the use of another browser).\n */\nfunction getInternetExplorerVersion(navigator) {\n var rv = -1;\n\n if (navigator.appName == 'Microsoft Internet Explorer') {\n var ua = navigator.userAgent;\n var re = new RegExp(\"MSIE ([0-9]{1,}[\\.0-9]{0,})\");\n var res = re.exec(ua);\n if (res !== null) {\n rv = parseFloat(res[1]);\n }\n }\n\n return rv;\n}\n\n/*** Mobile Utility functions ***/\nfunction isIDevice() {\n return /iP(hone|ad)/.test(utilities._UA);\n}\n\nfunction isMobile() {\n return /iP(hone|ad|od)|Android|Windows Phone/.test(utilities._UA);\n}\n\nfunction isIPhone() {\n return /iP(hone|od)/.test(utilities._UA);\n}\n\nfunction isAndroid() {\n return /Android/.test(utilities._UA);\n}\n\nvar utilities = {\n _UA: navigator.userAgent,\n noop: noop,\n isNull: isNull,\n isDefined: isDefined,\n isUndefined: isUndefined,\n isObject: isObject,\n isFunction: isFunction,\n isNumber: isNumber,\n isWindow: isWindow,\n isArray: isArray,\n isArrayLike: isArrayLike,\n isString: isString,\n isEmptyString: isEmptyString,\n isNotEmptyString: isNotEmptyString,\n arrayLikeObjToArray: arrayLikeObjToArray,\n forEach: forEach,\n snake_case: snake_case,\n isValidEmail: isValidEmail,\n extend: extend,\n capitalize: capitalize,\n decapitalize: decapitalize,\n transformArray: transformArray,\n toFixedDigits: toFixedDigits,\n throttle: throttle,\n debounce: debounce,\n treeSearch: treeSearch,\n echoFn: echoFn,\n isISO8601: isISO8601,\n isOldIE: isOldIE,\n getInternetExplorerVersion: getInternetExplorerVersion,\n isIDevice: isIDevice,\n isMobile: isMobile,\n isIPhone: isIPhone,\n isAndroid: isAndroid\n};\n\nmodule.exports = utilities;","'use strict';\n\nvar utilities = require('./utilityFunctions');\n\nvar xml = {};\n\nxml.strToXMLDoc = function strToXMLDoc(stringContainingXMLSource){\n //IE 8\n if(typeof window.DOMParser === 'undefined'){\n var xmlDocument = new ActiveXObject('Microsoft.XMLDOM');\n xmlDocument.async = false;\n xmlDocument.loadXML(stringContainingXMLSource);\n return xmlDocument;\n }\n\n return parseString(stringContainingXMLSource);\n\n function parseString(stringContainingXMLSource){\n var parser = new DOMParser();\n var parsedDocument;\n\n //Note: This try catch is to deal with the fact that on IE parser.parseFromString does throw an error but the rest of the browsers don't.\n try {\n parsedDocument = parser.parseFromString(stringContainingXMLSource, \"application/xml\");\n\n if(isParseError(parsedDocument) || utilities.isEmptyString(stringContainingXMLSource)){\n throw new Error();\n }\n }catch(e){\n throw new Error(\"xml.strToXMLDOC: Error parsing the string: '\" + stringContainingXMLSource + \"'\");\n }\n\n return parsedDocument;\n }\n\n function isParseError(parsedDocument) {\n try { // parser and parsererrorNS could be cached on startup for efficiency\n var parser = new DOMParser(),\n erroneousParse = parser.parseFromString('INVALID', 'text/xml'),\n parsererrorNS = erroneousParse.getElementsByTagName(\"parsererror\")[0].namespaceURI;\n\n if (parsererrorNS === 'http://www.w3.org/1999/xhtml') {\n // In PhantomJS the parseerror element doesn't seem to have a special namespace, so we are just guessing here :(\n return parsedDocument.getElementsByTagName(\"parsererror\").length > 0;\n }\n\n return parsedDocument.getElementsByTagNameNS(parsererrorNS, 'parsererror').length > 0;\n } catch (e) {\n //Note on IE parseString throws an error by itself and it will never reach this code. Because it will have failed before\n }\n }\n};\n\nxml.parseText = function parseText (sValue) {\n if (/^\\s*$/.test(sValue)) { return null; }\n if (/^(?:true|false)$/i.test(sValue)) { return sValue.toLowerCase() === \"true\"; }\n if (isFinite(sValue)) { return parseFloat(sValue); }\n if (utilities.isISO8601(sValue)) { return new Date(sValue); }\n return sValue.trim();\n};\n\nxml.JXONTree = function JXONTree (oXMLParent) {\n var parseText = xml.parseText;\n\n //The document object is an especial object that it may miss some functions or attrs depending on the browser.\n //To prevent this problem with create the JXONTree using the root childNode which is a fully fleshed node on all supported\n //browsers.\n if(oXMLParent.documentElement){\n return new xml.JXONTree(oXMLParent.documentElement);\n }\n\n if (oXMLParent.hasChildNodes()) {\n var sCollectedTxt = \"\";\n for (var oNode, sProp, vContent, nItem = 0; nItem < oXMLParent.childNodes.length; nItem++) {\n oNode = oXMLParent.childNodes.item(nItem);\n /*jshint bitwise: false*/\n if ((oNode.nodeType - 1 | 1) === 3) { sCollectedTxt += oNode.nodeType === 3 ? oNode.nodeValue.trim() : oNode.nodeValue; }\n else if (oNode.nodeType === 1 && !oNode.prefix) {\n sProp = utilities.decapitalize(oNode.nodeName);\n vContent = new xml.JXONTree(oNode);\n if (this.hasOwnProperty(sProp)) {\n if (this[sProp].constructor !== Array) { this[sProp] = [this[sProp]]; }\n this[sProp].push(vContent);\n } else { this[sProp] = vContent; }\n }\n }\n if (sCollectedTxt) { this.keyValue = parseText(sCollectedTxt); }\n }\n\n //IE8 Stupid fix\n var hasAttr = typeof oXMLParent.hasAttributes === 'undefined'? oXMLParent.attributes.length > 0: oXMLParent.hasAttributes();\n if (hasAttr) {\n var oAttrib;\n for (var nAttrib = 0; nAttrib < oXMLParent.attributes.length; nAttrib++) {\n oAttrib = oXMLParent.attributes.item(nAttrib);\n this[\"@\" + utilities.decapitalize(oAttrib.name)] = parseText(oAttrib.value.trim());\n }\n }\n};\n\nxml.JXONTree.prototype.attr = function(attr) {\n return this['@' + utilities.decapitalize(attr)];\n};\n\nxml.toJXONTree = function toJXONTree(xmlString){\n var xmlDoc = xml.strToXMLDoc(xmlString);\n return new xml.JXONTree(xmlDoc);\n};\n\n/**\n * Helper function to extract the keyvalue of a JXONTree obj\n *\n * @param xmlObj {JXONTree}\n * return the key value or undefined;\n */\nxml.keyValue = function getKeyValue(xmlObj) {\n if(xmlObj){\n return xmlObj.keyValue;\n }\n return undefined;\n};\n\nxml.attr = function getAttrValue(xmlObj, attr) {\n if(xmlObj) {\n return xmlObj['@' + utilities.decapitalize(attr)];\n }\n return undefined;\n};\n\nxml.encode = function encodeXML(str) {\n return str.replace(/&/g, '&')\n .replace(//g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n};\n\nxml.decode = function decodeXML(str) {\n return str.replace(/'/g, \"'\")\n .replace(/"/g, '\"')\n .replace(/>/g, '>')\n .replace(/</g, '<')\n .replace(/&/g, '&');\n};\n\nmodule.exports = xml;","'use strict';\n\nrequire('./plugin/components/ads-label_5');\nrequire('./plugin/components/black-poster_5');\n\nvar videoJsVAST = require('./plugin/videojs.vast.vpaid');\n\nvideojs.plugin('vastClient', videoJsVAST);\n"],"sourceRoot":"/source/"} \ No newline at end of file +{"version":3,"sources":["node_modules/browserify/node_modules/browser-pack/_prelude.js","bower_components/VPAIDFLASHClient/js/IVPAIDAdUnit.js","videojs_5.vast.vpaid.js","bower_components/VPAIDFLASHClient/js/VPAIDAdUnit.js","bower_components/VPAIDFLASHClient/js/VPAIDFLASHClient.js","bower_components/VPAIDFLASHClient/js/flashTester.js","bower_components/VPAIDFLASHClient/js/jsFlashBridge.js","bower_components/VPAIDFLASHClient/js/jsFlashBridgeRegistry.js","bower_components/VPAIDFLASHClient/js/registry.js","bower_components/VPAIDFLASHClient/js/utils.js","bower_components/VPAIDHTML5Client/js/IVPAIDAdUnit.js","bower_components/VPAIDHTML5Client/js/VPAIDAdUnit.js","bower_components/VPAIDHTML5Client/js/VPAIDHTML5Client.js","bower_components/VPAIDHTML5Client/js/subscriber.js","bower_components/VPAIDHTML5Client/js/utils.js","src/scripts/ads/vast/Ad.js","src/scripts/ads/vast/Companion.js","src/scripts/ads/vast/Creative.js","src/scripts/ads/vast/InLine.js","src/scripts/ads/vast/Linear.js","src/scripts/ads/vast/MediaFile.js","src/scripts/ads/vast/TrackingEvent.js","src/scripts/ads/vast/VASTClient.js","src/scripts/ads/vast/VASTError.js","src/scripts/ads/vast/VASTIntegrator.js","src/scripts/ads/vast/VASTResponse.js","src/scripts/ads/vast/VASTTracker.js","src/scripts/ads/vast/VideoClicks.js","src/scripts/ads/vast/Wrapper.js","src/scripts/ads/vast/parsers.js","src/scripts/ads/vast/vastUtil.js","src/scripts/ads/vpaid/VPAIDAdUnitWrapper.js","src/scripts/ads/vpaid/VPAIDFlashTech.js","src/scripts/ads/vpaid/VPAIDHTML5Tech.js","src/scripts/ads/vpaid/VPAIDIntegrator.js","src/scripts/plugin/components/ads-label.js","src/scripts/plugin/components/ads-label_5.js","src/scripts/plugin/components/black-poster.js","src/scripts/plugin/components/black-poster_5.js","src/scripts/plugin/videojs.vast.vpaid.js","src/scripts/utils/async.js","src/scripts/utils/dom.js","src/scripts/utils/http.js","src/scripts/utils/playerUtils.js","src/scripts/utils/urlUtils.js","src/scripts/utils/utilityFunctions.js","src/scripts/utils/xml.js","src/scripts/videojs_5.vast.vpaid.js"],"names":["e","t","n","r","s","o","u","a","require","i","f","Error","code","l","exports","call","length",1,"module","Object","defineProperty","value","_createClass","defineProperties","target","props","descriptor","enumerable","configurable","writable","key","Constructor","protoProps","staticProps","prototype","_classCallCheck","instance","TypeError","IVPAIDAdUnit","this","handshakeVersion","playerVPAIDVersion","arguments","undefined","callback","initAd","width","height","viewMode","desiredBitrate","creativeData","AdParameters","environmentVars","flashVars","resizeAd","startAd","stopAd","pauseAd","resumeAd","expandAd","collapseAd","skipAd","getAdLinear","getAdWidth","getAdHeight","getAdExpanded","getAdSkippableState","getAdRemainingTime","getAdDuration","setAdVolume","soundVolume","getAdVolume","getAdCompanions","getAdIcons",2,"_typeof","Symbol","iterator","obj","constructor","_possibleConstructorReturn","self","ReferenceError","_inherits","subClass","superClass","create","setPrototypeOf","__proto__","ALL_VPAID_METHODS","getOwnPropertyNames","filter","property","indexOf","VPAIDAdUnit","_IVPAIDAdUnit","flash","_this","getPrototypeOf","_destroyed","_flash","_destroy","_this2","forEach","methodName","removeCallbackByMethodName","EVENTS","event","offEvent","isDestroyed","on","eventName","off","callFlashMethod","setSize","getWidth","getHeight","volume","./IVPAIDAdUnit",3,"JSFlashBridge","noop","callbackTimeout","isPositiveInt","createElementWithID","uniqueVPAID","unique","createFlashTester","ERROR","FLASH_VERSION","flashTester","isSupported","VPAIDFLASHClient","vpaidParentEl","swfConfig","data","params","wmode","salign","align","allowScriptAccess","scale","allowFullScreen","quality","vpaidOptions","debug","timeout","hasExternalDependencies","onError","_vpaidParentEl","_flashID","movie","FlashVars","VPAID_FLASH_HANDLER","el","swfobject","createSWF","handler","err","$loadPendedAdUnit","error","setTimeout","destroy","_destroyAdUnit","_loadLater","_adUnitLoad","removeCallback","_adUnit","loadAdUnit","adURL","$throwIfDestroyed","isReady","message","url","unloadAdUnit","getFlashID","getFlashURL","setStaticProperty","hasFlashPlayerVersion","window","document","body","propertyName","./VPAIDAdUnit","./flashTester.js","./jsFlashBridge","./utils",4,"FLASH_TEST","FLASH_TEST_EL","utils","MultipleValuesRegistry","FlashTester","parent","parentEl","hideFlashEl","_handlers","_isSupported","support","get","add","./registry",5,"stringEndsWith","SingleValueRegistry","registry","flashURL","flashID","loadHandShake","_el","_flashURL","_width","_height","_callbacks","_uniqueMethodIdentifier","_ready","_handShakeHandler","addInstance","remove","removeByKey","offAll","removeAll","args","callbackID","concat","$asyncCallback","_trigger","removeByValue","suffix","filterKeys","removeAllCallbacks","_callCallback","result","trigger","_handShake","getSize","newWidth","newHeight","setAttribute","setWidth","setHeight","removeInstanceByID","parentElement","removeChild","_this3","typeID","typeName","getInstanceByID","./jsFlashBridgeRegistry",6,"instances","JSFlashBridgeRegistry","id",7,"_registries","push","keys","findByValue","index","splice","old","map","size","_this4",8,"prefix","count","timer","onSuccess","onTimeout","clearTimeout","apply","cleanContent","nEl","createElement","innerHTML","appendChild","newVal","oldVal","isNaN","parseFloat","isFinite","endsWith","String","searchString","position","subjectString","toString","lastIndex","string","search","style","left","top",9,"METHODS","GETTERS","SETTERS","creative","video","VPAIDVersion","subscribe","context","unsubscribe","addStaticToInterface","VPAID1_METHODS","method","checkVPAIDInterface","every","Interface","name",10,"Subscriber","AD_CLICK","FILTERED_EVENTS","VPAIDCreative","iframe","_isValid","_creative","_videoEl","_iframe","_subscribers","$addEventsSubscribers","isValidVPAIDAd","ignores","ariaty","Array","slice","pop","callOrTriggerEvent","bind","extend","slot","videoSlot","getter","validate","unsubscribeAll","$trigger","$clickThruHook","documentElement","contentDocument","videoEl","addEventListener","click","playerHandles","triggerSync","subscribers","./subscriber",11,"defaultTemplate","AD_STOPPED","VPAIDHTML5Client","templateConfig","_id","_frameContainer","createElementInEl","_vpaidOptions","_templateConfig","template","extraOptions","$unloadPreviousAdUnit","that","frame","createIframeWithContent","iframeURL_JS","iframeID","getID","origin","getOrigin","_frame","_onLoad","onLoad","JSON","parse","adUnit","createAd","contentWindow","getVPAIDAd","adEl","querySelector","$adDestroyed","$destroyLoadListener","$removeEl","$removeAdElements","$destroyAdUnit","removeEventListener","clearCallbackTimeout","location","protocol","hostname","port",12,"isHandlerAttached","subscriber","some",13,"isValid","timeouts","func","tagName","createIframe","zIndex","setIframeContent","simpleTemplate","src","marginWidth","marginHeight","frameBorder","margin","padding","border","stringify","replace","RegExp","iframeEl","content","iframeDoc","write","toExtend","fromSource",14,"InLine","Wrapper","Ad","adJTree","initialize","attr","sequence","inLine","wrapper","./InLine","./Wrapper",15,"TrackingEvent","utilities","xml","Companion","companionJTree","creativeType","staticResource","keyValue","htmlResource","HTMLResource","hTMLResource","iframeResource","IFrameResource","iFrameresource","expandedWidth","expandedHeight","scalable","maintainAspectRatio","minSuggestedDuration","apiFramework","companionClickThrough","trackingEvents","parseTrackingEvents","tracking","trackings","isDefined","isArray","trackingData","../../utils/utilityFunctions","../../utils/xml","./TrackingEvent",16,"Linear","Creative","creativeJTree","adId","linear","companionAds","companions","companion","companionData","parseCreatives","creativesJTree","creatives","creativesData","./Companion","./Linear",17,"vastUtil","inlineJTree","adTitle","adSystem","impressions","parseImpressions","impression","description","advertiser","surveys","parseSurveys","survey","pricing","extensions","inlineSurveys","transformArray","isNotEmptyString","uri","type","len","./Creative","./vastUtil",18,"MediaFile","VideoClicks","parsers","linearJTree","duration","mediaFiles","parseMediaFiles","mediaFile","skipoffset","offset","videoClicks","adParameters","decode","mediaFilesJxonTree","mfData","./MediaFile","./VideoClicks","./parsers",19,"attributesList","mediaFileJTree","x","attribute","isVPAID","findSupportedVPAIDTech","isFlashSupported",20,"trackingJTree",21,"VASTError","VASTResponse","async","http","VASTClient","options","defaultOptions","WRAPPER_LIMIT","settings","errorURLMacros","getVASTResponse","adTagUrl","sanityCheck","isFunction","waterfall","_getVASTAd","buildVASTResponse","adsChain","cb","response","_buildVASTResponse","getAdWaterfall","vastTree","waterfallAds","ads","_trackError","getAd","shift","waterfallHandler","adChain","requestVastXML","_requestVASTXml","buildVastWaterfall","xmlStr","toJXONTree","ad","validateVASTTree","vastVersion","next","isString","requestVASTAd","buildAd","VASTAdTagURI","adJxonTree","validateAd","errMsgPrefix","requestVASTXml","requestHandler","withCredentials","status","errMsg","addAdsToResponse","validateResponse","addAd","progressEvents","progress","hasLinear","progressEvent","isNumber","addErrorUrlMacros","track","ERRORCODE","../../utils/async","../../utils/http","./Ad","./VASTError","./VASTResponse",22,23,"VASTTracker","dom","playerUtils","VASTIntegrator","player","playAd","vastResponse","_selectAdSource","_createVASTTracker","_addClickThrough","_addSkipButton","_setupEvents","_playSelectedAd","_src","pause","play","isPaused","paused","getSrc","selectAdSource","source","playerWidth","getDimension","sort","compareTo","b","deltaA","Math","abs","deltaB","selectSource","createVASTTracker","adMediaFile","setupEvents","tracker","previouslyMuted","trackFullscreenChange","trackImpressions","trackPause","trackProgress","trackVolumeChange","once","unbindEvents","evt","trackComplete","isFullscreen","trackFullscreen","trackExitFullscreen","currentTime","trackResume","currentTimeInMs","trackCreativeView","muted","trackMute","trackUnmute","addSkipButton","skipOffsetInSec","addSkipButtonToPlayer","skipOffset","skipButton","createSkipButton","updateSkipButton","updateSkipButtonState","removeSkipButton","addClass","onclick","hasClass","trackSkip","Event","stopPropagation","timeLeft","ceil","toFixedDigits","addClickThrough","blocker","createClickThroughBlocker","updateBlocker","updateBlockerURL","insertBefore","controlBar","removeBlocker","clickThroughMacro","clickThrough","href","generateClickThroughURL","trackClick","variables","ASSETURI","CONTENTPLAYHEAD","formatProgress","parseURLMacro","playSelectedAd","preload","proceed","trackError","../../utils/dom","../../utils/playerUtils","./VASTTracker",24,"InLine__A","_linearAdded","clickTrackings","customClicks","_addInLine","_addWrapper","_addErrorTrackUrl","errorURL","JXONTree","_addImpressions","appendToArray","_addClickTrackings","_addCustomClicks","_addTrackingEvents","eventsMap","trackingEvent","_addTitle","title","_addDuration","_addVideoClicks","_addMediaFiles","_addSkipoffset","_addAdParameters","_addLinear","array","items","item",25,"assetURI","quartiles","firstQuartile","tracked","time","round","midpoint","thirdQuartile","isEmptyString","trackURLs","urls","trackEvent","trackOnce","getEventUris","uris","newProgressInMs","events","ONCE","ALWAYS","addTrackEvent","hasRewound","addQuartileEvents","trackProgressEvents","trackEvents","currentProgress","newProgress","REWIND_THRESHOLD","canBeAdded","trackQuartile","quartileName","quartile","canBeTracked","quartileTime","pendingProgressEvts","capitalize","trackErrorWithCode","errorcode",26,"videoClickJTree","parseClickTrackings","clickTracking","customClick","clickTrackingData",27,"wrapperJTree","vASTAdTagURI","followAdditionalWrappers","allowMultipleAds","fallbackOnNoAd",28,"durationRegex","parseDuration","durationStr","match","durationInMs","parseHoursToMs","parseMinToMs","parseSecToMs","parseInt","hourStr","minStr","secStr","parseOffset","isPercentage","calculatePercentage","percentageRegex","test","percentStr","calcPercent","quantity","percent",29,"VPAIDHTML5Tech","VPAIDFlashTech","URLMacros","sources","parseURLMacros","trackImgs","img","Image","parseMacros","parsedURLs","random","URLMacro","_parseURLMacro","parseMacro","hours","minutes","seconds","milliseconds","floor","VPAID_techs","isVPAIDMediaFile","mimeType","VPAIDTech","supports","runFlashSupportCheck","vpaidFlashLoaderPath","runFlashTest","../vpaid/VPAIDFlashTech","../vpaid/VPAIDHTML5Tech","VPAIDFLASHClient/js/VPAIDFLASHClient",30,"VPAIDAdUnitWrapper","vpaidAdUnit","opts","isObject","responseTimeout","VPAIDInterfaceMethods","canSubscribeToEvents","canUnsubscribeFromEvents","adUnitAsyncCall","arrayLikeObjToArray","timeoutId","wrapCallback","evtName","waitForEvent","responseListener","unshift","version","adUnitData","getterName","../vast/VASTError",31,"containerEl","vpaidFlashClient","loadFlashCreative","objectEl","flashClientOpts","container","isDomElement","console","log",32,"vpaidHTMLClient","INVALID_MEDIA_FILE","isOldIE","INVALID_DOM_CONTAINER_EL","toLowerCase","MISSING_CALLBACK","PREFIX","INVALID_DOM_VIDEO_EL","VPAIDHTML5Client/js/VPAIDHTML5Client",33,"VPAIDIntegrator","VIEW_MODE","NORMAL","FULLSCREEN","THUMBNAIL","createVPAIDContainerEl","VPAID_VERSION","playVPaidAd","tech","_findSupportedTech","triggerVpaidAdEnd","one","removeAdUnit","_loadAdUnit","_playAdUnit","_finishPlaying","adComplete","_paused","removeClass","vpaidMediaFiles","_createVPAIDAdUnitWrapper","vjsTechEl","WrappedAdUnit","techClass","_handshake","_initAd","_linkPlayerControls","_startAd","handshake","isSupportedVersion","majorNum","major","parts","split","dimension","adUnitSrc","notifyPlayToPlayer","trackStart","notifyPauseToPlayer","trackFirstQuartile","trackMidpoint","trackThirdQuartile","clickThruUrl","open","trackAcceptInvitation","trackAcceptInvitationLinear","trackClose","trackCloseLinear","trackCollapse","lastVolume","currentVolume","updateViewSize","updateViewSizeThrottled","throttle","autoResize","pauseAdUnit","resumeAdUnit","isSkippable","linkVolumeControl","linkFullScreenControl","updateAdUnitVolume","updatePlayerVolume","vol","logError","finishPlayingAd","errorCode","MODE","../vast/VASTResponse","../vast/VASTTracker","../vast/vastUtil","./VPAIDAdUnitWrapper",34,"element","className","AdsLabelFactory","baseComponent","init","currentTimeComp","getChild","getElement",35,"baseVideoJsComponent","videojs","getComponent","AdsLabel","registerComponent","./ads-label",36,"BlackPosterFactory","posterImg",37,"BlackPoster","./black-poster",38,"VASTPlugin","snapshot","vast","adsCanceled","defaultOpts","iosPrerollCancelTimeout","adCancelTimeout","playAdAlways","adsEnabled","isUndefined","echoFn","adTagXML","trackAdError","prepareForAds","tryToPlayPrerollAd","cancelAds","isEnabled","enable","disable","removeNativePoster","restoreVideoContent","checkAdsEnabled","preparePlayerForAd","startAdCancelTimeout","playPrerollAd","setupContentEvents","restorePlayerSnapshot","canPlayPrerollAd","getPlayerSnapshot","addSpinnerIcon","isIPhone","adCancelTimeoutId","clearAdCancelTimeout","removeSpinnerIcon","getVastResponse","adIntegrator","adFinished","addAdsLabel","removeAdsLabel","isIDevice","preventManualProgress","addChild","PROGRESS_THRESHOLD","previousTime","skipad_attempts","preventAdSeek","preventAdSkip","stopPreventManualProgress","progressDelta","../ads/vast/VASTClient","../ads/vast/VASTError","../ads/vast/VASTIntegrator","../ads/vast/vastUtil","../ads/vpaid/VPAIDIntegrator","../utils/async","../utils/dom","../utils/playerUtils","../utils/utilityFunctions",39,"setImmediate","fn","tasks","makeCallback","wrapIterator","when","condition","isAllowed","./utilityFunctions",40,"isVisible","getComputedStyle","visibility","isHidden","display","isShown","hide","__prev_style_display_","show","cssClass","classes","classList","contains","getAttribute","join","newClasses","attachEvent","detachEvent","dispatchEvent","fireEvent","eventType","isDescendant","child","node","parentNode","getTextContent","textContent","text","prependChild","firstChild","removeNode","Element","handlerWrap","rect","getBoundingClientRect","offsetWidth","offsetHeight",41,"urlUtils","HttpRequestError","HttpRequest","createXhr","run","xhr","urlParts","headers","setHeaders","onload","statusText","getAllResponseHeaders","responseText","onerror","requestError","onabort","send","abort","setRequestHeader","processResponse","headersString","isSuccess","XMLHttpRequest","XDomainRequest","./urlUtils",42,"ended","currentSrc","currentType","playing","suppressedTracks","getSuppressedTracks","nativePoster","poster","tracks","remoteTextTracks","tracks_","mode","attempts","hasSrcChanged","restoreTracks","tryToResume","ensureCanplayEvtGetsFired","load","trackSnapshot","isReadyToResume","warn","readyState","seekable","blackPoster","_firstPlay","volumeSnapshot","monkeyPatchPlayerApi","tryToTriggerFirstPlay","resetFirstPlay","restoreContentVolume","hideBlackPoster","addStyles","removeStyles","origPlay","callOrigPlay","isFirstPlay","firstPlay","resume","saveVolumeSnapshot","isAdPlaying","origPause","callOrigPause","origPaused","callOrigPaused","restoreVolumeSnapshot","removeAttribute","listener","./dom",43,"urlParsingNode","msie","documentMode","host","hash","pathname","charAt","queryStringToObj","qs","cond","pairs","qsObj","trim","pair","objToQueryString",44,"NODE_TYPE_ELEMENT","SNAKE_CASE_REGEXP","EMAIL_REGEXP","ISO8086_REGEXP","isNull","str","num","isWindow","isArrayLike","nodeType","hasOwnProperty","isPrimitive","snake_case","separator","letter","pos","isValidEmail","email","arg","k","toUpperCase","decapitalize","transformer","transformedArray","transformedItem","digits","formattedNum","NaN","delay","previousCall","Date","getTime","debounce","wait","treeSearch","root","getChildren","found","children","val","isISO8601","getInternetExplorerVersion","navigator","rv","appName","ua","userAgent","re","res","exec","_UA","isMobile","isAndroid",45,"strToXMLDoc","stringContainingXMLSource","DOMParser","xmlDocument","ActiveXObject","loadXML","parseString","parser","parsedDocument","parseFromString","isParseError","erroneousParse","parsererrorNS","getElementsByTagName","namespaceURI","getElementsByTagNameNS","parseText","sValue","oXMLParent","hasChildNodes","sCollectedTxt","oNode","sProp","vContent","nItem","childNodes","nodeValue","nodeName","hasAttr","hasAttributes","attributes","oAttrib","nAttrib","xmlString","xmlDoc","getKeyValue","xmlObj","getAttrValue","encode","encodeXML","decodeXML",46,"videoJsVAST","plugin","./plugin/components/ads-label_5","./plugin/components/black-poster_5","./plugin/videojs.vast.vpaid"],"mappings":"CAAA,QAAAA,GAAAC,EAAAC,EAAAC,GAAA,QAAAC,GAAAC,EAAAC,GAAA,IAAAJ,EAAAG,GAAA,CAAA,IAAAJ,EAAAI,GAAA,CAAA,GAAAE,SAAAC,UAAA,YAAAA,OAAA,KAAAF,GAAAC,EAAA,MAAAA,GAAAF,GAAA,EAAA,IAAAI,EAAA,MAAAA,GAAAJ,GAAA,EAAA,IAAAK,GAAA,GAAAC,OAAA,uBAAAN,EAAA,IAAA,MAAAK,GAAAE,KAAA,mBAAAF,EAAA,GAAAG,GAAAX,EAAAG,IAAAS,WAAAb,GAAAI,GAAA,GAAAU,KAAAF,EAAAC,QAAA,SAAAd,GAAA,GAAAE,GAAAD,EAAAI,GAAA,GAAAL,EAAA,OAAAI,GAAAF,EAAAA,EAAAF,IAAAa,EAAAA,EAAAC,QAAAd,EAAAC,EAAAC,EAAAC,GAAA,MAAAD,GAAAG,GAAAS,QAAA,GAAAL,SAAAD,UAAA,YAAAA,OAAA,KAAA,GAAAH,GAAA,EAAAA,EAAAF,EAAAa,OAAAX,IAAAD,EAAAD,EAAAE,GAAA,OAAAD,MAAAa,GAAA,SAAAT,EAAAU,EAAAJ,GCAA,YCKAK,QAAOC,eAAeN,EAAS,cAC3BO,MAAO,MAGX,IAAIC,GAAe,WACf,QAASC,GAAiBC,EAAQC,GAC9B,IAAK,GAAIhB,GAAI,EAAGA,EAAIgB,EAAMT,OAAQP,IAAK,CACnC,GAAIiB,GAAaD,EAAMhB,EAAGiB,GAAWC,WAAaD,EAAWC,YAAc,KAAMD,GAAWE,aAAe,IAAK,IAAI,SAAWF,GAAYA,EAAWG,SAAW,IAAKV,QAAOC,eAAeI,EAAQE,EAAWI,IAAKJ,IAE3N,MAAO,UAA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,KACAA,QAAA,UAAA,KACAA,QAAA,QAAA,KACAA,QAAA,QAAA,KACAA,QAAA,SAAA,KAGA1Y,GAAAJ,QAAAqa,I5C4gNGulB,qBAAqB,KAAKkO,IAAI,SAASpuC,EAAQU,EAAOJ,G6C7pNzD,YAEAN,GAAA,kCACAA,GAAA,qCAEA,IAAAquC,GAAAruC,EAAA,8BAEAm7B,SAAAmT,OAAA,aAAAD,K7CgqNGE,kCAAkC,GAAGC,qCAAqC,GAAGC,8BAA8B,UAAU","file":"videojs_5.vast.vpaid.min.js","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o 0) {\n callback(event);\n }\n }, 0);\n }\n });\n }\n }, {\n key: '_callCallback',\n value: function _callCallback(methodName, callbackID, err, result) {\n\n var callback = this._callbacks.get(callbackID);\n\n //not all methods callback's are mandatory\n //but if there exist an error, fire the error event\n if (!callback) {\n if (err && callbackID === '') {\n this.trigger(ERROR, err);\n }\n return;\n }\n\n $asyncCallback.call(this, callbackID, err, result);\n }\n }, {\n key: '_handShake',\n value: function _handShake(err, data) {\n this._ready = true;\n if (this._handShakeHandler) {\n this._handShakeHandler(err, data);\n delete this._handShakeHandler;\n }\n }\n\n //methods like properties specific to this implementation of VPAID\n\n }, {\n key: 'getSize',\n value: function getSize() {\n return { width: this._width, height: this._height };\n }\n }, {\n key: 'setSize',\n value: function setSize(newWidth, newHeight) {\n this._width = isPositiveInt(newWidth, this._width);\n this._height = isPositiveInt(newHeight, this._height);\n this._el.setAttribute('width', this._width);\n this._el.setAttribute('height', this._height);\n }\n }, {\n key: 'getWidth',\n value: function getWidth() {\n return this._width;\n }\n }, {\n key: 'setWidth',\n value: function setWidth(newWidth) {\n this.setSize(newWidth, this._height);\n }\n }, {\n key: 'getHeight',\n value: function getHeight() {\n return this._height;\n }\n }, {\n key: 'setHeight',\n value: function setHeight(newHeight) {\n this.setSize(this._width, newHeight);\n }\n }, {\n key: 'getFlashID',\n value: function getFlashID() {\n return this._flashID;\n }\n }, {\n key: 'getFlashURL',\n value: function getFlashURL() {\n return this._flashURL;\n }\n }, {\n key: 'isReady',\n value: function isReady() {\n return this._ready;\n }\n }, {\n key: 'destroy',\n value: function destroy() {\n this.offAll();\n this.removeAllCallbacks();\n registry.removeInstanceByID(this._flashID);\n if (this._el.parentElement) {\n this._el.parentElement.removeChild(this._el);\n }\n }\n }]);\n\n return JSFlashBridge;\n}();\n\nfunction $asyncCallback(callbackID, err, result) {\n var _this3 = this;\n\n setTimeout(function () {\n var callback = _this3._callbacks.get(callbackID);\n if (callback) {\n _this3._callbacks.remove(callbackID);\n callback(err, result);\n }\n }, 0);\n}\n\nObject.defineProperty(JSFlashBridge, 'VPAID_FLASH_HANDLER', {\n writable: false,\n configurable: false,\n value: VPAID_FLASH_HANDLER\n});\n\n/**\n * External interface handler\n *\n * @param {string} flashID identifier of the flash who call this\n * @param {string} typeID what type of message is, can be 'event' or 'callback'\n * @param {string} typeName if the typeID is a event the typeName will be the eventName, if is a callback the typeID is the methodName that is related this callback\n * @param {string} callbackID only applies when the typeID is 'callback', identifier of the callback to call\n * @param {object} error error object\n * @param {object} data\n */\nwindow[VPAID_FLASH_HANDLER] = function (flashID, typeID, typeName, callbackID, error, data) {\n var instance = registry.getInstanceByID(flashID);\n if (!instance) return;\n if (typeName === 'handShake') {\n instance._handShake(error, data);\n } else {\n if (typeID !== 'event') {\n instance._callCallback(typeName, callbackID, error, data);\n } else {\n instance._trigger(typeName, data);\n }\n }\n};\n\n},{\"./jsFlashBridgeRegistry\":6,\"./registry\":7,\"./utils\":8}],6:[function(require,module,exports){\n'use strict';\n\nvar SingleValueRegistry = require('./registry').SingleValueRegistry;\nvar instances = new SingleValueRegistry();\n\nvar JSFlashBridgeRegistry = {};\nObject.defineProperty(JSFlashBridgeRegistry, 'addInstance', {\n writable: false,\n configurable: false,\n value: function value(id, instance) {\n instances.add(id, instance);\n }\n});\n\nObject.defineProperty(JSFlashBridgeRegistry, 'getInstanceByID', {\n writable: false,\n configurable: false,\n value: function value(id) {\n return instances.get(id);\n }\n});\n\nObject.defineProperty(JSFlashBridgeRegistry, 'removeInstanceByID', {\n writable: false,\n configurable: false,\n value: function value(id) {\n return instances.remove(id);\n }\n});\n\nmodule.exports = JSFlashBridgeRegistry;\n\n},{\"./registry\":7}],7:[function(require,module,exports){\n'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if (\"value\" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);\n }\n }return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;\n };\n}();\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nvar MultipleValuesRegistry = exports.MultipleValuesRegistry = function () {\n function MultipleValuesRegistry() {\n _classCallCheck(this, MultipleValuesRegistry);\n\n this._registries = {};\n }\n\n _createClass(MultipleValuesRegistry, [{\n key: 'add',\n value: function add(id, value) {\n if (!this._registries[id]) {\n this._registries[id] = [];\n }\n if (this._registries[id].indexOf(value) === -1) {\n this._registries[id].push(value);\n }\n }\n }, {\n key: 'get',\n value: function get(id) {\n return this._registries[id] || [];\n }\n }, {\n key: 'filterKeys',\n value: function filterKeys(handler) {\n return Object.keys(this._registries).filter(handler);\n }\n }, {\n key: 'findByValue',\n value: function findByValue(value) {\n var _this = this;\n\n var keys = Object.keys(this._registries).filter(function (key) {\n return _this._registries[key].indexOf(value) !== -1;\n });\n\n return keys;\n }\n }, {\n key: 'remove',\n value: function remove(key, value) {\n if (!this._registries[key]) {\n return;\n }\n\n var index = this._registries[key].indexOf(value);\n\n if (index < 0) {\n return;\n }\n return this._registries[key].splice(index, 1);\n }\n }, {\n key: 'removeByKey',\n value: function removeByKey(id) {\n var old = this._registries[id];\n delete this._registries[id];\n return old;\n }\n }, {\n key: 'removeByValue',\n value: function removeByValue(value) {\n var _this2 = this;\n\n var keys = this.findByValue(value);\n return keys.map(function (key) {\n return _this2.remove(key, value);\n });\n }\n }, {\n key: 'removeAll',\n value: function removeAll() {\n var old = this._registries;\n this._registries = {};\n return old;\n }\n }, {\n key: 'size',\n value: function size() {\n return Object.keys(this._registries).length;\n }\n }]);\n\n return MultipleValuesRegistry;\n}();\n\nvar SingleValueRegistry = exports.SingleValueRegistry = function () {\n function SingleValueRegistry() {\n _classCallCheck(this, SingleValueRegistry);\n\n this._registries = {};\n }\n\n _createClass(SingleValueRegistry, [{\n key: 'add',\n value: function add(id, value) {\n this._registries[id] = value;\n }\n }, {\n key: 'get',\n value: function get(id) {\n return this._registries[id];\n }\n }, {\n key: 'filterKeys',\n value: function filterKeys(handler) {\n return Object.keys(this._registries).filter(handler);\n }\n }, {\n key: 'findByValue',\n value: function findByValue(value) {\n var _this3 = this;\n\n var keys = Object.keys(this._registries).filter(function (key) {\n return _this3._registries[key] === value;\n });\n\n return keys;\n }\n }, {\n key: 'remove',\n value: function remove(id) {\n var old = this._registries[id];\n delete this._registries[id];\n return old;\n }\n }, {\n key: 'removeByValue',\n value: function removeByValue(value) {\n var _this4 = this;\n\n var keys = this.findByValue(value);\n return keys.map(function (key) {\n return _this4.remove(key);\n });\n }\n }, {\n key: 'removeAll',\n value: function removeAll() {\n var old = this._registries;\n this._registries = {};\n return old;\n }\n }, {\n key: 'size',\n value: function size() {\n return Object.keys(this._registries).length;\n }\n }]);\n\n return SingleValueRegistry;\n}();\n\n},{}],8:[function(require,module,exports){\n'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.unique = unique;\nexports.noop = noop;\nexports.callbackTimeout = callbackTimeout;\nexports.createElementWithID = createElementWithID;\nexports.isPositiveInt = isPositiveInt;\nexports.stringEndsWith = stringEndsWith;\nexports.hideFlashEl = hideFlashEl;\nfunction unique(prefix) {\n var count = -1;\n return function (f) {\n return prefix + '_' + ++count;\n };\n}\n\nfunction noop() {}\n\nfunction callbackTimeout(timer, onSuccess, onTimeout) {\n\n var timeout = setTimeout(function () {\n\n onSuccess = noop;\n onTimeout();\n }, timer);\n\n return function () {\n clearTimeout(timeout);\n onSuccess.apply(this, arguments);\n };\n}\n\nfunction createElementWithID(parent, id) {\n var cleanContent = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2];\n\n var nEl = document.createElement('div');\n nEl.id = id;\n if (cleanContent) {\n parent.innerHTML = '';\n }\n parent.appendChild(nEl);\n return nEl;\n}\n\nfunction isPositiveInt(newVal, oldVal) {\n return !isNaN(parseFloat(newVal)) && isFinite(newVal) && newVal > 0 ? newVal : oldVal;\n}\n\nvar endsWith = function () {\n if (String.prototype.endsWith) return String.prototype.endsWith;\n return function endsWith(searchString, position) {\n var subjectString = this.toString();\n if (position === undefined || position > subjectString.length) {\n position = subjectString.length;\n }\n position -= searchString.length;\n var lastIndex = subjectString.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n };\n}();\n\nfunction stringEndsWith(string, search) {\n return endsWith.call(string, search);\n}\n\nfunction hideFlashEl(el) {\n // can't use display none or visibility none because will block flash in some browsers\n el.style.position = 'absolute';\n el.style.left = '-1px';\n el.style.top = '-1px';\n el.style.width = '1px';\n el.style.height = '1px';\n}\n\n},{}],9:[function(require,module,exports){\n'use strict';\n\nvar METHODS = [\n 'handshakeVersion',\n 'initAd',\n 'startAd',\n 'stopAd',\n 'skipAd', // VPAID 2.0 new method\n 'resizeAd',\n 'pauseAd',\n 'resumeAd',\n 'expandAd',\n 'collapseAd',\n 'subscribe',\n 'unsubscribe'\n];\n\nvar EVENTS = [\n 'AdLoaded',\n 'AdStarted',\n 'AdStopped',\n 'AdSkipped',\n 'AdSkippableStateChange', // VPAID 2.0 new event\n 'AdSizeChange', // VPAID 2.0 new event\n 'AdLinearChange',\n 'AdDurationChange', // VPAID 2.0 new event\n 'AdExpandedChange',\n 'AdRemainingTimeChange', // [Deprecated in 2.0] but will be still fired for backwards compatibility\n 'AdVolumeChange',\n 'AdImpression',\n 'AdVideoStart',\n 'AdVideoFirstQuartile',\n 'AdVideoMidpoint',\n 'AdVideoThirdQuartile',\n 'AdVideoComplete',\n 'AdClickThru',\n 'AdInteraction', // VPAID 2.0 new event\n 'AdUserAcceptInvitation',\n 'AdUserMinimize',\n 'AdUserClose',\n 'AdPaused',\n 'AdPlaying',\n 'AdLog',\n 'AdError'\n];\n\nvar GETTERS = [\n 'getAdLinear',\n 'getAdWidth', // VPAID 2.0 new getter\n 'getAdHeight', // VPAID 2.0 new getter\n 'getAdExpanded',\n 'getAdSkippableState', // VPAID 2.0 new getter\n 'getAdRemainingTime',\n 'getAdDuration', // VPAID 2.0 new getter\n 'getAdVolume',\n 'getAdCompanions', // VPAID 2.0 new getter\n 'getAdIcons' // VPAID 2.0 new getter\n];\n\nvar SETTERS = [\n 'setAdVolume'\n];\n\n\n/**\n * This callback is displayed as global member. The callback use nodejs error-first callback style\n * @callback NodeStyleCallback\n * @param {string|null}\n * @param {undefined|object}\n */\n\n\n/**\n * IVPAIDAdUnit\n *\n * @class\n *\n * @param {object} creative\n * @param {HTMLElement} el\n * @param {HTMLVideoElement} video\n */\nfunction IVPAIDAdUnit(creative, el, video) {}\n\n\n/**\n * handshakeVersion\n *\n * @param {string} VPAIDVersion\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.handshakeVersion = function (VPAIDVersion, callback) {};\n\n/**\n * initAd\n *\n * @param {number} width\n * @param {number} height\n * @param {string} viewMode can be 'normal', 'thumbnail' or 'fullscreen'\n * @param {number} desiredBitrate indicates the desired bitrate in kbps\n * @param {object} [creativeData] used for additional initialization data\n * @param {object} [environmentVars] used for passing implementation-specific of js version\n * @param {NodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.initAd = function(width, height, viewMode, desiredBitrate, creativeData, environmentVars, callback) {};\n\n/**\n * startAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.startAd = function(callback) {};\n\n/**\n * stopAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.stopAd = function(callback) {};\n\n/**\n * skipAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.skipAd = function(callback) {};\n\n/**\n * resizeAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.resizeAd = function(width, height, viewMode, callback) {};\n\n/**\n * pauseAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.pauseAd = function(callback) {};\n\n/**\n * resumeAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.resumeAd = function(callback) {};\n\n/**\n * expandAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.expandAd = function(callback) {};\n\n/**\n * collapseAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.collapseAd = function(callback) {};\n\n/**\n * subscribe\n *\n * @param {string} event\n * @param {nodeStyleCallback} handler\n * @param {object} context\n */\nIVPAIDAdUnit.prototype.subscribe = function(event, handler, context) {};\n\n/**\n * startAd\n *\n * @param {string} event\n * @param {function} handler\n */\nIVPAIDAdUnit.prototype.unsubscribe = function(event, handler) {};\n\n\n\n/**\n * getAdLinear\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdLinear = function(callback) {};\n\n/**\n * getAdWidth\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdWidth = function(callback) {};\n\n/**\n * getAdHeight\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdHeight = function(callback) {};\n\n/**\n * getAdExpanded\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdExpanded = function(callback) {};\n\n/**\n * getAdSkippableState\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdSkippableState = function(callback) {};\n\n/**\n * getAdRemainingTime\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdRemainingTime = function(callback) {};\n\n/**\n * getAdDuration\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdDuration = function(callback) {};\n\n/**\n * getAdVolume\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdVolume = function(callback) {};\n\n/**\n * getAdCompanions\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdCompanions = function(callback) {};\n\n/**\n * getAdIcons\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdIcons = function(callback) {};\n\n/**\n * setAdVolume\n *\n * @param {number} volume\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.setAdVolume = function(volume, callback) {};\n\naddStaticToInterface(IVPAIDAdUnit, 'METHODS', METHODS);\naddStaticToInterface(IVPAIDAdUnit, 'GETTERS', GETTERS);\naddStaticToInterface(IVPAIDAdUnit, 'SETTERS', SETTERS);\naddStaticToInterface(IVPAIDAdUnit, 'EVENTS', EVENTS);\n\n\nvar VPAID1_METHODS = METHODS.filter(function(method) {\n return ['skipAd'].indexOf(method) === -1;\n});\n\naddStaticToInterface(IVPAIDAdUnit, 'checkVPAIDInterface', function checkVPAIDInterface (creative) {\n var result = VPAID1_METHODS.every(function(key) {\n return typeof creative[key] === 'function';\n });\n return result;\n});\n\nmodule.exports = IVPAIDAdUnit;\n\nfunction addStaticToInterface(Interface, name, value) {\n Object.defineProperty(Interface, name, {\n writable: false,\n configurable: false,\n value: value\n });\n}\n\n\n},{}],10:[function(require,module,exports){\n'use strict';\n\nvar IVPAIDAdUnit = require('./IVPAIDAdUnit');\nvar Subscriber = require('./subscriber');\nvar checkVPAIDInterface = IVPAIDAdUnit.checkVPAIDInterface;\nvar utils = require('./utils');\nvar METHODS = IVPAIDAdUnit.METHODS;\nvar ERROR = 'AdError';\nvar AD_CLICK = 'AdClickThru';\nvar FILTERED_EVENTS = IVPAIDAdUnit.EVENTS.filter(function (event) {\n return event != AD_CLICK;\n});\n\n/**\n * This callback is displayed as global member. The callback use nodejs error-first callback style\n * @callback NodeStyleCallback\n * @param {string|null}\n * @param {undefined|object}\n */\n\n\n/**\n * VPAIDAdUnit\n * @class\n *\n * @param VPAIDCreative\n * @param {HTMLElement} [el] this will be used in initAd environmentVars.slot if defined\n * @param {HTMLVideoElement} [video] this will be used in initAd environmentVars.videoSlot if defined\n */\nfunction VPAIDAdUnit(VPAIDCreative, el, video, iframe) {\n this._isValid = checkVPAIDInterface(VPAIDCreative);\n if (this._isValid) {\n this._creative = VPAIDCreative;\n this._el = el;\n this._videoEl = video;\n this._iframe = iframe;\n this._subscribers = new Subscriber();\n $addEventsSubscribers.call(this);\n }\n}\n\nVPAIDAdUnit.prototype = Object.create(IVPAIDAdUnit.prototype);\n\n/**\n * isValidVPAIDAd will return if the VPAIDCreative passed in constructor is valid or not\n *\n * @return {boolean}\n */\nVPAIDAdUnit.prototype.isValidVPAIDAd = function isValidVPAIDAd() {\n return this._isValid;\n};\n\nIVPAIDAdUnit.METHODS.forEach(function(method) {\n //NOTE: this methods arguments order are implemented differently from the spec\n var ignores = [\n 'subscribe',\n 'unsubscribe',\n 'initAd'\n ];\n\n if (ignores.indexOf(method) !== -1) return;\n\n VPAIDAdUnit.prototype[method] = function () {\n var ariaty = IVPAIDAdUnit.prototype[method].length;\n // TODO avoid leaking arguments\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n var args = Array.prototype.slice.call(arguments);\n var callback = (ariaty === args.length) ? args.pop() : undefined;\n\n setTimeout(function () {\n var result, error = null;\n try {\n result = this._creative[method].apply(this._creative, args);\n } catch(e) {\n error = e;\n }\n\n callOrTriggerEvent(callback, this._subscribers, error, result);\n }.bind(this), 0);\n };\n});\n\n\n/**\n * initAd concreate implementation\n *\n * @param {number} width\n * @param {number} height\n * @param {string} viewMode can be 'normal', 'thumbnail' or 'fullscreen'\n * @param {number} desiredBitrate indicates the desired bitrate in kbps\n * @param {object} [creativeData] used for additional initialization data\n * @param {object} [environmentVars] used for passing implementation-specific of js version, if el & video was used in constructor slot & videoSlot will be added to the object\n * @param {NodeStyleCallback} callback\n */\nVPAIDAdUnit.prototype.initAd = function initAd(width, height, viewMode, desiredBitrate, creativeData, environmentVars, callback) {\n creativeData = creativeData || {};\n environmentVars = utils.extend({\n slot: this._el,\n videoSlot: this._videoEl\n }, environmentVars || {});\n\n setTimeout(function () {\n var error;\n try {\n this._creative.initAd(width, height, viewMode, desiredBitrate, creativeData, environmentVars);\n } catch (e) {\n error = e;\n }\n\n callOrTriggerEvent(callback, this._subscribers, error);\n }.bind(this), 0);\n};\n\n/**\n * subscribe\n *\n * @param {string} event\n * @param {nodeStyleCallback} handler\n * @param {object} context\n */\nVPAIDAdUnit.prototype.subscribe = function subscribe(event, handler, context) {\n this._subscribers.subscribe(handler, event, context);\n};\n\n\n/**\n * unsubscribe\n *\n * @param {string} event\n * @param {nodeStyleCallback} handler\n */\nVPAIDAdUnit.prototype.unsubscribe = function unsubscribe(event, handler) {\n this._subscribers.unsubscribe(handler, event);\n};\n\n//alias\nVPAIDAdUnit.prototype.on = VPAIDAdUnit.prototype.subscribe;\nVPAIDAdUnit.prototype.off = VPAIDAdUnit.prototype.unsubscribe;\n\nIVPAIDAdUnit.GETTERS.forEach(function(getter) {\n VPAIDAdUnit.prototype[getter] = function (callback) {\n setTimeout(function () {\n\n var result, error = null;\n try {\n result = this._creative[getter]();\n } catch(e) {\n error = e;\n }\n\n callOrTriggerEvent(callback, this._subscribers, error, result);\n }.bind(this), 0);\n };\n});\n\n/**\n * setAdVolume\n *\n * @param volume\n * @param {nodeStyleCallback} callback\n */\nVPAIDAdUnit.prototype.setAdVolume = function setAdVolume(volume, callback) {\n setTimeout(function () {\n\n var result, error = null;\n try {\n this._creative.setAdVolume(volume);\n result = this._creative.getAdVolume();\n } catch(e) {\n error = e;\n }\n\n if (!error) {\n error = utils.validate(result === volume, 'failed to apply volume: ' + volume);\n }\n callOrTriggerEvent(callback, this._subscribers, error, result);\n }.bind(this), 0);\n};\n\nVPAIDAdUnit.prototype._destroy = function destroy() {\n this.stopAd();\n this._subscribers.unsubscribeAll();\n};\n\nfunction $addEventsSubscribers() {\n // some ads implement\n // so they only handle one subscriber\n // to handle this we create our one\n FILTERED_EVENTS.forEach(function (event) {\n this._creative.subscribe($trigger.bind(this, event), event);\n }.bind(this));\n\n // map the click event to be an object instead of depending of the order of the arguments\n // and to be consistent with the flash\n this._creative.subscribe($clickThruHook.bind(this), AD_CLICK);\n\n // because we are adding the element inside the iframe\n // the user is not able to click in the video\n if (this._videoEl) {\n var documentElement = this._iframe.contentDocument.documentElement;\n var videoEl = this._videoEl;\n documentElement.addEventListener('click', function(e) {\n if (e.target === documentElement) {\n videoEl.click();\n }\n });\n }\n}\n\nfunction $clickThruHook(url, id, playerHandles) {\n this._subscribers.triggerSync(AD_CLICK, {url: url, id: id, playerHandles: playerHandles});\n}\n\nfunction $trigger(event) {\n // TODO avoid leaking arguments\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n this._subscribers.trigger(event, Array.prototype.slice(arguments, 1));\n}\n\nfunction callOrTriggerEvent(callback, subscribers, error, result) {\n if (callback) {\n callback(error, result);\n } else if (error) {\n subscribers.trigger(ERROR, error);\n }\n}\n\nmodule.exports = VPAIDAdUnit;\n\n\n},{\"./IVPAIDAdUnit\":9,\"./subscriber\":12,\"./utils\":13}],11:[function(require,module,exports){\n'use strict';\n\nvar utils = require('./utils');\nvar unique = utils.unique('vpaidIframe');\nvar VPAIDAdUnit = require('./VPAIDAdUnit');\n\nvar defaultTemplate = '' +\n '' +\n '' +\n '
' +\n '' +\n '' +\n '' +\n '';\n\nvar AD_STOPPED = 'AdStopped';\n\n/**\n * This callback is displayed as global member. The callback use nodejs error-first callback style\n * @callback NodeStyleCallback\n * @param {string|null}\n * @param {undefined|object}\n */\n\n/**\n * VPAIDHTML5Client\n * @class\n *\n * @param {HTMLElement} el that will contain the iframe to load adUnit and a el to add to adUnit slot\n * @param {HTMLVideoElement} video default video element to be used by adUnit\n * @param {object} [templateConfig] template: html template to be used instead of the default, extraOptions: to be used when rendering the template\n * @param {object} [vpaidOptions] timeout: when loading adUnit\n */\nfunction VPAIDHTML5Client(el, video, templateConfig, vpaidOptions) {\n templateConfig = templateConfig || {};\n\n this._id = unique();\n this._destroyed = false;\n\n this._frameContainer = utils.createElementInEl(el, 'div');\n this._videoEl = video;\n this._vpaidOptions = vpaidOptions || {timeout: 10000};\n\n this._templateConfig = {\n template: templateConfig.template || defaultTemplate,\n extraOptions: templateConfig.extraOptions || {}\n };\n}\n\n/**\n * destroy\n *\n */\nVPAIDHTML5Client.prototype.destroy = function destroy() {\n if (this._destroyed) {\n return;\n }\n this._destroyed = true;\n $unloadPreviousAdUnit.call(this);\n};\n\n/**\n * isDestroyed\n *\n * @return {boolean}\n */\nVPAIDHTML5Client.prototype.isDestroyed = function isDestroyed() {\n return this._destroyed;\n};\n\n/**\n * loadAdUnit\n *\n * @param {string} adURL url of the js of the adUnit\n * @param {nodeStyleCallback} callback\n */\nVPAIDHTML5Client.prototype.loadAdUnit = function loadAdUnit(adURL, callback) {\n $throwIfDestroyed.call(this);\n $unloadPreviousAdUnit.call(this);\n var that = this;\n\n var frame = utils.createIframeWithContent(\n this._frameContainer,\n this._templateConfig.template,\n utils.extend({\n iframeURL_JS: adURL,\n iframeID: this.getID(),\n origin: getOrigin()\n }, this._templateConfig.extraOptions)\n );\n\n this._frame = frame;\n\n this._onLoad = utils.callbackTimeout(\n this._vpaidOptions.timeout,\n onLoad.bind(this),\n onTimeout.bind(this)\n );\n\n window.addEventListener('message', this._onLoad);\n\n function onLoad (e) {\n /*jshint validthis: false */\n //don't clear timeout\n if (e.origin !== getOrigin()) return;\n var result = JSON.parse(e.data);\n\n //don't clear timeout\n if (result.id !== that.getID()) return;\n\n var adUnit, error, createAd;\n if (!that._frame.contentWindow) {\n\n error = 'the iframe is not anymore in the DOM tree';\n\n } else {\n createAd = that._frame.contentWindow.getVPAIDAd;\n error = utils.validate(typeof createAd === 'function', 'the ad didn\\'t return a function to create an ad');\n }\n\n if (!error) {\n var adEl = that._frame.contentWindow.document.querySelector('.ad-element');\n adUnit = new VPAIDAdUnit(createAd(), adEl, that._videoEl, that._frame);\n adUnit.subscribe(AD_STOPPED, $adDestroyed.bind(that));\n error = utils.validate(adUnit.isValidVPAIDAd(), 'the add is not fully complaint with VPAID specification');\n }\n\n that._adUnit = adUnit;\n $destroyLoadListener.call(that);\n callback(error, error ? null : adUnit);\n\n //clear timeout\n return true;\n }\n\n function onTimeout() {\n callback('timeout', null);\n }\n};\n\n/**\n * unloadAdUnit\n *\n */\nVPAIDHTML5Client.prototype.unloadAdUnit = function unloadAdUnit() {\n $unloadPreviousAdUnit.call(this);\n};\n\n/**\n * getID will return the unique id\n *\n * @return {string}\n */\nVPAIDHTML5Client.prototype.getID = function () {\n return this._id;\n};\n\n\n/**\n * $removeEl\n *\n * @param {string} key\n */\nfunction $removeEl(key) {\n var el = this[key];\n if (el) {\n el.remove();\n delete this[key];\n }\n}\n\nfunction $adDestroyed() {\n $removeAdElements.call(this);\n delete this._adUnit;\n}\n\nfunction $unloadPreviousAdUnit() {\n $removeAdElements.call(this);\n $destroyAdUnit.call(this);\n}\n\nfunction $removeAdElements() {\n $removeEl.call(this, '_frame');\n $destroyLoadListener.call(this);\n}\n\n/**\n * $destroyLoadListener\n *\n */\nfunction $destroyLoadListener() {\n if (this._onLoad) {\n window.removeEventListener('message', this._onLoad);\n utils.clearCallbackTimeout(this._onLoad);\n delete this._onLoad;\n }\n}\n\n\nfunction $destroyAdUnit() {\n if (this._adUnit) {\n this._adUnit.stopAd();\n delete this._adUnit;\n }\n}\n\n/**\n * $throwIfDestroyed\n *\n */\nfunction $throwIfDestroyed() {\n if (this._destroyed) {\n throw new Error ('VPAIDHTML5Client already destroyed!');\n }\n}\n\nfunction getOrigin() {\n if( window.location.origin ) {\n return window.location.origin;\n }\n else {\n return window.location.protocol + \"//\" +\n window.location.hostname +\n (window.location.port ? ':' + window.location.port: '');\n }\n}\n\nmodule.exports = VPAIDHTML5Client;\nwindow.VPAIDHTML5Client = VPAIDHTML5Client;\n\n\n},{\"./VPAIDAdUnit\":10,\"./utils\":13}],12:[function(require,module,exports){\n'use strict';\n\nfunction Subscriber() {\n this._subscribers = {};\n}\n\nSubscriber.prototype.subscribe = function subscribe(handler, eventName, context) {\n if (!this.isHandlerAttached(handler, eventName)) {\n this.get(eventName).push({handler: handler, context: context, eventName: eventName});\n }\n};\n\nSubscriber.prototype.unsubscribe = function unsubscribe(handler, eventName) {\n this._subscribers[eventName] = this.get(eventName).filter(function (subscriber) {\n return handler !== subscriber.handler;\n });\n};\n\nSubscriber.prototype.unsubscribeAll = function unsubscribeAll() {\n this._subscribers = {};\n};\n\nSubscriber.prototype.trigger = function(eventName, data) {\n var that = this;\n var subscribers = this.get(eventName)\n .concat(this.get('*'));\n\n subscribers.forEach(function (subscriber) {\n setTimeout(function () {\n if (that.isHandlerAttached(subscriber.handler, subscriber.eventName)) {\n subscriber.handler.call(subscriber.context, data);\n }\n }, 0);\n });\n};\n\nSubscriber.prototype.triggerSync = function(eventName, data) {\n var subscribers = this.get(eventName)\n .concat(this.get('*'));\n\n subscribers.forEach(function (subscriber) {\n subscriber.handler.call(subscriber.context, data);\n });\n};\n\nSubscriber.prototype.get = function get(eventName) {\n if (!this._subscribers[eventName]) {\n this._subscribers[eventName] = [];\n }\n return this._subscribers[eventName];\n};\n\nSubscriber.prototype.isHandlerAttached = function isHandlerAttached(handler, eventName) {\n return this.get(eventName).some(function(subscriber) {\n return handler === subscriber.handler;\n })\n};\n\nmodule.exports = Subscriber;\n\n\n},{}],13:[function(require,module,exports){\n'use strict';\n\n/**\n * noop a empty function\n */\nfunction noop() {}\n\n/**\n * validate if is not validate will return an Error with the message\n *\n * @param {boolean} isValid\n * @param {string} message\n */\nfunction validate(isValid, message) {\n return isValid ? null : new Error(message);\n}\n\nvar timeouts = {};\n/**\n * clearCallbackTimeout\n *\n * @param {function} func handler to remove\n */\nfunction clearCallbackTimeout(func) {\n var timeout = timeouts[func];\n if (timeout) {\n clearTimeout(timeout);\n delete timeouts[func];\n }\n}\n\n/**\n * callbackTimeout if the onSuccess is not called and returns true in the timelimit then onTimeout will be called\n *\n * @param {number} timer\n * @param {function} onSuccess\n * @param {function} onTimeout\n */\nfunction callbackTimeout(timer, onSuccess, onTimeout) {\n var callback, timeout;\n\n timeout = setTimeout(function () {\n onSuccess = noop;\n delete timeout[callback];\n onTimeout();\n }, timer);\n\n callback = function () {\n // TODO avoid leaking arguments\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n if (onSuccess.apply(this, arguments)) {\n clearCallbackTimeout(callback);\n }\n };\n\n timeouts[callback] = timeout;\n\n return callback;\n}\n\n\n/**\n * createElementInEl\n *\n * @param {HTMLElement} parent\n * @param {string} tagName\n * @param {string} id\n */\nfunction createElementInEl(parent, tagName, id) {\n var nEl = document.createElement(tagName);\n if (id) nEl.id = id;\n parent.appendChild(nEl);\n return nEl;\n}\n\n/**\n * createIframeWithContent\n *\n * @param {HTMLElement} parent\n * @param {string} template simple template using {{var}}\n * @param {object} data\n */\nfunction createIframeWithContent(parent, template, data) {\n var iframe = createIframe(parent, null, data.zIndex);\n if (!setIframeContent(iframe, simpleTemplate(template, data))) return;\n return iframe;\n}\n\n/**\n * createIframe\n *\n * @param {HTMLElement} parent\n * @param {string} url\n */\nfunction createIframe(parent, url, zIndex) {\n var nEl = document.createElement('iframe');\n nEl.src = url || 'about:blank';\n nEl.marginWidth = '0';\n nEl.marginHeight = '0';\n nEl.frameBorder = '0';\n nEl.width = '100%';\n nEl.height = '100%';\n nEl.style.position = 'absolute';\n nEl.style.left = '0';\n nEl.style.top = '0';\n nEl.style.margin = '0px';\n nEl.style.padding = '0px';\n nEl.style.border = 'none';\n\n if(zIndex){\n nEl.style.zIndex = zIndex;\n }\n\n nEl.setAttribute('SCROLLING','NO');\n parent.innerHTML = '';\n parent.appendChild(nEl);\n return nEl;\n}\n\n/**\n * simpleTemplate\n *\n * @param {string} template\n * @param {object} data\n */\nfunction simpleTemplate(template, data) {\n Object.keys(data).forEach(function (key) {\n var value = (typeof value === 'object') ? JSON.stringify(data[key]) : data[key];\n template = template.replace(new RegExp('{{' + key + '}}', 'g'), value);\n });\n return template;\n}\n\n/**\n * setIframeContent\n *\n * @param {HTMLIframeElement} iframeEl\n * @param content\n */\nfunction setIframeContent(iframeEl, content) {\n var iframeDoc = iframeEl.contentWindow && iframeEl.contentWindow.document;\n if (!iframeDoc) return false;\n\n iframeDoc.write(content);\n\n return true;\n}\n\n\n/**\n * extend object with keys from another object\n *\n * @param {object} toExtend\n * @param {object} fromSource\n */\nfunction extend(toExtend, fromSource) {\n Object.keys(fromSource).forEach(function(key) {\n toExtend[key] = fromSource[key];\n });\n return toExtend;\n}\n\n\n/**\n * unique will create a unique string everytime is called, sequentially and prefixed\n *\n * @param {string} prefix\n */\nfunction unique(prefix) {\n var count = -1;\n return function () {\n return prefix + '_' + (++count);\n };\n}\n\nmodule.exports = {\n noop: noop,\n validate: validate,\n clearCallbackTimeout: clearCallbackTimeout,\n callbackTimeout: callbackTimeout,\n createElementInEl: createElementInEl,\n createIframeWithContent: createIframeWithContent,\n createIframe: createIframe,\n simpleTemplate: simpleTemplate,\n setIframeContent: setIframeContent,\n extend: extend,\n unique: unique\n};\n\n\n},{}],14:[function(require,module,exports){\n'use strict';\n\nvar InLine = require('./InLine');\nvar Wrapper = require('./Wrapper');\n\nfunction Ad(adJTree) {\n if (!(this instanceof Ad)) {\n return new Ad(adJTree);\n }\n this.initialize(adJTree);\n}\n\nAd.prototype.initialize = function(adJTree) {\n this.id = adJTree.attr('id');\n this.sequence = adJTree.attr('sequence');\n\n if(adJTree.inLine) {\n this.inLine = new InLine(adJTree.inLine);\n }\n\n if(adJTree.wrapper){\n this.wrapper = new Wrapper(adJTree.wrapper);\n }\n};\n\nmodule.exports = Ad;\n},{\"./InLine\":17,\"./Wrapper\":27}],15:[function(require,module,exports){\n'use strict';\n\nvar TrackingEvent = require('./TrackingEvent');\n\nvar utilities = require('../../utils/utilityFunctions');\n\nvar xml = require('../../utils/xml');\n\n\nfunction Companion(companionJTree) {\n if (!(this instanceof Companion)) {\n return new Companion(companionJTree);\n }\n\n //Required Elements\n this.creativeType = xml.attr(companionJTree.staticResource, 'creativeType');\n this.staticResource = xml.keyValue(companionJTree.staticResource);\n\n // Weird bug when the JXON tree is built it doesn't handle casing properly in this situation...\n var htmlResource = null;\n if (xml.keyValue(companionJTree.HTMLResource)) {\n htmlResource = xml.keyValue(companionJTree.HTMLResource);\n } else if (xml.keyValue(companionJTree.hTMLResource)) {\n htmlResource = xml.keyValue(companionJTree.hTMLResource);\n }\n this.htmlResource = htmlResource;\n\n var iframeResource = null;\n if (xml.keyValue(companionJTree.IFrameResource)) {\n iframeResource = xml.keyValue(companionJTree.IFrameResource);\n } else if (xml.keyValue(companionJTree.iFrameresource)) {\n iframeResource = xml.keyValue(companionJTree.iFrameresource);\n }\n this.iframeResource = iframeResource;\n\n //Optional fields\n this.id = xml.attr(companionJTree, 'id');\n this.width = xml.attr(companionJTree, 'width');\n this.height = xml.attr(companionJTree, 'height');\n this.expandedWidth = xml.attr(companionJTree, 'expandedWidth');\n this.expandedHeight = xml.attr(companionJTree, 'expandedHeight');\n this.scalable = xml.attr(companionJTree, 'scalable');\n this.maintainAspectRatio = xml.attr(companionJTree, 'maintainAspectRatio');\n this.minSuggestedDuration = xml.attr(companionJTree, 'minSuggestedDuration');\n this.apiFramework = xml.attr(companionJTree, 'apiFramework');\n this.companionClickThrough = xml.keyValue(companionJTree.companionClickThrough);\n this.trackingEvents = parseTrackingEvents(companionJTree.trackingEvents && companionJTree.trackingEvents.tracking);\n\n /*** Local functions ***/\n function parseTrackingEvents(trackingEvents) {\n var trackings = [];\n if (utilities.isDefined(trackingEvents)) {\n trackingEvents = utilities.isArray(trackingEvents) ? trackingEvents : [trackingEvents];\n trackingEvents.forEach(function (trackingData) {\n trackings.push(new TrackingEvent(trackingData));\n });\n }\n return trackings;\n }\n}\n\nmodule.exports = Companion;\n},{\"../../utils/utilityFunctions\":44,\"../../utils/xml\":45,\"./TrackingEvent\":20}],16:[function(require,module,exports){\n'use strict';\n\nvar Linear = require('./Linear');\nvar Companion = require('./Companion');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction Creative(creativeJTree) {\n if(!(this instanceof Creative)) {\n return new Creative(creativeJTree);\n }\n\n this.id = creativeJTree.attr('id');\n this.sequence = creativeJTree.attr('sequence');\n this.adId = creativeJTree.attr('adId');\n this.apiFramework = creativeJTree.attr('apiFramework');\n\n if(creativeJTree.linear) {\n this.linear = new Linear(creativeJTree.linear);\n }\n\n if (creativeJTree.companionAds) {\n var companions = [];\n var companionAds = creativeJTree.companionAds && creativeJTree.companionAds.companion;\n if (utilities.isDefined(companionAds)) {\n companionAds = utilities.isArray(companionAds) ? companionAds : [companionAds];\n companionAds.forEach(function (companionData) {\n companions.push(new Companion(companionData));\n });\n }\n this.companionAds = companions;\n }\n}\n\n/**\n * Returns true if the browser supports at the creative.\n */\nCreative.prototype.isSupported = function(){\n if(this.linear) {\n return this.linear.isSupported();\n }\n\n return true;\n};\n\nCreative.parseCreatives = function parseCreatives(creativesJTree) {\n var creatives = [];\n var creativesData;\n if (utilities.isDefined(creativesJTree) && utilities.isDefined(creativesJTree.creative)) {\n creativesData = utilities.isArray(creativesJTree.creative) ? creativesJTree.creative : [creativesJTree.creative];\n creativesData.forEach(function (creative) {\n creatives.push(new Creative(creative));\n });\n }\n return creatives;\n};\n\nmodule.exports = Creative;\n\n},{\"../../utils/utilityFunctions\":44,\"./Companion\":15,\"./Linear\":18}],17:[function(require,module,exports){\n'use strict';\n\nvar vastUtil = require('./vastUtil');\nvar Creative = require('./Creative');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nfunction InLine(inlineJTree) {\n if (!(this instanceof InLine)) {\n return new InLine(inlineJTree);\n }\n\n //Required Fields\n this.adTitle = xml.keyValue(inlineJTree.adTitle);\n this.adSystem = xml.keyValue(inlineJTree.adSystem);\n this.impressions = vastUtil.parseImpressions(inlineJTree.impression);\n this.creatives = Creative.parseCreatives(inlineJTree.creatives);\n\n //Optional Fields\n this.description = xml.keyValue(inlineJTree.description);\n this.advertiser = xml.keyValue(inlineJTree.advertiser);\n this.surveys = parseSurveys(inlineJTree.survey);\n this.error = xml.keyValue(inlineJTree.error);\n this.pricing = xml.keyValue(inlineJTree.pricing);\n this.extensions = inlineJTree.extensions;\n\n /*** Local Functions ***/\n function parseSurveys(inlineSurveys) {\n if (inlineSurveys) {\n return utilities.transformArray(utilities.isArray(inlineSurveys) ? inlineSurveys : [inlineSurveys], function (survey) {\n if(utilities.isNotEmptyString(survey.keyValue)){\n return {\n uri: survey.keyValue,\n type: survey.attr('type')\n };\n }\n\n return undefined;\n });\n }\n return [];\n }\n}\n\n\n/**\n * Returns true if the browser supports all the creatives.\n */\nInLine.prototype.isSupported = function(){\n var i,len;\n\n if(this.creatives.length === 0) {\n return false;\n }\n\n for(i = 0, len = this.creatives.length; i< len; i+=1){\n if(!this.creatives[i].isSupported()){\n return false;\n }\n }\n return true;\n};\n\nmodule.exports = InLine;\n\n},{\"../../utils/utilityFunctions\":44,\"../../utils/xml\":45,\"./Creative\":16,\"./vastUtil\":29}],18:[function(require,module,exports){\n'use strict';\n\nvar TrackingEvent = require('./TrackingEvent');\nvar MediaFile = require('./MediaFile');\nvar VideoClicks = require('./VideoClicks');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar parsers = require('./parsers');\n\nvar xml = require('../../utils/xml');\n\n\nfunction Linear(linearJTree) {\n if (!(this instanceof Linear)) {\n return new Linear(linearJTree);\n }\n\n //Required Elements\n this.duration = parsers.duration(xml.keyValue(linearJTree.duration));\n this.mediaFiles = parseMediaFiles(linearJTree.mediaFiles && linearJTree.mediaFiles.mediaFile);\n\n //Optional fields\n this.trackingEvents = parseTrackingEvents(linearJTree.trackingEvents && linearJTree.trackingEvents.tracking, this.duration);\n this.skipoffset = parsers.offset(xml.attr(linearJTree, 'skipoffset'), this.duration);\n\n if (linearJTree.videoClicks) {\n this.videoClicks = new VideoClicks(linearJTree.videoClicks);\n }\n\n if(linearJTree.adParameters) {\n this.adParameters = xml.keyValue(linearJTree.adParameters);\n\n if(xml.attr(linearJTree.adParameters, 'xmlEncoded')){\n this.adParameters = xml.decode(this.adParameters);\n }\n }\n\n /*** Local functions ***/\n function parseTrackingEvents(trackingEvents, duration) {\n var trackings = [];\n if (utilities.isDefined(trackingEvents)) {\n trackingEvents = utilities.isArray(trackingEvents) ? trackingEvents : [trackingEvents];\n trackingEvents.forEach(function (trackingData) {\n trackings.push(new TrackingEvent(trackingData, duration));\n });\n }\n return trackings;\n }\n\n function parseMediaFiles(mediaFilesJxonTree) {\n var mediaFiles = [];\n if (utilities.isDefined(mediaFilesJxonTree)) {\n mediaFilesJxonTree = utilities.isArray(mediaFilesJxonTree) ? mediaFilesJxonTree : [mediaFilesJxonTree];\n\n mediaFilesJxonTree.forEach(function (mfData) {\n mediaFiles.push(new MediaFile(mfData));\n });\n }\n return mediaFiles;\n }\n}\n\n/**\n * Must return true if at least one of the MediaFiles' type is supported\n */\nLinear.prototype.isSupported = function () {\n var i, len;\n for(i=0, len=this.mediaFiles.length; i 0) {\n getAd(waterfallAds.shift(),[], waterfallHandler);\n } else {\n callback(error, adChain);\n }\n } else {\n callback(null, adChain);\n }\n }\n });\n\n /*** Local functions ***/\n function getAdWaterfall(adTagUrl, callback) {\n var requestVastXML = that._requestVASTXml.bind(that, adTagUrl);\n async.waterfall([\n requestVastXML,\n buildVastWaterfall\n ], callback);\n }\n\n function buildVastWaterfall(xmlStr, callback) {\n var vastTree;\n try {\n vastTree = xml.toJXONTree(xmlStr);\n\n if(utilities.isArray(vastTree.ad)) {\n vastTree.ads = vastTree.ad;\n } else if(vastTree.ad){\n vastTree.ads = [vastTree.ad];\n } else {\n vastTree.ads = [];\n }\n callback(validateVASTTree(vastTree), vastTree);\n\n } catch (e) {\n callback(new VASTError(\"on VASTClient.getVASTAd.buildVastWaterfall, error parsing xml\", 100), null);\n }\n }\n\n function validateVASTTree(vastTree) {\n var vastVersion = xml.attr(vastTree, 'version');\n\n if (!vastTree.ad) {\n return new VASTError('on VASTClient.getVASTAd.validateVASTTree, no Ad in VAST tree', 303);\n }\n\n if (vastVersion && (vastVersion != 3 && vastVersion != 2)) {\n return new VASTError('on VASTClient.getVASTAd.validateVASTTree, not supported VAST version \"' + vastVersion + '\"', 102);\n }\n\n return null;\n }\n\n function getAd(adTagUrl, adChain, callback) {\n if (adChain.length >= that.WRAPPER_LIMIT) {\n return callback(new VASTError(\"on VASTClient.getVASTAd.getAd, players wrapper limit reached (the limit is \" + that.WRAPPER_LIMIT + \")\", 302), adChain);\n }\n\n async.waterfall([\n function (next) {\n if (utilities.isString(adTagUrl)) {\n requestVASTAd(adTagUrl, next);\n } else {\n next(null, adTagUrl);\n }\n },\n buildAd\n ], function (error, ad) {\n if (ad) {\n adChain.push(ad);\n }\n\n if (error) {\n return callback(error, adChain);\n }\n\n if (ad.wrapper) {\n return getAd(ad.wrapper.VASTAdTagURI, adChain, callback);\n }\n\n return callback(null, adChain);\n });\n }\n\n function buildAd(adJxonTree, callback) {\n try {\n var ad = new Ad(adJxonTree);\n callback(validateAd(ad), ad);\n } catch (e) {\n callback(new VASTError('on VASTClient.getVASTAd.buildAd, error parsing xml', 100), null);\n }\n }\n\n function validateAd(ad) {\n var wrapper = ad.wrapper;\n var inLine = ad.inLine;\n var errMsgPrefix = 'on VASTClient.getVASTAd.validateAd, ';\n\n if (inLine && wrapper) {\n return new VASTError(errMsgPrefix +\"InLine and Wrapper both found on the same Ad\", 101);\n }\n\n if (!inLine && !wrapper) {\n return new VASTError(errMsgPrefix + \"nor wrapper nor inline elements found on the Ad\", 101);\n }\n\n if (inLine && !inLine.isSupported()) {\n return new VASTError(errMsgPrefix + \"could not find MediaFile that is supported by this video player\", 403);\n }\n\n if (wrapper && !wrapper.VASTAdTagURI) {\n return new VASTError(errMsgPrefix + \"missing 'VASTAdTagURI' in wrapper\", 101);\n }\n\n return null;\n }\n\n function requestVASTAd(adTagUrl, callback) {\n that._requestVASTXml(adTagUrl, function (error, xmlStr) {\n if (error) {\n return callback(error);\n }\n try {\n var vastTree = xml.toJXONTree(xmlStr);\n callback(validateVASTTree(vastTree), vastTree.ad);\n } catch (e) {\n callback(new VASTError(\"on VASTClient.getVASTAd.requestVASTAd, error parsing xml\", 100));\n }\n });\n }\n};\n\nVASTClient.prototype._requestVASTXml = function requestVASTXml(adTagUrl, callback) {\n try {\n if (utilities.isFunction(adTagUrl)) {\n adTagUrl(requestHandler);\n } else {\n http.get(adTagUrl, requestHandler, {\n withCredentials: true\n });\n }\n } catch (e) {\n callback(e);\n }\n\n /*** Local functions ***/\n function requestHandler(error, response, status) {\n if (error) {\n var errMsg = utilities.isDefined(status) ?\n \"on VASTClient.requestVastXML, HTTP request error with status '\" + status + \"'\" :\n \"on VASTClient.requestVastXML, Error getting the the VAST XML with he passed adTagXML fn\";\n return callback(new VASTError(errMsg, 301), null);\n }\n\n callback(null, response);\n }\n};\n\nVASTClient.prototype._buildVASTResponse = function buildVASTResponse(adsChain) {\n var response = new VASTResponse();\n addAdsToResponse(response, adsChain);\n validateResponse(response);\n\n return response;\n\n //*** Local function ****\n function addAdsToResponse(response, ads) {\n ads.forEach(function (ad) {\n response.addAd(ad);\n });\n }\n\n function validateResponse(response) {\n var progressEvents = response.trackingEvents.progress;\n\n if (!response.hasLinear()) {\n throw new VASTError(\"on VASTClient._buildVASTResponse, Received an Ad type that is not supported\", 200);\n }\n\n if (response.duration === undefined) {\n throw new VASTError(\"on VASTClient._buildVASTResponse, Missing duration field in VAST response\", 101);\n }\n\n if (progressEvents) {\n progressEvents.forEach(function (progressEvent) {\n if (!utilities.isNumber(progressEvent.offset)) {\n throw new VASTError(\"on VASTClient._buildVASTResponse, missing or wrong offset attribute on progress tracking event\", 101);\n }\n });\n }\n }\n};\n\nVASTClient.prototype._trackError = function (error, adChain) {\n if (!utilities.isArray(adChain) || adChain.length === 0) { //There is nothing to track\n return;\n }\n\n var errorURLMacros = [];\n adChain.forEach(addErrorUrlMacros);\n vastUtil.track(errorURLMacros, {ERRORCODE: error.code || 900}); //900 <== Undefined error\n\n /*** Local functions ***/\n function addErrorUrlMacros(ad) {\n if (ad.wrapper && ad.wrapper.error) {\n errorURLMacros.push(ad.wrapper.error);\n }\n\n if (ad.inLine && ad.inLine.error) {\n errorURLMacros.push(ad.inLine.error);\n }\n }\n};\n\nmodule.exports = VASTClient;\n\n},{\"../../utils/async\":39,\"../../utils/http\":41,\"../../utils/utilityFunctions\":44,\"../../utils/xml\":45,\"./Ad\":14,\"./VASTError\":22,\"./VASTResponse\":24,\"./vastUtil\":29}],22:[function(require,module,exports){\n'use strict';\n\nfunction VASTError(message, code) {\n this.message = 'VAST Error: ' + (message || '');\n if (code) {\n this.code = code;\n }\n}\n\nVASTError.prototype = new Error();\nVASTError.prototype.name = \"VAST Error\";\n\nmodule.exports = VASTError;\n},{}],23:[function(require,module,exports){\n'use strict';\n\n/**\n * Inner helper class that deals with the logic of the individual steps needed to setup an ad in the player.\n *\n * @param player {object} instance of the player that will play the ad. It assumes that the videojs-contrib-ads plugin\n * has been initialized when you use its utility functions.\n *\n * @constructor\n */\n\nvar VASTResponse = require('./VASTResponse');\nvar VASTError = require('./VASTError');\nvar VASTTracker = require('./VASTTracker');\nvar vastUtil = require('./vastUtil');\n\nvar async = require('../../utils/async');\nvar dom = require('../../utils/dom');\nvar playerUtils = require('../../utils/playerUtils');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VASTIntegrator(player) {\n if (!(this instanceof VASTIntegrator)) {\n return new VASTIntegrator(player);\n }\n\n this.player = player;\n}\n\nVASTIntegrator.prototype.playAd = function playAd(vastResponse, callback) {\n var that = this;\n callback = callback || utilities.noop;\n\n if (!(vastResponse instanceof VASTResponse)) {\n return callback(new VASTError('On VASTIntegrator, missing required VASTResponse'));\n }\n\n async.waterfall([\n function (next) {\n next(null, vastResponse);\n },\n this._selectAdSource.bind(this),\n this._createVASTTracker.bind(this),\n this._addClickThrough.bind(this),\n this._addSkipButton.bind(this),\n this._setupEvents.bind(this),\n this._playSelectedAd.bind(this)\n ], function (error, response) {\n if (error && response) {\n that._trackError(error, response);\n }\n callback(error, response);\n });\n\n this._adUnit = {\n _src: null,\n type: 'VAST',\n pauseAd: function () {\n that.player.pause(true);\n },\n\n resumeAd: function () {\n that.player.play(true);\n },\n\n isPaused: function () {\n return that.player.paused(true);\n },\n\n getSrc: function () {\n return this._src;\n }\n };\n\n return this._adUnit;\n};\n\nVASTIntegrator.prototype._selectAdSource = function selectAdSource(response, callback) {\n var source;\n\n var playerWidth = dom.getDimension(this.player.el()).width;\n response.mediaFiles.sort(function compareTo(a, b) {\n var deltaA = Math.abs(playerWidth - a.width);\n var deltaB = Math.abs(playerWidth - b.width);\n return deltaA - deltaB;\n });\n\n source = this.player.selectSource(response.mediaFiles).source;\n\n if (source) {\n if (this._adUnit) {\n this._adUnit._src = source;\n }\n return callback(null, source, response);\n }\n\n // code 403 <== Couldn't find MediaFile that is supported by this video player\n callback(new VASTError(\"Could not find Ad mediafile supported by this player\", 403), response);\n};\n\nVASTIntegrator.prototype._createVASTTracker = function createVASTTracker(adMediaFile, response, callback) {\n try {\n callback(null, adMediaFile, new VASTTracker(adMediaFile.src, response), response);\n } catch (e) {\n callback(e, response);\n }\n};\n\nVASTIntegrator.prototype._setupEvents = function setupEvents(adMediaFile, tracker, response, callback) {\n var previouslyMuted;\n var player = this.player;\n player.on('fullscreenchange', trackFullscreenChange);\n player.on('vast.adStart', trackImpressions);\n player.on('pause', trackPause);\n player.on('timeupdate', trackProgress);\n player.on('volumechange', trackVolumeChange);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], unbindEvents);\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel', 'vast.adSkip'], function(evt){\n if(evt.type === 'vast.adEnd'){\n tracker.trackComplete();\n }\n });\n\n return callback(null, adMediaFile, response);\n\n /*** Local Functions ***/\n function unbindEvents() {\n player.off('fullscreenchange', trackFullscreenChange);\n player.off('vast.adStart', trackImpressions);\n player.off('pause', trackPause);\n player.off('timeupdate', trackProgress);\n player.off('volumechange', trackVolumeChange);\n }\n\n function trackFullscreenChange() {\n if (player.isFullscreen()) {\n tracker.trackFullscreen();\n } else {\n tracker.trackExitFullscreen();\n }\n }\n\n function trackPause() {\n //NOTE: whenever a video ends the video Element triggers a 'pause' event before the 'ended' event.\n // We should not track this pause event because it makes the VAST tracking confusing again we use a\n // Threshold of 2 seconds to prevent false positives on IOS.\n if (Math.abs(player.duration() - player.currentTime()) < 2) {\n return;\n }\n\n tracker.trackPause();\n playerUtils.once(player, ['play', 'vast.adEnd', 'vast.adsCancel'], function (evt) {\n if(evt.type === 'play'){\n tracker.trackResume();\n }\n });\n }\n\n function trackProgress() {\n var currentTimeInMs = player.currentTime() * 1000;\n tracker.trackProgress(currentTimeInMs);\n }\n\n function trackImpressions() {\n tracker.trackImpressions();\n tracker.trackCreativeView();\n }\n\n function trackVolumeChange() {\n var muted = player.muted();\n if (muted) {\n tracker.trackMute();\n } else if (previouslyMuted) {\n tracker.trackUnmute();\n }\n previouslyMuted = muted;\n }\n};\n\nVASTIntegrator.prototype._addSkipButton = function addSkipButton(source, tracker, response, callback) {\n var skipOffsetInSec;\n var that = this;\n\n if (utilities.isNumber(response.skipoffset)) {\n skipOffsetInSec = response.skipoffset / 1000;\n addSkipButtonToPlayer(this.player, skipOffsetInSec);\n }\n callback(null, source, tracker, response);\n\n /*** Local function ***/\n function addSkipButtonToPlayer(player, skipOffset) {\n var skipButton = createSkipButton(player);\n var updateSkipButton = updateSkipButtonState.bind(that, skipButton, skipOffset, player);\n\n player.el().appendChild(skipButton);\n player.on('timeupdate', updateSkipButton);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeSkipButton);\n\n function removeSkipButton() {\n player.off('timeupdate', updateSkipButton);\n dom.remove(skipButton);\n }\n }\n\n function createSkipButton(player) {\n var skipButton = window.document.createElement(\"div\");\n dom.addClass(skipButton, \"vast-skip-button\");\n\n skipButton.onclick = function (e) {\n if (dom.hasClass(skipButton, 'enabled')) {\n tracker.trackSkip();\n player.trigger('vast.adSkip');\n }\n\n //We prevent event propagation to avoid problems with the clickThrough and so on\n if (window.Event.prototype.stopPropagation !== undefined) {\n e.stopPropagation();\n } else {\n return false;\n }\n };\n\n return skipButton;\n }\n\n function updateSkipButtonState(skipButton, skipOffset, player) {\n var timeLeft = Math.ceil(skipOffset - player.currentTime());\n if (timeLeft > 0) {\n skipButton.innerHTML = \"Skip in \" + utilities.toFixedDigits(timeLeft, 2) + \"...\";\n } else {\n if (!dom.hasClass(skipButton, 'enabled')) {\n dom.addClass(skipButton, 'enabled');\n skipButton.innerHTML = \"Skip ad\";\n }\n }\n }\n};\n\nVASTIntegrator.prototype._addClickThrough = function addClickThrough(mediaFile, tracker, response, callback) {\n var player = this.player;\n var blocker = createClickThroughBlocker(player, tracker, response);\n var updateBlocker = updateBlockerURL.bind(this, blocker, response, player);\n\n player.el().insertBefore(blocker, player.controlBar.el());\n player.on('timeupdate', updateBlocker);\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeBlocker);\n\n return callback(null, mediaFile, tracker, response);\n\n /*** Local Functions ***/\n\n function createClickThroughBlocker(player, tracker, response) {\n var blocker = window.document.createElement(\"a\");\n var clickThroughMacro = response.clickThrough;\n\n dom.addClass(blocker, 'vast-blocker');\n blocker.href = generateClickThroughURL(clickThroughMacro, player);\n\n if (utilities.isString(clickThroughMacro)) {\n blocker.target = \"_blank\";\n }\n\n blocker.onclick = function (e) {\n if (player.paused()) {\n player.play();\n\n //We prevent event propagation to avoid problems with the player's normal pause mechanism\n if (window.Event.prototype.stopPropagation !== undefined) {\n e.stopPropagation();\n }\n return false;\n }\n\n player.pause();\n tracker.trackClick();\n };\n\n return blocker;\n }\n\n function updateBlockerURL(blocker, response, player) {\n blocker.href = generateClickThroughURL(response.clickThrough, player);\n }\n\n function generateClickThroughURL(clickThroughMacro, player) {\n var variables = {\n ASSETURI: mediaFile.src,\n CONTENTPLAYHEAD: vastUtil.formatProgress(player.currentTime() * 1000)\n };\n\n return clickThroughMacro ? vastUtil.parseURLMacro(clickThroughMacro, variables) : '#';\n }\n\n function removeBlocker() {\n player.off('timeupdate', updateBlocker);\n dom.remove(blocker);\n }\n};\n\nVASTIntegrator.prototype._playSelectedAd = function playSelectedAd(source, response, callback) {\n var player = this.player;\n\n player.preload(\"auto\"); //without preload=auto the durationchange event is never fired\n player.src(source);\n\n playerUtils.once(player, ['durationchange', 'error', 'vast.adsCancel'], function (evt) {\n if (evt.type === 'durationchange') {\n playAd();\n } else if(evt.type === 'error') {\n callback(new VASTError(\"on VASTIntegrator, Player is unable to play the Ad\", 400), response);\n }\n //NOTE: If the ads get canceled we do nothing/\n });\n\n /**** local functions ******/\n function playAd() {\n\n playerUtils.once(player, ['playing', 'vast.adsCancel'], function (evt) {\n if(evt.type === 'vast.adsCancel'){\n return;\n }\n\n player.trigger('vast.adStart');\n\n player.on('ended', proceed);\n player.on('vast.adsCancel', proceed);\n player.on('vast.adSkip', proceed);\n\n function proceed(evt) {\n\n if(evt.type === 'ended' && (player.duration() - player.currentTime()) > 3 ) {\n // Ignore ended event if the Ad time was not 'near' the end\n // avoids issues where IOS controls could skip the Ad\n return;\n }\n\n player.off('ended', proceed);\n player.off('vast.adsCancel', proceed);\n player.off('vast.adSkip', proceed);\n\n //NOTE: if the ads get cancel we do nothing apart removing the listners\n if(evt.type === 'ended' || evt.type === 'vast.adSkip'){\n callback(null, response);\n }\n }\n });\n\n player.play();\n }\n};\n\nVASTIntegrator.prototype._trackError = function trackError(error, response) {\n vastUtil.track(response.errorURLMacros, {ERRORCODE: error.code || 900});\n};\n\nmodule.exports = VASTIntegrator;\n},{\"../../utils/async\":39,\"../../utils/dom\":40,\"../../utils/playerUtils\":42,\"../../utils/utilityFunctions\":44,\"./VASTError\":22,\"./VASTResponse\":24,\"./VASTTracker\":25,\"./vastUtil\":29}],24:[function(require,module,exports){\n'use strict';\n\nvar Ad = require('./Ad');\nvar VideoClicks = require('./VideoClicks');\nvar Linear = require('./Linear');\nvar InLine = require('./InLine');\nvar Wrapper = require('./Wrapper');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nwindow.InLine__A = InLine;\nfunction VASTResponse() {\n if (!(this instanceof VASTResponse)) {\n return new VASTResponse();\n }\n\n this._linearAdded = false;\n this.ads = [];\n this.errorURLMacros = [];\n this.impressions = [];\n this.clickTrackings = [];\n this.customClicks = [];\n this.trackingEvents = {};\n this.mediaFiles = [];\n this.clickThrough = undefined;\n this.adTitle = '';\n this.duration = undefined;\n this.skipoffset = undefined;\n}\n\nVASTResponse.prototype.addAd = function (ad) {\n var inLine, wrapper;\n if (ad instanceof Ad) {\n inLine = ad.inLine;\n wrapper = ad.wrapper;\n\n this.ads.push(ad);\n\n if (inLine) {\n this._addInLine(inLine);\n }\n\n if (wrapper) {\n this._addWrapper(wrapper);\n }\n }\n};\n\nVASTResponse.prototype._addErrorTrackUrl = function (error) {\n var errorURL = error instanceof xml.JXONTree ? xml.keyValue(error) : error;\n if (errorURL) {\n this.errorURLMacros.push(errorURL);\n }\n};\n\nVASTResponse.prototype._addImpressions = function (impressions) {\n utilities.isArray(impressions) && appendToArray(this.impressions, impressions);\n};\n\nVASTResponse.prototype._addClickThrough = function (clickThrough) {\n if (utilities.isNotEmptyString(clickThrough)) {\n this.clickThrough = clickThrough;\n }\n};\n\nVASTResponse.prototype._addClickTrackings = function (clickTrackings) {\n utilities.isArray(clickTrackings) && appendToArray(this.clickTrackings, clickTrackings);\n};\n\nVASTResponse.prototype._addCustomClicks = function (customClicks) {\n utilities.isArray(customClicks) && appendToArray(this.customClicks, customClicks);\n};\n\nVASTResponse.prototype._addTrackingEvents = function (trackingEvents) {\n var eventsMap = this.trackingEvents;\n\n if (trackingEvents) {\n trackingEvents = utilities.isArray(trackingEvents) ? trackingEvents : [trackingEvents];\n trackingEvents.forEach(function (trackingEvent) {\n if (!eventsMap[trackingEvent.name]) {\n eventsMap[trackingEvent.name] = [];\n }\n eventsMap[trackingEvent.name].push(trackingEvent);\n });\n }\n};\n\nVASTResponse.prototype._addTitle = function (title) {\n if (utilities.isNotEmptyString(title)) {\n this.adTitle = title;\n }\n};\n\nVASTResponse.prototype._addDuration = function (duration) {\n if (utilities.isNumber(duration)) {\n this.duration = duration;\n }\n};\n\nVASTResponse.prototype._addVideoClicks = function (videoClicks) {\n if (videoClicks instanceof VideoClicks) {\n this._addClickThrough(videoClicks.clickThrough);\n this._addClickTrackings(videoClicks.clickTrackings);\n this._addCustomClicks(videoClicks.customClicks);\n }\n};\n\nVASTResponse.prototype._addMediaFiles = function (mediaFiles) {\n utilities.isArray(mediaFiles) && appendToArray(this.mediaFiles, mediaFiles);\n};\n\nVASTResponse.prototype._addSkipoffset = function (offset) {\n if (offset) {\n this.skipoffset = offset;\n }\n};\n\nVASTResponse.prototype._addAdParameters = function (adParameters) {\n if (adParameters) {\n this.adParameters = adParameters;\n }\n};\n\nVASTResponse.prototype._addLinear = function (linear) {\n if (linear instanceof Linear) {\n this._addDuration(linear.duration);\n this._addTrackingEvents(linear.trackingEvents);\n this._addVideoClicks(linear.videoClicks);\n this._addMediaFiles(linear.mediaFiles);\n this._addSkipoffset(linear.skipoffset);\n this._addAdParameters(linear.adParameters);\n this._linearAdded = true;\n }\n};\n\nVASTResponse.prototype._addInLine = function (inLine) {\n var that = this;\n\n if (inLine instanceof InLine) {\n this._addTitle(inLine.adTitle);\n this._addErrorTrackUrl(inLine.error);\n this._addImpressions(inLine.impressions);\n\n inLine.creatives.forEach(function (creative) {\n if (creative.linear) {\n that._addLinear(creative.linear);\n }\n });\n }\n};\n\nVASTResponse.prototype._addWrapper = function (wrapper) {\n var that = this;\n\n if (wrapper instanceof Wrapper) {\n this._addErrorTrackUrl(wrapper.error);\n this._addImpressions(wrapper.impressions);\n\n wrapper.creatives.forEach(function (creative) {\n var linear = creative.linear;\n if (linear) {\n that._addVideoClicks(linear.videoClicks);\n that.clickThrough = undefined;//We ensure that no clickThrough has been added\n that._addTrackingEvents(linear.trackingEvents);\n }\n });\n }\n};\n\nVASTResponse.prototype.hasLinear = function(){\n return this._linearAdded;\n};\n\nfunction appendToArray(array, items) {\n items.forEach(function (item) {\n array.push(item);\n });\n}\n\nmodule.exports = VASTResponse;\n\n\n},{\"../../utils/utilityFunctions\":44,\"../../utils/xml\":45,\"./Ad\":14,\"./InLine\":17,\"./Linear\":18,\"./VideoClicks\":26,\"./Wrapper\":27}],25:[function(require,module,exports){\n'use strict';\n\nvar VASTError = require('./VASTError');\nvar VASTResponse = require('./VASTResponse');\nvar vastUtil = require('./vastUtil');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VASTTracker(assetURI, vastResponse) {\n if (!(this instanceof VASTTracker)) {\n return new VASTTracker(assetURI, vastResponse);\n }\n\n this.sanityCheck(assetURI, vastResponse);\n this.initialize(assetURI, vastResponse);\n\n}\n\nVASTTracker.prototype.initialize = function(assetURI, vastResponse) {\n this.response = vastResponse;\n this.assetURI = assetURI;\n this.progress = 0;\n this.quartiles = {\n firstQuartile: {tracked: false, time: Math.round(25 * vastResponse.duration) / 100},\n midpoint: {tracked: false, time: Math.round(50 * vastResponse.duration) / 100},\n thirdQuartile: {tracked: false, time: Math.round(75 * vastResponse.duration) / 100}\n };\n};\n\nVASTTracker.prototype.sanityCheck = function(assetURI, vastResponse) {\n if (!utilities.isString(assetURI) || utilities.isEmptyString(assetURI)) {\n throw new VASTError('on VASTTracker constructor, missing required the URI of the ad asset being played');\n }\n\n if (!(vastResponse instanceof VASTResponse)) {\n throw new VASTError('on VASTTracker constructor, missing required VAST response');\n }\n};\n\nVASTTracker.prototype.trackURLs = function trackURLs(urls, variables) {\n if (utilities.isArray(urls) && urls.length > 0) {\n variables = utilities.extend({\n ASSETURI: this.assetURI,\n CONTENTPLAYHEAD: vastUtil.formatProgress(this.progress)\n }, variables || {});\n\n vastUtil.track(urls, variables);\n }\n};\n\nVASTTracker.prototype.trackEvent = function trackEvent(eventName, trackOnce) {\n this.trackURLs(getEventUris(this.response.trackingEvents[eventName]));\n if (trackOnce) {\n this.response.trackingEvents[eventName] = undefined;\n }\n\n /*** Local function ***/\n function getEventUris(trackingEvents) {\n var uris;\n\n if (trackingEvents) {\n uris = [];\n trackingEvents.forEach(function (event) {\n uris.push(event.uri);\n });\n }\n return uris;\n }\n};\n\nVASTTracker.prototype.trackProgress = function trackProgress(newProgressInMs) {\n var that = this;\n var events = [];\n var ONCE = true;\n var ALWAYS = false;\n var trackingEvents = this.response.trackingEvents;\n\n if (utilities.isNumber(newProgressInMs)) {\n addTrackEvent('start', ONCE, newProgressInMs > 0);\n addTrackEvent('rewind', ALWAYS, hasRewound(this.progress, newProgressInMs));\n addQuartileEvents(newProgressInMs);\n trackProgressEvents(newProgressInMs);\n trackEvents();\n this.progress = newProgressInMs;\n }\n\n /*** Local function ***/\n function hasRewound(currentProgress, newProgress) {\n var REWIND_THRESHOLD = 3000; //IOS video clock is very unreliable and we need a 3 seconds threshold to ensure that there was a rewind an that it was on purpose.\n return currentProgress > newProgressInMs && Math.abs(newProgress - currentProgress) > REWIND_THRESHOLD;\n }\n\n function addTrackEvent(eventName, trackOnce, canBeAdded) {\n if (trackingEvents[eventName] && canBeAdded) {\n events.push({\n name: eventName,\n trackOnce: !!trackOnce\n });\n }\n }\n\n function addQuartileEvents(progress) {\n var quartiles = that.quartiles;\n var firstQuartile = that.quartiles.firstQuartile;\n var midpoint = that.quartiles.midpoint;\n var thirdQuartile = that.quartiles.thirdQuartile;\n\n if (!firstQuartile.tracked) {\n trackQuartile('firstQuartile', progress);\n } else if (!midpoint.tracked) {\n trackQuartile('midpoint', progress);\n } else if (!thirdQuartile.tracked){\n trackQuartile('thirdQuartile', progress);\n }\n\n /*** Local function ***/\n function trackQuartile(quartileName, progress){\n var quartile = quartiles[quartileName];\n if(canBeTracked(quartile, progress)){\n quartile.tracked = true;\n addTrackEvent(quartileName, ONCE, true);\n }\n }\n }\n\n function canBeTracked(quartile, progress) {\n var quartileTime = quartile.time;\n //We only fire the quartile event if the progress is bigger than the quartile time by 5 seconds at most.\n return progress >= quartileTime && progress <= (quartileTime + 5000);\n }\n\n function trackProgressEvents(progress) {\n if (!utilities.isArray(trackingEvents.progress)) {\n return; //Nothing to track\n }\n\n var pendingProgressEvts = [];\n\n trackingEvents.progress.forEach(function (evt) {\n if (evt.offset <= progress) {\n that.trackURLs([evt.uri]);\n } else {\n pendingProgressEvts.push(evt);\n }\n });\n trackingEvents.progress = pendingProgressEvts;\n }\n\n function trackEvents() {\n events.forEach(function (event) {\n that.trackEvent(event.name, event.trackOnce);\n });\n }\n};\n\n[\n 'rewind',\n 'fullscreen',\n 'exitFullscreen',\n 'pause',\n 'resume',\n 'mute',\n 'unmute',\n 'acceptInvitation',\n 'acceptInvitationLinear',\n 'collapse',\n 'expand'\n].forEach(function (eventName) {\n VASTTracker.prototype['track' + utilities.capitalize(eventName)] = function () {\n this.trackEvent(eventName);\n };\n });\n\n[\n 'start',\n 'skip',\n 'close',\n 'closeLinear'\n].forEach(function (eventName) {\n VASTTracker.prototype['track' + utilities.capitalize(eventName)] = function () {\n this.trackEvent(eventName, true);\n };\n });\n\n[\n 'firstQuartile',\n 'midpoint',\n 'thirdQuartile'\n].forEach(function (quartile) {\n VASTTracker.prototype['track' + utilities.capitalize(quartile)] = function () {\n this.quartiles[quartile].tracked = true;\n this.trackEvent(quartile, true);\n };\n });\n\nVASTTracker.prototype.trackComplete = function () {\n if(this.quartiles.thirdQuartile.tracked){\n this.trackEvent('complete', true);\n }\n};\n\nVASTTracker.prototype.trackErrorWithCode = function trackErrorWithCode(errorcode) {\n if (utilities.isNumber(errorcode)) {\n this.trackURLs(this.response.errorURLMacros, {ERRORCODE: errorcode});\n }\n};\n\nVASTTracker.prototype.trackImpressions = function trackImpressions() {\n this.trackURLs(this.response.impressions);\n};\n\nVASTTracker.prototype.trackCreativeView = function trackCreativeView() {\n this.trackEvent('creativeView');\n};\n\nVASTTracker.prototype.trackClick = function trackClick() {\n this.trackURLs(this.response.clickTrackings);\n};\n\nmodule.exports = VASTTracker;\n\n},{\"../../utils/utilityFunctions\":44,\"./VASTError\":22,\"./VASTResponse\":24,\"./vastUtil\":29}],26:[function(require,module,exports){\n'use strict';\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nfunction VideoClicks(videoClickJTree) {\n if (!(this instanceof VideoClicks)) {\n return new VideoClicks(videoClickJTree);\n }\n\n this.clickThrough = xml.keyValue(videoClickJTree.clickThrough);\n this.clickTrackings = parseClickTrackings(videoClickJTree.clickTracking);\n this.customClicks = parseClickTrackings(videoClickJTree.customClick);\n\n /*** Local functions ***/\n function parseClickTrackings(trackingData) {\n var clickTrackings = [];\n if (trackingData) {\n trackingData = utilities.isArray(trackingData) ? trackingData : [trackingData];\n trackingData.forEach(function (clickTrackingData) {\n clickTrackings.push(xml.keyValue(clickTrackingData));\n });\n }\n return clickTrackings;\n }\n}\n\nmodule.exports = VideoClicks;\n},{\"../../utils/utilityFunctions\":44,\"../../utils/xml\":45}],27:[function(require,module,exports){\n'use strict';\n\nvar vastUtil = require('./vastUtil');\nvar Creative = require('./Creative');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nfunction Wrapper(wrapperJTree) {\n if(!(this instanceof Wrapper)) {\n return new Wrapper(wrapperJTree);\n }\n\n //Required elements\n this.adSystem = xml.keyValue(wrapperJTree.adSystem);\n this.impressions = vastUtil.parseImpressions(wrapperJTree.impression);\n this.VASTAdTagURI = xml.keyValue(wrapperJTree.vASTAdTagURI);\n\n //Optional elements\n this.creatives = Creative.parseCreatives(wrapperJTree.creatives);\n this.error = xml.keyValue(wrapperJTree.error);\n this.extensions = wrapperJTree.extensions;\n\n //Optional attrs\n this.followAdditionalWrappers = utilities.isDefined(xml.attr(wrapperJTree, 'followAdditionalWrappers'))? xml.attr(wrapperJTree, 'followAdditionalWrappers'): true;\n this.allowMultipleAds = xml.attr(wrapperJTree, 'allowMultipleAds');\n this.fallbackOnNoAd = xml.attr(wrapperJTree, 'fallbackOnNoAd');\n}\n\nmodule.exports = Wrapper;\n\n},{\"../../utils/utilityFunctions\":44,\"../../utils/xml\":45,\"./Creative\":16,\"./vastUtil\":29}],28:[function(require,module,exports){\n'use strict';\n\nvar utilities = require('../../utils/utilityFunctions');\n\nvar durationRegex = /(\\d\\d):(\\d\\d):(\\d\\d)(\\.(\\d\\d\\d))?/;\n\nvar parsers = {\n\n duration: function parseDuration(durationStr) {\n\n var match, durationInMs;\n\n if (utilities.isString(durationStr)) {\n match = durationStr.match(durationRegex);\n if (match) {\n durationInMs = parseHoursToMs(match[1]) + parseMinToMs(match[2]) + parseSecToMs(match[3]) + parseInt(match[5] || 0);\n }\n }\n\n return isNaN(durationInMs) ? null : durationInMs;\n\n /*** local functions ***/\n function parseHoursToMs(hourStr) {\n return parseInt(hourStr, 10) * 60 * 60 * 1000;\n }\n\n function parseMinToMs(minStr) {\n return parseInt(minStr, 10) * 60 * 1000;\n }\n\n function parseSecToMs(secStr) {\n return parseInt(secStr, 10) * 1000;\n }\n },\n\n offset: function parseOffset(offset, duration) {\n if(isPercentage(offset)){\n return calculatePercentage(offset, duration);\n }\n return parsers.duration(offset);\n\n /*** Local function ***/\n function isPercentage(offset) {\n var percentageRegex = /^\\d+(\\.\\d+)?%$/g;\n return percentageRegex.test(offset);\n }\n\n function calculatePercentage(percentStr, duration) {\n if(duration) {\n return calcPercent(duration, parseFloat(percentStr.replace('%', '')));\n }\n return null;\n }\n\n function calcPercent(quantity, percent){\n return quantity * percent / 100;\n }\n }\n\n};\n\n\nmodule.exports = parsers;\n},{\"../../utils/utilityFunctions\":44}],29:[function(require,module,exports){\n'use strict';\n\nvar utilities = require('../../utils/utilityFunctions');\nvar VPAIDHTML5Tech = require('../vpaid/VPAIDHTML5Tech');\nvar VPAIDFlashTech = require('../vpaid/VPAIDFlashTech');\nvar VPAIDFLASHClient = require('VPAIDFLASHClient/js/VPAIDFLASHClient');\n\nvar vastUtil = {\n\n track: function track(URLMacros, variables) {\n var sources = vastUtil.parseURLMacros(URLMacros, variables);\n var trackImgs = [];\n sources.forEach(function (src) {\n var img = new Image();\n img.src = src;\n trackImgs.push(img);\n });\n return trackImgs;\n },\n\n parseURLMacros: function parseMacros(URLMacros, variables) {\n var parsedURLs = [];\n\n variables = variables || {};\n\n if (!(variables[\"CACHEBUSTING\"])) {\n variables[\"CACHEBUSTING\"] = Math.round(Math.random() * 1.0e+10);\n }\n\n URLMacros.forEach(function (URLMacro) {\n parsedURLs.push(vastUtil._parseURLMacro(URLMacro, variables));\n });\n\n return parsedURLs;\n },\n\n parseURLMacro: function parseMacro(URLMacro, variables) {\n variables = variables || {};\n\n if (!(variables[\"CACHEBUSTING\"])) {\n variables[\"CACHEBUSTING\"] = Math.round(Math.random() * 1.0e+10);\n }\n\n return vastUtil._parseURLMacro(URLMacro, variables);\n },\n\n _parseURLMacro: function parseMacro(URLMacro, variables) {\n variables = variables || {};\n\n utilities.forEach(variables, function (value, key) {\n URLMacro = URLMacro.replace(new RegExp(\"\\\\[\" + key + \"\\\\\\]\", 'gm'), value);\n });\n\n return URLMacro;\n },\n\n parseDuration: function parseDuration(durationStr) {\n var durationRegex = /(\\d\\d):(\\d\\d):(\\d\\d)(\\.(\\d\\d\\d))?/;\n var match, durationInMs;\n\n if (utilities.isString(durationStr)) {\n match = durationStr.match(durationRegex);\n if (match) {\n durationInMs = parseHoursToMs(match[1]) + parseMinToMs(match[2]) + parseSecToMs(match[3]) + parseInt(match[5] || 0);\n }\n }\n\n return isNaN(durationInMs) ? null : durationInMs;\n\n /*** local functions ***/\n function parseHoursToMs(hourStr) {\n return parseInt(hourStr, 10) * 60 * 60 * 1000;\n }\n\n function parseMinToMs(minStr) {\n return parseInt(minStr, 10) * 60 * 1000;\n }\n\n function parseSecToMs(secStr) {\n return parseInt(secStr, 10) * 1000;\n }\n },\n\n parseImpressions: function parseImpressions(impressions) {\n if (impressions) {\n impressions = utilities.isArray(impressions) ? impressions : [impressions];\n return utilities.transformArray(impressions, function (impression) {\n if (utilities.isNotEmptyString(impression.keyValue)) {\n return impression.keyValue;\n }\n return undefined;\n });\n }\n return [];\n },\n\n\n //We assume that the progress is going to arrive in milliseconds\n formatProgress: function formatProgress(progress) {\n var hours, minutes, seconds, milliseconds;\n hours = progress / (60 * 60 * 1000);\n hours = Math.floor(hours);\n minutes = (progress / (60 * 1000)) % 60;\n minutes = Math.floor(minutes);\n seconds = (progress / 1000) % 60;\n seconds = Math.floor(seconds);\n milliseconds = progress % 1000;\n return utilities.toFixedDigits(hours, 2) + ':' + utilities.toFixedDigits(minutes, 2) + ':' + utilities.toFixedDigits(seconds, 2) + '.' + utilities.toFixedDigits(milliseconds, 3);\n },\n\n parseOffset: function parseOffset(offset, duration) {\n if (isPercentage(offset)) {\n return calculatePercentage(offset, duration);\n }\n return vastUtil.parseDuration(offset);\n\n /*** Local function ***/\n function isPercentage(offset) {\n var percentageRegex = /^\\d+(\\.\\d+)?%$/g;\n return percentageRegex.test(offset);\n }\n\n function calculatePercentage(percentStr, duration) {\n if (duration) {\n return calcPercent(duration, parseFloat(percentStr.replace('%', '')));\n }\n return null;\n }\n\n function calcPercent(quantity, percent) {\n return quantity * percent / 100;\n }\n },\n\n\n //List of supported VPAID technologies\n VPAID_techs: [\n VPAIDFlashTech,\n VPAIDHTML5Tech\n ],\n\n isVPAID: function isVPAIDMediaFile(mediaFile) {\n return !!mediaFile && mediaFile.apiFramework === 'VPAID';\n },\n\n findSupportedVPAIDTech: function findSupportedVPAIDTech(mimeType) {\n var i, len, VPAIDTech;\n\n for (i = 0, len = this.VPAID_techs.length; i < len; i += 1) {\n VPAIDTech = this.VPAID_techs[i];\n if (VPAIDTech.supports(mimeType)) {\n return VPAIDTech;\n }\n }\n return null;\n },\n\n isFlashSupported: function isFlashSupported() {\n return VPAIDFLASHClient.isSupported();\n },\n\n /**\n * Necessary step for VPAIDFLAShClient to know if flash is supported and not blocked.\n * IMPORTANT NOTE: This is an async test and needs to be run as soon as possible.\n *\n * @param vpaidFlashLoaderPath the path to the vpaidFlashLoader swf obj.\n */\n runFlashSupportCheck: function runFlashSupportCheck(vpaidFlashLoaderPath) {\n VPAIDFLASHClient.runFlashTest({data: vpaidFlashLoaderPath});\n }\n\n};\n\nmodule.exports = vastUtil;\n\n},{\"../../utils/utilityFunctions\":44,\"../vpaid/VPAIDFlashTech\":31,\"../vpaid/VPAIDHTML5Tech\":32,\"VPAIDFLASHClient/js/VPAIDFLASHClient\":3}],30:[function(require,module,exports){\n'use strict';\n\nvar VASTError = require('../vast/VASTError');\n\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VPAIDAdUnitWrapper(vpaidAdUnit, opts) {\n if (!(this instanceof VPAIDAdUnitWrapper)) {\n return new VPAIDAdUnitWrapper(vpaidAdUnit, opts);\n }\n sanityCheck(vpaidAdUnit, opts);\n\n this.options = utilities.extend({}, opts);\n\n this._adUnit = vpaidAdUnit;\n\n /*** Local Functions ***/\n function sanityCheck(adUnit, opts) {\n if (!adUnit || !VPAIDAdUnitWrapper.checkVPAIDInterface(adUnit)) {\n throw new VASTError('on VPAIDAdUnitWrapper, the passed VPAID adUnit does not fully implement the VPAID interface');\n }\n\n if (!utilities.isObject(opts)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper, expected options hash but got '\" + opts + \"'\");\n }\n\n if (!(\"responseTimeout\" in opts) || !utilities.isNumber(opts.responseTimeout) ){\n throw new VASTError(\"on VPAIDAdUnitWrapper, expected responseTimeout in options\");\n }\n }\n}\n\nVPAIDAdUnitWrapper.checkVPAIDInterface = function checkVPAIDInterface(VPAIDAdUnit) {\n //NOTE: skipAd is not part of the method list because it only appears in VPAID 2.0 and we support VPAID 1.0\n var VPAIDInterfaceMethods = [\n 'handshakeVersion', 'initAd', 'startAd', 'stopAd', 'resizeAd', 'pauseAd', 'expandAd', 'collapseAd'\n ];\n\n for (var i = 0, len = VPAIDInterfaceMethods.length; i < len; i++) {\n if (!VPAIDAdUnit || !utilities.isFunction(VPAIDAdUnit[VPAIDInterfaceMethods[i]])) {\n return false;\n }\n }\n\n\n return canSubscribeToEvents(VPAIDAdUnit) && canUnsubscribeFromEvents(VPAIDAdUnit);\n\n /*** Local Functions ***/\n\n function canSubscribeToEvents(adUnit) {\n return utilities.isFunction(adUnit.subscribe) || utilities.isFunction(adUnit.addEventListener) || utilities.isFunction(adUnit.on);\n }\n\n function canUnsubscribeFromEvents(adUnit) {\n return utilities.isFunction(adUnit.unsubscribe) || utilities.isFunction(adUnit.removeEventListener) || utilities.isFunction(adUnit.off);\n\n }\n};\n\nVPAIDAdUnitWrapper.prototype.adUnitAsyncCall = function () {\n var args = utilities.arrayLikeObjToArray(arguments);\n var method = args.shift();\n var cb = args.pop();\n var timeoutId;\n\n sanityCheck(method, cb, this._adUnit);\n args.push(wrapCallback());\n\n this._adUnit[method].apply(this._adUnit, args);\n timeoutId = setTimeout(function () {\n timeoutId = null;\n cb(new VASTError(\"on VPAIDAdUnitWrapper, timeout while waiting for a response on call '\" + method + \"'\"));\n cb = utilities.noop;\n }, this.options.responseTimeout);\n\n /*** Local functions ***/\n function sanityCheck(method, cb, adUnit) {\n if (!utilities.isString(method) || !utilities.isFunction(adUnit[method])) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.adUnitAsyncCall, invalid method name\");\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.adUnitAsyncCall, missing callback\");\n }\n }\n\n function wrapCallback() {\n return function () {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n cb.apply(this, arguments);\n };\n }\n};\n\nVPAIDAdUnitWrapper.prototype.on = function (evtName, handler) {\n var addEventListener = this._adUnit.addEventListener || this._adUnit.subscribe || this._adUnit.on;\n addEventListener.call(this._adUnit, evtName, handler);\n};\n\nVPAIDAdUnitWrapper.prototype.off = function (evtName, handler) {\n var removeEventListener = this._adUnit.removeEventListener || this._adUnit.unsubscribe || this._adUnit.off;\n removeEventListener.call(this._adUnit, evtName, handler);\n};\n\nVPAIDAdUnitWrapper.prototype.waitForEvent = function (evtName, cb, context) {\n var timeoutId;\n sanityCheck(evtName, cb);\n context = context || null;\n\n this.on(evtName, responseListener);\n\n timeoutId = setTimeout(function () {\n cb(new VASTError(\"on VPAIDAdUnitWrapper.waitForEvent, timeout while waiting for event '\" + evtName + \"'\"));\n timeoutId = null;\n cb = utilities.noop;\n }, this.options.responseTimeout);\n\n /*** Local functions ***/\n function sanityCheck(evtName, cb) {\n if (!utilities.isString(evtName)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.waitForEvent, missing evt name\");\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.waitForEvent, missing callback\");\n }\n }\n\n function responseListener() {\n var args = utilities.arrayLikeObjToArray(arguments);\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n\n args.unshift(null);\n cb.apply(context, args);\n }\n};\n\n// VPAID METHODS\nVPAIDAdUnitWrapper.prototype.handshakeVersion = function (version, cb) {\n this.adUnitAsyncCall('handshakeVersion', version, cb);\n};\n\n/* jshint maxparams:6 */\nVPAIDAdUnitWrapper.prototype.initAd = function (width, height, viewMode, desiredBitrate, adUnitData, cb) {\n this.waitForEvent('AdLoaded', cb);\n this._adUnit.initAd(width, height, viewMode, desiredBitrate, adUnitData);\n};\n\nVPAIDAdUnitWrapper.prototype.resizeAd = function (width, height, viewMode, cb) {\n // NOTE: AdSizeChange event is only supported on VPAID 2.0 so for the moment we are not going to use it\n // and will assume that everything is fine after the async call\n this.adUnitAsyncCall('resizeAd', width, height, viewMode, cb);\n};\n\nVPAIDAdUnitWrapper.prototype.startAd = function (cb) {\n this.waitForEvent('AdStarted', cb);\n this._adUnit.startAd();\n};\n\nVPAIDAdUnitWrapper.prototype.stopAd = function (cb) {\n this.waitForEvent('AdStopped', cb);\n this._adUnit.stopAd();\n};\n\nVPAIDAdUnitWrapper.prototype.pauseAd = function (cb) {\n this.waitForEvent('AdPaused', cb);\n this._adUnit.pauseAd();\n};\n\nVPAIDAdUnitWrapper.prototype.resumeAd = function (cb) {\n this.waitForEvent('AdPlaying', cb);\n this._adUnit.resumeAd();\n};\n\nVPAIDAdUnitWrapper.prototype.expandAd = function (cb) {\n this.waitForEvent('AdExpandedChange', cb);\n this._adUnit.expandAd();\n};\n\nVPAIDAdUnitWrapper.prototype.collapseAd = function (cb) {\n this.waitForEvent('AdExpandedChange', cb);\n this._adUnit.collapseAd();\n};\n\nVPAIDAdUnitWrapper.prototype.skipAd = function (cb) {\n this.waitForEvent('AdSkipped', cb);\n this._adUnit.skipAd();\n};\n\n//VPAID property getters\n[\n 'adLinear',\n 'adWidth',\n 'adHeight',\n 'adExpanded',\n 'adSkippableState',\n 'adRemainingTime',\n 'adDuration',\n 'adVolume',\n 'adCompanions',\n 'adIcons'\n].forEach(function (property) {\n var getterName = 'get' + utilities.capitalize(property);\n\n VPAIDAdUnitWrapper.prototype[getterName] = function (cb) {\n this.adUnitAsyncCall(getterName, cb);\n };\n});\n\n//VPAID property setters\nVPAIDAdUnitWrapper.prototype.setAdVolume = function(volume, cb){\n this.adUnitAsyncCall('setAdVolume',volume, cb);\n};\n\nmodule.exports = VPAIDAdUnitWrapper;\n\n},{\"../../utils/utilityFunctions\":44,\"../vast/VASTError\":22}],31:[function(require,module,exports){\n'use strict';\n\nvar VASTError = require('../vast/VASTError');\n\nvar VPAIDFLASHClient = require('VPAIDFLASHClient/js/VPAIDFLASHClient');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar dom = require('../../utils/dom');\n\nfunction VPAIDFlashTech(mediaFile, settings) {\n if (!(this instanceof VPAIDFlashTech)) {\n return new VPAIDFlashTech(mediaFile);\n }\n sanityCheck(mediaFile);\n this.name = 'vpaid-flash';\n this.mediaFile = mediaFile;\n this.containerEl = null;\n this.vpaidFlashClient = null;\n this.settings = settings;\n\n /*** local functions ***/\n function sanityCheck(mediaFile) {\n if (!mediaFile || !utilities.isString(mediaFile.src)) {\n throw new VASTError('on VPAIDFlashTech, invalid MediaFile');\n }\n }\n}\n\nVPAIDFlashTech.VPAIDFLASHClient = VPAIDFLASHClient;\n\nVPAIDFlashTech.supports = function (type) {\n return type === 'application/x-shockwave-flash' && VPAIDFlashTech.VPAIDFLASHClient.isSupported();\n};\n\nVPAIDFlashTech.prototype.loadAdUnit = function loadFlashCreative(containerEl, objectEl, callback) {\n var that = this;\n var flashClientOpts = this.settings && this.settings.vpaidFlashLoaderPath ? {data: this.settings.vpaidFlashLoaderPath} : undefined;\n sanityCheck(containerEl, callback);\n\n this.containerEl = containerEl;\n this.vpaidFlashClient = new VPAIDFlashTech.VPAIDFLASHClient(containerEl, function (error) {\n if (error) {\n return callback(error);\n }\n\n that.vpaidFlashClient.loadAdUnit(that.mediaFile.src, callback);\n }, flashClientOpts);\n\n /*** Local Functions ***/\n function sanityCheck(container, cb) {\n\n if (!dom.isDomElement(container)) {\n throw new VASTError('on VPAIDFlashTech.loadAdUnit, invalid dom container element');\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError('on VPAIDFlashTech.loadAdUnit, missing valid callback');\n }\n }\n};\n\nVPAIDFlashTech.prototype.unloadAdUnit = function () {\n if (this.vpaidFlashClient) {\n try{\n this.vpaidFlashClient.destroy();\n } catch(e){\n if(console && utilities.isFunction(console.log)){\n console.log('VAST ERROR: trying to unload the VPAID adunit');\n }\n }\n this.vpaidFlashClient = null;\n }\n\n if (this.containerEl) {\n dom.remove(this.containerEl);\n this.containerEl = null;\n }\n};\n\nmodule.exports = VPAIDFlashTech;\n\n},{\"../../utils/dom\":40,\"../../utils/utilityFunctions\":44,\"../vast/VASTError\":22,\"VPAIDFLASHClient/js/VPAIDFLASHClient\":3}],32:[function(require,module,exports){\n'use strict';\n\nvar VASTError = require('../vast/VASTError');\n\nvar VPAIDHTML5Client = require('VPAIDHTML5Client/js/VPAIDHTML5Client');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar dom = require('../../utils/dom');\n\nfunction VPAIDHTML5Tech(mediaFile) {\n\n if(!(this instanceof VPAIDHTML5Tech)) {\n return new VPAIDHTML5Tech(mediaFile);\n }\n\n sanityCheck(mediaFile);\n\n this.name = 'vpaid-html5';\n this.containerEl = null;\n this.videoEl = null;\n this.vpaidHTMLClient = null;\n\n this.mediaFile = mediaFile;\n\n function sanityCheck(mediaFile) {\n if (!mediaFile || !utilities.isString(mediaFile.src)) {\n throw new VASTError(VPAIDHTML5Tech.INVALID_MEDIA_FILE);\n }\n }\n}\n\nVPAIDHTML5Tech.VPAIDHTML5Client = VPAIDHTML5Client;\n\nVPAIDHTML5Tech.supports = function (type) {\n return !utilities.isOldIE() && type === 'application/javascript';\n};\n\nVPAIDHTML5Tech.prototype.loadAdUnit = function loadAdUnit(containerEl, videoEl, callback) {\n sanityCheck(containerEl, videoEl, callback);\n\n this.containerEl = containerEl;\n this.videoEl = videoEl;\n this.vpaidHTMLClient = new VPAIDHTML5Tech.VPAIDHTML5Client(containerEl, videoEl, {});\n this.vpaidHTMLClient.loadAdUnit(this.mediaFile.src, callback);\n\n function sanityCheck(container, video, cb) {\n if (!dom.isDomElement(container)) {\n throw new VASTError(VPAIDHTML5Tech.INVALID_DOM_CONTAINER_EL);\n }\n\n if (!dom.isDomElement(video) || video.tagName.toLowerCase() !== 'video') {\n throw new VASTError(VPAIDHTML5Tech.INVALID_DOM_CONTAINER_EL);\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError(VPAIDHTML5Tech.MISSING_CALLBACK);\n }\n }\n};\n\nVPAIDHTML5Tech.prototype.unloadAdUnit = function unloadAdUnit() {\n if (this.vpaidHTMLClient) {\n try {\n this.vpaidHTMLClient.destroy();\n } catch(e) {\n if (console && utilities.isFunction(console.log)) {\n console.log('VAST ERROR: trying to unload the VPAID adunit');\n }\n }\n\n this.vpaidHTMLClient = null;\n }\n\n if (this.containerEl) {\n dom.remove(this.containerEl);\n this.containerEl = null;\n }\n};\n\nvar PREFIX = 'on VPAIDHTML5Tech';\nVPAIDHTML5Tech.INVALID_MEDIA_FILE = PREFIX + ', invalid MediaFile';\nVPAIDHTML5Tech.INVALID_DOM_CONTAINER_EL = PREFIX + ', invalid container HtmlElement';\nVPAIDHTML5Tech.INVALID_DOM_VIDEO_EL = PREFIX + ', invalid HTMLVideoElement';\nVPAIDHTML5Tech.MISSING_CALLBACK = PREFIX + ', missing valid callback';\n\nmodule.exports = VPAIDHTML5Tech;\n},{\"../../utils/dom\":40,\"../../utils/utilityFunctions\":44,\"../vast/VASTError\":22,\"VPAIDHTML5Client/js/VPAIDHTML5Client\":11}],33:[function(require,module,exports){\n'use strict';\n\nvar VASTError = require('../vast/VASTError');\nvar VASTResponse = require('../vast/VASTResponse');\nvar VASTTracker = require('../vast/VASTTracker');\nvar vastUtil = require('../vast/vastUtil');\n\nvar VPAIDAdUnitWrapper = require('./VPAIDAdUnitWrapper');\n\nvar async = require('../../utils/async');\nvar dom = require('../../utils/dom');\nvar playerUtils = require('../../utils/playerUtils');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VPAIDIntegrator(player, settings) {\n if (!(this instanceof VPAIDIntegrator)) {\n return new VPAIDIntegrator(player);\n }\n\n this.VIEW_MODE = {\n NORMAL: 'normal',\n FULLSCREEN: \"fullscreen\",\n THUMBNAIL: \"thumbnail\"\n };\n this.player = player;\n this.containerEl = createVPAIDContainerEl(player);\n this.options = {\n responseTimeout: 5000,\n VPAID_VERSION: '2.0'\n };\n this.settings = settings;\n\n /*** Local functions ***/\n\n function createVPAIDContainerEl() {\n var containerEl = document.createElement('div');\n dom.addClass(containerEl, 'VPAID-container');\n player.el().insertBefore(containerEl, player.controlBar.el());\n return containerEl;\n\n }\n}\n\nVPAIDIntegrator.prototype.playAd = function playVPaidAd(vastResponse, callback) {\n if (!(vastResponse instanceof VASTResponse)) {\n return callback(new VASTError('on VASTIntegrator.playAd, missing required VASTResponse'));\n }\n\n var that = this;\n var player = this.player;\n var tech = this._findSupportedTech(vastResponse, this.settings);\n\n callback = callback || utilities.noop;\n\n this._adUnit = null;\n\n dom.addClass(player.el(), 'vjs-vpaid-ad');\n\n player.on('vast.adsCancel', triggerVpaidAdEnd);\n player.one('vpaid.adEnd', function(){\n player.off('vast.adsCancel', triggerVpaidAdEnd);\n removeAdUnit();\n });\n\n if (tech) {\n async.waterfall([\n function (next) {\n next(null, tech, vastResponse);\n },\n this._loadAdUnit.bind(this),\n this._playAdUnit.bind(this),\n this._finishPlaying.bind(this)\n\n ], adComplete);\n\n this._adUnit = {\n _paused: true,\n type: 'VPAID',\n pauseAd: function() {\n player.trigger('vpaid.pauseAd');\n player.pause(true);//we make sure that the video content gets stopped.\n },\n resumeAd: function() {\n player.trigger('vpaid.resumeAd');\n },\n isPaused: function() {\n return this._paused;\n },\n getSrc: function() {\n return tech.mediaFile;\n }\n };\n\n } else {\n var error = new VASTError('on VPAIDIntegrator.playAd, could not find a supported mediaFile', 403);\n adComplete(error, this._adUnit, vastResponse);\n }\n\n return this._adUnit;\n\n /*** Local functions ***/\n function adComplete(error, adUnit, vastResponse) {\n if (error && vastResponse) {\n that._trackError(vastResponse, error.code);\n }\n player.trigger('vpaid.adEnd');\n callback(error, vastResponse);\n }\n\n function triggerVpaidAdEnd(){\n player.trigger('vpaid.adEnd');\n }\n\n function removeAdUnit() {\n if (tech) {\n tech.unloadAdUnit();\n }\n dom.removeClass(player.el(), 'vjs-vpaid-ad');\n }\n};\n\nVPAIDIntegrator.prototype._findSupportedTech = function (vastResponse, settings) {\n if (!(vastResponse instanceof VASTResponse)) {\n return null;\n }\n\n var vpaidMediaFiles = vastResponse.mediaFiles.filter(vastUtil.isVPAID);\n var i, len, mediaFile, VPAIDTech;\n\n for (i = 0, len = vpaidMediaFiles.length; i < len; i += 1) {\n mediaFile = vpaidMediaFiles[i];\n VPAIDTech = vastUtil.findSupportedVPAIDTech(mediaFile.type);\n if (VPAIDTech) {\n return new VPAIDTech(mediaFile, settings);\n }\n }\n return null;\n};\n\nVPAIDIntegrator.prototype._createVPAIDAdUnitWrapper = function(adUnit, src, responseTimeout) {\n return new VPAIDAdUnitWrapper(adUnit, {src: src, responseTimeout: responseTimeout});\n};\n\nVPAIDIntegrator.prototype._loadAdUnit = function (tech, vastResponse, next) {\n var that = this;\n var player = this.player;\n var vjsTechEl = player.el().querySelector('.vjs-tech');\n var responseTimeout = this.settings.responseTimeout || this.options.responseTimeout;\n tech.loadAdUnit(this.containerEl, vjsTechEl, function (error, adUnit) {\n if (error) {\n return next(error, adUnit, vastResponse);\n }\n\n try {\n var WrappedAdUnit = that._createVPAIDAdUnitWrapper(adUnit, tech.mediaFile.src, responseTimeout);\n var techClass = 'vjs-' + tech.name + '-ad';\n dom.addClass(player.el(), techClass);\n player.one('vpaid.adEnd', function() {\n dom.removeClass(player.el(),techClass);\n });\n next(null, WrappedAdUnit, vastResponse);\n } catch (e) {\n next(e, adUnit, vastResponse);\n }\n });\n};\n\nVPAIDIntegrator.prototype._playAdUnit = function (adUnit, vastResponse, callback) {\n async.waterfall([\n function (next) {\n next(null, adUnit, vastResponse);\n },\n this._handshake.bind(this),\n this._initAd.bind(this),\n this._setupEvents.bind(this),\n this._addSkipButton.bind(this),\n this._linkPlayerControls.bind(this),\n this._startAd.bind(this)\n ], callback);\n};\n\nVPAIDIntegrator.prototype._handshake = function handshake(adUnit, vastResponse, next) {\n adUnit.handshakeVersion(this.options.VPAID_VERSION, function (error, version) {\n if (error) {\n return next(error, adUnit, vastResponse);\n }\n\n if (version && isSupportedVersion(version)) {\n return next(null, adUnit, vastResponse);\n }\n\n return next(new VASTError('on VPAIDIntegrator._handshake, unsupported version \"' + version + '\"'), adUnit, vastResponse);\n });\n\n function isSupportedVersion(version) {\n var majorNum = major(version);\n return majorNum >= 1 && majorNum <= 2;\n }\n\n function major(version) {\n var parts = version.split('.');\n return parseInt(parts[0], 10);\n }\n};\n\nVPAIDIntegrator.prototype._initAd = function (adUnit, vastResponse, next) {\n var tech = this.player.el().querySelector('.vjs-tech');\n var dimension = dom.getDimension(tech);\n adUnit.initAd(dimension.width, dimension.height, this.VIEW_MODE.NORMAL, -1, {AdParameters: vastResponse.adParameters || ''}, function (error) {\n next(error, adUnit, vastResponse);\n });\n};\n\nVPAIDIntegrator.prototype._createVASTTracker = function(adUnitSrc, vastResponse) {\n return new VASTTracker(adUnitSrc, vastResponse);\n};\n\nVPAIDIntegrator.prototype._setupEvents = function (adUnit, vastResponse, next) {\n var adUnitSrc = adUnit.options.src;\n var tracker = this._createVASTTracker(adUnitSrc, vastResponse);\n var player = this.player;\n var that = this;\n\n adUnit.on('AdSkipped', function () {\n player.trigger('vpaid.AdSkipped');\n tracker.trackSkip();\n });\n\n adUnit.on('AdImpression', function () {\n player.trigger('vpaid.AdImpression');\n tracker.trackImpressions();\n });\n\n adUnit.on('AdStarted', function () {\n player.trigger('vpaid.AdStarted');\n tracker.trackCreativeView();\n notifyPlayToPlayer();\n });\n\n adUnit.on('AdVideoStart', function () {\n player.trigger('vpaid.AdVideoStart');\n tracker.trackStart();\n notifyPlayToPlayer();\n });\n\n adUnit.on('AdPlaying', function () {\n player.trigger('vpaid.AdPlaying');\n tracker.trackResume();\n notifyPlayToPlayer();\n });\n\n adUnit.on('AdPaused', function () {\n player.trigger('vpaid.AdPaused');\n tracker.trackPause();\n notifyPauseToPlayer();\n });\n\n function notifyPlayToPlayer(){\n if(that._adUnit && that._adUnit.isPaused()){\n that._adUnit._paused = false;\n }\n player.trigger('play');\n\n }\n\n function notifyPauseToPlayer() {\n if(that._adUnit){\n that._adUnit._paused = true;\n }\n player.trigger('pause');\n }\n\n adUnit.on('AdVideoFirstQuartile', function () {\n player.trigger('vpaid.AdVideoFirstQuartile');\n tracker.trackFirstQuartile();\n });\n\n adUnit.on('AdVideoMidpoint', function () {\n player.trigger('vpaid.AdVideoMidpoint');\n tracker.trackMidpoint();\n });\n\n adUnit.on('AdVideoThirdQuartile', function () {\n player.trigger('vpaid.AdVideoThirdQuartile');\n tracker.trackThirdQuartile();\n });\n\n adUnit.on('AdVideoComplete', function () {\n player.trigger('vpaid.AdVideoComplete');\n tracker.trackComplete();\n });\n\n adUnit.on('AdClickThru', function (data) {\n player.trigger('vpaid.AdClickThru');\n var url = data.url;\n var playerHandles = data.playerHandles;\n var clickThruUrl = utilities.isNotEmptyString(url) ? url : generateClickThroughURL(vastResponse.clickThrough);\n\n tracker.trackClick();\n if (playerHandles && clickThruUrl) {\n window.open(clickThruUrl, '_blank');\n }\n\n function generateClickThroughURL(clickThroughMacro) {\n var variables = {\n ASSETURI: adUnit.options.src,\n CONTENTPLAYHEAD: 0 //In VPAID there is no method to know the current time from the adUnit\n };\n\n return clickThroughMacro ? vastUtil.parseURLMacro(clickThroughMacro, variables) : null;\n }\n });\n\n adUnit.on('AdUserAcceptInvitation', function () {\n player.trigger('vpaid.AdUserAcceptInvitation');\n tracker.trackAcceptInvitation();\n tracker.trackAcceptInvitationLinear();\n });\n\n adUnit.on('AdUserClose', function () {\n player.trigger('vpaid.AdUserClose');\n tracker.trackClose();\n tracker.trackCloseLinear();\n });\n\n adUnit.on('AdUserMinimize', function () {\n player.trigger('vpaid.AdUserMinimize');\n tracker.trackCollapse();\n });\n\n adUnit.on('AdError', function () {\n player.trigger('vpaid.AdError');\n //NOTE: we track errors code 901, as noted in VAST 3.0\n tracker.trackErrorWithCode(901);\n });\n\n adUnit.on('AdVolumeChange', function () {\n player.trigger('vpaid.AdVolumeChange');\n var lastVolume = player.volume();\n adUnit.getAdVolume(function (error, currentVolume) {\n if (currentVolume === 0 && lastVolume > 0) {\n tracker.trackMute();\n }\n\n if (currentVolume > 0 && lastVolume === 0) {\n tracker.trackUnmute();\n }\n\n player.volume(currentVolume);\n });\n });\n\n var updateViewSize = resizeAd.bind(this, player, adUnit, this.VIEW_MODE);\n var updateViewSizeThrottled = utilities.throttle(updateViewSize, 100);\n var autoResize = this.settings.autoResize;\n\n if (autoResize) {\n dom.addEventListener(window, 'resize', updateViewSizeThrottled);\n dom.addEventListener(window, 'orientationchange', updateViewSizeThrottled);\n }\n\n player.on('vast.resize', updateViewSize);\n player.on('vpaid.pauseAd', pauseAdUnit);\n player.on('vpaid.resumeAd', resumeAdUnit);\n\n player.one('vpaid.adEnd', function () {\n player.off('vast.resize', updateViewSize);\n player.off('vpaid.pauseAd', pauseAdUnit);\n player.off('vpaid.resumeAd', resumeAdUnit);\n\n if (autoResize) {\n dom.removeEventListener(window, 'resize', updateViewSizeThrottled);\n dom.removeEventListener(window, 'orientationchange', updateViewSizeThrottled);\n }\n });\n\n next(null, adUnit, vastResponse);\n\n /*** Local Functions ***/\n function pauseAdUnit() {\n adUnit.pauseAd(utilities.noop);\n }\n\n function resumeAdUnit() {\n adUnit.resumeAd(utilities.noop);\n }\n};\n\nVPAIDIntegrator.prototype._addSkipButton = function (adUnit, vastResponse, next) {\n var skipButton;\n var player = this.player;\n\n adUnit.on('AdSkippableStateChange', updateSkipButtonState);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeSkipButton);\n\n next(null, adUnit, vastResponse);\n\n /*** Local function ***/\n function updateSkipButtonState() {\n player.trigger('vpaid.AdSkippableStateChange');\n adUnit.getAdSkippableState(function (error, isSkippable) {\n if (isSkippable) {\n if (!skipButton) {\n addSkipButton(player);\n }\n } else {\n removeSkipButton(player);\n }\n });\n }\n\n function addSkipButton(player) {\n skipButton = createSkipButton(player);\n player.el().appendChild(skipButton);\n }\n\n function removeSkipButton() {\n dom.remove(skipButton);\n skipButton = null;\n }\n\n function createSkipButton() {\n var skipButton = window.document.createElement(\"div\");\n dom.addClass(skipButton, \"vast-skip-button\");\n dom.addClass(skipButton, \"enabled\");\n skipButton.innerHTML = \"Skip ad\";\n\n skipButton.onclick = function (e) {\n adUnit.skipAd(utilities.noop);//We skip the adUnit\n\n //We prevent event propagation to avoid problems with the clickThrough and so on\n if (window.Event.prototype.stopPropagation !== undefined) {\n e.stopPropagation();\n } else {\n return false;\n }\n };\n\n return skipButton;\n }\n};\n\nVPAIDIntegrator.prototype._linkPlayerControls = function (adUnit, vastResponse, next) {\n var that = this;\n linkVolumeControl(this.player, adUnit);\n linkFullScreenControl(this.player, adUnit, this.VIEW_MODE);\n\n next(null, adUnit, vastResponse);\n\n /*** Local functions ***/\n function linkVolumeControl(player, adUnit) {\n player.on('volumechange', updateAdUnitVolume);\n adUnit.on('AdVolumeChange', updatePlayerVolume);\n\n player.one('vpaid.adEnd', function () {\n player.off('volumechange', updateAdUnitVolume);\n });\n\n\n /*** local functions ***/\n function updateAdUnitVolume() {\n var vol = player.muted() ? 0 : player.volume();\n adUnit.setAdVolume(vol, logError);\n }\n\n function updatePlayerVolume() {\n player.trigger('vpaid.AdVolumeChange');\n adUnit.getAdVolume(function (error, vol) {\n if (error) {\n logError(error);\n } else {\n player.volume(vol);\n }\n });\n }\n }\n\n function linkFullScreenControl(player, adUnit, VIEW_MODE) {\n var updateViewSize = resizeAd.bind(that, player, adUnit, VIEW_MODE);\n\n player.on('fullscreenchange', updateViewSize);\n\n player.one('vpaid.adEnd', function () {\n player.off('fullscreenchange', updateViewSize);\n });\n }\n};\n\nVPAIDIntegrator.prototype._startAd = function (adUnit, vastResponse, next) {\n var player = this.player;\n\n adUnit.startAd(function (error) {\n if (!error) {\n player.trigger('vast.adStart');\n }\n next(error, adUnit, vastResponse);\n });\n};\n\nVPAIDIntegrator.prototype._finishPlaying = function (adUnit, vastResponse, next) {\n var player = this.player;\n adUnit.on('AdStopped', function () {\n player.trigger('vpaid.AdStopped');\n finishPlayingAd(null);\n });\n\n adUnit.on('AdError', function (error) {\n var errMsg = error? error.message : 'on VPAIDIntegrator, error while waiting for the adUnit to finish playing';\n finishPlayingAd(new VASTError(errMsg));\n });\n\n /*** local functions ***/\n function finishPlayingAd(error) {\n next(error, adUnit, vastResponse);\n }\n};\n\nVPAIDIntegrator.prototype._trackError = function trackError(response, errorCode) {\n vastUtil.track(response.errorURLMacros, {ERRORCODE: errorCode || 901});\n};\n\nfunction resizeAd(player, adUnit, VIEW_MODE) {\n var tech = player.el().querySelector('.vjs-tech');\n var dimension = dom.getDimension(tech);\n var MODE = player.isFullscreen() ? VIEW_MODE.FULLSCREEN : VIEW_MODE.NORMAL;\n adUnit.resizeAd(dimension.width, dimension.height, MODE, logError);\n}\n\nfunction logError(error) {\n if (error && console && console.log) {\n console.log('ERROR: ' + error.message, error);\n }\n}\n\nmodule.exports = VPAIDIntegrator;\n},{\"../../utils/async\":39,\"../../utils/dom\":40,\"../../utils/playerUtils\":42,\"../../utils/utilityFunctions\":44,\"../vast/VASTError\":22,\"../vast/VASTResponse\":24,\"../vast/VASTTracker\":25,\"../vast/vastUtil\":29,\"./VPAIDAdUnitWrapper\":30}],34:[function(require,module,exports){\n'use strict';\n\nvar dom = require('../../utils/dom');\n\nvar element = document.createElement('div');\nelement.className = 'vjs-ads-label vjs-control vjs-label-hidden';\nelement.innerHTML = 'Advertisement';\n\nvar AdsLabelFactory = function(baseComponent) {\n return {\n /** @constructor */\n init: function init(player, options) {\n options.el = element;\n baseComponent.call(this, player, options);\n\n // We asynchronously reposition the ads label element\n setTimeout(function () {\n var currentTimeComp = player.controlBar &&( player.controlBar.getChild(\"timerControls\") || player.controlBar.getChild(\"currentTimeDisplay\") );\n if(currentTimeComp) {\n player.controlBar.el().insertBefore(element, currentTimeComp.el());\n }\n dom.removeClass(element, 'vjs-label-hidden');\n }, 0);\n },\n\n el: function getElement() {\n return element;\n }\n };\n};\n\nmodule.exports = AdsLabelFactory;\n},{\"../../utils/dom\":40}],35:[function(require,module,exports){\n'use strict';\n\nvar baseVideoJsComponent = videojs.getComponent('Component');\n\nvar AdsLabel = require('./ads-label')(baseVideoJsComponent);\n\nvideojs.registerComponent('AdsLabel', videojs.extend(baseVideoJsComponent, AdsLabel));\n\n},{\"./ads-label\":34}],36:[function(require,module,exports){\n'use strict';\n\n/**\n * The component that shows a black screen until the ads plugin has decided if it can or it can not play the ad.\n *\n * Note: In case you wonder why instead of this black poster we don't just show the spinner loader.\n * IOS devices do not work well with animations and the browser chrashes from time to time That is why we chose to\n * have a secondary black poster.\n *\n * It also makes it much more easier for the users of the plugin since it does not change the default behaviour of the\n * spinner and the player works the same way with and without the plugin.\n *\n * @param {vjs.Player|Object} player\n * @param {Object=} options\n * @constructor\n */\nvar element = document.createElement('div');\n\nvar BlackPosterFactory = function(baseComponent) {\n return {\n /** @constructor */\n init: function init(player, options) {\n options.el = element;\n element.className = 'vjs-black-poster';\n baseComponent.call(this, player, options);\n\n var posterImg = player.getChild('posterImage');\n\n //We need to do it asynchronously to be sure that the black poster el is on the dom.\n setTimeout(function() {\n if(posterImg && player && player.el()) {\n player.el().insertBefore(element, posterImg.el());\n }\n }, 0);\n },\n el: function getElement() {\n return element;\n }\n };\n};\n\nmodule.exports = BlackPosterFactory;\n},{}],37:[function(require,module,exports){\n'use strict';\n\nvar baseVideoJsComponent = videojs.getComponent('Component');\n\nvar BlackPoster = require('./black-poster')(baseVideoJsComponent);\n\nvideojs.registerComponent('BlackPoster', videojs.extend(baseVideoJsComponent, BlackPoster));\n\n},{\"./black-poster\":36}],38:[function(require,module,exports){\n'use strict';\n\nvar VASTClient = require('../ads/vast/VASTClient');\nvar VASTError = require('../ads/vast/VASTError');\nvar vastUtil = require('../ads/vast/vastUtil');\n\nvar VASTIntegrator = require('../ads/vast/VASTIntegrator');\nvar VPAIDIntegrator = require('../ads/vpaid/VPAIDIntegrator');\n\nvar async = require('../utils/async');\nvar dom = require('../utils/dom');\nvar playerUtils = require('../utils/playerUtils');\nvar utilities = require('../utils/utilityFunctions');\n\nmodule.exports = function VASTPlugin(options) {\n var snapshot;\n var player = this;\n var vast = new VASTClient();\n var adsCanceled = false;\n var defaultOpts = {\n // maximum amount of time in ms to wait to receive `adsready` from the ad\n // implementation after play has been requested. Ad implementations are\n // expected to load any dynamic libraries and make any requests to determine\n // ad policies for a video during this time.\n timeout: 500,\n\n //TODO:finish this IOS FIX\n //Whenever you play an add on IOS, the native player kicks in and we loose control of it. On very heavy pages the 'play' event\n // May occur after the video content has already started. This is wrong if you want to play a preroll ad that needs to happen before the user\n // starts watching the content. To prevent this usec\n iosPrerollCancelTimeout: 2000,\n\n // maximun amount of time for the ad to actually start playing. If this timeout gets\n // triggered the ads will be cancelled\n adCancelTimeout: 3000,\n\n // Boolean flag that configures the player to play a new ad before the user sees the video again\n // the current video\n playAdAlways: false,\n\n // Flag to enable or disable the ads by default.\n adsEnabled: true,\n\n // Boolean flag to enable or disable the resize with window.resize or orientationchange\n autoResize: true,\n\n // Path to the VPAID flash ad's loader\n vpaidFlashLoaderPath: '/VPAIDFlash.swf'\n };\n\n var settings = utilities.extend({}, defaultOpts, options || {});\n\n if(utilities.isUndefined(settings.adTagUrl) && utilities.isDefined(settings.url)){\n settings.adTagUrl = settings.url;\n }\n\n if (utilities.isString(settings.adTagUrl)) {\n settings.adTagUrl = utilities.echoFn(settings.adTagUrl);\n }\n\n if (utilities.isDefined(settings.adTagXML) && !utilities.isFunction(settings.adTagXML)) {\n return trackAdError(new VASTError('on VideoJS VAST plugin, the passed adTagXML option does not contain a function'));\n }\n\n if (!utilities.isDefined(settings.adTagUrl) && !utilities.isFunction(settings.adTagXML)) {\n return trackAdError(new VASTError('on VideoJS VAST plugin, missing adTagUrl on options object'));\n }\n\n vastUtil.runFlashSupportCheck(settings.vpaidFlashLoaderPath);// Necessary step for VPAIDFLASHClient to work.\n\n playerUtils.prepareForAds(player);\n\n if (settings.playAdAlways) {\n // No matter what happens we play a new ad before the user sees the video again.\n player.on('vast.contentEnd', function () {\n setTimeout(function () {\n player.trigger('vast.reset');\n }, 0);\n });\n }\n\n player.on('vast.firstPlay', tryToPlayPrerollAd);\n\n player.on('vast.reset', function () {\n //If we are reseting the plugin, we don't want to restore the content\n snapshot = null;\n cancelAds();\n });\n\n player.vast = {\n isEnabled: function () {\n return settings.adsEnabled;\n },\n\n enable: function () {\n settings.adsEnabled = true;\n },\n\n disable: function () {\n settings.adsEnabled = false;\n }\n };\n\n return player.vast;\n\n /**** Local functions ****/\n function tryToPlayPrerollAd() {\n //We remove the poster to prevent flickering whenever the content starts playing\n playerUtils.removeNativePoster(player);\n\n playerUtils.once(player, ['vast.adsCancel', 'vast.adEnd'], function () {\n removeAdUnit();\n restoreVideoContent();\n });\n\n async.waterfall([\n checkAdsEnabled,\n preparePlayerForAd,\n startAdCancelTimeout,\n playPrerollAd\n ], function (error, response) {\n if (error) {\n trackAdError(error, response);\n } else {\n player.trigger('vast.adEnd');\n }\n });\n\n /*** Local functions ***/\n\n function removeAdUnit() {\n if (player.vast && player.vast.adUnit) {\n player.vast.adUnit = null; //We remove the adUnit\n }\n }\n\n function restoreVideoContent() {\n setupContentEvents();\n if (snapshot) {\n playerUtils.restorePlayerSnapshot(player, snapshot);\n snapshot = null;\n }\n }\n\n function setupContentEvents() {\n playerUtils.once(player, ['playing', 'vast.reset', 'vast.firstPlay'], function (evt) {\n if (evt.type !== 'playing') {\n return;\n }\n\n player.trigger('vast.contentStart');\n\n playerUtils.once(player, ['ended', 'vast.reset', 'vast.firstPlay'], function (evt) {\n if (evt.type === 'ended') {\n player.trigger('vast.contentEnd');\n }\n });\n });\n }\n\n function checkAdsEnabled(next) {\n if (settings.adsEnabled) {\n return next(null);\n }\n next(new VASTError('Ads are not enabled'));\n }\n\n function preparePlayerForAd(next) {\n if (canPlayPrerollAd()) {\n snapshot = playerUtils.getPlayerSnapshot(player);\n player.pause();\n addSpinnerIcon();\n\n if(player.paused()) {\n next(null);\n } else {\n playerUtils.once(player, ['playing'], function() {\n player.pause();\n next(null);\n });\n }\n } else {\n next(new VASTError('video content has been playing before preroll ad'));\n }\n }\n\n function canPlayPrerollAd() {\n return !utilities.isIPhone() || player.currentTime() <= settings.iosPrerollCancelTimeout;\n }\n\n function startAdCancelTimeout(next) {\n var adCancelTimeoutId;\n adsCanceled = false;\n\n adCancelTimeoutId = setTimeout(function () {\n trackAdError(new VASTError('timeout while waiting for the video to start playing', 402));\n }, settings.adCancelTimeout);\n\n playerUtils.once(player, ['vast.adStart', 'vast.adsCancel'], clearAdCancelTimeout);\n\n /*** local functions ***/\n function clearAdCancelTimeout() {\n if (adCancelTimeoutId) {\n clearTimeout(adCancelTimeoutId);\n adCancelTimeoutId = null;\n }\n }\n\n next(null);\n }\n\n function addSpinnerIcon() {\n dom.addClass(player.el(), 'vjs-vast-ad-loading');\n playerUtils.once(player, ['vast.adStart', 'vast.adsCancel'], removeSpinnerIcon);\n }\n\n function removeSpinnerIcon() {\n //IMPORTANT NOTE: We remove the spinnerIcon asynchronously to give time to the browser to start the video.\n // If we remove it synchronously we see a flash of the content video before the ad starts playing.\n setTimeout(function () {\n dom.removeClass(player.el(), 'vjs-vast-ad-loading');\n }, 100);\n }\n\n }\n\n function cancelAds() {\n player.trigger('vast.adsCancel');\n adsCanceled = true;\n }\n\n function playPrerollAd(callback) {\n async.waterfall([\n getVastResponse,\n playAd\n ], callback);\n }\n\n function getVastResponse(callback) {\n vast.getVASTResponse(settings.adTagUrl ? settings.adTagUrl() : settings.adTagXML, callback);\n }\n\n function playAd(vastResponse, callback) {\n //TODO: Find a better way to stop the play. The 'playPrerollWaterfall' ends in an inconsistent situation\n //If the state is not 'preroll?' it means the ads were canceled therefore, we break the waterfall\n if (adsCanceled) {\n return;\n }\n\n var adIntegrator = isVPAID(vastResponse) ? new VPAIDIntegrator(player, settings) : new VASTIntegrator(player);\n var adFinished = false;\n\n playerUtils.once(player, ['vast.adStart', 'vast.adsCancel'], function (evt) {\n if (evt.type === 'vast.adStart') {\n addAdsLabel();\n }\n });\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeAdsLabel);\n\n if (utilities.isIDevice()) {\n preventManualProgress();\n }\n\n player.vast.vastResponse = vastResponse;\n player.vast.adUnit = adIntegrator.playAd(vastResponse, callback);\n\n /*** Local functions ****/\n function addAdsLabel() {\n if (adFinished || player.controlBar.getChild('AdsLabel')) {\n return;\n }\n\n player.controlBar.addChild('AdsLabel');\n }\n\n function removeAdsLabel() {\n player.controlBar.removeChild('AdsLabel');\n adFinished = true;\n }\n\n function preventManualProgress() {\n //IOS video clock is very unreliable and we need a 3 seconds threshold to ensure that the user forwarded/rewound the ad\n var PROGRESS_THRESHOLD = 3;\n var previousTime = 0;\n var skipad_attempts = 0;\n\n player.on('timeupdate', preventAdSeek);\n player.on('ended', preventAdSkip);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel', 'vast.adError'], stopPreventManualProgress);\n\n /*** Local functions ***/\n function preventAdSkip() {\n // Ignore ended event if the Ad time was not 'near' the end\n // and revert time to the previous 'valid' time\n if ((player.duration() - previousTime) > PROGRESS_THRESHOLD) {\n player.pause(true); // this reduce the video jitter if the IOS skip button is pressed\n player.play(true); // we need to trigger the play to put the video element back in a valid state\n player.currentTime(previousTime);\n }\n }\n\n function preventAdSeek() {\n var currentTime = player.currentTime();\n var progressDelta = Math.abs(currentTime - previousTime);\n if (progressDelta > PROGRESS_THRESHOLD) {\n skipad_attempts += 1;\n if (skipad_attempts >= 2) {\n player.pause(true);\n }\n player.currentTime(previousTime);\n } else {\n previousTime = currentTime;\n }\n }\n\n function stopPreventManualProgress() {\n player.off('timeupdate', preventAdSeek);\n player.off('ended', preventAdSkip);\n }\n }\n }\n\n function trackAdError(error, vastResponse) {\n player.trigger({type: 'vast.adError', error: error});\n cancelAds();\n if (console && console.log) {\n console.log('AD ERROR:', error.message, error, vastResponse);\n }\n }\n\n function isVPAID(vastResponse) {\n var i, len;\n var mediaFiles = vastResponse.mediaFiles;\n for (i = 0, len = mediaFiles.length; i < len; i++) {\n if (vastUtil.isVPAID(mediaFiles[i])) {\n return true;\n }\n }\n return false;\n }\n};\n\n},{\"../ads/vast/VASTClient\":21,\"../ads/vast/VASTError\":22,\"../ads/vast/VASTIntegrator\":23,\"../ads/vast/vastUtil\":29,\"../ads/vpaid/VPAIDIntegrator\":33,\"../utils/async\":39,\"../utils/dom\":40,\"../utils/playerUtils\":42,\"../utils/utilityFunctions\":44}],39:[function(require,module,exports){\n//Small subset of async\n\nvar utilities = require('./utilityFunctions');\n\nvar async = {};\n\nasync.setImmediate = function (fn) {\n setTimeout(fn, 0);\n};\n\nasync.iterator = function (tasks) {\n var makeCallback = function (index) {\n var fn = function () {\n if (tasks.length) {\n tasks[index].apply(null, arguments);\n }\n return fn.next();\n };\n fn.next = function () {\n return (index < tasks.length - 1) ? makeCallback(index + 1) : null;\n };\n return fn;\n };\n return makeCallback(0);\n};\n\n\nasync.waterfall = function (tasks, callback) {\n callback = callback || function () { };\n if (!utilities.isArray(tasks)) {\n var err = new Error('First argument to waterfall must be an array of functions');\n return callback(err);\n }\n if (!tasks.length) {\n return callback();\n }\n var wrapIterator = function (iterator) {\n return function (err) {\n if (err) {\n callback.apply(null, arguments);\n callback = function () {\n };\n }\n else {\n var args = Array.prototype.slice.call(arguments, 1);\n var next = iterator.next();\n if (next) {\n args.push(wrapIterator(next));\n }\n else {\n args.push(callback);\n }\n async.setImmediate(function () {\n iterator.apply(null, args);\n });\n }\n };\n };\n wrapIterator(async.iterator(tasks))();\n};\n\nasync.when = function (condition, callback) {\n if (!utilities.isFunction(callback)) {\n throw new Error(\"async.when error: missing callback argument\");\n }\n\n var isAllowed = utilities.isFunction(condition) ? condition : function () {\n return !!condition;\n };\n\n return function () {\n var args = utilities.arrayLikeObjToArray(arguments);\n var next = args.pop();\n\n if (isAllowed.apply(null, args)) {\n return callback.apply(this, arguments);\n }\n\n args.unshift(null);\n return next.apply(null, args);\n };\n};\n\nmodule.exports = async;\n\n\n},{\"./utilityFunctions\":44}],40:[function(require,module,exports){\n'use strict';\n\nvar utilities = require('./utilityFunctions');\n\nvar dom = {};\n\ndom.isVisible = function isVisible(el) {\n var style = window.getComputedStyle(el);\n return style.visibility !== 'hidden';\n};\n\ndom.isHidden = function isHidden(el) {\n var style = window.getComputedStyle(el);\n return style.display === 'none';\n};\n\ndom.isShown = function isShown(el) {\n return !dom.isHidden(el);\n};\n\ndom.hide = function hide(el) {\n el.__prev_style_display_ = el.style.display;\n el.style.display = 'none';\n};\n\ndom.show = function show(el) {\n if (dom.isHidden(el)) {\n el.style.display = el.__prev_style_display_;\n }\n el.__prev_style_display_ = undefined;\n};\n\ndom.hasClass = function hasClass(el, cssClass) {\n var classes, i, len;\n\n if (utilities.isNotEmptyString(cssClass)) {\n if (el.classList) {\n return el.classList.contains(cssClass);\n }\n\n classes = utilities.isString(el.getAttribute('class')) ? el.getAttribute('class').split(/\\s+/) : [];\n cssClass = (cssClass || '');\n\n for (i = 0, len = classes.length; i < len; i += 1) {\n if (classes[i] === cssClass) {\n return true;\n }\n }\n }\n return false;\n};\n\ndom.addClass = function (el, cssClass) {\n var classes;\n\n if (utilities.isNotEmptyString(cssClass)) {\n if (el.classList) {\n return el.classList.add(cssClass);\n }\n\n classes = utilities.isString(el.getAttribute('class')) ? el.getAttribute('class').split(/\\s+/) : [];\n if (utilities.isString(cssClass) && utilities.isNotEmptyString(cssClass.replace(/\\s+/, ''))) {\n classes.push(cssClass);\n el.setAttribute('class', classes.join(' '));\n }\n }\n};\n\ndom.removeClass = function (el, cssClass) {\n var classes;\n\n if (utilities.isNotEmptyString(cssClass)) {\n if (el.classList) {\n return el.classList.remove(cssClass);\n }\n\n classes = utilities.isString(el.getAttribute('class')) ? el.getAttribute('class').split(/\\s+/) : [];\n var newClasses = [];\n var i, len;\n if (utilities.isString(cssClass) && utilities.isNotEmptyString(cssClass.replace(/\\s+/, ''))) {\n\n for (i = 0, len = classes.length; i < len; i += 1) {\n if (cssClass !== classes[i]) {\n newClasses.push(classes[i]);\n }\n }\n el.setAttribute('class', newClasses.join(' '));\n }\n }\n};\n\ndom.addEventListener = function addEventListener(el, type, handler) {\n if(utilities.isArray(el)){\n utilities.forEach(el, function(e) {\n dom.addEventListener(e, type, handler);\n });\n return;\n }\n\n if(utilities.isArray(type)){\n utilities.forEach(type, function(t) {\n dom.addEventListener(el, t, handler);\n });\n return;\n }\n\n if (el.addEventListener) {\n el.addEventListener(type, handler, false);\n } else if (el.attachEvent) {\n // WARNING!!! this is a very naive implementation !\n // the event object that should be passed to the handler\n // would not be there for IE8\n // we should use \"window.event\" and then \"event.srcElement\"\n // instead of \"event.target\"\n el.attachEvent(\"on\" + type, handler);\n }\n};\n\ndom.removeEventListener = function removeEventListener(el, type, handler) {\n if(utilities.isArray(el)){\n utilities.forEach(el, function(e) {\n dom.removeEventListener(e, type, handler);\n });\n return;\n }\n\n if(utilities.isArray(type)){\n utilities.forEach(type, function(t) {\n dom.removeEventListener(el, t, handler);\n });\n return;\n }\n\n if (el.removeEventListener) {\n el.removeEventListener(type, handler, false);\n } else if (el.detachEvent) {\n el.detachEvent(\"on\" + type, handler);\n } else {\n el[\"on\" + type] = null;\n }\n};\n\ndom.dispatchEvent = function dispatchEvent(el, event) {\n if (el.dispatchEvent) {\n el.dispatchEvent(event);\n } else {\n el.fireEvent(\"on\" + event.eventType, event);\n }\n};\n\ndom.isDescendant = function isDescendant(parent, child) {\n var node = child.parentNode;\n while (node !== null) {\n if (node === parent) {\n return true;\n }\n node = node.parentNode;\n }\n return false;\n};\n\ndom.getTextContent = function getTextContent(el){\n return el.textContent || el.text;\n};\n\ndom.prependChild = function prependChild(parent, child) {\n if(child.parentNode){\n child.parentNode.removeChild(child);\n }\n return parent.insertBefore(child, parent.firstChild);\n};\n\ndom.remove = function removeNode(node){\n if(node && node.parentNode){\n node.parentNode.removeChild(node);\n }\n};\n\ndom.isDomElement = function isDomElement(o) {\n return o instanceof Element;\n};\n\ndom.click = function(el, handler) {\n dom.addEventListener(el, 'click', handler);\n};\n\ndom.once = function(el, type, handler) {\n function handlerWrap() {\n handler.apply(null, arguments);\n dom.removeEventListener(el, type, handlerWrap);\n }\n\n dom.addEventListener(el, type, handlerWrap);\n};\n\n//Note: there is no getBoundingClientRect on iPad so we need a fallback\ndom.getDimension = function getDimension(element) {\n var rect;\n\n //On IE9 and below getBoundingClientRect does not work consistently\n if(!utilities.isOldIE() && element.getBoundingClientRect) {\n rect = element.getBoundingClientRect();\n return {\n width: rect.width,\n height: rect.height\n };\n }\n\n return {\n width: element.offsetWidth,\n height: element.offsetHeight\n };\n};\n\nmodule.exports = dom;\n},{\"./utilityFunctions\":44}],41:[function(require,module,exports){\n'use strict';\n\nvar urlUtils = require('./urlUtils');\nvar utilities = require('./utilityFunctions');\n\nfunction HttpRequestError(message) {\n this.message = 'HttpRequest Error: ' + (message || '');\n}\nHttpRequestError.prototype = new Error();\nHttpRequestError.prototype.name = \"HttpRequest Error\";\n\nfunction HttpRequest(createXhr) {\n if (!utilities.isFunction(createXhr)) {\n throw new HttpRequestError('Missing XMLHttpRequest factory method');\n }\n\n this.createXhr = createXhr;\n}\n\nHttpRequest.prototype.run = function (method, url, callback, options) {\n sanityCheck(url, callback, options);\n var timeout, timeoutId;\n var xhr = this.createXhr();\n options = options || {};\n timeout = utilities.isNumber(options.timeout) ? options.timeout : 0;\n\n xhr.open(method, urlUtils.urlParts(url).href, true);\n\n if (options.headers) {\n setHeaders(xhr, options.headers);\n }\n\n if (options.withCredentials) {\n xhr.withCredentials = true;\n }\n\n xhr.onload = function () {\n var statusText, response, status;\n\n /**\n * The only way to do a secure request on IE8 and IE9 is with the XDomainRequest object. Unfortunately, microsoft is\n * so nice that decided that the status property and the 'getAllResponseHeaders' method where not needed so we have to\n * fake them. If the request gets done with an XDomainRequest instance, we will assume that there are no headers and\n * the status will always be 200. If you don't like it, DO NOT USE ANCIENT BROWSERS!!!\n *\n * For mor info go to: https://msdn.microsoft.com/en-us/library/cc288060(v=vs.85).aspx\n */\n if (!xhr.getAllResponseHeaders) {\n xhr.getAllResponseHeaders = function () {\n return null;\n };\n }\n\n if (!xhr.status) {\n xhr.status = 200;\n }\n\n if (utilities.isDefined(timeoutId)) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n\n statusText = xhr.statusText || '';\n\n // responseText is the old-school way of retrieving response (supported by IE8 & 9)\n // response/responseType properties were introduced in XHR Level2 spec (supported by IE10)\n response = ('response' in xhr) ? xhr.response : xhr.responseText;\n\n // normalize IE9 bug (http://bugs.jquery.com/ticket/1450)\n status = xhr.status === 1223 ? 204 : xhr.status;\n\n callback(\n status,\n response,\n xhr.getAllResponseHeaders(),\n statusText);\n };\n\n xhr.onerror = requestError;\n xhr.onabort = requestError;\n\n xhr.send();\n\n if (timeout > 0) {\n timeoutId = setTimeout(function () {\n xhr && xhr.abort();\n }, timeout);\n }\n\n function sanityCheck(url, callback, options) {\n if (!utilities.isString(url) || utilities.isEmptyString(url)) {\n throw new HttpRequestError(\"Invalid url '\" + url + \"'\");\n }\n\n if (!utilities.isFunction(callback)) {\n throw new HttpRequestError(\"Invalid handler '\" + callback + \"' for the http request\");\n }\n\n if (utilities.isDefined(options) && !utilities.isObject(options)) {\n throw new HttpRequestError(\"Invalid options map '\" + options + \"'\");\n }\n }\n\n function setHeaders(xhr, headers) {\n utilities.forEach(headers, function (value, key) {\n if (utilities.isDefined(value)) {\n xhr.setRequestHeader(key, value);\n }\n });\n }\n\n function requestError() {\n callback(-1, null, null, '');\n }\n};\n\nHttpRequest.prototype.get = function (url, callback, options) {\n this.run('GET', url, processResponse, options);\n\n function processResponse(status, response, headersString, statusText) {\n if (isSuccess(status)) {\n callback(null, response, status, headersString, statusText);\n } else {\n callback(new HttpRequestError(statusText), response, status, headersString, statusText);\n }\n }\n\n function isSuccess(status) {\n return 200 <= status && status < 300;\n }\n};\n\nfunction createXhr() {\n var xhr = new XMLHttpRequest();\n if (!(\"withCredentials\" in xhr)) {\n // XDomainRequest for IE.\n xhr = new XDomainRequest();\n }\n return xhr;\n}\n\nvar http = new HttpRequest(createXhr);\n\nmodule.exports = {\n http: http,\n HttpRequest: HttpRequest,\n HttpRequestError: HttpRequestError,\n createXhr: createXhr\n};\n\n},{\"./urlUtils\":43,\"./utilityFunctions\":44}],42:[function(require,module,exports){\n'use strict';\n\nvar dom = require('./dom');\nvar utilities = require('./utilityFunctions');\n\nvar playerUtils = {};\n\n/**\n * Returns an object that captures the portions of player state relevant to\n * video playback. The result of this function can be passed to\n * restorePlayerSnapshot with a player to return the player to the state it\n * was in when this function was invoked.\n * @param {object} player The videojs player object\n */\nplayerUtils.getPlayerSnapshot = function getPlayerSnapshot(player) {\n var tech = player.el().querySelector('.vjs-tech');\n\n var snapshot = {\n ended: player.ended(),\n src: player.currentSrc(),\n currentTime: player.currentTime(),\n type: player.currentType(),\n playing: !player.paused(),\n suppressedTracks: getSuppressedTracks(player)\n };\n\n if (tech) {\n snapshot.nativePoster = tech.poster;\n snapshot.style = tech.getAttribute('style');\n }\n return snapshot;\n\n /**** Local Functions ****/\n function getSuppressedTracks(player) {\n var tracks = player.remoteTextTracks ? player.remoteTextTracks() : [];\n\n if (tracks && utilities.isArray(tracks.tracks_)) {\n tracks = tracks.tracks_;\n }\n\n if (!utilities.isArray(tracks)) {\n tracks = [];\n }\n\n var suppressedTracks = [];\n tracks.forEach(function (track) {\n suppressedTracks.push({\n track: track,\n mode: track.mode\n });\n track.mode = 'disabled';\n });\n\n return suppressedTracks;\n }\n};\n\n/**\n * Attempts to modify the specified player so that its state is equivalent to\n * the state of the snapshot.\n * @param {object} snapshot - the player state to apply\n */\nplayerUtils.restorePlayerSnapshot = function restorePlayerSnapshot(player, snapshot) {\n var tech = player.el().querySelector('.vjs-tech');\n var attempts = 20; // the number of remaining attempts to restore the snapshot\n\n if (snapshot.nativePoster) {\n tech.poster = snapshot.nativePoster;\n }\n\n if ('style' in snapshot) {\n // overwrite all css style properties to restore state precisely\n tech.setAttribute('style', snapshot.style || '');\n }\n\n if (hasSrcChanged(player, snapshot)) {\n\n // on ios7, fiddling with textTracks too early will cause safari to crash\n player.one('contentloadedmetadata', restoreTracks);\n\n player.one('canplay', tryToResume);\n ensureCanplayEvtGetsFired();\n\n // if the src changed for ad playback, reset it\n player.src({src: snapshot.src, type: snapshot.type});\n\n // safari requires a call to `load` to pick up a changed source\n player.load();\n\n } else {\n restoreTracks();\n\n if (snapshot.playing) {\n player.play();\n }\n }\n\n /*** Local Functions ***/\n\n /**\n * Sometimes firefox does not trigger the 'canplay' evt.\n * This code ensure that it always gets triggered triggered.\n */\n function ensureCanplayEvtGetsFired() {\n var timeoutId = setTimeout(function() {\n player.trigger('canplay');\n }, 1000);\n\n player.one('canplay', function(){\n clearTimeout(timeoutId);\n });\n }\n\n /**\n * Determine whether the player needs to be restored to its state\n * before ad playback began. With a custom ad display or burned-in\n * ads, the content player state hasn't been modified and so no\n * restoration is required\n */\n function hasSrcChanged(player, snapshot) {\n if (player.src()) {\n return player.src() !== snapshot.src;\n }\n // the player was configured through source element children\n return player.currentSrc() !== snapshot.src;\n }\n\n function restoreTracks() {\n var suppressedTracks = snapshot.suppressedTracks;\n suppressedTracks.forEach(function (trackSnapshot) {\n trackSnapshot.track.mode = trackSnapshot.mode;\n });\n }\n\n /**\n * Determine if the video element has loaded enough of the snapshot source\n * to be ready to apply the rest of the state\n */\n function tryToResume() {\n\n // if some period of the video is seekable, resume playback\n // otherwise delay a bit and then check again unless we're out of attempts\n\n if (!playerUtils.isReadyToResume(player) && attempts--) {\n setTimeout(tryToResume, 50);\n } else {\n try {\n if(player.currentTime() !== snapshot.currentTime) {\n if (snapshot.playing) { // if needed restore playing status after seek completes\n player.one('seeked', function() {\n player.play();\n });\n }\n player.currentTime(snapshot.currentTime);\n\n } else if (snapshot.playing) {\n // if needed and no seek has been performed, restore playing status immediately\n player.play();\n }\n\n } catch (e) {\n videojs.log.warn('Failed to resume the content after an advertisement', e);\n }\n }\n }\n};\n\nplayerUtils.isReadyToResume = function (player) {\n\n if (player.readyState() > 1) {\n // some browsers and media aren't \"seekable\".\n // readyState greater than 1 allows for seeking without exceptions\n return true;\n }\n\n if (player.seekable() === undefined) {\n // if the player doesn't expose the seekable time ranges, try to\n // resume playback immediately\n return true;\n }\n\n if (player.seekable().length > 0) {\n // if some period of the video is seekable, resume playback\n return true;\n }\n\n return false;\n};\n\n/**\n * This function prepares the player to display ads.\n * Adding convenience events like the 'vast.firsPlay' that gets fired when the video is first played\n * and ads the blackPoster to the player to prevent content from being displayed before the preroll ad.\n *\n * @param player\n */\nplayerUtils.prepareForAds = function (player) {\n var blackPoster = player.addChild('blackPoster');\n var _firstPlay = true;\n var volumeSnapshot;\n\n\n monkeyPatchPlayerApi();\n\n player.on('play', tryToTriggerFirstPlay);\n player.on('vast.reset', resetFirstPlay);//Every time we change the sources we reset the first play.\n player.on('vast.firstPlay', restoreContentVolume);\n player.on('error', hideBlackPoster);//If there is an error in the player we remove the blackposter to show the err msg\n player.on('vast.adStart', hideBlackPoster);\n player.on('vast.adsCancel', hideBlackPoster);\n player.on('vast.adError', hideBlackPoster);\n player.on('vast.adStart', addStyles);\n player.on('vast.adEnd', removeStyles);\n player.on('vast.adsCancel', removeStyles);\n\n /*** Local Functions ***/\n\n /**\n What this function does is ugly and horrible and I should think twice before calling myself a good developer. With that said,\n it is the best solution I could find to mute the video until the 'play' event happens (on mobile devices) and the plugin can decide whether\n to play the ad or not.\n\n We also need this monkeypatch to be able to pause and resume an ad using the player's API\n\n If you have a better solution please do tell me.\n */\n function monkeyPatchPlayerApi() {\n\n /**\n * Monkey patch needed to handle firstPlay and resume of playing ad.\n *\n * @param callOrigPlay necessary flag to prevent infinite loop when you are restoring a VAST ad.\n * @returns {player}\n */\n var origPlay = player.play;\n player.play = function (callOrigPlay) {\n var that = this;\n\n if (isFirstPlay()) {\n firstPlay();\n } else {\n resume(callOrigPlay);\n }\n\n return this;\n\n /*** local functions ***/\n function firstPlay() {\n if (!utilities.isIPhone()) {\n volumeSnapshot = saveVolumeSnapshot();\n player.muted(true);\n }\n\n origPlay.apply(that, arguments);\n }\n\n function resume(callOrigPlay) {\n if (isAdPlaying() && !callOrigPlay) {\n player.vast.adUnit.resumeAd();\n } else {\n origPlay.apply(that, arguments);\n }\n }\n };\n\n\n /**\n * Needed monkey patch to handle pause of playing ad.\n *\n * @param callOrigPlay necessary flag to prevent infinite loop when you are pausing a VAST ad.\n * @returns {player}\n */\n var origPause = player.pause;\n player.pause = function (callOrigPause) {\n if (isAdPlaying() && !callOrigPause) {\n player.vast.adUnit.pauseAd();\n } else {\n origPause.apply(this, arguments);\n }\n return this;\n };\n\n\n /**\n * Needed monkey patch to handle paused state of the player when ads are playing.\n *\n * @param callOrigPlay necessary flag to prevent infinite loop when you are pausing a VAST ad.\n * @returns {player}\n */\n var origPaused = player.paused;\n player.paused = function (callOrigPaused) {\n if (isAdPlaying() && !callOrigPaused) {\n return player.vast.adUnit.isPaused();\n }\n return origPaused.apply(this, arguments);\n };\n }\n\n function isAdPlaying() {\n return player.vast && player.vast.adUnit;\n }\n\n function tryToTriggerFirstPlay() {\n if (isFirstPlay()) {\n _firstPlay = false;\n player.trigger('vast.firstPlay');\n }\n }\n\n function resetFirstPlay() {\n _firstPlay = true;\n blackPoster.show();\n restoreContentVolume();\n }\n\n function isFirstPlay() {\n return _firstPlay;\n }\n\n function saveVolumeSnapshot() {\n return {\n muted: player.muted(),\n volume: player.volume()\n };\n }\n\n function restoreContentVolume() {\n if (volumeSnapshot) {\n player.currentTime(0);\n restoreVolumeSnapshot(volumeSnapshot);\n volumeSnapshot = null;\n }\n }\n\n function restoreVolumeSnapshot(snapshot) {\n if (utilities.isObject(snapshot)) {\n player.volume(snapshot.volume);\n player.muted(snapshot.muted);\n }\n }\n\n function hideBlackPoster() {\n if (!dom.hasClass(blackPoster.el(), 'vjs-hidden')) {\n blackPoster.hide();\n }\n }\n\n function addStyles() {\n dom.addClass(player.el(), 'vjs-ad-playing');\n }\n\n function removeStyles() {\n dom.removeClass(player.el(), 'vjs-ad-playing');\n }\n};\n\n/**\n * Remove the poster attribute from the video element tech, if present. When\n * reusing a video element for multiple videos, the poster image will briefly\n * reappear while the new source loads. Removing the attribute ahead of time\n * prevents the poster from showing up between videos.\n * @param {object} player The videojs player object\n */\nplayerUtils.removeNativePoster = function (player) {\n var tech = player.el().querySelector('.vjs-tech');\n if (tech) {\n tech.removeAttribute('poster');\n }\n};\n\n/**\n * Helper function to listen to many events until one of them gets fired, then we\n * execute the handler and unsubscribe all the event listeners;\n *\n * @param player specific player from where to listen for the events\n * @param events array of events\n * @param handler function to execute once one of the events fires\n */\nplayerUtils.once = function once(player, events, handler) {\n function listener() {\n handler.apply(null, arguments);\n\n events.forEach(function (event) {\n player.off(event, listener);\n });\n }\n\n events.forEach(function (event) {\n player.on(event, listener);\n });\n};\n\n\nmodule.exports = playerUtils;\n},{\"./dom\":40,\"./utilityFunctions\":44}],43:[function(require,module,exports){\n'use strict';\n\nvar utilities = require('./utilityFunctions');\n\n/**\n *\n * IMPORTANT NOTE: This function comes from angularJs and was originally called urlResolve\n * you can take a look at the original code here https://github.com/angular/angular.js/blob/master/src/ng/urlUtils.js\n *\n * Implementation Notes for non-IE browsers\n * ----------------------------------------\n * Assigning a URL to the href property of an anchor DOM node, even one attached to the DOM,\n * results both in the normalizing and parsing of the URL. Normalizing means that a relative\n * URL will be resolved into an absolute URL in the context of the application document.\n * Parsing means that the anchor node's host, hostname, protocol, port, pathname and related\n * properties are all populated to reflect the normalized URL. This approach has wide\n * compatibility - Safari 1+, Mozilla 1+, Opera 7+,e etc. See\n * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html\n *\n * Implementation Notes for IE\n * ---------------------------\n * IE >= 8 and <= 10 normalizes the URL when assigned to the anchor node similar to the other\n * browsers. However, the parsed components will not be set if the URL assigned did not specify\n * them. (e.g. if you assign a.href = \"foo\", then a.protocol, a.host, etc. will be empty.) We\n * work around that by performing the parsing in a 2nd step by taking a previously normalized\n * URL (e.g. by assigning to a.href) and assigning it a.href again. This correctly populates the\n * properties such as protocol, hostname, port, etc.\n *\n * IE7 does not normalize the URL when assigned to an anchor node. (Apparently, it does, if one\n * uses the inner HTML approach to assign the URL as part of an HTML snippet -\n * http://stackoverflow.com/a/472729) However, setting img[src] does normalize the URL.\n * Unfortunately, setting img[src] to something like \"javascript:foo\" on IE throws an exception.\n * Since the primary usage for normalizing URLs is to sanitize such URLs, we can't use that\n * method and IE < 8 is unsupported.\n *\n * References:\n * http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement\n * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html\n * http://url.spec.whatwg.org/#urlutils\n * https://github.com/angular/angular.js/pull/2902\n * http://james.padolsey.com/javascript/parsing-urls-with-the-dom/\n *\n * @kind function\n * @param {string} url The URL to be parsed.\n * @description Normalizes and parses a URL.\n * @returns {object} Returns the normalized URL as a dictionary.\n *\n * | member name | Description |\n * |---------------|----------------|\n * | href | A normalized version of the provided URL if it was not an absolute URL |\n * | protocol | The protocol including the trailing colon |\n * | host | The host and port (if the port is non-default) of the normalizedUrl |\n * | search | The search params, minus the question mark |\n * | hash | The hash string, minus the hash symbol\n * | hostname | The hostname\n * | port | The port, without \":\"\n * | pathname | The pathname, beginning with \"/\"\n *\n */\n\nvar urlParsingNode = document.createElement(\"a\");\n/**\n * documentMode is an IE-only property\n * http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx\n */\nvar msie = document.documentMode;\n\nfunction urlParts(url) {\n var href = url;\n\n if (msie) {\n // Normalize before parse. Refer Implementation Notes on why this is\n // done in two steps on IE.\n urlParsingNode.setAttribute(\"href\", href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: utilities.isNotEmptyString(urlParsingNode.port)? urlParsingNode.port: 80,\n pathname: (urlParsingNode.pathname.charAt(0) === '/')\n ? urlParsingNode.pathname\n : '/' + urlParsingNode.pathname\n };\n}\n\n\n/**\n * This function accepts a query string (search part of a url) and returns a dictionary with\n * the different key value pairs\n * @param {string} qs queryString\n */\nfunction queryStringToObj(qs, cond) {\n var pairs, qsObj;\n\n cond = utilities.isFunction(cond)? cond : function() {\n return true;\n };\n\n qs = qs.trim().replace(/^\\?/, '');\n pairs = qs.split('&');\n qsObj = {};\n\n utilities.forEach(pairs, function (pair) {\n var keyValue, key, value;\n if (pair !== '') {\n keyValue = pair.split('=');\n key = keyValue[0];\n value = keyValue[1];\n if(cond(key, value)){\n qsObj[key] = value;\n }\n }\n });\n\n return qsObj;\n}\n\n/**\n * This function accepts an object and serializes it into a query string without the leading '?'\n * @param obj\n * @returns {string}\n */\nfunction objToQueryString(obj) {\n var pairs = [];\n utilities.forEach(obj, function (value, key) {\n pairs.push(key + '=' + value);\n });\n return pairs.join('&');\n}\n\nmodule.exports = {\n urlParts: urlParts,\n queryStringToObj: queryStringToObj,\n objToQueryString: objToQueryString\n};\n\n},{\"./utilityFunctions\":44}],44:[function(require,module,exports){\n/*jshint unused:false */\n\"use strict\";\n\nvar NODE_TYPE_ELEMENT = 1;\nvar SNAKE_CASE_REGEXP = /[A-Z]/g;\nvar EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i;\n/*jslint maxlen: 500 */\nvar ISO8086_REGEXP = /^([\\+-]?\\d{4}(?!\\d{2}\\b))((-?)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))?|W([0-4]\\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6])))([T\\s]((([01]\\d|2[0-3])((:?)[0-5]\\d)?|24\\:?00)([\\.,]\\d+(?!:))?)?(\\17[0-5]\\d([\\.,]\\d+)?)?([zZ]|([\\+-])([01]\\d|2[0-3]):?([0-5]\\d)?)?)?)?$/;\n\n\nfunction noop(){ }\n\nfunction isNull(o) {\n return o === null;\n}\n\nfunction isDefined(o){\n return o !== undefined;\n}\n\nfunction isUndefined(o){\n return o === undefined;\n}\n\nfunction isObject(obj) {\n return typeof obj === 'object';\n}\n\nfunction isFunction(str){\n return typeof str === 'function';\n}\n\nfunction isNumber(num){\n return typeof num === 'number';\n}\n\nfunction isWindow(obj) {\n return utilities.isObject(obj) && obj.window === obj;\n}\n\nfunction isArray(array){\n return Object.prototype.toString.call( array ) === '[object Array]';\n}\n\nfunction isArrayLike(obj) {\n if (obj === null || utilities.isWindow(obj) || utilities.isFunction(obj) || utilities.isUndefined(obj)) {\n return false;\n }\n\n var length = obj.length;\n\n if (obj.nodeType === NODE_TYPE_ELEMENT && length) {\n return true;\n }\n\n return utilities.isString(obj) || utilities.isArray(obj) || length === 0 ||\n typeof length === 'number' && length > 0 && (length - 1) in obj;\n}\n\nfunction isString(str){\n return typeof str === 'string';\n}\n\nfunction isEmptyString(str) {\n return utilities.isString(str) && str.length === 0;\n}\n\nfunction isNotEmptyString(str) {\n return utilities.isString(str) && str.length !== 0;\n}\n\nfunction arrayLikeObjToArray(args) {\n return Array.prototype.slice.call(args);\n}\n\nfunction forEach(obj, iterator, context) {\n var key, length;\n if (obj) {\n if (isFunction(obj)) {\n for (key in obj) {\n // Need to check if hasOwnProperty exists,\n // as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function\n if (key !== 'prototype' && key !== 'length' && key !== 'name' && (!obj.hasOwnProperty || obj.hasOwnProperty(key))) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n } else if (isArray(obj)) {\n var isPrimitive = typeof obj !== 'object';\n for (key = 0, length = obj.length; key < length; key++) {\n if (isPrimitive || key in obj) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n } else if (obj.forEach && obj.forEach !== forEach) {\n obj.forEach(iterator, context, obj);\n } else {\n for (key in obj) {\n if (obj.hasOwnProperty(key)) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n }\n }\n return obj;\n}\n\nfunction snake_case(name, separator) {\n separator = separator || '_';\n return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n}\n\nfunction isValidEmail(email){\n if(!utilities.isString(email)){\n return false;\n }\n\n return EMAIL_REGEXP.test(email.trim());\n}\n\nfunction extend (obj) {\n var arg, i, k;\n for (i = 1; i < arguments.length; i++) {\n arg = arguments[i];\n for (k in arg) {\n if (arg.hasOwnProperty(k)) {\n if(isObject(obj[k]) && !isNull(obj[k]) && isObject(arg[k])){\n obj[k] = extend({}, obj[k], arg[k]);\n }else {\n obj[k] = arg[k];\n }\n }\n }\n }\n return obj;\n}\n\nfunction capitalize(s){\n return s.charAt(0).toUpperCase() + s.slice(1);\n}\n\nfunction decapitalize(s) {\n return s.charAt(0).toLowerCase() + s.slice(1);\n}\n\n/**\n * This method works the same way array.prototype.map works but if the transformer returns undefine, then\n * it won't be added to the transformed Array.\n */\nfunction transformArray(array, transformer) {\n var transformedArray = [];\n\n array.forEach(function(item, index){\n var transformedItem = transformer(item, index);\n if(utilities.isDefined(transformedItem)) {\n transformedArray.push(transformedItem);\n }\n });\n\n return transformedArray;\n}\n\nfunction toFixedDigits(num, digits) {\n var formattedNum = num + '';\n digits = utilities.isNumber(digits) ? digits : 0;\n num = utilities.isNumber(num) ? num : parseInt(num, 10);\n if(utilities.isNumber(num) && !isNaN(num)){\n formattedNum = num + '';\n while(formattedNum.length < digits) {\n formattedNum = '0' + formattedNum;\n }\n return formattedNum;\n }\n return NaN + '';\n}\n\nfunction throttle(callback, delay) {\n var previousCall = new Date().getTime() - (delay + 1);\n return function() {\n var time = new Date().getTime();\n if ((time - previousCall) >= delay) {\n previousCall = time;\n callback.apply(this, arguments);\n }\n };\n}\n\nfunction debounce (callback, wait) {\n var timeoutId;\n\n return function (){\n if(timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(function(){\n callback.apply(this, arguments);\n timeoutId = undefined;\n }, wait);\n };\n}\n\n// a function designed to blow up the stack in a naive way\n// but it is ok for videoJs children components\nfunction treeSearch(root, getChildren, found){\n var children = getChildren(root);\n for (var i = 0; i < children.length; i++){\n if (found(children[i])) {\n return children[i];\n }\n else {\n var el = treeSearch(children[i], getChildren, found);\n if (el){\n return el;\n }\n }\n }\n}\n\nfunction echoFn(val) {\n return function () {\n return val;\n };\n}\n\n//Note: Supported formats come from http://www.w3.org/TR/NOTE-datetime\n// and the iso8601 regex comes from http://www.pelagodesign.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/\nfunction isISO8601(value) {\n if(utilities.isNumber(value)){\n value = value + ''; //we make sure that we are working with strings\n }\n\n if(!utilities.isString(value)){\n return false;\n }\n\n return ISO8086_REGEXP.test(value.trim());\n}\n\n/**\n * Checks if the Browser is IE9 and below\n * @returns {boolean}\n */\nfunction isOldIE() {\n var version = utilities.getInternetExplorerVersion(navigator);\n if (version === -1) {\n return false;\n }\n\n return version < 10;\n}\n\n/**\n * Returns the version of Internet Explorer or a -1 (indicating the use of another browser).\n * Source: https://msdn.microsoft.com/en-us/library/ms537509(v=vs.85).aspx\n * @returns {number} the version of Internet Explorer or a -1 (indicating the use of another browser).\n */\nfunction getInternetExplorerVersion(navigator) {\n var rv = -1;\n\n if (navigator.appName == 'Microsoft Internet Explorer') {\n var ua = navigator.userAgent;\n var re = new RegExp(\"MSIE ([0-9]{1,}[\\.0-9]{0,})\");\n var res = re.exec(ua);\n if (res !== null) {\n rv = parseFloat(res[1]);\n }\n }\n\n return rv;\n}\n\n/*** Mobile Utility functions ***/\nfunction isIDevice() {\n return /iP(hone|ad)/.test(utilities._UA);\n}\n\nfunction isMobile() {\n return /iP(hone|ad|od)|Android|Windows Phone/.test(utilities._UA);\n}\n\nfunction isIPhone() {\n return /iP(hone|od)/.test(utilities._UA);\n}\n\nfunction isAndroid() {\n return /Android/.test(utilities._UA);\n}\n\nvar utilities = {\n _UA: navigator.userAgent,\n noop: noop,\n isNull: isNull,\n isDefined: isDefined,\n isUndefined: isUndefined,\n isObject: isObject,\n isFunction: isFunction,\n isNumber: isNumber,\n isWindow: isWindow,\n isArray: isArray,\n isArrayLike: isArrayLike,\n isString: isString,\n isEmptyString: isEmptyString,\n isNotEmptyString: isNotEmptyString,\n arrayLikeObjToArray: arrayLikeObjToArray,\n forEach: forEach,\n snake_case: snake_case,\n isValidEmail: isValidEmail,\n extend: extend,\n capitalize: capitalize,\n decapitalize: decapitalize,\n transformArray: transformArray,\n toFixedDigits: toFixedDigits,\n throttle: throttle,\n debounce: debounce,\n treeSearch: treeSearch,\n echoFn: echoFn,\n isISO8601: isISO8601,\n isOldIE: isOldIE,\n getInternetExplorerVersion: getInternetExplorerVersion,\n isIDevice: isIDevice,\n isMobile: isMobile,\n isIPhone: isIPhone,\n isAndroid: isAndroid\n};\n\nmodule.exports = utilities;\n},{}],45:[function(require,module,exports){\n'use strict';\n\nvar utilities = require('./utilityFunctions');\n\nvar xml = {};\n\nxml.strToXMLDoc = function strToXMLDoc(stringContainingXMLSource){\n //IE 8\n if(typeof window.DOMParser === 'undefined'){\n var xmlDocument = new ActiveXObject('Microsoft.XMLDOM');\n xmlDocument.async = false;\n xmlDocument.loadXML(stringContainingXMLSource);\n return xmlDocument;\n }\n\n return parseString(stringContainingXMLSource);\n\n function parseString(stringContainingXMLSource){\n var parser = new DOMParser();\n var parsedDocument;\n\n //Note: This try catch is to deal with the fact that on IE parser.parseFromString does throw an error but the rest of the browsers don't.\n try {\n parsedDocument = parser.parseFromString(stringContainingXMLSource, \"application/xml\");\n\n if(isParseError(parsedDocument) || utilities.isEmptyString(stringContainingXMLSource)){\n throw new Error();\n }\n }catch(e){\n throw new Error(\"xml.strToXMLDOC: Error parsing the string: '\" + stringContainingXMLSource + \"'\");\n }\n\n return parsedDocument;\n }\n\n function isParseError(parsedDocument) {\n try { // parser and parsererrorNS could be cached on startup for efficiency\n var parser = new DOMParser(),\n erroneousParse = parser.parseFromString('INVALID', 'text/xml'),\n parsererrorNS = erroneousParse.getElementsByTagName(\"parsererror\")[0].namespaceURI;\n\n if (parsererrorNS === 'http://www.w3.org/1999/xhtml') {\n // In PhantomJS the parseerror element doesn't seem to have a special namespace, so we are just guessing here :(\n return parsedDocument.getElementsByTagName(\"parsererror\").length > 0;\n }\n\n return parsedDocument.getElementsByTagNameNS(parsererrorNS, 'parsererror').length > 0;\n } catch (e) {\n //Note on IE parseString throws an error by itself and it will never reach this code. Because it will have failed before\n }\n }\n};\n\nxml.parseText = function parseText (sValue) {\n if (/^\\s*$/.test(sValue)) { return null; }\n if (/^(?:true|false)$/i.test(sValue)) { return sValue.toLowerCase() === \"true\"; }\n if (isFinite(sValue)) { return parseFloat(sValue); }\n if (utilities.isISO8601(sValue)) { return new Date(sValue); }\n return sValue.trim();\n};\n\nxml.JXONTree = function JXONTree (oXMLParent) {\n var parseText = xml.parseText;\n\n //The document object is an especial object that it may miss some functions or attrs depending on the browser.\n //To prevent this problem with create the JXONTree using the root childNode which is a fully fleshed node on all supported\n //browsers.\n if(oXMLParent.documentElement){\n return new xml.JXONTree(oXMLParent.documentElement);\n }\n\n if (oXMLParent.hasChildNodes()) {\n var sCollectedTxt = \"\";\n for (var oNode, sProp, vContent, nItem = 0; nItem < oXMLParent.childNodes.length; nItem++) {\n oNode = oXMLParent.childNodes.item(nItem);\n /*jshint bitwise: false*/\n if ((oNode.nodeType - 1 | 1) === 3) { sCollectedTxt += oNode.nodeType === 3 ? oNode.nodeValue.trim() : oNode.nodeValue; }\n else if (oNode.nodeType === 1 && !oNode.prefix) {\n sProp = utilities.decapitalize(oNode.nodeName);\n vContent = new xml.JXONTree(oNode);\n if (this.hasOwnProperty(sProp)) {\n if (this[sProp].constructor !== Array) { this[sProp] = [this[sProp]]; }\n this[sProp].push(vContent);\n } else { this[sProp] = vContent; }\n }\n }\n if (sCollectedTxt) { this.keyValue = parseText(sCollectedTxt); }\n }\n\n //IE8 Stupid fix\n var hasAttr = typeof oXMLParent.hasAttributes === 'undefined'? oXMLParent.attributes.length > 0: oXMLParent.hasAttributes();\n if (hasAttr) {\n var oAttrib;\n for (var nAttrib = 0; nAttrib < oXMLParent.attributes.length; nAttrib++) {\n oAttrib = oXMLParent.attributes.item(nAttrib);\n this[\"@\" + utilities.decapitalize(oAttrib.name)] = parseText(oAttrib.value.trim());\n }\n }\n};\n\nxml.JXONTree.prototype.attr = function(attr) {\n return this['@' + utilities.decapitalize(attr)];\n};\n\nxml.toJXONTree = function toJXONTree(xmlString){\n var xmlDoc = xml.strToXMLDoc(xmlString);\n return new xml.JXONTree(xmlDoc);\n};\n\n/**\n * Helper function to extract the keyvalue of a JXONTree obj\n *\n * @param xmlObj {JXONTree}\n * return the key value or undefined;\n */\nxml.keyValue = function getKeyValue(xmlObj) {\n if(xmlObj){\n return xmlObj.keyValue;\n }\n return undefined;\n};\n\nxml.attr = function getAttrValue(xmlObj, attr) {\n if(xmlObj) {\n return xmlObj['@' + utilities.decapitalize(attr)];\n }\n return undefined;\n};\n\nxml.encode = function encodeXML(str) {\n return str.replace(/&/g, '&')\n .replace(//g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n};\n\nxml.decode = function decodeXML(str) {\n return str.replace(/'/g, \"'\")\n .replace(/"/g, '\"')\n .replace(/>/g, '>')\n .replace(/</g, '<')\n .replace(/&/g, '&');\n};\n\nmodule.exports = xml;\n},{\"./utilityFunctions\":44}],46:[function(require,module,exports){\n'use strict';\n\nrequire('./plugin/components/ads-label_5');\nrequire('./plugin/components/black-poster_5');\n\nvar videoJsVAST = require('./plugin/videojs.vast.vpaid');\n\nvideojs.plugin('vastClient', videoJsVAST);\n\n},{\"./plugin/components/ads-label_5\":35,\"./plugin/components/black-poster_5\":37,\"./plugin/videojs.vast.vpaid\":38}]},{},[46])\n\n","'use strict';\n\nlet IVPAIDAdUnit = require('./IVPAIDAdUnit').IVPAIDAdUnit;\nlet ALL_VPAID_METHODS = Object.getOwnPropertyNames(IVPAIDAdUnit.prototype).filter(function (property) {\n return ['constructor'].indexOf(property) === -1;\n});\n\nexport class VPAIDAdUnit extends IVPAIDAdUnit {\n constructor (flash) {\n super();\n this._destroyed = false;\n this._flash = flash;\n }\n\n _destroy() {\n this._destroyed = true;\n ALL_VPAID_METHODS.forEach((methodName) => {\n this._flash.removeCallbackByMethodName(methodName);\n });\n IVPAIDAdUnit.EVENTS.forEach((event) => {\n this._flash.offEvent(event);\n });\n\n this._flash = null;\n }\n\n isDestroyed () {\n return this._destroyed;\n }\n\n on(eventName, callback) {\n this._flash.on(eventName, callback);\n }\n\n off(eventName, callback) {\n this._flash.off(eventName, callback);\n }\n\n //VPAID interface\n handshakeVersion(playerVPAIDVersion = '2.0', callback = undefined) {\n this._flash.callFlashMethod('handshakeVersion', [playerVPAIDVersion], callback);\n }\n initAd (width, height, viewMode, desiredBitrate, creativeData = {AdParameters: ''}, environmentVars = {flashVars: ''}, callback = undefined) {\n //resize element that has the flash object\n this._flash.setSize(width, height);\n creativeData = creativeData || {AdParameters: ''};\n environmentVars = environmentVars || {flashVars: ''};\n\n this._flash.callFlashMethod('initAd', [this._flash.getWidth(), this._flash.getHeight(), viewMode, desiredBitrate, creativeData.AdParameters || '', environmentVars.flashVars || ''], callback);\n }\n resizeAd(width, height, viewMode, callback = undefined) {\n //resize element that has the flash object\n this._flash.setSize(width, height);\n\n //resize ad inside the flash\n this._flash.callFlashMethod('resizeAd', [this._flash.getWidth(), this._flash.getHeight(), viewMode], callback);\n }\n startAd(callback = undefined) {\n this._flash.callFlashMethod('startAd', [], callback);\n }\n stopAd(callback = undefined) {\n this._flash.callFlashMethod('stopAd', [], callback);\n }\n pauseAd(callback = undefined) {\n this._flash.callFlashMethod('pauseAd', [], callback);\n }\n resumeAd(callback = undefined) {\n this._flash.callFlashMethod('resumeAd', [], callback);\n }\n expandAd(callback = undefined) {\n this._flash.callFlashMethod('expandAd', [], callback);\n }\n collapseAd(callback = undefined) {\n this._flash.callFlashMethod('collapseAd', [], callback);\n }\n skipAd(callback = undefined) {\n this._flash.callFlashMethod('skipAd', [], callback);\n }\n\n //properties that will be treat as async methods\n getAdLinear(callback) {\n this._flash.callFlashMethod('getAdLinear', [], callback);\n }\n getAdWidth(callback) {\n this._flash.callFlashMethod('getAdWidth', [], callback);\n }\n getAdHeight(callback) {\n this._flash.callFlashMethod('getAdHeight', [], callback);\n }\n getAdExpanded(callback) {\n this._flash.callFlashMethod('getAdExpanded', [], callback);\n }\n getAdSkippableState(callback) {\n this._flash.callFlashMethod('getAdSkippableState', [], callback);\n }\n getAdRemainingTime(callback) {\n this._flash.callFlashMethod('getAdRemainingTime', [], callback);\n }\n getAdDuration(callback) {\n this._flash.callFlashMethod('getAdDuration', [], callback);\n }\n setAdVolume(volume, callback = undefined) {\n this._flash.callFlashMethod('setAdVolume', [volume], callback);\n }\n getAdVolume(callback) {\n this._flash.callFlashMethod('getAdVolume', [], callback);\n }\n getAdCompanions(callback) {\n this._flash.callFlashMethod('getAdCompanions', [], callback);\n }\n getAdIcons(callback) {\n this._flash.callFlashMethod('getAdIcons', [], callback);\n }\n}\n\n","'use strict';\n\nconst JSFlashBridge = require('./jsFlashBridge').JSFlashBridge;\nconst VPAIDAdUnit = require('./VPAIDAdUnit').VPAIDAdUnit;\n\nconst noop = require('./utils').noop;\nconst callbackTimeout = require('./utils').callbackTimeout;\nconst isPositiveInt = require('./utils').isPositiveInt;\nconst createElementWithID = require('./utils').createElementWithID;\nconst uniqueVPAID = require('./utils').unique('vpaid');\nconst createFlashTester = require('./flashTester.js').createFlashTester;\n\nconst ERROR = 'error';\nconst FLASH_VERSION = '10.1.0';\n\nlet flashTester = {isSupported: ()=> true}; // if the runFlashTest is not run the flashTester will always return true\n\nclass VPAIDFLASHClient {\n constructor (vpaidParentEl, callback, swfConfig = {data: 'VPAIDFlash.swf', width: 800, height: 400}, params = { wmode: 'transparent', salign: 'tl', align: 'left', allowScriptAccess: 'always', scale: 'noScale', allowFullScreen: 'true', quality: 'high'}, vpaidOptions = { debug: false, timeout: 10000 }) {\n\n if (!VPAIDFLASHClient.hasExternalDependencies()) {\n return onError('no swfobject in global scope. check: https://github.com/swfobject/swfobject or https://code.google.com/p/swfobject/');\n }\n\n this._vpaidParentEl = vpaidParentEl;\n this._flashID = uniqueVPAID();\n this._destroyed = false;\n callback = callback || noop;\n\n swfConfig.width = isPositiveInt(swfConfig.width, 800);\n swfConfig.height = isPositiveInt(swfConfig.height, 400);\n\n createElementWithID(vpaidParentEl, this._flashID, true);\n\n params.movie = swfConfig.data;\n params.FlashVars = `flashid=${this._flashID}&handler=${JSFlashBridge.VPAID_FLASH_HANDLER}&debug=${vpaidOptions.debug}&salign=${params.salign}`;\n\n if (!VPAIDFLASHClient.isSupported()) {\n return onError('user don\\'t support flash or doesn\\'t have the minimum required version of flash ' + FLASH_VERSION);\n }\n\n this.el = swfobject.createSWF(swfConfig, params, this._flashID);\n\n if (!this.el) {\n return onError( 'swfobject failed to create object in element' );\n }\n\n var handler = callbackTimeout(vpaidOptions.timeout,\n (err, data) => {\n $loadPendedAdUnit.call(this);\n callback(err, data);\n }, () => {\n callback('vpaid flash load timeout ' + vpaidOptions.timeout);\n }\n );\n\n this._flash = new JSFlashBridge(this.el, swfConfig.data, this._flashID, swfConfig.width, swfConfig.height, handler);\n\n function onError(error) {\n setTimeout(() => {\n callback(new Error(error));\n }, 0);\n return this;\n }\n\n }\n\n destroy () {\n this._destroyAdUnit();\n\n if (this._flash) {\n this._flash.destroy();\n this._flash = null;\n }\n this.el = null;\n this._destroyed = true;\n }\n\n isDestroyed () {\n return this._destroyed;\n }\n\n _destroyAdUnit() {\n delete this._loadLater;\n\n if (this._adUnitLoad) {\n this._adUnitLoad = null;\n this._flash.removeCallback(this._adUnitLoad);\n }\n\n if (this._adUnit) {\n this._adUnit._destroy();\n this._adUnit = null;\n }\n }\n\n loadAdUnit(adURL, callback) {\n $throwIfDestroyed.call(this);\n\n if (this._adUnit) {\n this._destroyAdUnit();\n }\n\n if (this._flash.isReady()) {\n this._adUnitLoad = (err, message) => {\n if (!err) {\n this._adUnit = new VPAIDAdUnit(this._flash);\n }\n this._adUnitLoad = null;\n callback(err, this._adUnit);\n };\n\n this._flash.callFlashMethod('loadAdUnit', [adURL], this._adUnitLoad);\n }else {\n this._loadLater = {url: adURL, callback};\n }\n }\n\n unloadAdUnit(callback = undefined) {\n $throwIfDestroyed.call(this);\n\n this._destroyAdUnit();\n this._flash.callFlashMethod('unloadAdUnit', [], callback);\n }\n getFlashID() {\n $throwIfDestroyed.call(this);\n return this._flash.getFlashID();\n }\n getFlashURL() {\n $throwIfDestroyed.call(this);\n return this._flash.getFlashURL();\n }\n}\n\nsetStaticProperty('isSupported', () => {\n return VPAIDFLASHClient.hasExternalDependencies() && swfobject.hasFlashPlayerVersion(FLASH_VERSION) && flashTester.isSupported();\n}, true);\n\nsetStaticProperty('hasExternalDependencies', () => {\n return !!window.swfobject;\n});\n\nsetStaticProperty('runFlashTest', (swfConfig) => {\n flashTester = createFlashTester(document.body, swfConfig);\n});\n\nfunction $throwIfDestroyed() {\n if(this._destroyed) {\n throw new Error('VPAIDFlashToJS is destroyed!');\n }\n}\n\nfunction $loadPendedAdUnit() {\n if (this._loadLater) {\n this.loadAdUnit(this._loadLater.url, this._loadLater.callback);\n delete this._loadLater;\n }\n}\n\nfunction setStaticProperty(propertyName, value, writable = false) {\n Object.defineProperty(VPAIDFLASHClient, propertyName, {\n writable: writable,\n configurable: false,\n value: value\n });\n}\n\nmodule.exports = VPAIDFLASHClient;\n","'use strict';\n\nconst FLASH_TEST = 'vpaid_video_flash_tester';\nconst FLASH_TEST_EL = 'vpaid_video_flash_tester_el';\nconst JSFlashBridge = require('./jsFlashBridge').JSFlashBridge;\nconst utils = require('./utils');\nconst MultipleValuesRegistry = require('./registry').MultipleValuesRegistry;\n\nclass FlashTester {\n constructor(parent, swfConfig = {data: 'VPAIDFlash.swf', width: 800, height: 400}) {\n this.parentEl = utils.createElementWithID(parent, FLASH_TEST_EL); // some browsers create global variables using the element id http://stackoverflow.com/questions/3434278/do-dom-tree-elements-with-ids-become-global-variables\n utils.hideFlashEl(this.parentEl);\n var params = {};\n params.movie = swfConfig.data;\n params.FlashVars = `flashid=${FLASH_TEST_EL}&handler=${JSFlashBridge.VPAID_FLASH_HANDLER}`;\n\n this.el = swfobject.createSWF(swfConfig, params, FLASH_TEST_EL);\n this._handlers = new MultipleValuesRegistry();\n this._isSupported = false;\n if (this.el) {\n utils.hideFlashEl(this.el);\n this._flash = new JSFlashBridge(this.el, swfConfig.data, FLASH_TEST_EL, 400, 400, ()=> {\n const support = true;\n this._isSupported = support;\n this._handlers.get('change').forEach((callback) => {\n setTimeout(()=> {\n callback('change', support);\n }, 0);\n });\n });\n }\n }\n isSupported() {\n return this._isSupported;\n }\n on(eventName, callback) {\n this._handlers.add(eventName, callback);\n }\n}\n\nexport var createFlashTester = function createFlashTester(el, swfConfig) {\n if (!window[FLASH_TEST]) {\n window[FLASH_TEST] = new FlashTester(el, swfConfig);\n }\n return window[FLASH_TEST];\n};\n","'use strict';\n\nlet unique = require('./utils').unique;\nlet isPositiveInt = require('./utils').isPositiveInt;\nlet stringEndsWith = require('./utils').stringEndsWith;\nlet SingleValueRegistry = require('./registry').SingleValueRegistry;\nlet MultipleValuesRegistry = require('./registry').MultipleValuesRegistry;\nconst registry = require('./jsFlashBridgeRegistry');\nconst VPAID_FLASH_HANDLER = 'vpaid_video_flash_handler';\nconst ERROR = 'AdError';\n\nexport class JSFlashBridge {\n constructor (el, flashURL, flashID, width, height, loadHandShake) {\n this._el = el;\n this._flashID = flashID;\n this._flashURL = flashURL;\n this._width = width;\n this._height = height;\n this._handlers = new MultipleValuesRegistry();\n this._callbacks = new SingleValueRegistry();\n this._uniqueMethodIdentifier = unique(this._flashID);\n this._ready = false;\n this._handShakeHandler = loadHandShake;\n\n registry.addInstance(this._flashID, this);\n }\n\n on(eventName, callback) {\n this._handlers.add(eventName, callback);\n }\n\n off(eventName, callback) {\n return this._handlers.remove(eventName, callback);\n }\n\n offEvent(eventName) {\n return this._handlers.removeByKey(eventName);\n }\n\n offAll() {\n return this._handlers.removeAll();\n }\n\n callFlashMethod(methodName, args = [], callback = undefined) {\n var callbackID = '';\n // if no callback, some methods the return is void so they don't need callback\n if (callback) {\n callbackID = `${this._uniqueMethodIdentifier()}_${methodName}`;\n this._callbacks.add(callbackID, callback);\n }\n\n\n try {\n //methods are created by ExternalInterface.addCallback in as3 code, if for some reason it failed\n //this code will throw an error\n this._el[methodName]([callbackID].concat(args));\n\n } catch (e) {\n if (callback) {\n $asyncCallback.call(this, callbackID, e);\n } else {\n\n //if there isn't any callback to return error use error event handler\n this._trigger(ERROR, e);\n }\n }\n }\n\n removeCallback(callback) {\n return this._callbacks.removeByValue(callback);\n }\n\n removeCallbackByMethodName(suffix) {\n this._callbacks.filterKeys((key) => {\n return stringEndsWith(key, suffix);\n }).forEach((key) => {\n this._callbacks.remove(key);\n });\n }\n\n removeAllCallbacks() {\n return this._callbacks.removeAll();\n }\n\n _trigger(eventName, event) {\n this._handlers.get(eventName).forEach((callback) => {\n //clickThru has to be sync, if not will be block by the popupblocker\n if (eventName === 'AdClickThru') {\n callback(event);\n } else {\n setTimeout(() => {\n if (this._handlers.get(eventName).length > 0) {\n callback(event);\n }\n }, 0);\n }\n });\n }\n\n _callCallback(methodName, callbackID, err, result) {\n\n let callback = this._callbacks.get(callbackID);\n\n //not all methods callback's are mandatory\n //but if there exist an error, fire the error event\n if (!callback) {\n if (err && callbackID === '') {\n this.trigger(ERROR, err);\n }\n return;\n }\n\n $asyncCallback.call(this, callbackID, err, result);\n\n }\n\n _handShake(err, data) {\n this._ready = true;\n if (this._handShakeHandler) {\n this._handShakeHandler(err, data);\n delete this._handShakeHandler;\n }\n }\n\n //methods like properties specific to this implementation of VPAID\n getSize() {\n return {width: this._width, height: this._height};\n }\n setSize(newWidth, newHeight) {\n this._width = isPositiveInt(newWidth, this._width);\n this._height = isPositiveInt(newHeight, this._height);\n this._el.setAttribute('width', this._width);\n this._el.setAttribute('height', this._height);\n }\n getWidth() {\n return this._width;\n }\n setWidth(newWidth) {\n this.setSize(newWidth, this._height);\n }\n getHeight() {\n return this._height;\n }\n setHeight(newHeight) {\n this.setSize(this._width, newHeight);\n }\n getFlashID() {\n return this._flashID;\n }\n getFlashURL() {\n return this._flashURL;\n }\n isReady() {\n return this._ready;\n }\n destroy() {\n this.offAll();\n this.removeAllCallbacks();\n registry.removeInstanceByID(this._flashID);\n if (this._el.parentElement) {\n this._el.parentElement.removeChild(this._el);\n }\n }\n}\n\nfunction $asyncCallback(callbackID, err, result) {\n setTimeout(() => {\n let callback = this._callbacks.get(callbackID);\n if (callback) {\n this._callbacks.remove(callbackID);\n callback(err, result);\n }\n }, 0);\n}\n\nObject.defineProperty(JSFlashBridge, 'VPAID_FLASH_HANDLER', {\n writable: false,\n configurable: false,\n value: VPAID_FLASH_HANDLER\n});\n\n/**\n * External interface handler\n *\n * @param {string} flashID identifier of the flash who call this\n * @param {string} typeID what type of message is, can be 'event' or 'callback'\n * @param {string} typeName if the typeID is a event the typeName will be the eventName, if is a callback the typeID is the methodName that is related this callback\n * @param {string} callbackID only applies when the typeID is 'callback', identifier of the callback to call\n * @param {object} error error object\n * @param {object} data\n */\nwindow[VPAID_FLASH_HANDLER] = (flashID, typeID, typeName, callbackID, error, data) => {\n let instance = registry.getInstanceByID(flashID);\n if (!instance) return;\n if (typeName === 'handShake') {\n instance._handShake(error, data);\n } else {\n if (typeID !== 'event') {\n instance._callCallback(typeName, callbackID, error, data);\n } else {\n instance._trigger(typeName, data);\n }\n }\n};\n\n","'use strict';\n\nlet SingleValueRegistry = require('./registry').SingleValueRegistry;\nlet instances = new SingleValueRegistry();\n\nconst JSFlashBridgeRegistry = {};\nObject.defineProperty(JSFlashBridgeRegistry, 'addInstance', {\n writable: false,\n configurable: false,\n value: function (id, instance) {\n instances.add(id, instance);\n }\n});\n\nObject.defineProperty(JSFlashBridgeRegistry, 'getInstanceByID', {\n writable: false,\n configurable: false,\n value: function (id) {\n return instances.get(id);\n }\n});\n\nObject.defineProperty(JSFlashBridgeRegistry, 'removeInstanceByID', {\n writable: false,\n configurable: false,\n value: function (id) {\n return instances.remove(id);\n }\n});\n\nmodule.exports = JSFlashBridgeRegistry;\n\n","'use strict';\n\nexport class MultipleValuesRegistry {\n constructor () {\n this._registries = {};\n }\n add (id, value) {\n if (!this._registries[id]) {\n this._registries[id] = [];\n }\n if (this._registries[id].indexOf(value) === -1) {\n this._registries[id].push(value);\n }\n }\n get (id) {\n return this._registries[id] || [];\n }\n filterKeys (handler) {\n return Object.keys(this._registries).filter(handler);\n }\n findByValue (value) {\n var keys = Object.keys(this._registries).filter((key) => {\n return this._registries[key].indexOf(value) !== -1;\n });\n\n return keys;\n }\n remove(key, value) {\n if (!this._registries[key]) { return; }\n\n var index = this._registries[key].indexOf(value);\n\n if (index < 0) { return; }\n return this._registries[key].splice(index, 1);\n }\n removeByKey (id) {\n let old = this._registries[id];\n delete this._registries[id];\n return old;\n }\n removeByValue (value) {\n let keys = this.findByValue(value);\n return keys.map((key) => {\n return this.remove(key, value);\n });\n }\n removeAll() {\n let old = this._registries;\n this._registries = {};\n return old;\n }\n size() {\n return Object.keys(this._registries).length;\n }\n}\n\nexport class SingleValueRegistry {\n constructor () {\n this._registries = {};\n }\n add (id, value) {\n this._registries[id] = value;\n }\n get (id) {\n return this._registries[id];\n }\n filterKeys (handler) {\n return Object.keys(this._registries).filter(handler);\n }\n findByValue (value) {\n var keys = Object.keys(this._registries).filter((key) => {\n return this._registries[key] === value;\n });\n\n return keys;\n }\n remove (id) {\n let old = this._registries[id];\n delete this._registries[id];\n return old;\n }\n removeByValue (value) {\n let keys = this.findByValue(value);\n return keys.map((key) => {\n return this.remove(key);\n });\n }\n removeAll() {\n let old = this._registries;\n this._registries = {};\n return old;\n }\n size() {\n return Object.keys(this._registries).length;\n }\n}\n\n","'use strict';\n\nexport function unique(prefix) {\n let count = -1;\n return f => {\n return `${prefix}_${++count}`;\n };\n}\n\nexport function noop() {\n}\n\n\nexport function callbackTimeout(timer, onSuccess, onTimeout) {\n\n let timeout = setTimeout(() => {\n\n onSuccess = noop;\n onTimeout();\n\n }, timer);\n\n return function () {\n clearTimeout(timeout);\n onSuccess.apply(this, arguments);\n };\n}\n\n\nexport function createElementWithID(parent, id, cleanContent = false) {\n var nEl = document.createElement('div');\n nEl.id = id;\n if (cleanContent) {\n parent.innerHTML = '';\n }\n parent.appendChild(nEl);\n return nEl;\n}\n\nexport function isPositiveInt(newVal, oldVal) {\n return !isNaN(parseFloat(newVal)) && isFinite(newVal) && newVal > 0 ? newVal : oldVal;\n}\n\nlet endsWith = (function () {\n if (String.prototype.endsWith) return String.prototype.endsWith;\n return function endsWith (searchString, position) {\n var subjectString = this.toString();\n if (position === undefined || position > subjectString.length) {\n position = subjectString.length;\n }\n position -= searchString.length;\n var lastIndex = subjectString.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n };\n})();\n\nexport function stringEndsWith(string, search) {\n return endsWith.call(string, search);\n}\n\nexport function hideFlashEl(el) {\n // can't use display none or visibility none because will block flash in some browsers\n el.style.position = 'absolute';\n el.style.left = '-1px';\n el.style.top = '-1px';\n el.style.width = '1px';\n el.style.height = '1px';\n}\n","'use strict';\n\nvar METHODS = [\n 'handshakeVersion',\n 'initAd',\n 'startAd',\n 'stopAd',\n 'skipAd', // VPAID 2.0 new method\n 'resizeAd',\n 'pauseAd',\n 'resumeAd',\n 'expandAd',\n 'collapseAd',\n 'subscribe',\n 'unsubscribe'\n];\n\nvar EVENTS = [\n 'AdLoaded',\n 'AdStarted',\n 'AdStopped',\n 'AdSkipped',\n 'AdSkippableStateChange', // VPAID 2.0 new event\n 'AdSizeChange', // VPAID 2.0 new event\n 'AdLinearChange',\n 'AdDurationChange', // VPAID 2.0 new event\n 'AdExpandedChange',\n 'AdRemainingTimeChange', // [Deprecated in 2.0] but will be still fired for backwards compatibility\n 'AdVolumeChange',\n 'AdImpression',\n 'AdVideoStart',\n 'AdVideoFirstQuartile',\n 'AdVideoMidpoint',\n 'AdVideoThirdQuartile',\n 'AdVideoComplete',\n 'AdClickThru',\n 'AdInteraction', // VPAID 2.0 new event\n 'AdUserAcceptInvitation',\n 'AdUserMinimize',\n 'AdUserClose',\n 'AdPaused',\n 'AdPlaying',\n 'AdLog',\n 'AdError'\n];\n\nvar GETTERS = [\n 'getAdLinear',\n 'getAdWidth', // VPAID 2.0 new getter\n 'getAdHeight', // VPAID 2.0 new getter\n 'getAdExpanded',\n 'getAdSkippableState', // VPAID 2.0 new getter\n 'getAdRemainingTime',\n 'getAdDuration', // VPAID 2.0 new getter\n 'getAdVolume',\n 'getAdCompanions', // VPAID 2.0 new getter\n 'getAdIcons' // VPAID 2.0 new getter\n];\n\nvar SETTERS = [\n 'setAdVolume'\n];\n\n\n/**\n * This callback is displayed as global member. The callback use nodejs error-first callback style\n * @callback NodeStyleCallback\n * @param {string|null}\n * @param {undefined|object}\n */\n\n\n/**\n * IVPAIDAdUnit\n *\n * @class\n *\n * @param {object} creative\n * @param {HTMLElement} el\n * @param {HTMLVideoElement} video\n */\nfunction IVPAIDAdUnit(creative, el, video) {}\n\n\n/**\n * handshakeVersion\n *\n * @param {string} VPAIDVersion\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.handshakeVersion = function (VPAIDVersion, callback) {};\n\n/**\n * initAd\n *\n * @param {number} width\n * @param {number} height\n * @param {string} viewMode can be 'normal', 'thumbnail' or 'fullscreen'\n * @param {number} desiredBitrate indicates the desired bitrate in kbps\n * @param {object} [creativeData] used for additional initialization data\n * @param {object} [environmentVars] used for passing implementation-specific of js version\n * @param {NodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.initAd = function(width, height, viewMode, desiredBitrate, creativeData, environmentVars, callback) {};\n\n/**\n * startAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.startAd = function(callback) {};\n\n/**\n * stopAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.stopAd = function(callback) {};\n\n/**\n * skipAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.skipAd = function(callback) {};\n\n/**\n * resizeAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.resizeAd = function(width, height, viewMode, callback) {};\n\n/**\n * pauseAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.pauseAd = function(callback) {};\n\n/**\n * resumeAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.resumeAd = function(callback) {};\n\n/**\n * expandAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.expandAd = function(callback) {};\n\n/**\n * collapseAd\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.collapseAd = function(callback) {};\n\n/**\n * subscribe\n *\n * @param {string} event\n * @param {nodeStyleCallback} handler\n * @param {object} context\n */\nIVPAIDAdUnit.prototype.subscribe = function(event, handler, context) {};\n\n/**\n * startAd\n *\n * @param {string} event\n * @param {function} handler\n */\nIVPAIDAdUnit.prototype.unsubscribe = function(event, handler) {};\n\n\n\n/**\n * getAdLinear\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdLinear = function(callback) {};\n\n/**\n * getAdWidth\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdWidth = function(callback) {};\n\n/**\n * getAdHeight\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdHeight = function(callback) {};\n\n/**\n * getAdExpanded\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdExpanded = function(callback) {};\n\n/**\n * getAdSkippableState\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdSkippableState = function(callback) {};\n\n/**\n * getAdRemainingTime\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdRemainingTime = function(callback) {};\n\n/**\n * getAdDuration\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdDuration = function(callback) {};\n\n/**\n * getAdVolume\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdVolume = function(callback) {};\n\n/**\n * getAdCompanions\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdCompanions = function(callback) {};\n\n/**\n * getAdIcons\n *\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.getAdIcons = function(callback) {};\n\n/**\n * setAdVolume\n *\n * @param {number} volume\n * @param {nodeStyleCallback} callback\n */\nIVPAIDAdUnit.prototype.setAdVolume = function(volume, callback) {};\n\naddStaticToInterface(IVPAIDAdUnit, 'METHODS', METHODS);\naddStaticToInterface(IVPAIDAdUnit, 'GETTERS', GETTERS);\naddStaticToInterface(IVPAIDAdUnit, 'SETTERS', SETTERS);\naddStaticToInterface(IVPAIDAdUnit, 'EVENTS', EVENTS);\n\n\nvar VPAID1_METHODS = METHODS.filter(function(method) {\n return ['skipAd'].indexOf(method) === -1;\n});\n\naddStaticToInterface(IVPAIDAdUnit, 'checkVPAIDInterface', function checkVPAIDInterface (creative) {\n var result = VPAID1_METHODS.every(function(key) {\n return typeof creative[key] === 'function';\n });\n return result;\n});\n\nmodule.exports = IVPAIDAdUnit;\n\nfunction addStaticToInterface(Interface, name, value) {\n Object.defineProperty(Interface, name, {\n writable: false,\n configurable: false,\n value: value\n });\n}\n\n","'use strict';\n\nvar IVPAIDAdUnit = require('./IVPAIDAdUnit');\nvar Subscriber = require('./subscriber');\nvar checkVPAIDInterface = IVPAIDAdUnit.checkVPAIDInterface;\nvar utils = require('./utils');\nvar METHODS = IVPAIDAdUnit.METHODS;\nvar ERROR = 'AdError';\nvar AD_CLICK = 'AdClickThru';\nvar FILTERED_EVENTS = IVPAIDAdUnit.EVENTS.filter(function (event) {\n return event != AD_CLICK;\n});\n\n/**\n * This callback is displayed as global member. The callback use nodejs error-first callback style\n * @callback NodeStyleCallback\n * @param {string|null}\n * @param {undefined|object}\n */\n\n\n/**\n * VPAIDAdUnit\n * @class\n *\n * @param VPAIDCreative\n * @param {HTMLElement} [el] this will be used in initAd environmentVars.slot if defined\n * @param {HTMLVideoElement} [video] this will be used in initAd environmentVars.videoSlot if defined\n */\nfunction VPAIDAdUnit(VPAIDCreative, el, video, iframe) {\n this._isValid = checkVPAIDInterface(VPAIDCreative);\n if (this._isValid) {\n this._creative = VPAIDCreative;\n this._el = el;\n this._videoEl = video;\n this._iframe = iframe;\n this._subscribers = new Subscriber();\n $addEventsSubscribers.call(this);\n }\n}\n\nVPAIDAdUnit.prototype = Object.create(IVPAIDAdUnit.prototype);\n\n/**\n * isValidVPAIDAd will return if the VPAIDCreative passed in constructor is valid or not\n *\n * @return {boolean}\n */\nVPAIDAdUnit.prototype.isValidVPAIDAd = function isValidVPAIDAd() {\n return this._isValid;\n};\n\nIVPAIDAdUnit.METHODS.forEach(function(method) {\n //NOTE: this methods arguments order are implemented differently from the spec\n var ignores = [\n 'subscribe',\n 'unsubscribe',\n 'initAd'\n ];\n\n if (ignores.indexOf(method) !== -1) return;\n\n VPAIDAdUnit.prototype[method] = function () {\n var ariaty = IVPAIDAdUnit.prototype[method].length;\n // TODO avoid leaking arguments\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n var args = Array.prototype.slice.call(arguments);\n var callback = (ariaty === args.length) ? args.pop() : undefined;\n\n setTimeout(function () {\n var result, error = null;\n try {\n result = this._creative[method].apply(this._creative, args);\n } catch(e) {\n error = e;\n }\n\n callOrTriggerEvent(callback, this._subscribers, error, result);\n }.bind(this), 0);\n };\n});\n\n\n/**\n * initAd concreate implementation\n *\n * @param {number} width\n * @param {number} height\n * @param {string} viewMode can be 'normal', 'thumbnail' or 'fullscreen'\n * @param {number} desiredBitrate indicates the desired bitrate in kbps\n * @param {object} [creativeData] used for additional initialization data\n * @param {object} [environmentVars] used for passing implementation-specific of js version, if el & video was used in constructor slot & videoSlot will be added to the object\n * @param {NodeStyleCallback} callback\n */\nVPAIDAdUnit.prototype.initAd = function initAd(width, height, viewMode, desiredBitrate, creativeData, environmentVars, callback) {\n creativeData = creativeData || {};\n environmentVars = utils.extend({\n slot: this._el,\n videoSlot: this._videoEl\n }, environmentVars || {});\n\n setTimeout(function () {\n var error;\n try {\n this._creative.initAd(width, height, viewMode, desiredBitrate, creativeData, environmentVars);\n } catch (e) {\n error = e;\n }\n\n callOrTriggerEvent(callback, this._subscribers, error);\n }.bind(this), 0);\n};\n\n/**\n * subscribe\n *\n * @param {string} event\n * @param {nodeStyleCallback} handler\n * @param {object} context\n */\nVPAIDAdUnit.prototype.subscribe = function subscribe(event, handler, context) {\n this._subscribers.subscribe(handler, event, context);\n};\n\n\n/**\n * unsubscribe\n *\n * @param {string} event\n * @param {nodeStyleCallback} handler\n */\nVPAIDAdUnit.prototype.unsubscribe = function unsubscribe(event, handler) {\n this._subscribers.unsubscribe(handler, event);\n};\n\n//alias\nVPAIDAdUnit.prototype.on = VPAIDAdUnit.prototype.subscribe;\nVPAIDAdUnit.prototype.off = VPAIDAdUnit.prototype.unsubscribe;\n\nIVPAIDAdUnit.GETTERS.forEach(function(getter) {\n VPAIDAdUnit.prototype[getter] = function (callback) {\n setTimeout(function () {\n\n var result, error = null;\n try {\n result = this._creative[getter]();\n } catch(e) {\n error = e;\n }\n\n callOrTriggerEvent(callback, this._subscribers, error, result);\n }.bind(this), 0);\n };\n});\n\n/**\n * setAdVolume\n *\n * @param volume\n * @param {nodeStyleCallback} callback\n */\nVPAIDAdUnit.prototype.setAdVolume = function setAdVolume(volume, callback) {\n setTimeout(function () {\n\n var result, error = null;\n try {\n this._creative.setAdVolume(volume);\n result = this._creative.getAdVolume();\n } catch(e) {\n error = e;\n }\n\n if (!error) {\n error = utils.validate(result === volume, 'failed to apply volume: ' + volume);\n }\n callOrTriggerEvent(callback, this._subscribers, error, result);\n }.bind(this), 0);\n};\n\nVPAIDAdUnit.prototype._destroy = function destroy() {\n this.stopAd();\n this._subscribers.unsubscribeAll();\n};\n\nfunction $addEventsSubscribers() {\n // some ads implement\n // so they only handle one subscriber\n // to handle this we create our one\n FILTERED_EVENTS.forEach(function (event) {\n this._creative.subscribe($trigger.bind(this, event), event);\n }.bind(this));\n\n // map the click event to be an object instead of depending of the order of the arguments\n // and to be consistent with the flash\n this._creative.subscribe($clickThruHook.bind(this), AD_CLICK);\n\n // because we are adding the element inside the iframe\n // the user is not able to click in the video\n if (this._videoEl) {\n var documentElement = this._iframe.contentDocument.documentElement;\n var videoEl = this._videoEl;\n documentElement.addEventListener('click', function(e) {\n if (e.target === documentElement) {\n videoEl.click();\n }\n });\n }\n}\n\nfunction $clickThruHook(url, id, playerHandles) {\n this._subscribers.triggerSync(AD_CLICK, {url: url, id: id, playerHandles: playerHandles});\n}\n\nfunction $trigger(event) {\n // TODO avoid leaking arguments\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n this._subscribers.trigger(event, Array.prototype.slice(arguments, 1));\n}\n\nfunction callOrTriggerEvent(callback, subscribers, error, result) {\n if (callback) {\n callback(error, result);\n } else if (error) {\n subscribers.trigger(ERROR, error);\n }\n}\n\nmodule.exports = VPAIDAdUnit;\n\n","'use strict';\n\nvar utils = require('./utils');\nvar unique = utils.unique('vpaidIframe');\nvar VPAIDAdUnit = require('./VPAIDAdUnit');\n\nvar defaultTemplate = '' +\n '' +\n '' +\n '
' +\n '' +\n '' +\n '' +\n '';\n\nvar AD_STOPPED = 'AdStopped';\n\n/**\n * This callback is displayed as global member. The callback use nodejs error-first callback style\n * @callback NodeStyleCallback\n * @param {string|null}\n * @param {undefined|object}\n */\n\n/**\n * VPAIDHTML5Client\n * @class\n *\n * @param {HTMLElement} el that will contain the iframe to load adUnit and a el to add to adUnit slot\n * @param {HTMLVideoElement} video default video element to be used by adUnit\n * @param {object} [templateConfig] template: html template to be used instead of the default, extraOptions: to be used when rendering the template\n * @param {object} [vpaidOptions] timeout: when loading adUnit\n */\nfunction VPAIDHTML5Client(el, video, templateConfig, vpaidOptions) {\n templateConfig = templateConfig || {};\n\n this._id = unique();\n this._destroyed = false;\n\n this._frameContainer = utils.createElementInEl(el, 'div');\n this._videoEl = video;\n this._vpaidOptions = vpaidOptions || {timeout: 10000};\n\n this._templateConfig = {\n template: templateConfig.template || defaultTemplate,\n extraOptions: templateConfig.extraOptions || {}\n };\n}\n\n/**\n * destroy\n *\n */\nVPAIDHTML5Client.prototype.destroy = function destroy() {\n if (this._destroyed) {\n return;\n }\n this._destroyed = true;\n $unloadPreviousAdUnit.call(this);\n};\n\n/**\n * isDestroyed\n *\n * @return {boolean}\n */\nVPAIDHTML5Client.prototype.isDestroyed = function isDestroyed() {\n return this._destroyed;\n};\n\n/**\n * loadAdUnit\n *\n * @param {string} adURL url of the js of the adUnit\n * @param {nodeStyleCallback} callback\n */\nVPAIDHTML5Client.prototype.loadAdUnit = function loadAdUnit(adURL, callback) {\n $throwIfDestroyed.call(this);\n $unloadPreviousAdUnit.call(this);\n var that = this;\n\n var frame = utils.createIframeWithContent(\n this._frameContainer,\n this._templateConfig.template,\n utils.extend({\n iframeURL_JS: adURL,\n iframeID: this.getID(),\n origin: getOrigin()\n }, this._templateConfig.extraOptions)\n );\n\n this._frame = frame;\n\n this._onLoad = utils.callbackTimeout(\n this._vpaidOptions.timeout,\n onLoad.bind(this),\n onTimeout.bind(this)\n );\n\n window.addEventListener('message', this._onLoad);\n\n function onLoad (e) {\n /*jshint validthis: false */\n //don't clear timeout\n if (e.origin !== getOrigin()) return;\n var result = JSON.parse(e.data);\n\n //don't clear timeout\n if (result.id !== that.getID()) return;\n\n var adUnit, error, createAd;\n if (!that._frame.contentWindow) {\n\n error = 'the iframe is not anymore in the DOM tree';\n\n } else {\n createAd = that._frame.contentWindow.getVPAIDAd;\n error = utils.validate(typeof createAd === 'function', 'the ad didn\\'t return a function to create an ad');\n }\n\n if (!error) {\n var adEl = that._frame.contentWindow.document.querySelector('.ad-element');\n adUnit = new VPAIDAdUnit(createAd(), adEl, that._videoEl, that._frame);\n adUnit.subscribe(AD_STOPPED, $adDestroyed.bind(that));\n error = utils.validate(adUnit.isValidVPAIDAd(), 'the add is not fully complaint with VPAID specification');\n }\n\n that._adUnit = adUnit;\n $destroyLoadListener.call(that);\n callback(error, error ? null : adUnit);\n\n //clear timeout\n return true;\n }\n\n function onTimeout() {\n callback('timeout', null);\n }\n};\n\n/**\n * unloadAdUnit\n *\n */\nVPAIDHTML5Client.prototype.unloadAdUnit = function unloadAdUnit() {\n $unloadPreviousAdUnit.call(this);\n};\n\n/**\n * getID will return the unique id\n *\n * @return {string}\n */\nVPAIDHTML5Client.prototype.getID = function () {\n return this._id;\n};\n\n\n/**\n * $removeEl\n *\n * @param {string} key\n */\nfunction $removeEl(key) {\n var el = this[key];\n if (el) {\n el.remove();\n delete this[key];\n }\n}\n\nfunction $adDestroyed() {\n $removeAdElements.call(this);\n delete this._adUnit;\n}\n\nfunction $unloadPreviousAdUnit() {\n $removeAdElements.call(this);\n $destroyAdUnit.call(this);\n}\n\nfunction $removeAdElements() {\n $removeEl.call(this, '_frame');\n $destroyLoadListener.call(this);\n}\n\n/**\n * $destroyLoadListener\n *\n */\nfunction $destroyLoadListener() {\n if (this._onLoad) {\n window.removeEventListener('message', this._onLoad);\n utils.clearCallbackTimeout(this._onLoad);\n delete this._onLoad;\n }\n}\n\n\nfunction $destroyAdUnit() {\n if (this._adUnit) {\n this._adUnit.stopAd();\n delete this._adUnit;\n }\n}\n\n/**\n * $throwIfDestroyed\n *\n */\nfunction $throwIfDestroyed() {\n if (this._destroyed) {\n throw new Error ('VPAIDHTML5Client already destroyed!');\n }\n}\n\nfunction getOrigin() {\n if( window.location.origin ) {\n return window.location.origin;\n }\n else {\n return window.location.protocol + \"//\" +\n window.location.hostname +\n (window.location.port ? ':' + window.location.port: '');\n }\n}\n\nmodule.exports = VPAIDHTML5Client;\nwindow.VPAIDHTML5Client = VPAIDHTML5Client;\n\n","'use strict';\n\nfunction Subscriber() {\n this._subscribers = {};\n}\n\nSubscriber.prototype.subscribe = function subscribe(handler, eventName, context) {\n if (!this.isHandlerAttached(handler, eventName)) {\n this.get(eventName).push({handler: handler, context: context, eventName: eventName});\n }\n};\n\nSubscriber.prototype.unsubscribe = function unsubscribe(handler, eventName) {\n this._subscribers[eventName] = this.get(eventName).filter(function (subscriber) {\n return handler !== subscriber.handler;\n });\n};\n\nSubscriber.prototype.unsubscribeAll = function unsubscribeAll() {\n this._subscribers = {};\n};\n\nSubscriber.prototype.trigger = function(eventName, data) {\n var that = this;\n var subscribers = this.get(eventName)\n .concat(this.get('*'));\n\n subscribers.forEach(function (subscriber) {\n setTimeout(function () {\n if (that.isHandlerAttached(subscriber.handler, subscriber.eventName)) {\n subscriber.handler.call(subscriber.context, data);\n }\n }, 0);\n });\n};\n\nSubscriber.prototype.triggerSync = function(eventName, data) {\n var subscribers = this.get(eventName)\n .concat(this.get('*'));\n\n subscribers.forEach(function (subscriber) {\n subscriber.handler.call(subscriber.context, data);\n });\n};\n\nSubscriber.prototype.get = function get(eventName) {\n if (!this._subscribers[eventName]) {\n this._subscribers[eventName] = [];\n }\n return this._subscribers[eventName];\n};\n\nSubscriber.prototype.isHandlerAttached = function isHandlerAttached(handler, eventName) {\n return this.get(eventName).some(function(subscriber) {\n return handler === subscriber.handler;\n })\n};\n\nmodule.exports = Subscriber;\n\n","'use strict';\n\n/**\n * noop a empty function\n */\nfunction noop() {}\n\n/**\n * validate if is not validate will return an Error with the message\n *\n * @param {boolean} isValid\n * @param {string} message\n */\nfunction validate(isValid, message) {\n return isValid ? null : new Error(message);\n}\n\nvar timeouts = {};\n/**\n * clearCallbackTimeout\n *\n * @param {function} func handler to remove\n */\nfunction clearCallbackTimeout(func) {\n var timeout = timeouts[func];\n if (timeout) {\n clearTimeout(timeout);\n delete timeouts[func];\n }\n}\n\n/**\n * callbackTimeout if the onSuccess is not called and returns true in the timelimit then onTimeout will be called\n *\n * @param {number} timer\n * @param {function} onSuccess\n * @param {function} onTimeout\n */\nfunction callbackTimeout(timer, onSuccess, onTimeout) {\n var callback, timeout;\n\n timeout = setTimeout(function () {\n onSuccess = noop;\n delete timeout[callback];\n onTimeout();\n }, timer);\n\n callback = function () {\n // TODO avoid leaking arguments\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n if (onSuccess.apply(this, arguments)) {\n clearCallbackTimeout(callback);\n }\n };\n\n timeouts[callback] = timeout;\n\n return callback;\n}\n\n\n/**\n * createElementInEl\n *\n * @param {HTMLElement} parent\n * @param {string} tagName\n * @param {string} id\n */\nfunction createElementInEl(parent, tagName, id) {\n var nEl = document.createElement(tagName);\n if (id) nEl.id = id;\n parent.appendChild(nEl);\n return nEl;\n}\n\n/**\n * createIframeWithContent\n *\n * @param {HTMLElement} parent\n * @param {string} template simple template using {{var}}\n * @param {object} data\n */\nfunction createIframeWithContent(parent, template, data) {\n var iframe = createIframe(parent, null, data.zIndex);\n if (!setIframeContent(iframe, simpleTemplate(template, data))) return;\n return iframe;\n}\n\n/**\n * createIframe\n *\n * @param {HTMLElement} parent\n * @param {string} url\n */\nfunction createIframe(parent, url, zIndex) {\n var nEl = document.createElement('iframe');\n nEl.src = url || 'about:blank';\n nEl.marginWidth = '0';\n nEl.marginHeight = '0';\n nEl.frameBorder = '0';\n nEl.width = '100%';\n nEl.height = '100%';\n nEl.style.position = 'absolute';\n nEl.style.left = '0';\n nEl.style.top = '0';\n nEl.style.margin = '0px';\n nEl.style.padding = '0px';\n nEl.style.border = 'none';\n\n if(zIndex){\n nEl.style.zIndex = zIndex;\n }\n\n nEl.setAttribute('SCROLLING','NO');\n parent.innerHTML = '';\n parent.appendChild(nEl);\n return nEl;\n}\n\n/**\n * simpleTemplate\n *\n * @param {string} template\n * @param {object} data\n */\nfunction simpleTemplate(template, data) {\n Object.keys(data).forEach(function (key) {\n var value = (typeof value === 'object') ? JSON.stringify(data[key]) : data[key];\n template = template.replace(new RegExp('{{' + key + '}}', 'g'), value);\n });\n return template;\n}\n\n/**\n * setIframeContent\n *\n * @param {HTMLIframeElement} iframeEl\n * @param content\n */\nfunction setIframeContent(iframeEl, content) {\n var iframeDoc = iframeEl.contentWindow && iframeEl.contentWindow.document;\n if (!iframeDoc) return false;\n\n iframeDoc.write(content);\n\n return true;\n}\n\n\n/**\n * extend object with keys from another object\n *\n * @param {object} toExtend\n * @param {object} fromSource\n */\nfunction extend(toExtend, fromSource) {\n Object.keys(fromSource).forEach(function(key) {\n toExtend[key] = fromSource[key];\n });\n return toExtend;\n}\n\n\n/**\n * unique will create a unique string everytime is called, sequentially and prefixed\n *\n * @param {string} prefix\n */\nfunction unique(prefix) {\n var count = -1;\n return function () {\n return prefix + '_' + (++count);\n };\n}\n\nmodule.exports = {\n noop: noop,\n validate: validate,\n clearCallbackTimeout: clearCallbackTimeout,\n callbackTimeout: callbackTimeout,\n createElementInEl: createElementInEl,\n createIframeWithContent: createIframeWithContent,\n createIframe: createIframe,\n simpleTemplate: simpleTemplate,\n setIframeContent: setIframeContent,\n extend: extend,\n unique: unique\n};\n\n","'use strict';\n\nvar InLine = require('./InLine');\nvar Wrapper = require('./Wrapper');\n\nfunction Ad(adJTree) {\n if (!(this instanceof Ad)) {\n return new Ad(adJTree);\n }\n this.initialize(adJTree);\n}\n\nAd.prototype.initialize = function(adJTree) {\n this.id = adJTree.attr('id');\n this.sequence = adJTree.attr('sequence');\n\n if(adJTree.inLine) {\n this.inLine = new InLine(adJTree.inLine);\n }\n\n if(adJTree.wrapper){\n this.wrapper = new Wrapper(adJTree.wrapper);\n }\n};\n\nmodule.exports = Ad;","'use strict';\n\nvar TrackingEvent = require('./TrackingEvent');\n\nvar utilities = require('../../utils/utilityFunctions');\n\nvar xml = require('../../utils/xml');\n\n\nfunction Companion(companionJTree) {\n if (!(this instanceof Companion)) {\n return new Companion(companionJTree);\n }\n\n //Required Elements\n this.creativeType = xml.attr(companionJTree.staticResource, 'creativeType');\n this.staticResource = xml.keyValue(companionJTree.staticResource);\n\n // Weird bug when the JXON tree is built it doesn't handle casing properly in this situation...\n var htmlResource = null;\n if (xml.keyValue(companionJTree.HTMLResource)) {\n htmlResource = xml.keyValue(companionJTree.HTMLResource);\n } else if (xml.keyValue(companionJTree.hTMLResource)) {\n htmlResource = xml.keyValue(companionJTree.hTMLResource);\n }\n this.htmlResource = htmlResource;\n\n var iframeResource = null;\n if (xml.keyValue(companionJTree.IFrameResource)) {\n iframeResource = xml.keyValue(companionJTree.IFrameResource);\n } else if (xml.keyValue(companionJTree.iFrameresource)) {\n iframeResource = xml.keyValue(companionJTree.iFrameresource);\n }\n this.iframeResource = iframeResource;\n\n //Optional fields\n this.id = xml.attr(companionJTree, 'id');\n this.width = xml.attr(companionJTree, 'width');\n this.height = xml.attr(companionJTree, 'height');\n this.expandedWidth = xml.attr(companionJTree, 'expandedWidth');\n this.expandedHeight = xml.attr(companionJTree, 'expandedHeight');\n this.scalable = xml.attr(companionJTree, 'scalable');\n this.maintainAspectRatio = xml.attr(companionJTree, 'maintainAspectRatio');\n this.minSuggestedDuration = xml.attr(companionJTree, 'minSuggestedDuration');\n this.apiFramework = xml.attr(companionJTree, 'apiFramework');\n this.companionClickThrough = xml.keyValue(companionJTree.companionClickThrough);\n this.trackingEvents = parseTrackingEvents(companionJTree.trackingEvents && companionJTree.trackingEvents.tracking);\n\n /*** Local functions ***/\n function parseTrackingEvents(trackingEvents) {\n var trackings = [];\n if (utilities.isDefined(trackingEvents)) {\n trackingEvents = utilities.isArray(trackingEvents) ? trackingEvents : [trackingEvents];\n trackingEvents.forEach(function (trackingData) {\n trackings.push(new TrackingEvent(trackingData));\n });\n }\n return trackings;\n }\n}\n\nmodule.exports = Companion;","'use strict';\n\nvar Linear = require('./Linear');\nvar Companion = require('./Companion');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction Creative(creativeJTree) {\n if(!(this instanceof Creative)) {\n return new Creative(creativeJTree);\n }\n\n this.id = creativeJTree.attr('id');\n this.sequence = creativeJTree.attr('sequence');\n this.adId = creativeJTree.attr('adId');\n this.apiFramework = creativeJTree.attr('apiFramework');\n\n if(creativeJTree.linear) {\n this.linear = new Linear(creativeJTree.linear);\n }\n\n if (creativeJTree.companionAds) {\n var companions = [];\n var companionAds = creativeJTree.companionAds && creativeJTree.companionAds.companion;\n if (utilities.isDefined(companionAds)) {\n companionAds = utilities.isArray(companionAds) ? companionAds : [companionAds];\n companionAds.forEach(function (companionData) {\n companions.push(new Companion(companionData));\n });\n }\n this.companionAds = companions;\n }\n}\n\n/**\n * Returns true if the browser supports at the creative.\n */\nCreative.prototype.isSupported = function(){\n if(this.linear) {\n return this.linear.isSupported();\n }\n\n return true;\n};\n\nCreative.parseCreatives = function parseCreatives(creativesJTree) {\n var creatives = [];\n var creativesData;\n if (utilities.isDefined(creativesJTree) && utilities.isDefined(creativesJTree.creative)) {\n creativesData = utilities.isArray(creativesJTree.creative) ? creativesJTree.creative : [creativesJTree.creative];\n creativesData.forEach(function (creative) {\n creatives.push(new Creative(creative));\n });\n }\n return creatives;\n};\n\nmodule.exports = Creative;\n","'use strict';\n\nvar vastUtil = require('./vastUtil');\nvar Creative = require('./Creative');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nfunction InLine(inlineJTree) {\n if (!(this instanceof InLine)) {\n return new InLine(inlineJTree);\n }\n\n //Required Fields\n this.adTitle = xml.keyValue(inlineJTree.adTitle);\n this.adSystem = xml.keyValue(inlineJTree.adSystem);\n this.impressions = vastUtil.parseImpressions(inlineJTree.impression);\n this.creatives = Creative.parseCreatives(inlineJTree.creatives);\n\n //Optional Fields\n this.description = xml.keyValue(inlineJTree.description);\n this.advertiser = xml.keyValue(inlineJTree.advertiser);\n this.surveys = parseSurveys(inlineJTree.survey);\n this.error = xml.keyValue(inlineJTree.error);\n this.pricing = xml.keyValue(inlineJTree.pricing);\n this.extensions = inlineJTree.extensions;\n\n /*** Local Functions ***/\n function parseSurveys(inlineSurveys) {\n if (inlineSurveys) {\n return utilities.transformArray(utilities.isArray(inlineSurveys) ? inlineSurveys : [inlineSurveys], function (survey) {\n if(utilities.isNotEmptyString(survey.keyValue)){\n return {\n uri: survey.keyValue,\n type: survey.attr('type')\n };\n }\n\n return undefined;\n });\n }\n return [];\n }\n}\n\n\n/**\n * Returns true if the browser supports all the creatives.\n */\nInLine.prototype.isSupported = function(){\n var i,len;\n\n if(this.creatives.length === 0) {\n return false;\n }\n\n for(i = 0, len = this.creatives.length; i< len; i+=1){\n if(!this.creatives[i].isSupported()){\n return false;\n }\n }\n return true;\n};\n\nmodule.exports = InLine;\n","'use strict';\n\nvar TrackingEvent = require('./TrackingEvent');\nvar MediaFile = require('./MediaFile');\nvar VideoClicks = require('./VideoClicks');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar parsers = require('./parsers');\n\nvar xml = require('../../utils/xml');\n\n\nfunction Linear(linearJTree) {\n if (!(this instanceof Linear)) {\n return new Linear(linearJTree);\n }\n\n //Required Elements\n this.duration = parsers.duration(xml.keyValue(linearJTree.duration));\n this.mediaFiles = parseMediaFiles(linearJTree.mediaFiles && linearJTree.mediaFiles.mediaFile);\n\n //Optional fields\n this.trackingEvents = parseTrackingEvents(linearJTree.trackingEvents && linearJTree.trackingEvents.tracking, this.duration);\n this.skipoffset = parsers.offset(xml.attr(linearJTree, 'skipoffset'), this.duration);\n\n if (linearJTree.videoClicks) {\n this.videoClicks = new VideoClicks(linearJTree.videoClicks);\n }\n\n if(linearJTree.adParameters) {\n this.adParameters = xml.keyValue(linearJTree.adParameters);\n\n if(xml.attr(linearJTree.adParameters, 'xmlEncoded')){\n this.adParameters = xml.decode(this.adParameters);\n }\n }\n\n /*** Local functions ***/\n function parseTrackingEvents(trackingEvents, duration) {\n var trackings = [];\n if (utilities.isDefined(trackingEvents)) {\n trackingEvents = utilities.isArray(trackingEvents) ? trackingEvents : [trackingEvents];\n trackingEvents.forEach(function (trackingData) {\n trackings.push(new TrackingEvent(trackingData, duration));\n });\n }\n return trackings;\n }\n\n function parseMediaFiles(mediaFilesJxonTree) {\n var mediaFiles = [];\n if (utilities.isDefined(mediaFilesJxonTree)) {\n mediaFilesJxonTree = utilities.isArray(mediaFilesJxonTree) ? mediaFilesJxonTree : [mediaFilesJxonTree];\n\n mediaFilesJxonTree.forEach(function (mfData) {\n mediaFiles.push(new MediaFile(mfData));\n });\n }\n return mediaFiles;\n }\n}\n\n/**\n * Must return true if at least one of the MediaFiles' type is supported\n */\nLinear.prototype.isSupported = function () {\n var i, len;\n for(i=0, len=this.mediaFiles.length; i 0) {\n getAd(waterfallAds.shift(),[], waterfallHandler);\n } else {\n callback(error, adChain);\n }\n } else {\n callback(null, adChain);\n }\n }\n });\n\n /*** Local functions ***/\n function getAdWaterfall(adTagUrl, callback) {\n var requestVastXML = that._requestVASTXml.bind(that, adTagUrl);\n async.waterfall([\n requestVastXML,\n buildVastWaterfall\n ], callback);\n }\n\n function buildVastWaterfall(xmlStr, callback) {\n var vastTree;\n try {\n vastTree = xml.toJXONTree(xmlStr);\n\n if(utilities.isArray(vastTree.ad)) {\n vastTree.ads = vastTree.ad;\n } else if(vastTree.ad){\n vastTree.ads = [vastTree.ad];\n } else {\n vastTree.ads = [];\n }\n callback(validateVASTTree(vastTree), vastTree);\n\n } catch (e) {\n callback(new VASTError(\"on VASTClient.getVASTAd.buildVastWaterfall, error parsing xml\", 100), null);\n }\n }\n\n function validateVASTTree(vastTree) {\n var vastVersion = xml.attr(vastTree, 'version');\n\n if (!vastTree.ad) {\n return new VASTError('on VASTClient.getVASTAd.validateVASTTree, no Ad in VAST tree', 303);\n }\n\n if (vastVersion && (vastVersion != 3 && vastVersion != 2)) {\n return new VASTError('on VASTClient.getVASTAd.validateVASTTree, not supported VAST version \"' + vastVersion + '\"', 102);\n }\n\n return null;\n }\n\n function getAd(adTagUrl, adChain, callback) {\n if (adChain.length >= that.WRAPPER_LIMIT) {\n return callback(new VASTError(\"on VASTClient.getVASTAd.getAd, players wrapper limit reached (the limit is \" + that.WRAPPER_LIMIT + \")\", 302), adChain);\n }\n\n async.waterfall([\n function (next) {\n if (utilities.isString(adTagUrl)) {\n requestVASTAd(adTagUrl, next);\n } else {\n next(null, adTagUrl);\n }\n },\n buildAd\n ], function (error, ad) {\n if (ad) {\n adChain.push(ad);\n }\n\n if (error) {\n return callback(error, adChain);\n }\n\n if (ad.wrapper) {\n return getAd(ad.wrapper.VASTAdTagURI, adChain, callback);\n }\n\n return callback(null, adChain);\n });\n }\n\n function buildAd(adJxonTree, callback) {\n try {\n var ad = new Ad(adJxonTree);\n callback(validateAd(ad), ad);\n } catch (e) {\n callback(new VASTError('on VASTClient.getVASTAd.buildAd, error parsing xml', 100), null);\n }\n }\n\n function validateAd(ad) {\n var wrapper = ad.wrapper;\n var inLine = ad.inLine;\n var errMsgPrefix = 'on VASTClient.getVASTAd.validateAd, ';\n\n if (inLine && wrapper) {\n return new VASTError(errMsgPrefix +\"InLine and Wrapper both found on the same Ad\", 101);\n }\n\n if (!inLine && !wrapper) {\n return new VASTError(errMsgPrefix + \"nor wrapper nor inline elements found on the Ad\", 101);\n }\n\n if (inLine && !inLine.isSupported()) {\n return new VASTError(errMsgPrefix + \"could not find MediaFile that is supported by this video player\", 403);\n }\n\n if (wrapper && !wrapper.VASTAdTagURI) {\n return new VASTError(errMsgPrefix + \"missing 'VASTAdTagURI' in wrapper\", 101);\n }\n\n return null;\n }\n\n function requestVASTAd(adTagUrl, callback) {\n that._requestVASTXml(adTagUrl, function (error, xmlStr) {\n if (error) {\n return callback(error);\n }\n try {\n var vastTree = xml.toJXONTree(xmlStr);\n callback(validateVASTTree(vastTree), vastTree.ad);\n } catch (e) {\n callback(new VASTError(\"on VASTClient.getVASTAd.requestVASTAd, error parsing xml\", 100));\n }\n });\n }\n};\n\nVASTClient.prototype._requestVASTXml = function requestVASTXml(adTagUrl, callback) {\n try {\n if (utilities.isFunction(adTagUrl)) {\n adTagUrl(requestHandler);\n } else {\n http.get(adTagUrl, requestHandler, {\n withCredentials: true\n });\n }\n } catch (e) {\n callback(e);\n }\n\n /*** Local functions ***/\n function requestHandler(error, response, status) {\n if (error) {\n var errMsg = utilities.isDefined(status) ?\n \"on VASTClient.requestVastXML, HTTP request error with status '\" + status + \"'\" :\n \"on VASTClient.requestVastXML, Error getting the the VAST XML with he passed adTagXML fn\";\n return callback(new VASTError(errMsg, 301), null);\n }\n\n callback(null, response);\n }\n};\n\nVASTClient.prototype._buildVASTResponse = function buildVASTResponse(adsChain) {\n var response = new VASTResponse();\n addAdsToResponse(response, adsChain);\n validateResponse(response);\n\n return response;\n\n //*** Local function ****\n function addAdsToResponse(response, ads) {\n ads.forEach(function (ad) {\n response.addAd(ad);\n });\n }\n\n function validateResponse(response) {\n var progressEvents = response.trackingEvents.progress;\n\n if (!response.hasLinear()) {\n throw new VASTError(\"on VASTClient._buildVASTResponse, Received an Ad type that is not supported\", 200);\n }\n\n if (response.duration === undefined) {\n throw new VASTError(\"on VASTClient._buildVASTResponse, Missing duration field in VAST response\", 101);\n }\n\n if (progressEvents) {\n progressEvents.forEach(function (progressEvent) {\n if (!utilities.isNumber(progressEvent.offset)) {\n throw new VASTError(\"on VASTClient._buildVASTResponse, missing or wrong offset attribute on progress tracking event\", 101);\n }\n });\n }\n }\n};\n\nVASTClient.prototype._trackError = function (error, adChain) {\n if (!utilities.isArray(adChain) || adChain.length === 0) { //There is nothing to track\n return;\n }\n\n var errorURLMacros = [];\n adChain.forEach(addErrorUrlMacros);\n vastUtil.track(errorURLMacros, {ERRORCODE: error.code || 900}); //900 <== Undefined error\n\n /*** Local functions ***/\n function addErrorUrlMacros(ad) {\n if (ad.wrapper && ad.wrapper.error) {\n errorURLMacros.push(ad.wrapper.error);\n }\n\n if (ad.inLine && ad.inLine.error) {\n errorURLMacros.push(ad.inLine.error);\n }\n }\n};\n\nmodule.exports = VASTClient;\n","'use strict';\n\nfunction VASTError(message, code) {\n this.message = 'VAST Error: ' + (message || '');\n if (code) {\n this.code = code;\n }\n}\n\nVASTError.prototype = new Error();\nVASTError.prototype.name = \"VAST Error\";\n\nmodule.exports = VASTError;","'use strict';\n\n/**\n * Inner helper class that deals with the logic of the individual steps needed to setup an ad in the player.\n *\n * @param player {object} instance of the player that will play the ad. It assumes that the videojs-contrib-ads plugin\n * has been initialized when you use its utility functions.\n *\n * @constructor\n */\n\nvar VASTResponse = require('./VASTResponse');\nvar VASTError = require('./VASTError');\nvar VASTTracker = require('./VASTTracker');\nvar vastUtil = require('./vastUtil');\n\nvar async = require('../../utils/async');\nvar dom = require('../../utils/dom');\nvar playerUtils = require('../../utils/playerUtils');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VASTIntegrator(player) {\n if (!(this instanceof VASTIntegrator)) {\n return new VASTIntegrator(player);\n }\n\n this.player = player;\n}\n\nVASTIntegrator.prototype.playAd = function playAd(vastResponse, callback) {\n var that = this;\n callback = callback || utilities.noop;\n\n if (!(vastResponse instanceof VASTResponse)) {\n return callback(new VASTError('On VASTIntegrator, missing required VASTResponse'));\n }\n\n async.waterfall([\n function (next) {\n next(null, vastResponse);\n },\n this._selectAdSource.bind(this),\n this._createVASTTracker.bind(this),\n this._addClickThrough.bind(this),\n this._addSkipButton.bind(this),\n this._setupEvents.bind(this),\n this._playSelectedAd.bind(this)\n ], function (error, response) {\n if (error && response) {\n that._trackError(error, response);\n }\n callback(error, response);\n });\n\n this._adUnit = {\n _src: null,\n type: 'VAST',\n pauseAd: function () {\n that.player.pause(true);\n },\n\n resumeAd: function () {\n that.player.play(true);\n },\n\n isPaused: function () {\n return that.player.paused(true);\n },\n\n getSrc: function () {\n return this._src;\n }\n };\n\n return this._adUnit;\n};\n\nVASTIntegrator.prototype._selectAdSource = function selectAdSource(response, callback) {\n var source;\n\n var playerWidth = dom.getDimension(this.player.el()).width;\n response.mediaFiles.sort(function compareTo(a, b) {\n var deltaA = Math.abs(playerWidth - a.width);\n var deltaB = Math.abs(playerWidth - b.width);\n return deltaA - deltaB;\n });\n\n source = this.player.selectSource(response.mediaFiles).source;\n\n if (source) {\n if (this._adUnit) {\n this._adUnit._src = source;\n }\n return callback(null, source, response);\n }\n\n // code 403 <== Couldn't find MediaFile that is supported by this video player\n callback(new VASTError(\"Could not find Ad mediafile supported by this player\", 403), response);\n};\n\nVASTIntegrator.prototype._createVASTTracker = function createVASTTracker(adMediaFile, response, callback) {\n try {\n callback(null, adMediaFile, new VASTTracker(adMediaFile.src, response), response);\n } catch (e) {\n callback(e, response);\n }\n};\n\nVASTIntegrator.prototype._setupEvents = function setupEvents(adMediaFile, tracker, response, callback) {\n var previouslyMuted;\n var player = this.player;\n player.on('fullscreenchange', trackFullscreenChange);\n player.on('vast.adStart', trackImpressions);\n player.on('pause', trackPause);\n player.on('timeupdate', trackProgress);\n player.on('volumechange', trackVolumeChange);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], unbindEvents);\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel', 'vast.adSkip'], function(evt){\n if(evt.type === 'vast.adEnd'){\n tracker.trackComplete();\n }\n });\n\n return callback(null, adMediaFile, response);\n\n /*** Local Functions ***/\n function unbindEvents() {\n player.off('fullscreenchange', trackFullscreenChange);\n player.off('vast.adStart', trackImpressions);\n player.off('pause', trackPause);\n player.off('timeupdate', trackProgress);\n player.off('volumechange', trackVolumeChange);\n }\n\n function trackFullscreenChange() {\n if (player.isFullscreen()) {\n tracker.trackFullscreen();\n } else {\n tracker.trackExitFullscreen();\n }\n }\n\n function trackPause() {\n //NOTE: whenever a video ends the video Element triggers a 'pause' event before the 'ended' event.\n // We should not track this pause event because it makes the VAST tracking confusing again we use a\n // Threshold of 2 seconds to prevent false positives on IOS.\n if (Math.abs(player.duration() - player.currentTime()) < 2) {\n return;\n }\n\n tracker.trackPause();\n playerUtils.once(player, ['play', 'vast.adEnd', 'vast.adsCancel'], function (evt) {\n if(evt.type === 'play'){\n tracker.trackResume();\n }\n });\n }\n\n function trackProgress() {\n var currentTimeInMs = player.currentTime() * 1000;\n tracker.trackProgress(currentTimeInMs);\n }\n\n function trackImpressions() {\n tracker.trackImpressions();\n tracker.trackCreativeView();\n }\n\n function trackVolumeChange() {\n var muted = player.muted();\n if (muted) {\n tracker.trackMute();\n } else if (previouslyMuted) {\n tracker.trackUnmute();\n }\n previouslyMuted = muted;\n }\n};\n\nVASTIntegrator.prototype._addSkipButton = function addSkipButton(source, tracker, response, callback) {\n var skipOffsetInSec;\n var that = this;\n\n if (utilities.isNumber(response.skipoffset)) {\n skipOffsetInSec = response.skipoffset / 1000;\n addSkipButtonToPlayer(this.player, skipOffsetInSec);\n }\n callback(null, source, tracker, response);\n\n /*** Local function ***/\n function addSkipButtonToPlayer(player, skipOffset) {\n var skipButton = createSkipButton(player);\n var updateSkipButton = updateSkipButtonState.bind(that, skipButton, skipOffset, player);\n\n player.el().appendChild(skipButton);\n player.on('timeupdate', updateSkipButton);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeSkipButton);\n\n function removeSkipButton() {\n player.off('timeupdate', updateSkipButton);\n dom.remove(skipButton);\n }\n }\n\n function createSkipButton(player) {\n var skipButton = window.document.createElement(\"div\");\n dom.addClass(skipButton, \"vast-skip-button\");\n\n skipButton.onclick = function (e) {\n if (dom.hasClass(skipButton, 'enabled')) {\n tracker.trackSkip();\n player.trigger('vast.adSkip');\n }\n\n //We prevent event propagation to avoid problems with the clickThrough and so on\n if (window.Event.prototype.stopPropagation !== undefined) {\n e.stopPropagation();\n } else {\n return false;\n }\n };\n\n return skipButton;\n }\n\n function updateSkipButtonState(skipButton, skipOffset, player) {\n var timeLeft = Math.ceil(skipOffset - player.currentTime());\n if (timeLeft > 0) {\n skipButton.innerHTML = \"Skip in \" + utilities.toFixedDigits(timeLeft, 2) + \"...\";\n } else {\n if (!dom.hasClass(skipButton, 'enabled')) {\n dom.addClass(skipButton, 'enabled');\n skipButton.innerHTML = \"Skip ad\";\n }\n }\n }\n};\n\nVASTIntegrator.prototype._addClickThrough = function addClickThrough(mediaFile, tracker, response, callback) {\n var player = this.player;\n var blocker = createClickThroughBlocker(player, tracker, response);\n var updateBlocker = updateBlockerURL.bind(this, blocker, response, player);\n\n player.el().insertBefore(blocker, player.controlBar.el());\n player.on('timeupdate', updateBlocker);\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeBlocker);\n\n return callback(null, mediaFile, tracker, response);\n\n /*** Local Functions ***/\n\n function createClickThroughBlocker(player, tracker, response) {\n var blocker = window.document.createElement(\"a\");\n var clickThroughMacro = response.clickThrough;\n\n dom.addClass(blocker, 'vast-blocker');\n blocker.href = generateClickThroughURL(clickThroughMacro, player);\n\n if (utilities.isString(clickThroughMacro)) {\n blocker.target = \"_blank\";\n }\n\n blocker.onclick = function (e) {\n if (player.paused()) {\n player.play();\n\n //We prevent event propagation to avoid problems with the player's normal pause mechanism\n if (window.Event.prototype.stopPropagation !== undefined) {\n e.stopPropagation();\n }\n return false;\n }\n\n player.pause();\n tracker.trackClick();\n };\n\n return blocker;\n }\n\n function updateBlockerURL(blocker, response, player) {\n blocker.href = generateClickThroughURL(response.clickThrough, player);\n }\n\n function generateClickThroughURL(clickThroughMacro, player) {\n var variables = {\n ASSETURI: mediaFile.src,\n CONTENTPLAYHEAD: vastUtil.formatProgress(player.currentTime() * 1000)\n };\n\n return clickThroughMacro ? vastUtil.parseURLMacro(clickThroughMacro, variables) : '#';\n }\n\n function removeBlocker() {\n player.off('timeupdate', updateBlocker);\n dom.remove(blocker);\n }\n};\n\nVASTIntegrator.prototype._playSelectedAd = function playSelectedAd(source, response, callback) {\n var player = this.player;\n\n player.preload(\"auto\"); //without preload=auto the durationchange event is never fired\n player.src(source);\n\n playerUtils.once(player, ['durationchange', 'error', 'vast.adsCancel'], function (evt) {\n if (evt.type === 'durationchange') {\n playAd();\n } else if(evt.type === 'error') {\n callback(new VASTError(\"on VASTIntegrator, Player is unable to play the Ad\", 400), response);\n }\n //NOTE: If the ads get canceled we do nothing/\n });\n\n /**** local functions ******/\n function playAd() {\n\n playerUtils.once(player, ['playing', 'vast.adsCancel'], function (evt) {\n if(evt.type === 'vast.adsCancel'){\n return;\n }\n\n player.trigger('vast.adStart');\n\n player.on('ended', proceed);\n player.on('vast.adsCancel', proceed);\n player.on('vast.adSkip', proceed);\n\n function proceed(evt) {\n\n if(evt.type === 'ended' && (player.duration() - player.currentTime()) > 3 ) {\n // Ignore ended event if the Ad time was not 'near' the end\n // avoids issues where IOS controls could skip the Ad\n return;\n }\n\n player.off('ended', proceed);\n player.off('vast.adsCancel', proceed);\n player.off('vast.adSkip', proceed);\n\n //NOTE: if the ads get cancel we do nothing apart removing the listners\n if(evt.type === 'ended' || evt.type === 'vast.adSkip'){\n callback(null, response);\n }\n }\n });\n\n player.play();\n }\n};\n\nVASTIntegrator.prototype._trackError = function trackError(error, response) {\n vastUtil.track(response.errorURLMacros, {ERRORCODE: error.code || 900});\n};\n\nmodule.exports = VASTIntegrator;","'use strict';\n\nvar Ad = require('./Ad');\nvar VideoClicks = require('./VideoClicks');\nvar Linear = require('./Linear');\nvar InLine = require('./InLine');\nvar Wrapper = require('./Wrapper');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nwindow.InLine__A = InLine;\nfunction VASTResponse() {\n if (!(this instanceof VASTResponse)) {\n return new VASTResponse();\n }\n\n this._linearAdded = false;\n this.ads = [];\n this.errorURLMacros = [];\n this.impressions = [];\n this.clickTrackings = [];\n this.customClicks = [];\n this.trackingEvents = {};\n this.mediaFiles = [];\n this.clickThrough = undefined;\n this.adTitle = '';\n this.duration = undefined;\n this.skipoffset = undefined;\n}\n\nVASTResponse.prototype.addAd = function (ad) {\n var inLine, wrapper;\n if (ad instanceof Ad) {\n inLine = ad.inLine;\n wrapper = ad.wrapper;\n\n this.ads.push(ad);\n\n if (inLine) {\n this._addInLine(inLine);\n }\n\n if (wrapper) {\n this._addWrapper(wrapper);\n }\n }\n};\n\nVASTResponse.prototype._addErrorTrackUrl = function (error) {\n var errorURL = error instanceof xml.JXONTree ? xml.keyValue(error) : error;\n if (errorURL) {\n this.errorURLMacros.push(errorURL);\n }\n};\n\nVASTResponse.prototype._addImpressions = function (impressions) {\n utilities.isArray(impressions) && appendToArray(this.impressions, impressions);\n};\n\nVASTResponse.prototype._addClickThrough = function (clickThrough) {\n if (utilities.isNotEmptyString(clickThrough)) {\n this.clickThrough = clickThrough;\n }\n};\n\nVASTResponse.prototype._addClickTrackings = function (clickTrackings) {\n utilities.isArray(clickTrackings) && appendToArray(this.clickTrackings, clickTrackings);\n};\n\nVASTResponse.prototype._addCustomClicks = function (customClicks) {\n utilities.isArray(customClicks) && appendToArray(this.customClicks, customClicks);\n};\n\nVASTResponse.prototype._addTrackingEvents = function (trackingEvents) {\n var eventsMap = this.trackingEvents;\n\n if (trackingEvents) {\n trackingEvents = utilities.isArray(trackingEvents) ? trackingEvents : [trackingEvents];\n trackingEvents.forEach(function (trackingEvent) {\n if (!eventsMap[trackingEvent.name]) {\n eventsMap[trackingEvent.name] = [];\n }\n eventsMap[trackingEvent.name].push(trackingEvent);\n });\n }\n};\n\nVASTResponse.prototype._addTitle = function (title) {\n if (utilities.isNotEmptyString(title)) {\n this.adTitle = title;\n }\n};\n\nVASTResponse.prototype._addDuration = function (duration) {\n if (utilities.isNumber(duration)) {\n this.duration = duration;\n }\n};\n\nVASTResponse.prototype._addVideoClicks = function (videoClicks) {\n if (videoClicks instanceof VideoClicks) {\n this._addClickThrough(videoClicks.clickThrough);\n this._addClickTrackings(videoClicks.clickTrackings);\n this._addCustomClicks(videoClicks.customClicks);\n }\n};\n\nVASTResponse.prototype._addMediaFiles = function (mediaFiles) {\n utilities.isArray(mediaFiles) && appendToArray(this.mediaFiles, mediaFiles);\n};\n\nVASTResponse.prototype._addSkipoffset = function (offset) {\n if (offset) {\n this.skipoffset = offset;\n }\n};\n\nVASTResponse.prototype._addAdParameters = function (adParameters) {\n if (adParameters) {\n this.adParameters = adParameters;\n }\n};\n\nVASTResponse.prototype._addLinear = function (linear) {\n if (linear instanceof Linear) {\n this._addDuration(linear.duration);\n this._addTrackingEvents(linear.trackingEvents);\n this._addVideoClicks(linear.videoClicks);\n this._addMediaFiles(linear.mediaFiles);\n this._addSkipoffset(linear.skipoffset);\n this._addAdParameters(linear.adParameters);\n this._linearAdded = true;\n }\n};\n\nVASTResponse.prototype._addInLine = function (inLine) {\n var that = this;\n\n if (inLine instanceof InLine) {\n this._addTitle(inLine.adTitle);\n this._addErrorTrackUrl(inLine.error);\n this._addImpressions(inLine.impressions);\n\n inLine.creatives.forEach(function (creative) {\n if (creative.linear) {\n that._addLinear(creative.linear);\n }\n });\n }\n};\n\nVASTResponse.prototype._addWrapper = function (wrapper) {\n var that = this;\n\n if (wrapper instanceof Wrapper) {\n this._addErrorTrackUrl(wrapper.error);\n this._addImpressions(wrapper.impressions);\n\n wrapper.creatives.forEach(function (creative) {\n var linear = creative.linear;\n if (linear) {\n that._addVideoClicks(linear.videoClicks);\n that.clickThrough = undefined;//We ensure that no clickThrough has been added\n that._addTrackingEvents(linear.trackingEvents);\n }\n });\n }\n};\n\nVASTResponse.prototype.hasLinear = function(){\n return this._linearAdded;\n};\n\nfunction appendToArray(array, items) {\n items.forEach(function (item) {\n array.push(item);\n });\n}\n\nmodule.exports = VASTResponse;\n\n","'use strict';\n\nvar VASTError = require('./VASTError');\nvar VASTResponse = require('./VASTResponse');\nvar vastUtil = require('./vastUtil');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VASTTracker(assetURI, vastResponse) {\n if (!(this instanceof VASTTracker)) {\n return new VASTTracker(assetURI, vastResponse);\n }\n\n this.sanityCheck(assetURI, vastResponse);\n this.initialize(assetURI, vastResponse);\n\n}\n\nVASTTracker.prototype.initialize = function(assetURI, vastResponse) {\n this.response = vastResponse;\n this.assetURI = assetURI;\n this.progress = 0;\n this.quartiles = {\n firstQuartile: {tracked: false, time: Math.round(25 * vastResponse.duration) / 100},\n midpoint: {tracked: false, time: Math.round(50 * vastResponse.duration) / 100},\n thirdQuartile: {tracked: false, time: Math.round(75 * vastResponse.duration) / 100}\n };\n};\n\nVASTTracker.prototype.sanityCheck = function(assetURI, vastResponse) {\n if (!utilities.isString(assetURI) || utilities.isEmptyString(assetURI)) {\n throw new VASTError('on VASTTracker constructor, missing required the URI of the ad asset being played');\n }\n\n if (!(vastResponse instanceof VASTResponse)) {\n throw new VASTError('on VASTTracker constructor, missing required VAST response');\n }\n};\n\nVASTTracker.prototype.trackURLs = function trackURLs(urls, variables) {\n if (utilities.isArray(urls) && urls.length > 0) {\n variables = utilities.extend({\n ASSETURI: this.assetURI,\n CONTENTPLAYHEAD: vastUtil.formatProgress(this.progress)\n }, variables || {});\n\n vastUtil.track(urls, variables);\n }\n};\n\nVASTTracker.prototype.trackEvent = function trackEvent(eventName, trackOnce) {\n this.trackURLs(getEventUris(this.response.trackingEvents[eventName]));\n if (trackOnce) {\n this.response.trackingEvents[eventName] = undefined;\n }\n\n /*** Local function ***/\n function getEventUris(trackingEvents) {\n var uris;\n\n if (trackingEvents) {\n uris = [];\n trackingEvents.forEach(function (event) {\n uris.push(event.uri);\n });\n }\n return uris;\n }\n};\n\nVASTTracker.prototype.trackProgress = function trackProgress(newProgressInMs) {\n var that = this;\n var events = [];\n var ONCE = true;\n var ALWAYS = false;\n var trackingEvents = this.response.trackingEvents;\n\n if (utilities.isNumber(newProgressInMs)) {\n addTrackEvent('start', ONCE, newProgressInMs > 0);\n addTrackEvent('rewind', ALWAYS, hasRewound(this.progress, newProgressInMs));\n addQuartileEvents(newProgressInMs);\n trackProgressEvents(newProgressInMs);\n trackEvents();\n this.progress = newProgressInMs;\n }\n\n /*** Local function ***/\n function hasRewound(currentProgress, newProgress) {\n var REWIND_THRESHOLD = 3000; //IOS video clock is very unreliable and we need a 3 seconds threshold to ensure that there was a rewind an that it was on purpose.\n return currentProgress > newProgressInMs && Math.abs(newProgress - currentProgress) > REWIND_THRESHOLD;\n }\n\n function addTrackEvent(eventName, trackOnce, canBeAdded) {\n if (trackingEvents[eventName] && canBeAdded) {\n events.push({\n name: eventName,\n trackOnce: !!trackOnce\n });\n }\n }\n\n function addQuartileEvents(progress) {\n var quartiles = that.quartiles;\n var firstQuartile = that.quartiles.firstQuartile;\n var midpoint = that.quartiles.midpoint;\n var thirdQuartile = that.quartiles.thirdQuartile;\n\n if (!firstQuartile.tracked) {\n trackQuartile('firstQuartile', progress);\n } else if (!midpoint.tracked) {\n trackQuartile('midpoint', progress);\n } else if (!thirdQuartile.tracked){\n trackQuartile('thirdQuartile', progress);\n }\n\n /*** Local function ***/\n function trackQuartile(quartileName, progress){\n var quartile = quartiles[quartileName];\n if(canBeTracked(quartile, progress)){\n quartile.tracked = true;\n addTrackEvent(quartileName, ONCE, true);\n }\n }\n }\n\n function canBeTracked(quartile, progress) {\n var quartileTime = quartile.time;\n //We only fire the quartile event if the progress is bigger than the quartile time by 5 seconds at most.\n return progress >= quartileTime && progress <= (quartileTime + 5000);\n }\n\n function trackProgressEvents(progress) {\n if (!utilities.isArray(trackingEvents.progress)) {\n return; //Nothing to track\n }\n\n var pendingProgressEvts = [];\n\n trackingEvents.progress.forEach(function (evt) {\n if (evt.offset <= progress) {\n that.trackURLs([evt.uri]);\n } else {\n pendingProgressEvts.push(evt);\n }\n });\n trackingEvents.progress = pendingProgressEvts;\n }\n\n function trackEvents() {\n events.forEach(function (event) {\n that.trackEvent(event.name, event.trackOnce);\n });\n }\n};\n\n[\n 'rewind',\n 'fullscreen',\n 'exitFullscreen',\n 'pause',\n 'resume',\n 'mute',\n 'unmute',\n 'acceptInvitation',\n 'acceptInvitationLinear',\n 'collapse',\n 'expand'\n].forEach(function (eventName) {\n VASTTracker.prototype['track' + utilities.capitalize(eventName)] = function () {\n this.trackEvent(eventName);\n };\n });\n\n[\n 'start',\n 'skip',\n 'close',\n 'closeLinear'\n].forEach(function (eventName) {\n VASTTracker.prototype['track' + utilities.capitalize(eventName)] = function () {\n this.trackEvent(eventName, true);\n };\n });\n\n[\n 'firstQuartile',\n 'midpoint',\n 'thirdQuartile'\n].forEach(function (quartile) {\n VASTTracker.prototype['track' + utilities.capitalize(quartile)] = function () {\n this.quartiles[quartile].tracked = true;\n this.trackEvent(quartile, true);\n };\n });\n\nVASTTracker.prototype.trackComplete = function () {\n if(this.quartiles.thirdQuartile.tracked){\n this.trackEvent('complete', true);\n }\n};\n\nVASTTracker.prototype.trackErrorWithCode = function trackErrorWithCode(errorcode) {\n if (utilities.isNumber(errorcode)) {\n this.trackURLs(this.response.errorURLMacros, {ERRORCODE: errorcode});\n }\n};\n\nVASTTracker.prototype.trackImpressions = function trackImpressions() {\n this.trackURLs(this.response.impressions);\n};\n\nVASTTracker.prototype.trackCreativeView = function trackCreativeView() {\n this.trackEvent('creativeView');\n};\n\nVASTTracker.prototype.trackClick = function trackClick() {\n this.trackURLs(this.response.clickTrackings);\n};\n\nmodule.exports = VASTTracker;\n","'use strict';\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nfunction VideoClicks(videoClickJTree) {\n if (!(this instanceof VideoClicks)) {\n return new VideoClicks(videoClickJTree);\n }\n\n this.clickThrough = xml.keyValue(videoClickJTree.clickThrough);\n this.clickTrackings = parseClickTrackings(videoClickJTree.clickTracking);\n this.customClicks = parseClickTrackings(videoClickJTree.customClick);\n\n /*** Local functions ***/\n function parseClickTrackings(trackingData) {\n var clickTrackings = [];\n if (trackingData) {\n trackingData = utilities.isArray(trackingData) ? trackingData : [trackingData];\n trackingData.forEach(function (clickTrackingData) {\n clickTrackings.push(xml.keyValue(clickTrackingData));\n });\n }\n return clickTrackings;\n }\n}\n\nmodule.exports = VideoClicks;","'use strict';\n\nvar vastUtil = require('./vastUtil');\nvar Creative = require('./Creative');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar xml = require('../../utils/xml');\n\nfunction Wrapper(wrapperJTree) {\n if(!(this instanceof Wrapper)) {\n return new Wrapper(wrapperJTree);\n }\n\n //Required elements\n this.adSystem = xml.keyValue(wrapperJTree.adSystem);\n this.impressions = vastUtil.parseImpressions(wrapperJTree.impression);\n this.VASTAdTagURI = xml.keyValue(wrapperJTree.vASTAdTagURI);\n\n //Optional elements\n this.creatives = Creative.parseCreatives(wrapperJTree.creatives);\n this.error = xml.keyValue(wrapperJTree.error);\n this.extensions = wrapperJTree.extensions;\n\n //Optional attrs\n this.followAdditionalWrappers = utilities.isDefined(xml.attr(wrapperJTree, 'followAdditionalWrappers'))? xml.attr(wrapperJTree, 'followAdditionalWrappers'): true;\n this.allowMultipleAds = xml.attr(wrapperJTree, 'allowMultipleAds');\n this.fallbackOnNoAd = xml.attr(wrapperJTree, 'fallbackOnNoAd');\n}\n\nmodule.exports = Wrapper;\n","'use strict';\n\nvar utilities = require('../../utils/utilityFunctions');\n\nvar durationRegex = /(\\d\\d):(\\d\\d):(\\d\\d)(\\.(\\d\\d\\d))?/;\n\nvar parsers = {\n\n duration: function parseDuration(durationStr) {\n\n var match, durationInMs;\n\n if (utilities.isString(durationStr)) {\n match = durationStr.match(durationRegex);\n if (match) {\n durationInMs = parseHoursToMs(match[1]) + parseMinToMs(match[2]) + parseSecToMs(match[3]) + parseInt(match[5] || 0);\n }\n }\n\n return isNaN(durationInMs) ? null : durationInMs;\n\n /*** local functions ***/\n function parseHoursToMs(hourStr) {\n return parseInt(hourStr, 10) * 60 * 60 * 1000;\n }\n\n function parseMinToMs(minStr) {\n return parseInt(minStr, 10) * 60 * 1000;\n }\n\n function parseSecToMs(secStr) {\n return parseInt(secStr, 10) * 1000;\n }\n },\n\n offset: function parseOffset(offset, duration) {\n if(isPercentage(offset)){\n return calculatePercentage(offset, duration);\n }\n return parsers.duration(offset);\n\n /*** Local function ***/\n function isPercentage(offset) {\n var percentageRegex = /^\\d+(\\.\\d+)?%$/g;\n return percentageRegex.test(offset);\n }\n\n function calculatePercentage(percentStr, duration) {\n if(duration) {\n return calcPercent(duration, parseFloat(percentStr.replace('%', '')));\n }\n return null;\n }\n\n function calcPercent(quantity, percent){\n return quantity * percent / 100;\n }\n }\n\n};\n\n\nmodule.exports = parsers;","'use strict';\n\nvar utilities = require('../../utils/utilityFunctions');\nvar VPAIDHTML5Tech = require('../vpaid/VPAIDHTML5Tech');\nvar VPAIDFlashTech = require('../vpaid/VPAIDFlashTech');\nvar VPAIDFLASHClient = require('VPAIDFLASHClient/js/VPAIDFLASHClient');\n\nvar vastUtil = {\n\n track: function track(URLMacros, variables) {\n var sources = vastUtil.parseURLMacros(URLMacros, variables);\n var trackImgs = [];\n sources.forEach(function (src) {\n var img = new Image();\n img.src = src;\n trackImgs.push(img);\n });\n return trackImgs;\n },\n\n parseURLMacros: function parseMacros(URLMacros, variables) {\n var parsedURLs = [];\n\n variables = variables || {};\n\n if (!(variables[\"CACHEBUSTING\"])) {\n variables[\"CACHEBUSTING\"] = Math.round(Math.random() * 1.0e+10);\n }\n\n URLMacros.forEach(function (URLMacro) {\n parsedURLs.push(vastUtil._parseURLMacro(URLMacro, variables));\n });\n\n return parsedURLs;\n },\n\n parseURLMacro: function parseMacro(URLMacro, variables) {\n variables = variables || {};\n\n if (!(variables[\"CACHEBUSTING\"])) {\n variables[\"CACHEBUSTING\"] = Math.round(Math.random() * 1.0e+10);\n }\n\n return vastUtil._parseURLMacro(URLMacro, variables);\n },\n\n _parseURLMacro: function parseMacro(URLMacro, variables) {\n variables = variables || {};\n\n utilities.forEach(variables, function (value, key) {\n URLMacro = URLMacro.replace(new RegExp(\"\\\\[\" + key + \"\\\\\\]\", 'gm'), value);\n });\n\n return URLMacro;\n },\n\n parseDuration: function parseDuration(durationStr) {\n var durationRegex = /(\\d\\d):(\\d\\d):(\\d\\d)(\\.(\\d\\d\\d))?/;\n var match, durationInMs;\n\n if (utilities.isString(durationStr)) {\n match = durationStr.match(durationRegex);\n if (match) {\n durationInMs = parseHoursToMs(match[1]) + parseMinToMs(match[2]) + parseSecToMs(match[3]) + parseInt(match[5] || 0);\n }\n }\n\n return isNaN(durationInMs) ? null : durationInMs;\n\n /*** local functions ***/\n function parseHoursToMs(hourStr) {\n return parseInt(hourStr, 10) * 60 * 60 * 1000;\n }\n\n function parseMinToMs(minStr) {\n return parseInt(minStr, 10) * 60 * 1000;\n }\n\n function parseSecToMs(secStr) {\n return parseInt(secStr, 10) * 1000;\n }\n },\n\n parseImpressions: function parseImpressions(impressions) {\n if (impressions) {\n impressions = utilities.isArray(impressions) ? impressions : [impressions];\n return utilities.transformArray(impressions, function (impression) {\n if (utilities.isNotEmptyString(impression.keyValue)) {\n return impression.keyValue;\n }\n return undefined;\n });\n }\n return [];\n },\n\n\n //We assume that the progress is going to arrive in milliseconds\n formatProgress: function formatProgress(progress) {\n var hours, minutes, seconds, milliseconds;\n hours = progress / (60 * 60 * 1000);\n hours = Math.floor(hours);\n minutes = (progress / (60 * 1000)) % 60;\n minutes = Math.floor(minutes);\n seconds = (progress / 1000) % 60;\n seconds = Math.floor(seconds);\n milliseconds = progress % 1000;\n return utilities.toFixedDigits(hours, 2) + ':' + utilities.toFixedDigits(minutes, 2) + ':' + utilities.toFixedDigits(seconds, 2) + '.' + utilities.toFixedDigits(milliseconds, 3);\n },\n\n parseOffset: function parseOffset(offset, duration) {\n if (isPercentage(offset)) {\n return calculatePercentage(offset, duration);\n }\n return vastUtil.parseDuration(offset);\n\n /*** Local function ***/\n function isPercentage(offset) {\n var percentageRegex = /^\\d+(\\.\\d+)?%$/g;\n return percentageRegex.test(offset);\n }\n\n function calculatePercentage(percentStr, duration) {\n if (duration) {\n return calcPercent(duration, parseFloat(percentStr.replace('%', '')));\n }\n return null;\n }\n\n function calcPercent(quantity, percent) {\n return quantity * percent / 100;\n }\n },\n\n\n //List of supported VPAID technologies\n VPAID_techs: [\n VPAIDFlashTech,\n VPAIDHTML5Tech\n ],\n\n isVPAID: function isVPAIDMediaFile(mediaFile) {\n return !!mediaFile && mediaFile.apiFramework === 'VPAID';\n },\n\n findSupportedVPAIDTech: function findSupportedVPAIDTech(mimeType) {\n var i, len, VPAIDTech;\n\n for (i = 0, len = this.VPAID_techs.length; i < len; i += 1) {\n VPAIDTech = this.VPAID_techs[i];\n if (VPAIDTech.supports(mimeType)) {\n return VPAIDTech;\n }\n }\n return null;\n },\n\n isFlashSupported: function isFlashSupported() {\n return VPAIDFLASHClient.isSupported();\n },\n\n /**\n * Necessary step for VPAIDFLAShClient to know if flash is supported and not blocked.\n * IMPORTANT NOTE: This is an async test and needs to be run as soon as possible.\n *\n * @param vpaidFlashLoaderPath the path to the vpaidFlashLoader swf obj.\n */\n runFlashSupportCheck: function runFlashSupportCheck(vpaidFlashLoaderPath) {\n VPAIDFLASHClient.runFlashTest({data: vpaidFlashLoaderPath});\n }\n\n};\n\nmodule.exports = vastUtil;\n","'use strict';\n\nvar VASTError = require('../vast/VASTError');\n\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VPAIDAdUnitWrapper(vpaidAdUnit, opts) {\n if (!(this instanceof VPAIDAdUnitWrapper)) {\n return new VPAIDAdUnitWrapper(vpaidAdUnit, opts);\n }\n sanityCheck(vpaidAdUnit, opts);\n\n this.options = utilities.extend({}, opts);\n\n this._adUnit = vpaidAdUnit;\n\n /*** Local Functions ***/\n function sanityCheck(adUnit, opts) {\n if (!adUnit || !VPAIDAdUnitWrapper.checkVPAIDInterface(adUnit)) {\n throw new VASTError('on VPAIDAdUnitWrapper, the passed VPAID adUnit does not fully implement the VPAID interface');\n }\n\n if (!utilities.isObject(opts)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper, expected options hash but got '\" + opts + \"'\");\n }\n\n if (!(\"responseTimeout\" in opts) || !utilities.isNumber(opts.responseTimeout) ){\n throw new VASTError(\"on VPAIDAdUnitWrapper, expected responseTimeout in options\");\n }\n }\n}\n\nVPAIDAdUnitWrapper.checkVPAIDInterface = function checkVPAIDInterface(VPAIDAdUnit) {\n //NOTE: skipAd is not part of the method list because it only appears in VPAID 2.0 and we support VPAID 1.0\n var VPAIDInterfaceMethods = [\n 'handshakeVersion', 'initAd', 'startAd', 'stopAd', 'resizeAd', 'pauseAd', 'expandAd', 'collapseAd'\n ];\n\n for (var i = 0, len = VPAIDInterfaceMethods.length; i < len; i++) {\n if (!VPAIDAdUnit || !utilities.isFunction(VPAIDAdUnit[VPAIDInterfaceMethods[i]])) {\n return false;\n }\n }\n\n\n return canSubscribeToEvents(VPAIDAdUnit) && canUnsubscribeFromEvents(VPAIDAdUnit);\n\n /*** Local Functions ***/\n\n function canSubscribeToEvents(adUnit) {\n return utilities.isFunction(adUnit.subscribe) || utilities.isFunction(adUnit.addEventListener) || utilities.isFunction(adUnit.on);\n }\n\n function canUnsubscribeFromEvents(adUnit) {\n return utilities.isFunction(adUnit.unsubscribe) || utilities.isFunction(adUnit.removeEventListener) || utilities.isFunction(adUnit.off);\n\n }\n};\n\nVPAIDAdUnitWrapper.prototype.adUnitAsyncCall = function () {\n var args = utilities.arrayLikeObjToArray(arguments);\n var method = args.shift();\n var cb = args.pop();\n var timeoutId;\n\n sanityCheck(method, cb, this._adUnit);\n args.push(wrapCallback());\n\n this._adUnit[method].apply(this._adUnit, args);\n timeoutId = setTimeout(function () {\n timeoutId = null;\n cb(new VASTError(\"on VPAIDAdUnitWrapper, timeout while waiting for a response on call '\" + method + \"'\"));\n cb = utilities.noop;\n }, this.options.responseTimeout);\n\n /*** Local functions ***/\n function sanityCheck(method, cb, adUnit) {\n if (!utilities.isString(method) || !utilities.isFunction(adUnit[method])) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.adUnitAsyncCall, invalid method name\");\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.adUnitAsyncCall, missing callback\");\n }\n }\n\n function wrapCallback() {\n return function () {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n cb.apply(this, arguments);\n };\n }\n};\n\nVPAIDAdUnitWrapper.prototype.on = function (evtName, handler) {\n var addEventListener = this._adUnit.addEventListener || this._adUnit.subscribe || this._adUnit.on;\n addEventListener.call(this._adUnit, evtName, handler);\n};\n\nVPAIDAdUnitWrapper.prototype.off = function (evtName, handler) {\n var removeEventListener = this._adUnit.removeEventListener || this._adUnit.unsubscribe || this._adUnit.off;\n removeEventListener.call(this._adUnit, evtName, handler);\n};\n\nVPAIDAdUnitWrapper.prototype.waitForEvent = function (evtName, cb, context) {\n var timeoutId;\n sanityCheck(evtName, cb);\n context = context || null;\n\n this.on(evtName, responseListener);\n\n timeoutId = setTimeout(function () {\n cb(new VASTError(\"on VPAIDAdUnitWrapper.waitForEvent, timeout while waiting for event '\" + evtName + \"'\"));\n timeoutId = null;\n cb = utilities.noop;\n }, this.options.responseTimeout);\n\n /*** Local functions ***/\n function sanityCheck(evtName, cb) {\n if (!utilities.isString(evtName)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.waitForEvent, missing evt name\");\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError(\"on VPAIDAdUnitWrapper.waitForEvent, missing callback\");\n }\n }\n\n function responseListener() {\n var args = utilities.arrayLikeObjToArray(arguments);\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n\n args.unshift(null);\n cb.apply(context, args);\n }\n};\n\n// VPAID METHODS\nVPAIDAdUnitWrapper.prototype.handshakeVersion = function (version, cb) {\n this.adUnitAsyncCall('handshakeVersion', version, cb);\n};\n\n/* jshint maxparams:6 */\nVPAIDAdUnitWrapper.prototype.initAd = function (width, height, viewMode, desiredBitrate, adUnitData, cb) {\n this.waitForEvent('AdLoaded', cb);\n this._adUnit.initAd(width, height, viewMode, desiredBitrate, adUnitData);\n};\n\nVPAIDAdUnitWrapper.prototype.resizeAd = function (width, height, viewMode, cb) {\n // NOTE: AdSizeChange event is only supported on VPAID 2.0 so for the moment we are not going to use it\n // and will assume that everything is fine after the async call\n this.adUnitAsyncCall('resizeAd', width, height, viewMode, cb);\n};\n\nVPAIDAdUnitWrapper.prototype.startAd = function (cb) {\n this.waitForEvent('AdStarted', cb);\n this._adUnit.startAd();\n};\n\nVPAIDAdUnitWrapper.prototype.stopAd = function (cb) {\n this.waitForEvent('AdStopped', cb);\n this._adUnit.stopAd();\n};\n\nVPAIDAdUnitWrapper.prototype.pauseAd = function (cb) {\n this.waitForEvent('AdPaused', cb);\n this._adUnit.pauseAd();\n};\n\nVPAIDAdUnitWrapper.prototype.resumeAd = function (cb) {\n this.waitForEvent('AdPlaying', cb);\n this._adUnit.resumeAd();\n};\n\nVPAIDAdUnitWrapper.prototype.expandAd = function (cb) {\n this.waitForEvent('AdExpandedChange', cb);\n this._adUnit.expandAd();\n};\n\nVPAIDAdUnitWrapper.prototype.collapseAd = function (cb) {\n this.waitForEvent('AdExpandedChange', cb);\n this._adUnit.collapseAd();\n};\n\nVPAIDAdUnitWrapper.prototype.skipAd = function (cb) {\n this.waitForEvent('AdSkipped', cb);\n this._adUnit.skipAd();\n};\n\n//VPAID property getters\n[\n 'adLinear',\n 'adWidth',\n 'adHeight',\n 'adExpanded',\n 'adSkippableState',\n 'adRemainingTime',\n 'adDuration',\n 'adVolume',\n 'adCompanions',\n 'adIcons'\n].forEach(function (property) {\n var getterName = 'get' + utilities.capitalize(property);\n\n VPAIDAdUnitWrapper.prototype[getterName] = function (cb) {\n this.adUnitAsyncCall(getterName, cb);\n };\n});\n\n//VPAID property setters\nVPAIDAdUnitWrapper.prototype.setAdVolume = function(volume, cb){\n this.adUnitAsyncCall('setAdVolume',volume, cb);\n};\n\nmodule.exports = VPAIDAdUnitWrapper;\n","'use strict';\n\nvar VASTError = require('../vast/VASTError');\n\nvar VPAIDFLASHClient = require('VPAIDFLASHClient/js/VPAIDFLASHClient');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar dom = require('../../utils/dom');\n\nfunction VPAIDFlashTech(mediaFile, settings) {\n if (!(this instanceof VPAIDFlashTech)) {\n return new VPAIDFlashTech(mediaFile);\n }\n sanityCheck(mediaFile);\n this.name = 'vpaid-flash';\n this.mediaFile = mediaFile;\n this.containerEl = null;\n this.vpaidFlashClient = null;\n this.settings = settings;\n\n /*** local functions ***/\n function sanityCheck(mediaFile) {\n if (!mediaFile || !utilities.isString(mediaFile.src)) {\n throw new VASTError('on VPAIDFlashTech, invalid MediaFile');\n }\n }\n}\n\nVPAIDFlashTech.VPAIDFLASHClient = VPAIDFLASHClient;\n\nVPAIDFlashTech.supports = function (type) {\n return type === 'application/x-shockwave-flash' && VPAIDFlashTech.VPAIDFLASHClient.isSupported();\n};\n\nVPAIDFlashTech.prototype.loadAdUnit = function loadFlashCreative(containerEl, objectEl, callback) {\n var that = this;\n var flashClientOpts = this.settings && this.settings.vpaidFlashLoaderPath ? {data: this.settings.vpaidFlashLoaderPath} : undefined;\n sanityCheck(containerEl, callback);\n\n this.containerEl = containerEl;\n this.vpaidFlashClient = new VPAIDFlashTech.VPAIDFLASHClient(containerEl, function (error) {\n if (error) {\n return callback(error);\n }\n\n that.vpaidFlashClient.loadAdUnit(that.mediaFile.src, callback);\n }, flashClientOpts);\n\n /*** Local Functions ***/\n function sanityCheck(container, cb) {\n\n if (!dom.isDomElement(container)) {\n throw new VASTError('on VPAIDFlashTech.loadAdUnit, invalid dom container element');\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError('on VPAIDFlashTech.loadAdUnit, missing valid callback');\n }\n }\n};\n\nVPAIDFlashTech.prototype.unloadAdUnit = function () {\n if (this.vpaidFlashClient) {\n try{\n this.vpaidFlashClient.destroy();\n } catch(e){\n if(console && utilities.isFunction(console.log)){\n console.log('VAST ERROR: trying to unload the VPAID adunit');\n }\n }\n this.vpaidFlashClient = null;\n }\n\n if (this.containerEl) {\n dom.remove(this.containerEl);\n this.containerEl = null;\n }\n};\n\nmodule.exports = VPAIDFlashTech;\n","'use strict';\n\nvar VASTError = require('../vast/VASTError');\n\nvar VPAIDHTML5Client = require('VPAIDHTML5Client/js/VPAIDHTML5Client');\n\nvar utilities = require('../../utils/utilityFunctions');\nvar dom = require('../../utils/dom');\n\nfunction VPAIDHTML5Tech(mediaFile) {\n\n if(!(this instanceof VPAIDHTML5Tech)) {\n return new VPAIDHTML5Tech(mediaFile);\n }\n\n sanityCheck(mediaFile);\n\n this.name = 'vpaid-html5';\n this.containerEl = null;\n this.videoEl = null;\n this.vpaidHTMLClient = null;\n\n this.mediaFile = mediaFile;\n\n function sanityCheck(mediaFile) {\n if (!mediaFile || !utilities.isString(mediaFile.src)) {\n throw new VASTError(VPAIDHTML5Tech.INVALID_MEDIA_FILE);\n }\n }\n}\n\nVPAIDHTML5Tech.VPAIDHTML5Client = VPAIDHTML5Client;\n\nVPAIDHTML5Tech.supports = function (type) {\n return !utilities.isOldIE() && type === 'application/javascript';\n};\n\nVPAIDHTML5Tech.prototype.loadAdUnit = function loadAdUnit(containerEl, videoEl, callback) {\n sanityCheck(containerEl, videoEl, callback);\n\n this.containerEl = containerEl;\n this.videoEl = videoEl;\n this.vpaidHTMLClient = new VPAIDHTML5Tech.VPAIDHTML5Client(containerEl, videoEl, {});\n this.vpaidHTMLClient.loadAdUnit(this.mediaFile.src, callback);\n\n function sanityCheck(container, video, cb) {\n if (!dom.isDomElement(container)) {\n throw new VASTError(VPAIDHTML5Tech.INVALID_DOM_CONTAINER_EL);\n }\n\n if (!dom.isDomElement(video) || video.tagName.toLowerCase() !== 'video') {\n throw new VASTError(VPAIDHTML5Tech.INVALID_DOM_CONTAINER_EL);\n }\n\n if (!utilities.isFunction(cb)) {\n throw new VASTError(VPAIDHTML5Tech.MISSING_CALLBACK);\n }\n }\n};\n\nVPAIDHTML5Tech.prototype.unloadAdUnit = function unloadAdUnit() {\n if (this.vpaidHTMLClient) {\n try {\n this.vpaidHTMLClient.destroy();\n } catch(e) {\n if (console && utilities.isFunction(console.log)) {\n console.log('VAST ERROR: trying to unload the VPAID adunit');\n }\n }\n\n this.vpaidHTMLClient = null;\n }\n\n if (this.containerEl) {\n dom.remove(this.containerEl);\n this.containerEl = null;\n }\n};\n\nvar PREFIX = 'on VPAIDHTML5Tech';\nVPAIDHTML5Tech.INVALID_MEDIA_FILE = PREFIX + ', invalid MediaFile';\nVPAIDHTML5Tech.INVALID_DOM_CONTAINER_EL = PREFIX + ', invalid container HtmlElement';\nVPAIDHTML5Tech.INVALID_DOM_VIDEO_EL = PREFIX + ', invalid HTMLVideoElement';\nVPAIDHTML5Tech.MISSING_CALLBACK = PREFIX + ', missing valid callback';\n\nmodule.exports = VPAIDHTML5Tech;","'use strict';\n\nvar VASTError = require('../vast/VASTError');\nvar VASTResponse = require('../vast/VASTResponse');\nvar VASTTracker = require('../vast/VASTTracker');\nvar vastUtil = require('../vast/vastUtil');\n\nvar VPAIDAdUnitWrapper = require('./VPAIDAdUnitWrapper');\n\nvar async = require('../../utils/async');\nvar dom = require('../../utils/dom');\nvar playerUtils = require('../../utils/playerUtils');\nvar utilities = require('../../utils/utilityFunctions');\n\nfunction VPAIDIntegrator(player, settings) {\n if (!(this instanceof VPAIDIntegrator)) {\n return new VPAIDIntegrator(player);\n }\n\n this.VIEW_MODE = {\n NORMAL: 'normal',\n FULLSCREEN: \"fullscreen\",\n THUMBNAIL: \"thumbnail\"\n };\n this.player = player;\n this.containerEl = createVPAIDContainerEl(player);\n this.options = {\n responseTimeout: 5000,\n VPAID_VERSION: '2.0'\n };\n this.settings = settings;\n\n /*** Local functions ***/\n\n function createVPAIDContainerEl() {\n var containerEl = document.createElement('div');\n dom.addClass(containerEl, 'VPAID-container');\n player.el().insertBefore(containerEl, player.controlBar.el());\n return containerEl;\n\n }\n}\n\nVPAIDIntegrator.prototype.playAd = function playVPaidAd(vastResponse, callback) {\n if (!(vastResponse instanceof VASTResponse)) {\n return callback(new VASTError('on VASTIntegrator.playAd, missing required VASTResponse'));\n }\n\n var that = this;\n var player = this.player;\n var tech = this._findSupportedTech(vastResponse, this.settings);\n\n callback = callback || utilities.noop;\n\n this._adUnit = null;\n\n dom.addClass(player.el(), 'vjs-vpaid-ad');\n\n player.on('vast.adsCancel', triggerVpaidAdEnd);\n player.one('vpaid.adEnd', function(){\n player.off('vast.adsCancel', triggerVpaidAdEnd);\n removeAdUnit();\n });\n\n if (tech) {\n async.waterfall([\n function (next) {\n next(null, tech, vastResponse);\n },\n this._loadAdUnit.bind(this),\n this._playAdUnit.bind(this),\n this._finishPlaying.bind(this)\n\n ], adComplete);\n\n this._adUnit = {\n _paused: true,\n type: 'VPAID',\n pauseAd: function() {\n player.trigger('vpaid.pauseAd');\n player.pause(true);//we make sure that the video content gets stopped.\n },\n resumeAd: function() {\n player.trigger('vpaid.resumeAd');\n },\n isPaused: function() {\n return this._paused;\n },\n getSrc: function() {\n return tech.mediaFile;\n }\n };\n\n } else {\n var error = new VASTError('on VPAIDIntegrator.playAd, could not find a supported mediaFile', 403);\n adComplete(error, this._adUnit, vastResponse);\n }\n\n return this._adUnit;\n\n /*** Local functions ***/\n function adComplete(error, adUnit, vastResponse) {\n if (error && vastResponse) {\n that._trackError(vastResponse, error.code);\n }\n player.trigger('vpaid.adEnd');\n callback(error, vastResponse);\n }\n\n function triggerVpaidAdEnd(){\n player.trigger('vpaid.adEnd');\n }\n\n function removeAdUnit() {\n if (tech) {\n tech.unloadAdUnit();\n }\n dom.removeClass(player.el(), 'vjs-vpaid-ad');\n }\n};\n\nVPAIDIntegrator.prototype._findSupportedTech = function (vastResponse, settings) {\n if (!(vastResponse instanceof VASTResponse)) {\n return null;\n }\n\n var vpaidMediaFiles = vastResponse.mediaFiles.filter(vastUtil.isVPAID);\n var i, len, mediaFile, VPAIDTech;\n\n for (i = 0, len = vpaidMediaFiles.length; i < len; i += 1) {\n mediaFile = vpaidMediaFiles[i];\n VPAIDTech = vastUtil.findSupportedVPAIDTech(mediaFile.type);\n if (VPAIDTech) {\n return new VPAIDTech(mediaFile, settings);\n }\n }\n return null;\n};\n\nVPAIDIntegrator.prototype._createVPAIDAdUnitWrapper = function(adUnit, src, responseTimeout) {\n return new VPAIDAdUnitWrapper(adUnit, {src: src, responseTimeout: responseTimeout});\n};\n\nVPAIDIntegrator.prototype._loadAdUnit = function (tech, vastResponse, next) {\n var that = this;\n var player = this.player;\n var vjsTechEl = player.el().querySelector('.vjs-tech');\n var responseTimeout = this.settings.responseTimeout || this.options.responseTimeout;\n tech.loadAdUnit(this.containerEl, vjsTechEl, function (error, adUnit) {\n if (error) {\n return next(error, adUnit, vastResponse);\n }\n\n try {\n var WrappedAdUnit = that._createVPAIDAdUnitWrapper(adUnit, tech.mediaFile.src, responseTimeout);\n var techClass = 'vjs-' + tech.name + '-ad';\n dom.addClass(player.el(), techClass);\n player.one('vpaid.adEnd', function() {\n dom.removeClass(player.el(),techClass);\n });\n next(null, WrappedAdUnit, vastResponse);\n } catch (e) {\n next(e, adUnit, vastResponse);\n }\n });\n};\n\nVPAIDIntegrator.prototype._playAdUnit = function (adUnit, vastResponse, callback) {\n async.waterfall([\n function (next) {\n next(null, adUnit, vastResponse);\n },\n this._handshake.bind(this),\n this._initAd.bind(this),\n this._setupEvents.bind(this),\n this._addSkipButton.bind(this),\n this._linkPlayerControls.bind(this),\n this._startAd.bind(this)\n ], callback);\n};\n\nVPAIDIntegrator.prototype._handshake = function handshake(adUnit, vastResponse, next) {\n adUnit.handshakeVersion(this.options.VPAID_VERSION, function (error, version) {\n if (error) {\n return next(error, adUnit, vastResponse);\n }\n\n if (version && isSupportedVersion(version)) {\n return next(null, adUnit, vastResponse);\n }\n\n return next(new VASTError('on VPAIDIntegrator._handshake, unsupported version \"' + version + '\"'), adUnit, vastResponse);\n });\n\n function isSupportedVersion(version) {\n var majorNum = major(version);\n return majorNum >= 1 && majorNum <= 2;\n }\n\n function major(version) {\n var parts = version.split('.');\n return parseInt(parts[0], 10);\n }\n};\n\nVPAIDIntegrator.prototype._initAd = function (adUnit, vastResponse, next) {\n var tech = this.player.el().querySelector('.vjs-tech');\n var dimension = dom.getDimension(tech);\n adUnit.initAd(dimension.width, dimension.height, this.VIEW_MODE.NORMAL, -1, {AdParameters: vastResponse.adParameters || ''}, function (error) {\n next(error, adUnit, vastResponse);\n });\n};\n\nVPAIDIntegrator.prototype._createVASTTracker = function(adUnitSrc, vastResponse) {\n return new VASTTracker(adUnitSrc, vastResponse);\n};\n\nVPAIDIntegrator.prototype._setupEvents = function (adUnit, vastResponse, next) {\n var adUnitSrc = adUnit.options.src;\n var tracker = this._createVASTTracker(adUnitSrc, vastResponse);\n var player = this.player;\n var that = this;\n\n adUnit.on('AdSkipped', function () {\n player.trigger('vpaid.AdSkipped');\n tracker.trackSkip();\n });\n\n adUnit.on('AdImpression', function () {\n player.trigger('vpaid.AdImpression');\n tracker.trackImpressions();\n });\n\n adUnit.on('AdStarted', function () {\n player.trigger('vpaid.AdStarted');\n tracker.trackCreativeView();\n notifyPlayToPlayer();\n });\n\n adUnit.on('AdVideoStart', function () {\n player.trigger('vpaid.AdVideoStart');\n tracker.trackStart();\n notifyPlayToPlayer();\n });\n\n adUnit.on('AdPlaying', function () {\n player.trigger('vpaid.AdPlaying');\n tracker.trackResume();\n notifyPlayToPlayer();\n });\n\n adUnit.on('AdPaused', function () {\n player.trigger('vpaid.AdPaused');\n tracker.trackPause();\n notifyPauseToPlayer();\n });\n\n function notifyPlayToPlayer(){\n if(that._adUnit && that._adUnit.isPaused()){\n that._adUnit._paused = false;\n }\n player.trigger('play');\n\n }\n\n function notifyPauseToPlayer() {\n if(that._adUnit){\n that._adUnit._paused = true;\n }\n player.trigger('pause');\n }\n\n adUnit.on('AdVideoFirstQuartile', function () {\n player.trigger('vpaid.AdVideoFirstQuartile');\n tracker.trackFirstQuartile();\n });\n\n adUnit.on('AdVideoMidpoint', function () {\n player.trigger('vpaid.AdVideoMidpoint');\n tracker.trackMidpoint();\n });\n\n adUnit.on('AdVideoThirdQuartile', function () {\n player.trigger('vpaid.AdVideoThirdQuartile');\n tracker.trackThirdQuartile();\n });\n\n adUnit.on('AdVideoComplete', function () {\n player.trigger('vpaid.AdVideoComplete');\n tracker.trackComplete();\n });\n\n adUnit.on('AdClickThru', function (data) {\n player.trigger('vpaid.AdClickThru');\n var url = data.url;\n var playerHandles = data.playerHandles;\n var clickThruUrl = utilities.isNotEmptyString(url) ? url : generateClickThroughURL(vastResponse.clickThrough);\n\n tracker.trackClick();\n if (playerHandles && clickThruUrl) {\n window.open(clickThruUrl, '_blank');\n }\n\n function generateClickThroughURL(clickThroughMacro) {\n var variables = {\n ASSETURI: adUnit.options.src,\n CONTENTPLAYHEAD: 0 //In VPAID there is no method to know the current time from the adUnit\n };\n\n return clickThroughMacro ? vastUtil.parseURLMacro(clickThroughMacro, variables) : null;\n }\n });\n\n adUnit.on('AdUserAcceptInvitation', function () {\n player.trigger('vpaid.AdUserAcceptInvitation');\n tracker.trackAcceptInvitation();\n tracker.trackAcceptInvitationLinear();\n });\n\n adUnit.on('AdUserClose', function () {\n player.trigger('vpaid.AdUserClose');\n tracker.trackClose();\n tracker.trackCloseLinear();\n });\n\n adUnit.on('AdUserMinimize', function () {\n player.trigger('vpaid.AdUserMinimize');\n tracker.trackCollapse();\n });\n\n adUnit.on('AdError', function () {\n player.trigger('vpaid.AdError');\n //NOTE: we track errors code 901, as noted in VAST 3.0\n tracker.trackErrorWithCode(901);\n });\n\n adUnit.on('AdVolumeChange', function () {\n player.trigger('vpaid.AdVolumeChange');\n var lastVolume = player.volume();\n adUnit.getAdVolume(function (error, currentVolume) {\n if (currentVolume === 0 && lastVolume > 0) {\n tracker.trackMute();\n }\n\n if (currentVolume > 0 && lastVolume === 0) {\n tracker.trackUnmute();\n }\n\n player.volume(currentVolume);\n });\n });\n\n var updateViewSize = resizeAd.bind(this, player, adUnit, this.VIEW_MODE);\n var updateViewSizeThrottled = utilities.throttle(updateViewSize, 100);\n var autoResize = this.settings.autoResize;\n\n if (autoResize) {\n dom.addEventListener(window, 'resize', updateViewSizeThrottled);\n dom.addEventListener(window, 'orientationchange', updateViewSizeThrottled);\n }\n\n player.on('vast.resize', updateViewSize);\n player.on('vpaid.pauseAd', pauseAdUnit);\n player.on('vpaid.resumeAd', resumeAdUnit);\n\n player.one('vpaid.adEnd', function () {\n player.off('vast.resize', updateViewSize);\n player.off('vpaid.pauseAd', pauseAdUnit);\n player.off('vpaid.resumeAd', resumeAdUnit);\n\n if (autoResize) {\n dom.removeEventListener(window, 'resize', updateViewSizeThrottled);\n dom.removeEventListener(window, 'orientationchange', updateViewSizeThrottled);\n }\n });\n\n next(null, adUnit, vastResponse);\n\n /*** Local Functions ***/\n function pauseAdUnit() {\n adUnit.pauseAd(utilities.noop);\n }\n\n function resumeAdUnit() {\n adUnit.resumeAd(utilities.noop);\n }\n};\n\nVPAIDIntegrator.prototype._addSkipButton = function (adUnit, vastResponse, next) {\n var skipButton;\n var player = this.player;\n\n adUnit.on('AdSkippableStateChange', updateSkipButtonState);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeSkipButton);\n\n next(null, adUnit, vastResponse);\n\n /*** Local function ***/\n function updateSkipButtonState() {\n player.trigger('vpaid.AdSkippableStateChange');\n adUnit.getAdSkippableState(function (error, isSkippable) {\n if (isSkippable) {\n if (!skipButton) {\n addSkipButton(player);\n }\n } else {\n removeSkipButton(player);\n }\n });\n }\n\n function addSkipButton(player) {\n skipButton = createSkipButton(player);\n player.el().appendChild(skipButton);\n }\n\n function removeSkipButton() {\n dom.remove(skipButton);\n skipButton = null;\n }\n\n function createSkipButton() {\n var skipButton = window.document.createElement(\"div\");\n dom.addClass(skipButton, \"vast-skip-button\");\n dom.addClass(skipButton, \"enabled\");\n skipButton.innerHTML = \"Skip ad\";\n\n skipButton.onclick = function (e) {\n adUnit.skipAd(utilities.noop);//We skip the adUnit\n\n //We prevent event propagation to avoid problems with the clickThrough and so on\n if (window.Event.prototype.stopPropagation !== undefined) {\n e.stopPropagation();\n } else {\n return false;\n }\n };\n\n return skipButton;\n }\n};\n\nVPAIDIntegrator.prototype._linkPlayerControls = function (adUnit, vastResponse, next) {\n var that = this;\n linkVolumeControl(this.player, adUnit);\n linkFullScreenControl(this.player, adUnit, this.VIEW_MODE);\n\n next(null, adUnit, vastResponse);\n\n /*** Local functions ***/\n function linkVolumeControl(player, adUnit) {\n player.on('volumechange', updateAdUnitVolume);\n adUnit.on('AdVolumeChange', updatePlayerVolume);\n\n player.one('vpaid.adEnd', function () {\n player.off('volumechange', updateAdUnitVolume);\n });\n\n\n /*** local functions ***/\n function updateAdUnitVolume() {\n var vol = player.muted() ? 0 : player.volume();\n adUnit.setAdVolume(vol, logError);\n }\n\n function updatePlayerVolume() {\n player.trigger('vpaid.AdVolumeChange');\n adUnit.getAdVolume(function (error, vol) {\n if (error) {\n logError(error);\n } else {\n player.volume(vol);\n }\n });\n }\n }\n\n function linkFullScreenControl(player, adUnit, VIEW_MODE) {\n var updateViewSize = resizeAd.bind(that, player, adUnit, VIEW_MODE);\n\n player.on('fullscreenchange', updateViewSize);\n\n player.one('vpaid.adEnd', function () {\n player.off('fullscreenchange', updateViewSize);\n });\n }\n};\n\nVPAIDIntegrator.prototype._startAd = function (adUnit, vastResponse, next) {\n var player = this.player;\n\n adUnit.startAd(function (error) {\n if (!error) {\n player.trigger('vast.adStart');\n }\n next(error, adUnit, vastResponse);\n });\n};\n\nVPAIDIntegrator.prototype._finishPlaying = function (adUnit, vastResponse, next) {\n var player = this.player;\n adUnit.on('AdStopped', function () {\n player.trigger('vpaid.AdStopped');\n finishPlayingAd(null);\n });\n\n adUnit.on('AdError', function (error) {\n var errMsg = error? error.message : 'on VPAIDIntegrator, error while waiting for the adUnit to finish playing';\n finishPlayingAd(new VASTError(errMsg));\n });\n\n /*** local functions ***/\n function finishPlayingAd(error) {\n next(error, adUnit, vastResponse);\n }\n};\n\nVPAIDIntegrator.prototype._trackError = function trackError(response, errorCode) {\n vastUtil.track(response.errorURLMacros, {ERRORCODE: errorCode || 901});\n};\n\nfunction resizeAd(player, adUnit, VIEW_MODE) {\n var tech = player.el().querySelector('.vjs-tech');\n var dimension = dom.getDimension(tech);\n var MODE = player.isFullscreen() ? VIEW_MODE.FULLSCREEN : VIEW_MODE.NORMAL;\n adUnit.resizeAd(dimension.width, dimension.height, MODE, logError);\n}\n\nfunction logError(error) {\n if (error && console && console.log) {\n console.log('ERROR: ' + error.message, error);\n }\n}\n\nmodule.exports = VPAIDIntegrator;","'use strict';\n\nvar dom = require('../../utils/dom');\n\nvar element = document.createElement('div');\nelement.className = 'vjs-ads-label vjs-control vjs-label-hidden';\nelement.innerHTML = 'Advertisement';\n\nvar AdsLabelFactory = function(baseComponent) {\n return {\n /** @constructor */\n init: function init(player, options) {\n options.el = element;\n baseComponent.call(this, player, options);\n\n // We asynchronously reposition the ads label element\n setTimeout(function () {\n var currentTimeComp = player.controlBar &&( player.controlBar.getChild(\"timerControls\") || player.controlBar.getChild(\"currentTimeDisplay\") );\n if(currentTimeComp) {\n player.controlBar.el().insertBefore(element, currentTimeComp.el());\n }\n dom.removeClass(element, 'vjs-label-hidden');\n }, 0);\n },\n\n el: function getElement() {\n return element;\n }\n };\n};\n\nmodule.exports = AdsLabelFactory;","'use strict';\n\nvar baseVideoJsComponent = videojs.getComponent('Component');\n\nvar AdsLabel = require('./ads-label')(baseVideoJsComponent);\n\nvideojs.registerComponent('AdsLabel', videojs.extend(baseVideoJsComponent, AdsLabel));\n","'use strict';\n\n/**\n * The component that shows a black screen until the ads plugin has decided if it can or it can not play the ad.\n *\n * Note: In case you wonder why instead of this black poster we don't just show the spinner loader.\n * IOS devices do not work well with animations and the browser chrashes from time to time That is why we chose to\n * have a secondary black poster.\n *\n * It also makes it much more easier for the users of the plugin since it does not change the default behaviour of the\n * spinner and the player works the same way with and without the plugin.\n *\n * @param {vjs.Player|Object} player\n * @param {Object=} options\n * @constructor\n */\nvar element = document.createElement('div');\n\nvar BlackPosterFactory = function(baseComponent) {\n return {\n /** @constructor */\n init: function init(player, options) {\n options.el = element;\n element.className = 'vjs-black-poster';\n baseComponent.call(this, player, options);\n\n var posterImg = player.getChild('posterImage');\n\n //We need to do it asynchronously to be sure that the black poster el is on the dom.\n setTimeout(function() {\n if(posterImg && player && player.el()) {\n player.el().insertBefore(element, posterImg.el());\n }\n }, 0);\n },\n el: function getElement() {\n return element;\n }\n };\n};\n\nmodule.exports = BlackPosterFactory;","'use strict';\n\nvar baseVideoJsComponent = videojs.getComponent('Component');\n\nvar BlackPoster = require('./black-poster')(baseVideoJsComponent);\n\nvideojs.registerComponent('BlackPoster', videojs.extend(baseVideoJsComponent, BlackPoster));\n","'use strict';\n\nvar VASTClient = require('../ads/vast/VASTClient');\nvar VASTError = require('../ads/vast/VASTError');\nvar vastUtil = require('../ads/vast/vastUtil');\n\nvar VASTIntegrator = require('../ads/vast/VASTIntegrator');\nvar VPAIDIntegrator = require('../ads/vpaid/VPAIDIntegrator');\n\nvar async = require('../utils/async');\nvar dom = require('../utils/dom');\nvar playerUtils = require('../utils/playerUtils');\nvar utilities = require('../utils/utilityFunctions');\n\nmodule.exports = function VASTPlugin(options) {\n var snapshot;\n var player = this;\n var vast = new VASTClient();\n var adsCanceled = false;\n var defaultOpts = {\n // maximum amount of time in ms to wait to receive `adsready` from the ad\n // implementation after play has been requested. Ad implementations are\n // expected to load any dynamic libraries and make any requests to determine\n // ad policies for a video during this time.\n timeout: 500,\n\n //TODO:finish this IOS FIX\n //Whenever you play an add on IOS, the native player kicks in and we loose control of it. On very heavy pages the 'play' event\n // May occur after the video content has already started. This is wrong if you want to play a preroll ad that needs to happen before the user\n // starts watching the content. To prevent this usec\n iosPrerollCancelTimeout: 2000,\n\n // maximun amount of time for the ad to actually start playing. If this timeout gets\n // triggered the ads will be cancelled\n adCancelTimeout: 3000,\n\n // Boolean flag that configures the player to play a new ad before the user sees the video again\n // the current video\n playAdAlways: false,\n\n // Flag to enable or disable the ads by default.\n adsEnabled: true,\n\n // Boolean flag to enable or disable the resize with window.resize or orientationchange\n autoResize: true,\n\n // Path to the VPAID flash ad's loader\n vpaidFlashLoaderPath: '/VPAIDFlash.swf'\n };\n\n var settings = utilities.extend({}, defaultOpts, options || {});\n\n if(utilities.isUndefined(settings.adTagUrl) && utilities.isDefined(settings.url)){\n settings.adTagUrl = settings.url;\n }\n\n if (utilities.isString(settings.adTagUrl)) {\n settings.adTagUrl = utilities.echoFn(settings.adTagUrl);\n }\n\n if (utilities.isDefined(settings.adTagXML) && !utilities.isFunction(settings.adTagXML)) {\n return trackAdError(new VASTError('on VideoJS VAST plugin, the passed adTagXML option does not contain a function'));\n }\n\n if (!utilities.isDefined(settings.adTagUrl) && !utilities.isFunction(settings.adTagXML)) {\n return trackAdError(new VASTError('on VideoJS VAST plugin, missing adTagUrl on options object'));\n }\n\n vastUtil.runFlashSupportCheck(settings.vpaidFlashLoaderPath);// Necessary step for VPAIDFLASHClient to work.\n\n playerUtils.prepareForAds(player);\n\n if (settings.playAdAlways) {\n // No matter what happens we play a new ad before the user sees the video again.\n player.on('vast.contentEnd', function () {\n setTimeout(function () {\n player.trigger('vast.reset');\n }, 0);\n });\n }\n\n player.on('vast.firstPlay', tryToPlayPrerollAd);\n\n player.on('vast.reset', function () {\n //If we are reseting the plugin, we don't want to restore the content\n snapshot = null;\n cancelAds();\n });\n\n player.vast = {\n isEnabled: function () {\n return settings.adsEnabled;\n },\n\n enable: function () {\n settings.adsEnabled = true;\n },\n\n disable: function () {\n settings.adsEnabled = false;\n }\n };\n\n return player.vast;\n\n /**** Local functions ****/\n function tryToPlayPrerollAd() {\n //We remove the poster to prevent flickering whenever the content starts playing\n playerUtils.removeNativePoster(player);\n\n playerUtils.once(player, ['vast.adsCancel', 'vast.adEnd'], function () {\n removeAdUnit();\n restoreVideoContent();\n });\n\n async.waterfall([\n checkAdsEnabled,\n preparePlayerForAd,\n startAdCancelTimeout,\n playPrerollAd\n ], function (error, response) {\n if (error) {\n trackAdError(error, response);\n } else {\n player.trigger('vast.adEnd');\n }\n });\n\n /*** Local functions ***/\n\n function removeAdUnit() {\n if (player.vast && player.vast.adUnit) {\n player.vast.adUnit = null; //We remove the adUnit\n }\n }\n\n function restoreVideoContent() {\n setupContentEvents();\n if (snapshot) {\n playerUtils.restorePlayerSnapshot(player, snapshot);\n snapshot = null;\n }\n }\n\n function setupContentEvents() {\n playerUtils.once(player, ['playing', 'vast.reset', 'vast.firstPlay'], function (evt) {\n if (evt.type !== 'playing') {\n return;\n }\n\n player.trigger('vast.contentStart');\n\n playerUtils.once(player, ['ended', 'vast.reset', 'vast.firstPlay'], function (evt) {\n if (evt.type === 'ended') {\n player.trigger('vast.contentEnd');\n }\n });\n });\n }\n\n function checkAdsEnabled(next) {\n if (settings.adsEnabled) {\n return next(null);\n }\n next(new VASTError('Ads are not enabled'));\n }\n\n function preparePlayerForAd(next) {\n if (canPlayPrerollAd()) {\n snapshot = playerUtils.getPlayerSnapshot(player);\n player.pause();\n addSpinnerIcon();\n\n if(player.paused()) {\n next(null);\n } else {\n playerUtils.once(player, ['playing'], function() {\n player.pause();\n next(null);\n });\n }\n } else {\n next(new VASTError('video content has been playing before preroll ad'));\n }\n }\n\n function canPlayPrerollAd() {\n return !utilities.isIPhone() || player.currentTime() <= settings.iosPrerollCancelTimeout;\n }\n\n function startAdCancelTimeout(next) {\n var adCancelTimeoutId;\n adsCanceled = false;\n\n adCancelTimeoutId = setTimeout(function () {\n trackAdError(new VASTError('timeout while waiting for the video to start playing', 402));\n }, settings.adCancelTimeout);\n\n playerUtils.once(player, ['vast.adStart', 'vast.adsCancel'], clearAdCancelTimeout);\n\n /*** local functions ***/\n function clearAdCancelTimeout() {\n if (adCancelTimeoutId) {\n clearTimeout(adCancelTimeoutId);\n adCancelTimeoutId = null;\n }\n }\n\n next(null);\n }\n\n function addSpinnerIcon() {\n dom.addClass(player.el(), 'vjs-vast-ad-loading');\n playerUtils.once(player, ['vast.adStart', 'vast.adsCancel'], removeSpinnerIcon);\n }\n\n function removeSpinnerIcon() {\n //IMPORTANT NOTE: We remove the spinnerIcon asynchronously to give time to the browser to start the video.\n // If we remove it synchronously we see a flash of the content video before the ad starts playing.\n setTimeout(function () {\n dom.removeClass(player.el(), 'vjs-vast-ad-loading');\n }, 100);\n }\n\n }\n\n function cancelAds() {\n player.trigger('vast.adsCancel');\n adsCanceled = true;\n }\n\n function playPrerollAd(callback) {\n async.waterfall([\n getVastResponse,\n playAd\n ], callback);\n }\n\n function getVastResponse(callback) {\n vast.getVASTResponse(settings.adTagUrl ? settings.adTagUrl() : settings.adTagXML, callback);\n }\n\n function playAd(vastResponse, callback) {\n //TODO: Find a better way to stop the play. The 'playPrerollWaterfall' ends in an inconsistent situation\n //If the state is not 'preroll?' it means the ads were canceled therefore, we break the waterfall\n if (adsCanceled) {\n return;\n }\n\n var adIntegrator = isVPAID(vastResponse) ? new VPAIDIntegrator(player, settings) : new VASTIntegrator(player);\n var adFinished = false;\n\n playerUtils.once(player, ['vast.adStart', 'vast.adsCancel'], function (evt) {\n if (evt.type === 'vast.adStart') {\n addAdsLabel();\n }\n });\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel'], removeAdsLabel);\n\n if (utilities.isIDevice()) {\n preventManualProgress();\n }\n\n player.vast.vastResponse = vastResponse;\n player.vast.adUnit = adIntegrator.playAd(vastResponse, callback);\n\n /*** Local functions ****/\n function addAdsLabel() {\n if (adFinished || player.controlBar.getChild('AdsLabel')) {\n return;\n }\n\n player.controlBar.addChild('AdsLabel');\n }\n\n function removeAdsLabel() {\n player.controlBar.removeChild('AdsLabel');\n adFinished = true;\n }\n\n function preventManualProgress() {\n //IOS video clock is very unreliable and we need a 3 seconds threshold to ensure that the user forwarded/rewound the ad\n var PROGRESS_THRESHOLD = 3;\n var previousTime = 0;\n var skipad_attempts = 0;\n\n player.on('timeupdate', preventAdSeek);\n player.on('ended', preventAdSkip);\n\n playerUtils.once(player, ['vast.adEnd', 'vast.adsCancel', 'vast.adError'], stopPreventManualProgress);\n\n /*** Local functions ***/\n function preventAdSkip() {\n // Ignore ended event if the Ad time was not 'near' the end\n // and revert time to the previous 'valid' time\n if ((player.duration() - previousTime) > PROGRESS_THRESHOLD) {\n player.pause(true); // this reduce the video jitter if the IOS skip button is pressed\n player.play(true); // we need to trigger the play to put the video element back in a valid state\n player.currentTime(previousTime);\n }\n }\n\n function preventAdSeek() {\n var currentTime = player.currentTime();\n var progressDelta = Math.abs(currentTime - previousTime);\n if (progressDelta > PROGRESS_THRESHOLD) {\n skipad_attempts += 1;\n if (skipad_attempts >= 2) {\n player.pause(true);\n }\n player.currentTime(previousTime);\n } else {\n previousTime = currentTime;\n }\n }\n\n function stopPreventManualProgress() {\n player.off('timeupdate', preventAdSeek);\n player.off('ended', preventAdSkip);\n }\n }\n }\n\n function trackAdError(error, vastResponse) {\n player.trigger({type: 'vast.adError', error: error});\n cancelAds();\n if (console && console.log) {\n console.log('AD ERROR:', error.message, error, vastResponse);\n }\n }\n\n function isVPAID(vastResponse) {\n var i, len;\n var mediaFiles = vastResponse.mediaFiles;\n for (i = 0, len = mediaFiles.length; i < len; i++) {\n if (vastUtil.isVPAID(mediaFiles[i])) {\n return true;\n }\n }\n return false;\n }\n};\n","//Small subset of async\n\nvar utilities = require('./utilityFunctions');\n\nvar async = {};\n\nasync.setImmediate = function (fn) {\n setTimeout(fn, 0);\n};\n\nasync.iterator = function (tasks) {\n var makeCallback = function (index) {\n var fn = function () {\n if (tasks.length) {\n tasks[index].apply(null, arguments);\n }\n return fn.next();\n };\n fn.next = function () {\n return (index < tasks.length - 1) ? makeCallback(index + 1) : null;\n };\n return fn;\n };\n return makeCallback(0);\n};\n\n\nasync.waterfall = function (tasks, callback) {\n callback = callback || function () { };\n if (!utilities.isArray(tasks)) {\n var err = new Error('First argument to waterfall must be an array of functions');\n return callback(err);\n }\n if (!tasks.length) {\n return callback();\n }\n var wrapIterator = function (iterator) {\n return function (err) {\n if (err) {\n callback.apply(null, arguments);\n callback = function () {\n };\n }\n else {\n var args = Array.prototype.slice.call(arguments, 1);\n var next = iterator.next();\n if (next) {\n args.push(wrapIterator(next));\n }\n else {\n args.push(callback);\n }\n async.setImmediate(function () {\n iterator.apply(null, args);\n });\n }\n };\n };\n wrapIterator(async.iterator(tasks))();\n};\n\nasync.when = function (condition, callback) {\n if (!utilities.isFunction(callback)) {\n throw new Error(\"async.when error: missing callback argument\");\n }\n\n var isAllowed = utilities.isFunction(condition) ? condition : function () {\n return !!condition;\n };\n\n return function () {\n var args = utilities.arrayLikeObjToArray(arguments);\n var next = args.pop();\n\n if (isAllowed.apply(null, args)) {\n return callback.apply(this, arguments);\n }\n\n args.unshift(null);\n return next.apply(null, args);\n };\n};\n\nmodule.exports = async;\n\n","'use strict';\n\nvar utilities = require('./utilityFunctions');\n\nvar dom = {};\n\ndom.isVisible = function isVisible(el) {\n var style = window.getComputedStyle(el);\n return style.visibility !== 'hidden';\n};\n\ndom.isHidden = function isHidden(el) {\n var style = window.getComputedStyle(el);\n return style.display === 'none';\n};\n\ndom.isShown = function isShown(el) {\n return !dom.isHidden(el);\n};\n\ndom.hide = function hide(el) {\n el.__prev_style_display_ = el.style.display;\n el.style.display = 'none';\n};\n\ndom.show = function show(el) {\n if (dom.isHidden(el)) {\n el.style.display = el.__prev_style_display_;\n }\n el.__prev_style_display_ = undefined;\n};\n\ndom.hasClass = function hasClass(el, cssClass) {\n var classes, i, len;\n\n if (utilities.isNotEmptyString(cssClass)) {\n if (el.classList) {\n return el.classList.contains(cssClass);\n }\n\n classes = utilities.isString(el.getAttribute('class')) ? el.getAttribute('class').split(/\\s+/) : [];\n cssClass = (cssClass || '');\n\n for (i = 0, len = classes.length; i < len; i += 1) {\n if (classes[i] === cssClass) {\n return true;\n }\n }\n }\n return false;\n};\n\ndom.addClass = function (el, cssClass) {\n var classes;\n\n if (utilities.isNotEmptyString(cssClass)) {\n if (el.classList) {\n return el.classList.add(cssClass);\n }\n\n classes = utilities.isString(el.getAttribute('class')) ? el.getAttribute('class').split(/\\s+/) : [];\n if (utilities.isString(cssClass) && utilities.isNotEmptyString(cssClass.replace(/\\s+/, ''))) {\n classes.push(cssClass);\n el.setAttribute('class', classes.join(' '));\n }\n }\n};\n\ndom.removeClass = function (el, cssClass) {\n var classes;\n\n if (utilities.isNotEmptyString(cssClass)) {\n if (el.classList) {\n return el.classList.remove(cssClass);\n }\n\n classes = utilities.isString(el.getAttribute('class')) ? el.getAttribute('class').split(/\\s+/) : [];\n var newClasses = [];\n var i, len;\n if (utilities.isString(cssClass) && utilities.isNotEmptyString(cssClass.replace(/\\s+/, ''))) {\n\n for (i = 0, len = classes.length; i < len; i += 1) {\n if (cssClass !== classes[i]) {\n newClasses.push(classes[i]);\n }\n }\n el.setAttribute('class', newClasses.join(' '));\n }\n }\n};\n\ndom.addEventListener = function addEventListener(el, type, handler) {\n if(utilities.isArray(el)){\n utilities.forEach(el, function(e) {\n dom.addEventListener(e, type, handler);\n });\n return;\n }\n\n if(utilities.isArray(type)){\n utilities.forEach(type, function(t) {\n dom.addEventListener(el, t, handler);\n });\n return;\n }\n\n if (el.addEventListener) {\n el.addEventListener(type, handler, false);\n } else if (el.attachEvent) {\n // WARNING!!! this is a very naive implementation !\n // the event object that should be passed to the handler\n // would not be there for IE8\n // we should use \"window.event\" and then \"event.srcElement\"\n // instead of \"event.target\"\n el.attachEvent(\"on\" + type, handler);\n }\n};\n\ndom.removeEventListener = function removeEventListener(el, type, handler) {\n if(utilities.isArray(el)){\n utilities.forEach(el, function(e) {\n dom.removeEventListener(e, type, handler);\n });\n return;\n }\n\n if(utilities.isArray(type)){\n utilities.forEach(type, function(t) {\n dom.removeEventListener(el, t, handler);\n });\n return;\n }\n\n if (el.removeEventListener) {\n el.removeEventListener(type, handler, false);\n } else if (el.detachEvent) {\n el.detachEvent(\"on\" + type, handler);\n } else {\n el[\"on\" + type] = null;\n }\n};\n\ndom.dispatchEvent = function dispatchEvent(el, event) {\n if (el.dispatchEvent) {\n el.dispatchEvent(event);\n } else {\n el.fireEvent(\"on\" + event.eventType, event);\n }\n};\n\ndom.isDescendant = function isDescendant(parent, child) {\n var node = child.parentNode;\n while (node !== null) {\n if (node === parent) {\n return true;\n }\n node = node.parentNode;\n }\n return false;\n};\n\ndom.getTextContent = function getTextContent(el){\n return el.textContent || el.text;\n};\n\ndom.prependChild = function prependChild(parent, child) {\n if(child.parentNode){\n child.parentNode.removeChild(child);\n }\n return parent.insertBefore(child, parent.firstChild);\n};\n\ndom.remove = function removeNode(node){\n if(node && node.parentNode){\n node.parentNode.removeChild(node);\n }\n};\n\ndom.isDomElement = function isDomElement(o) {\n return o instanceof Element;\n};\n\ndom.click = function(el, handler) {\n dom.addEventListener(el, 'click', handler);\n};\n\ndom.once = function(el, type, handler) {\n function handlerWrap() {\n handler.apply(null, arguments);\n dom.removeEventListener(el, type, handlerWrap);\n }\n\n dom.addEventListener(el, type, handlerWrap);\n};\n\n//Note: there is no getBoundingClientRect on iPad so we need a fallback\ndom.getDimension = function getDimension(element) {\n var rect;\n\n //On IE9 and below getBoundingClientRect does not work consistently\n if(!utilities.isOldIE() && element.getBoundingClientRect) {\n rect = element.getBoundingClientRect();\n return {\n width: rect.width,\n height: rect.height\n };\n }\n\n return {\n width: element.offsetWidth,\n height: element.offsetHeight\n };\n};\n\nmodule.exports = dom;","'use strict';\n\nvar urlUtils = require('./urlUtils');\nvar utilities = require('./utilityFunctions');\n\nfunction HttpRequestError(message) {\n this.message = 'HttpRequest Error: ' + (message || '');\n}\nHttpRequestError.prototype = new Error();\nHttpRequestError.prototype.name = \"HttpRequest Error\";\n\nfunction HttpRequest(createXhr) {\n if (!utilities.isFunction(createXhr)) {\n throw new HttpRequestError('Missing XMLHttpRequest factory method');\n }\n\n this.createXhr = createXhr;\n}\n\nHttpRequest.prototype.run = function (method, url, callback, options) {\n sanityCheck(url, callback, options);\n var timeout, timeoutId;\n var xhr = this.createXhr();\n options = options || {};\n timeout = utilities.isNumber(options.timeout) ? options.timeout : 0;\n\n xhr.open(method, urlUtils.urlParts(url).href, true);\n\n if (options.headers) {\n setHeaders(xhr, options.headers);\n }\n\n if (options.withCredentials) {\n xhr.withCredentials = true;\n }\n\n xhr.onload = function () {\n var statusText, response, status;\n\n /**\n * The only way to do a secure request on IE8 and IE9 is with the XDomainRequest object. Unfortunately, microsoft is\n * so nice that decided that the status property and the 'getAllResponseHeaders' method where not needed so we have to\n * fake them. If the request gets done with an XDomainRequest instance, we will assume that there are no headers and\n * the status will always be 200. If you don't like it, DO NOT USE ANCIENT BROWSERS!!!\n *\n * For mor info go to: https://msdn.microsoft.com/en-us/library/cc288060(v=vs.85).aspx\n */\n if (!xhr.getAllResponseHeaders) {\n xhr.getAllResponseHeaders = function () {\n return null;\n };\n }\n\n if (!xhr.status) {\n xhr.status = 200;\n }\n\n if (utilities.isDefined(timeoutId)) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n\n statusText = xhr.statusText || '';\n\n // responseText is the old-school way of retrieving response (supported by IE8 & 9)\n // response/responseType properties were introduced in XHR Level2 spec (supported by IE10)\n response = ('response' in xhr) ? xhr.response : xhr.responseText;\n\n // normalize IE9 bug (http://bugs.jquery.com/ticket/1450)\n status = xhr.status === 1223 ? 204 : xhr.status;\n\n callback(\n status,\n response,\n xhr.getAllResponseHeaders(),\n statusText);\n };\n\n xhr.onerror = requestError;\n xhr.onabort = requestError;\n\n xhr.send();\n\n if (timeout > 0) {\n timeoutId = setTimeout(function () {\n xhr && xhr.abort();\n }, timeout);\n }\n\n function sanityCheck(url, callback, options) {\n if (!utilities.isString(url) || utilities.isEmptyString(url)) {\n throw new HttpRequestError(\"Invalid url '\" + url + \"'\");\n }\n\n if (!utilities.isFunction(callback)) {\n throw new HttpRequestError(\"Invalid handler '\" + callback + \"' for the http request\");\n }\n\n if (utilities.isDefined(options) && !utilities.isObject(options)) {\n throw new HttpRequestError(\"Invalid options map '\" + options + \"'\");\n }\n }\n\n function setHeaders(xhr, headers) {\n utilities.forEach(headers, function (value, key) {\n if (utilities.isDefined(value)) {\n xhr.setRequestHeader(key, value);\n }\n });\n }\n\n function requestError() {\n callback(-1, null, null, '');\n }\n};\n\nHttpRequest.prototype.get = function (url, callback, options) {\n this.run('GET', url, processResponse, options);\n\n function processResponse(status, response, headersString, statusText) {\n if (isSuccess(status)) {\n callback(null, response, status, headersString, statusText);\n } else {\n callback(new HttpRequestError(statusText), response, status, headersString, statusText);\n }\n }\n\n function isSuccess(status) {\n return 200 <= status && status < 300;\n }\n};\n\nfunction createXhr() {\n var xhr = new XMLHttpRequest();\n if (!(\"withCredentials\" in xhr)) {\n // XDomainRequest for IE.\n xhr = new XDomainRequest();\n }\n return xhr;\n}\n\nvar http = new HttpRequest(createXhr);\n\nmodule.exports = {\n http: http,\n HttpRequest: HttpRequest,\n HttpRequestError: HttpRequestError,\n createXhr: createXhr\n};\n","'use strict';\n\nvar dom = require('./dom');\nvar utilities = require('./utilityFunctions');\n\nvar playerUtils = {};\n\n/**\n * Returns an object that captures the portions of player state relevant to\n * video playback. The result of this function can be passed to\n * restorePlayerSnapshot with a player to return the player to the state it\n * was in when this function was invoked.\n * @param {object} player The videojs player object\n */\nplayerUtils.getPlayerSnapshot = function getPlayerSnapshot(player) {\n var tech = player.el().querySelector('.vjs-tech');\n\n var snapshot = {\n ended: player.ended(),\n src: player.currentSrc(),\n currentTime: player.currentTime(),\n type: player.currentType(),\n playing: !player.paused(),\n suppressedTracks: getSuppressedTracks(player)\n };\n\n if (tech) {\n snapshot.nativePoster = tech.poster;\n snapshot.style = tech.getAttribute('style');\n }\n return snapshot;\n\n /**** Local Functions ****/\n function getSuppressedTracks(player) {\n var tracks = player.remoteTextTracks ? player.remoteTextTracks() : [];\n\n if (tracks && utilities.isArray(tracks.tracks_)) {\n tracks = tracks.tracks_;\n }\n\n if (!utilities.isArray(tracks)) {\n tracks = [];\n }\n\n var suppressedTracks = [];\n tracks.forEach(function (track) {\n suppressedTracks.push({\n track: track,\n mode: track.mode\n });\n track.mode = 'disabled';\n });\n\n return suppressedTracks;\n }\n};\n\n/**\n * Attempts to modify the specified player so that its state is equivalent to\n * the state of the snapshot.\n * @param {object} snapshot - the player state to apply\n */\nplayerUtils.restorePlayerSnapshot = function restorePlayerSnapshot(player, snapshot) {\n var tech = player.el().querySelector('.vjs-tech');\n var attempts = 20; // the number of remaining attempts to restore the snapshot\n\n if (snapshot.nativePoster) {\n tech.poster = snapshot.nativePoster;\n }\n\n if ('style' in snapshot) {\n // overwrite all css style properties to restore state precisely\n tech.setAttribute('style', snapshot.style || '');\n }\n\n if (hasSrcChanged(player, snapshot)) {\n\n // on ios7, fiddling with textTracks too early will cause safari to crash\n player.one('contentloadedmetadata', restoreTracks);\n\n player.one('canplay', tryToResume);\n ensureCanplayEvtGetsFired();\n\n // if the src changed for ad playback, reset it\n player.src({src: snapshot.src, type: snapshot.type});\n\n // safari requires a call to `load` to pick up a changed source\n player.load();\n\n } else {\n restoreTracks();\n\n if (snapshot.playing) {\n player.play();\n }\n }\n\n /*** Local Functions ***/\n\n /**\n * Sometimes firefox does not trigger the 'canplay' evt.\n * This code ensure that it always gets triggered triggered.\n */\n function ensureCanplayEvtGetsFired() {\n var timeoutId = setTimeout(function() {\n player.trigger('canplay');\n }, 1000);\n\n player.one('canplay', function(){\n clearTimeout(timeoutId);\n });\n }\n\n /**\n * Determine whether the player needs to be restored to its state\n * before ad playback began. With a custom ad display or burned-in\n * ads, the content player state hasn't been modified and so no\n * restoration is required\n */\n function hasSrcChanged(player, snapshot) {\n if (player.src()) {\n return player.src() !== snapshot.src;\n }\n // the player was configured through source element children\n return player.currentSrc() !== snapshot.src;\n }\n\n function restoreTracks() {\n var suppressedTracks = snapshot.suppressedTracks;\n suppressedTracks.forEach(function (trackSnapshot) {\n trackSnapshot.track.mode = trackSnapshot.mode;\n });\n }\n\n /**\n * Determine if the video element has loaded enough of the snapshot source\n * to be ready to apply the rest of the state\n */\n function tryToResume() {\n\n // if some period of the video is seekable, resume playback\n // otherwise delay a bit and then check again unless we're out of attempts\n\n if (!playerUtils.isReadyToResume(player) && attempts--) {\n setTimeout(tryToResume, 50);\n } else {\n try {\n if(player.currentTime() !== snapshot.currentTime) {\n if (snapshot.playing) { // if needed restore playing status after seek completes\n player.one('seeked', function() {\n player.play();\n });\n }\n player.currentTime(snapshot.currentTime);\n\n } else if (snapshot.playing) {\n // if needed and no seek has been performed, restore playing status immediately\n player.play();\n }\n\n } catch (e) {\n videojs.log.warn('Failed to resume the content after an advertisement', e);\n }\n }\n }\n};\n\nplayerUtils.isReadyToResume = function (player) {\n\n if (player.readyState() > 1) {\n // some browsers and media aren't \"seekable\".\n // readyState greater than 1 allows for seeking without exceptions\n return true;\n }\n\n if (player.seekable() === undefined) {\n // if the player doesn't expose the seekable time ranges, try to\n // resume playback immediately\n return true;\n }\n\n if (player.seekable().length > 0) {\n // if some period of the video is seekable, resume playback\n return true;\n }\n\n return false;\n};\n\n/**\n * This function prepares the player to display ads.\n * Adding convenience events like the 'vast.firsPlay' that gets fired when the video is first played\n * and ads the blackPoster to the player to prevent content from being displayed before the preroll ad.\n *\n * @param player\n */\nplayerUtils.prepareForAds = function (player) {\n var blackPoster = player.addChild('blackPoster');\n var _firstPlay = true;\n var volumeSnapshot;\n\n\n monkeyPatchPlayerApi();\n\n player.on('play', tryToTriggerFirstPlay);\n player.on('vast.reset', resetFirstPlay);//Every time we change the sources we reset the first play.\n player.on('vast.firstPlay', restoreContentVolume);\n player.on('error', hideBlackPoster);//If there is an error in the player we remove the blackposter to show the err msg\n player.on('vast.adStart', hideBlackPoster);\n player.on('vast.adsCancel', hideBlackPoster);\n player.on('vast.adError', hideBlackPoster);\n player.on('vast.adStart', addStyles);\n player.on('vast.adEnd', removeStyles);\n player.on('vast.adsCancel', removeStyles);\n\n /*** Local Functions ***/\n\n /**\n What this function does is ugly and horrible and I should think twice before calling myself a good developer. With that said,\n it is the best solution I could find to mute the video until the 'play' event happens (on mobile devices) and the plugin can decide whether\n to play the ad or not.\n\n We also need this monkeypatch to be able to pause and resume an ad using the player's API\n\n If you have a better solution please do tell me.\n */\n function monkeyPatchPlayerApi() {\n\n /**\n * Monkey patch needed to handle firstPlay and resume of playing ad.\n *\n * @param callOrigPlay necessary flag to prevent infinite loop when you are restoring a VAST ad.\n * @returns {player}\n */\n var origPlay = player.play;\n player.play = function (callOrigPlay) {\n var that = this;\n\n if (isFirstPlay()) {\n firstPlay();\n } else {\n resume(callOrigPlay);\n }\n\n return this;\n\n /*** local functions ***/\n function firstPlay() {\n if (!utilities.isIPhone()) {\n volumeSnapshot = saveVolumeSnapshot();\n player.muted(true);\n }\n\n origPlay.apply(that, arguments);\n }\n\n function resume(callOrigPlay) {\n if (isAdPlaying() && !callOrigPlay) {\n player.vast.adUnit.resumeAd();\n } else {\n origPlay.apply(that, arguments);\n }\n }\n };\n\n\n /**\n * Needed monkey patch to handle pause of playing ad.\n *\n * @param callOrigPlay necessary flag to prevent infinite loop when you are pausing a VAST ad.\n * @returns {player}\n */\n var origPause = player.pause;\n player.pause = function (callOrigPause) {\n if (isAdPlaying() && !callOrigPause) {\n player.vast.adUnit.pauseAd();\n } else {\n origPause.apply(this, arguments);\n }\n return this;\n };\n\n\n /**\n * Needed monkey patch to handle paused state of the player when ads are playing.\n *\n * @param callOrigPlay necessary flag to prevent infinite loop when you are pausing a VAST ad.\n * @returns {player}\n */\n var origPaused = player.paused;\n player.paused = function (callOrigPaused) {\n if (isAdPlaying() && !callOrigPaused) {\n return player.vast.adUnit.isPaused();\n }\n return origPaused.apply(this, arguments);\n };\n }\n\n function isAdPlaying() {\n return player.vast && player.vast.adUnit;\n }\n\n function tryToTriggerFirstPlay() {\n if (isFirstPlay()) {\n _firstPlay = false;\n player.trigger('vast.firstPlay');\n }\n }\n\n function resetFirstPlay() {\n _firstPlay = true;\n blackPoster.show();\n restoreContentVolume();\n }\n\n function isFirstPlay() {\n return _firstPlay;\n }\n\n function saveVolumeSnapshot() {\n return {\n muted: player.muted(),\n volume: player.volume()\n };\n }\n\n function restoreContentVolume() {\n if (volumeSnapshot) {\n player.currentTime(0);\n restoreVolumeSnapshot(volumeSnapshot);\n volumeSnapshot = null;\n }\n }\n\n function restoreVolumeSnapshot(snapshot) {\n if (utilities.isObject(snapshot)) {\n player.volume(snapshot.volume);\n player.muted(snapshot.muted);\n }\n }\n\n function hideBlackPoster() {\n if (!dom.hasClass(blackPoster.el(), 'vjs-hidden')) {\n blackPoster.hide();\n }\n }\n\n function addStyles() {\n dom.addClass(player.el(), 'vjs-ad-playing');\n }\n\n function removeStyles() {\n dom.removeClass(player.el(), 'vjs-ad-playing');\n }\n};\n\n/**\n * Remove the poster attribute from the video element tech, if present. When\n * reusing a video element for multiple videos, the poster image will briefly\n * reappear while the new source loads. Removing the attribute ahead of time\n * prevents the poster from showing up between videos.\n * @param {object} player The videojs player object\n */\nplayerUtils.removeNativePoster = function (player) {\n var tech = player.el().querySelector('.vjs-tech');\n if (tech) {\n tech.removeAttribute('poster');\n }\n};\n\n/**\n * Helper function to listen to many events until one of them gets fired, then we\n * execute the handler and unsubscribe all the event listeners;\n *\n * @param player specific player from where to listen for the events\n * @param events array of events\n * @param handler function to execute once one of the events fires\n */\nplayerUtils.once = function once(player, events, handler) {\n function listener() {\n handler.apply(null, arguments);\n\n events.forEach(function (event) {\n player.off(event, listener);\n });\n }\n\n events.forEach(function (event) {\n player.on(event, listener);\n });\n};\n\n\nmodule.exports = playerUtils;","'use strict';\n\nvar utilities = require('./utilityFunctions');\n\n/**\n *\n * IMPORTANT NOTE: This function comes from angularJs and was originally called urlResolve\n * you can take a look at the original code here https://github.com/angular/angular.js/blob/master/src/ng/urlUtils.js\n *\n * Implementation Notes for non-IE browsers\n * ----------------------------------------\n * Assigning a URL to the href property of an anchor DOM node, even one attached to the DOM,\n * results both in the normalizing and parsing of the URL. Normalizing means that a relative\n * URL will be resolved into an absolute URL in the context of the application document.\n * Parsing means that the anchor node's host, hostname, protocol, port, pathname and related\n * properties are all populated to reflect the normalized URL. This approach has wide\n * compatibility - Safari 1+, Mozilla 1+, Opera 7+,e etc. See\n * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html\n *\n * Implementation Notes for IE\n * ---------------------------\n * IE >= 8 and <= 10 normalizes the URL when assigned to the anchor node similar to the other\n * browsers. However, the parsed components will not be set if the URL assigned did not specify\n * them. (e.g. if you assign a.href = \"foo\", then a.protocol, a.host, etc. will be empty.) We\n * work around that by performing the parsing in a 2nd step by taking a previously normalized\n * URL (e.g. by assigning to a.href) and assigning it a.href again. This correctly populates the\n * properties such as protocol, hostname, port, etc.\n *\n * IE7 does not normalize the URL when assigned to an anchor node. (Apparently, it does, if one\n * uses the inner HTML approach to assign the URL as part of an HTML snippet -\n * http://stackoverflow.com/a/472729) However, setting img[src] does normalize the URL.\n * Unfortunately, setting img[src] to something like \"javascript:foo\" on IE throws an exception.\n * Since the primary usage for normalizing URLs is to sanitize such URLs, we can't use that\n * method and IE < 8 is unsupported.\n *\n * References:\n * http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement\n * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html\n * http://url.spec.whatwg.org/#urlutils\n * https://github.com/angular/angular.js/pull/2902\n * http://james.padolsey.com/javascript/parsing-urls-with-the-dom/\n *\n * @kind function\n * @param {string} url The URL to be parsed.\n * @description Normalizes and parses a URL.\n * @returns {object} Returns the normalized URL as a dictionary.\n *\n * | member name | Description |\n * |---------------|----------------|\n * | href | A normalized version of the provided URL if it was not an absolute URL |\n * | protocol | The protocol including the trailing colon |\n * | host | The host and port (if the port is non-default) of the normalizedUrl |\n * | search | The search params, minus the question mark |\n * | hash | The hash string, minus the hash symbol\n * | hostname | The hostname\n * | port | The port, without \":\"\n * | pathname | The pathname, beginning with \"/\"\n *\n */\n\nvar urlParsingNode = document.createElement(\"a\");\n/**\n * documentMode is an IE-only property\n * http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx\n */\nvar msie = document.documentMode;\n\nfunction urlParts(url) {\n var href = url;\n\n if (msie) {\n // Normalize before parse. Refer Implementation Notes on why this is\n // done in two steps on IE.\n urlParsingNode.setAttribute(\"href\", href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: utilities.isNotEmptyString(urlParsingNode.port)? urlParsingNode.port: 80,\n pathname: (urlParsingNode.pathname.charAt(0) === '/')\n ? urlParsingNode.pathname\n : '/' + urlParsingNode.pathname\n };\n}\n\n\n/**\n * This function accepts a query string (search part of a url) and returns a dictionary with\n * the different key value pairs\n * @param {string} qs queryString\n */\nfunction queryStringToObj(qs, cond) {\n var pairs, qsObj;\n\n cond = utilities.isFunction(cond)? cond : function() {\n return true;\n };\n\n qs = qs.trim().replace(/^\\?/, '');\n pairs = qs.split('&');\n qsObj = {};\n\n utilities.forEach(pairs, function (pair) {\n var keyValue, key, value;\n if (pair !== '') {\n keyValue = pair.split('=');\n key = keyValue[0];\n value = keyValue[1];\n if(cond(key, value)){\n qsObj[key] = value;\n }\n }\n });\n\n return qsObj;\n}\n\n/**\n * This function accepts an object and serializes it into a query string without the leading '?'\n * @param obj\n * @returns {string}\n */\nfunction objToQueryString(obj) {\n var pairs = [];\n utilities.forEach(obj, function (value, key) {\n pairs.push(key + '=' + value);\n });\n return pairs.join('&');\n}\n\nmodule.exports = {\n urlParts: urlParts,\n queryStringToObj: queryStringToObj,\n objToQueryString: objToQueryString\n};\n","/*jshint unused:false */\n\"use strict\";\n\nvar NODE_TYPE_ELEMENT = 1;\nvar SNAKE_CASE_REGEXP = /[A-Z]/g;\nvar EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i;\n/*jslint maxlen: 500 */\nvar ISO8086_REGEXP = /^([\\+-]?\\d{4}(?!\\d{2}\\b))((-?)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))?|W([0-4]\\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6])))([T\\s]((([01]\\d|2[0-3])((:?)[0-5]\\d)?|24\\:?00)([\\.,]\\d+(?!:))?)?(\\17[0-5]\\d([\\.,]\\d+)?)?([zZ]|([\\+-])([01]\\d|2[0-3]):?([0-5]\\d)?)?)?)?$/;\n\n\nfunction noop(){ }\n\nfunction isNull(o) {\n return o === null;\n}\n\nfunction isDefined(o){\n return o !== undefined;\n}\n\nfunction isUndefined(o){\n return o === undefined;\n}\n\nfunction isObject(obj) {\n return typeof obj === 'object';\n}\n\nfunction isFunction(str){\n return typeof str === 'function';\n}\n\nfunction isNumber(num){\n return typeof num === 'number';\n}\n\nfunction isWindow(obj) {\n return utilities.isObject(obj) && obj.window === obj;\n}\n\nfunction isArray(array){\n return Object.prototype.toString.call( array ) === '[object Array]';\n}\n\nfunction isArrayLike(obj) {\n if (obj === null || utilities.isWindow(obj) || utilities.isFunction(obj) || utilities.isUndefined(obj)) {\n return false;\n }\n\n var length = obj.length;\n\n if (obj.nodeType === NODE_TYPE_ELEMENT && length) {\n return true;\n }\n\n return utilities.isString(obj) || utilities.isArray(obj) || length === 0 ||\n typeof length === 'number' && length > 0 && (length - 1) in obj;\n}\n\nfunction isString(str){\n return typeof str === 'string';\n}\n\nfunction isEmptyString(str) {\n return utilities.isString(str) && str.length === 0;\n}\n\nfunction isNotEmptyString(str) {\n return utilities.isString(str) && str.length !== 0;\n}\n\nfunction arrayLikeObjToArray(args) {\n return Array.prototype.slice.call(args);\n}\n\nfunction forEach(obj, iterator, context) {\n var key, length;\n if (obj) {\n if (isFunction(obj)) {\n for (key in obj) {\n // Need to check if hasOwnProperty exists,\n // as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function\n if (key !== 'prototype' && key !== 'length' && key !== 'name' && (!obj.hasOwnProperty || obj.hasOwnProperty(key))) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n } else if (isArray(obj)) {\n var isPrimitive = typeof obj !== 'object';\n for (key = 0, length = obj.length; key < length; key++) {\n if (isPrimitive || key in obj) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n } else if (obj.forEach && obj.forEach !== forEach) {\n obj.forEach(iterator, context, obj);\n } else {\n for (key in obj) {\n if (obj.hasOwnProperty(key)) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n }\n }\n return obj;\n}\n\nfunction snake_case(name, separator) {\n separator = separator || '_';\n return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n}\n\nfunction isValidEmail(email){\n if(!utilities.isString(email)){\n return false;\n }\n\n return EMAIL_REGEXP.test(email.trim());\n}\n\nfunction extend (obj) {\n var arg, i, k;\n for (i = 1; i < arguments.length; i++) {\n arg = arguments[i];\n for (k in arg) {\n if (arg.hasOwnProperty(k)) {\n if(isObject(obj[k]) && !isNull(obj[k]) && isObject(arg[k])){\n obj[k] = extend({}, obj[k], arg[k]);\n }else {\n obj[k] = arg[k];\n }\n }\n }\n }\n return obj;\n}\n\nfunction capitalize(s){\n return s.charAt(0).toUpperCase() + s.slice(1);\n}\n\nfunction decapitalize(s) {\n return s.charAt(0).toLowerCase() + s.slice(1);\n}\n\n/**\n * This method works the same way array.prototype.map works but if the transformer returns undefine, then\n * it won't be added to the transformed Array.\n */\nfunction transformArray(array, transformer) {\n var transformedArray = [];\n\n array.forEach(function(item, index){\n var transformedItem = transformer(item, index);\n if(utilities.isDefined(transformedItem)) {\n transformedArray.push(transformedItem);\n }\n });\n\n return transformedArray;\n}\n\nfunction toFixedDigits(num, digits) {\n var formattedNum = num + '';\n digits = utilities.isNumber(digits) ? digits : 0;\n num = utilities.isNumber(num) ? num : parseInt(num, 10);\n if(utilities.isNumber(num) && !isNaN(num)){\n formattedNum = num + '';\n while(formattedNum.length < digits) {\n formattedNum = '0' + formattedNum;\n }\n return formattedNum;\n }\n return NaN + '';\n}\n\nfunction throttle(callback, delay) {\n var previousCall = new Date().getTime() - (delay + 1);\n return function() {\n var time = new Date().getTime();\n if ((time - previousCall) >= delay) {\n previousCall = time;\n callback.apply(this, arguments);\n }\n };\n}\n\nfunction debounce (callback, wait) {\n var timeoutId;\n\n return function (){\n if(timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(function(){\n callback.apply(this, arguments);\n timeoutId = undefined;\n }, wait);\n };\n}\n\n// a function designed to blow up the stack in a naive way\n// but it is ok for videoJs children components\nfunction treeSearch(root, getChildren, found){\n var children = getChildren(root);\n for (var i = 0; i < children.length; i++){\n if (found(children[i])) {\n return children[i];\n }\n else {\n var el = treeSearch(children[i], getChildren, found);\n if (el){\n return el;\n }\n }\n }\n}\n\nfunction echoFn(val) {\n return function () {\n return val;\n };\n}\n\n//Note: Supported formats come from http://www.w3.org/TR/NOTE-datetime\n// and the iso8601 regex comes from http://www.pelagodesign.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/\nfunction isISO8601(value) {\n if(utilities.isNumber(value)){\n value = value + ''; //we make sure that we are working with strings\n }\n\n if(!utilities.isString(value)){\n return false;\n }\n\n return ISO8086_REGEXP.test(value.trim());\n}\n\n/**\n * Checks if the Browser is IE9 and below\n * @returns {boolean}\n */\nfunction isOldIE() {\n var version = utilities.getInternetExplorerVersion(navigator);\n if (version === -1) {\n return false;\n }\n\n return version < 10;\n}\n\n/**\n * Returns the version of Internet Explorer or a -1 (indicating the use of another browser).\n * Source: https://msdn.microsoft.com/en-us/library/ms537509(v=vs.85).aspx\n * @returns {number} the version of Internet Explorer or a -1 (indicating the use of another browser).\n */\nfunction getInternetExplorerVersion(navigator) {\n var rv = -1;\n\n if (navigator.appName == 'Microsoft Internet Explorer') {\n var ua = navigator.userAgent;\n var re = new RegExp(\"MSIE ([0-9]{1,}[\\.0-9]{0,})\");\n var res = re.exec(ua);\n if (res !== null) {\n rv = parseFloat(res[1]);\n }\n }\n\n return rv;\n}\n\n/*** Mobile Utility functions ***/\nfunction isIDevice() {\n return /iP(hone|ad)/.test(utilities._UA);\n}\n\nfunction isMobile() {\n return /iP(hone|ad|od)|Android|Windows Phone/.test(utilities._UA);\n}\n\nfunction isIPhone() {\n return /iP(hone|od)/.test(utilities._UA);\n}\n\nfunction isAndroid() {\n return /Android/.test(utilities._UA);\n}\n\nvar utilities = {\n _UA: navigator.userAgent,\n noop: noop,\n isNull: isNull,\n isDefined: isDefined,\n isUndefined: isUndefined,\n isObject: isObject,\n isFunction: isFunction,\n isNumber: isNumber,\n isWindow: isWindow,\n isArray: isArray,\n isArrayLike: isArrayLike,\n isString: isString,\n isEmptyString: isEmptyString,\n isNotEmptyString: isNotEmptyString,\n arrayLikeObjToArray: arrayLikeObjToArray,\n forEach: forEach,\n snake_case: snake_case,\n isValidEmail: isValidEmail,\n extend: extend,\n capitalize: capitalize,\n decapitalize: decapitalize,\n transformArray: transformArray,\n toFixedDigits: toFixedDigits,\n throttle: throttle,\n debounce: debounce,\n treeSearch: treeSearch,\n echoFn: echoFn,\n isISO8601: isISO8601,\n isOldIE: isOldIE,\n getInternetExplorerVersion: getInternetExplorerVersion,\n isIDevice: isIDevice,\n isMobile: isMobile,\n isIPhone: isIPhone,\n isAndroid: isAndroid\n};\n\nmodule.exports = utilities;","'use strict';\n\nvar utilities = require('./utilityFunctions');\n\nvar xml = {};\n\nxml.strToXMLDoc = function strToXMLDoc(stringContainingXMLSource){\n //IE 8\n if(typeof window.DOMParser === 'undefined'){\n var xmlDocument = new ActiveXObject('Microsoft.XMLDOM');\n xmlDocument.async = false;\n xmlDocument.loadXML(stringContainingXMLSource);\n return xmlDocument;\n }\n\n return parseString(stringContainingXMLSource);\n\n function parseString(stringContainingXMLSource){\n var parser = new DOMParser();\n var parsedDocument;\n\n //Note: This try catch is to deal with the fact that on IE parser.parseFromString does throw an error but the rest of the browsers don't.\n try {\n parsedDocument = parser.parseFromString(stringContainingXMLSource, \"application/xml\");\n\n if(isParseError(parsedDocument) || utilities.isEmptyString(stringContainingXMLSource)){\n throw new Error();\n }\n }catch(e){\n throw new Error(\"xml.strToXMLDOC: Error parsing the string: '\" + stringContainingXMLSource + \"'\");\n }\n\n return parsedDocument;\n }\n\n function isParseError(parsedDocument) {\n try { // parser and parsererrorNS could be cached on startup for efficiency\n var parser = new DOMParser(),\n erroneousParse = parser.parseFromString('INVALID', 'text/xml'),\n parsererrorNS = erroneousParse.getElementsByTagName(\"parsererror\")[0].namespaceURI;\n\n if (parsererrorNS === 'http://www.w3.org/1999/xhtml') {\n // In PhantomJS the parseerror element doesn't seem to have a special namespace, so we are just guessing here :(\n return parsedDocument.getElementsByTagName(\"parsererror\").length > 0;\n }\n\n return parsedDocument.getElementsByTagNameNS(parsererrorNS, 'parsererror').length > 0;\n } catch (e) {\n //Note on IE parseString throws an error by itself and it will never reach this code. Because it will have failed before\n }\n }\n};\n\nxml.parseText = function parseText (sValue) {\n if (/^\\s*$/.test(sValue)) { return null; }\n if (/^(?:true|false)$/i.test(sValue)) { return sValue.toLowerCase() === \"true\"; }\n if (isFinite(sValue)) { return parseFloat(sValue); }\n if (utilities.isISO8601(sValue)) { return new Date(sValue); }\n return sValue.trim();\n};\n\nxml.JXONTree = function JXONTree (oXMLParent) {\n var parseText = xml.parseText;\n\n //The document object is an especial object that it may miss some functions or attrs depending on the browser.\n //To prevent this problem with create the JXONTree using the root childNode which is a fully fleshed node on all supported\n //browsers.\n if(oXMLParent.documentElement){\n return new xml.JXONTree(oXMLParent.documentElement);\n }\n\n if (oXMLParent.hasChildNodes()) {\n var sCollectedTxt = \"\";\n for (var oNode, sProp, vContent, nItem = 0; nItem < oXMLParent.childNodes.length; nItem++) {\n oNode = oXMLParent.childNodes.item(nItem);\n /*jshint bitwise: false*/\n if ((oNode.nodeType - 1 | 1) === 3) { sCollectedTxt += oNode.nodeType === 3 ? oNode.nodeValue.trim() : oNode.nodeValue; }\n else if (oNode.nodeType === 1 && !oNode.prefix) {\n sProp = utilities.decapitalize(oNode.nodeName);\n vContent = new xml.JXONTree(oNode);\n if (this.hasOwnProperty(sProp)) {\n if (this[sProp].constructor !== Array) { this[sProp] = [this[sProp]]; }\n this[sProp].push(vContent);\n } else { this[sProp] = vContent; }\n }\n }\n if (sCollectedTxt) { this.keyValue = parseText(sCollectedTxt); }\n }\n\n //IE8 Stupid fix\n var hasAttr = typeof oXMLParent.hasAttributes === 'undefined'? oXMLParent.attributes.length > 0: oXMLParent.hasAttributes();\n if (hasAttr) {\n var oAttrib;\n for (var nAttrib = 0; nAttrib < oXMLParent.attributes.length; nAttrib++) {\n oAttrib = oXMLParent.attributes.item(nAttrib);\n this[\"@\" + utilities.decapitalize(oAttrib.name)] = parseText(oAttrib.value.trim());\n }\n }\n};\n\nxml.JXONTree.prototype.attr = function(attr) {\n return this['@' + utilities.decapitalize(attr)];\n};\n\nxml.toJXONTree = function toJXONTree(xmlString){\n var xmlDoc = xml.strToXMLDoc(xmlString);\n return new xml.JXONTree(xmlDoc);\n};\n\n/**\n * Helper function to extract the keyvalue of a JXONTree obj\n *\n * @param xmlObj {JXONTree}\n * return the key value or undefined;\n */\nxml.keyValue = function getKeyValue(xmlObj) {\n if(xmlObj){\n return xmlObj.keyValue;\n }\n return undefined;\n};\n\nxml.attr = function getAttrValue(xmlObj, attr) {\n if(xmlObj) {\n return xmlObj['@' + utilities.decapitalize(attr)];\n }\n return undefined;\n};\n\nxml.encode = function encodeXML(str) {\n return str.replace(/&/g, '&')\n .replace(//g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n};\n\nxml.decode = function decodeXML(str) {\n return str.replace(/'/g, \"'\")\n .replace(/"/g, '\"')\n .replace(/>/g, '>')\n .replace(/</g, '<')\n .replace(/&/g, '&');\n};\n\nmodule.exports = xml;","'use strict';\n\nrequire('./plugin/components/ads-label_5');\nrequire('./plugin/components/black-poster_5');\n\nvar videoJsVAST = require('./plugin/videojs.vast.vpaid');\n\nvideojs.plugin('vastClient', videoJsVAST);\n"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/bower.json b/bower.json index 83dbe22a..c01fd051 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "videojs-vast-vpaid", - "version": "1.2.0", + "version": "1.2.1", "authors": [ "Carlos Serrano " ], @@ -34,7 +34,7 @@ "frontend/demo/*" ], "dependencies": { - "VPAIDFLASHClient": "^0.1.11", + "VPAIDFLASHClient": "^0.1.12", "VPAIDHTML5Client": "^0.1.12" }, "devDependencies": { diff --git a/package.json b/package.json index 3da49954..82272ec7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "videojs-vast-vpaid", - "version": "1.2.0", + "version": "1.2.1", "authors": [ "Carlos Serrano " ],