(function(){var g={}; var _ = _ || {}
var f=function(window){var oY=function(a,b){this.m=a;this.f=b;this.a=new _.gi;this.h=!1},pY=function(a){function b(c){var d=GenericPlayerApi.call(this)||this;d.m=c;d.a=_.sk();return d}_.w(b,GenericPlayerApi);b.prototype.getPlayerName=function(){return _.xa};b.prototype.getVersion=function(){return _.ia};b.prototype.getOSName=function(){return this.a.os};b.prototype.getDeviceVersion=function(){return this.a.osVersion.name};b.prototype.getDeviceType=function(){return"browser"};b.prototype.getTotalDuration=function(){return this.m.isLive()?
0:1E3*this.m.getDuration()};b.prototype.getCurrentPosition=function(){return 1E3*this.m.getPosition()};b.prototype.getCurrentBitrate=function(){var c=this.m.getStats();return(c?c.streamBandwidth:0)/1E3};return new b(a)},qY=function(){this.l=this.f=this.a=this.h=this.m=null;this.o=new _.gi;this.j=!1},rY=function(a,b){var c=b.analyticsAddress||null,d=b.nanoCDNHost||null,e=b.broadpeakDomainNames||"",f=b.uuid||null;a.h||(a.h=SmartLib.getInstance(),a.h.init(c,d,e),typeof f===_.eg&&a.h.setUUID(f))},sY=
function(a,b){var c=b.customParameters||{};a.a=a.h.createStreamingSession();a.a.setOption(StreamingSessionOptions.SESSION_PRECACHE,!0);for(var d in c)a.a.setCustomParameter(d,c[d]);a.o.on(a.m,_.ie,a.Wj.bind(a));a.l=pY(a.m);a.a.attachPlayer(a.l)},tY=function(a,b){_.ki(a.o);a.f&&(a.f.release(),a.f=null);a.a&&(a.a.stopStreamingSession(b),a.a=null)},uY=function(){return!window.SmartLib||!window.GenericPlayerApi},vY=function(){};_.r=oY.prototype;
_.r.init=function(){var a=this.m,b=this.a;b.on(a,_.bg,this.Zj.bind(this));b.on(a,_.Yc,this.Xj.bind(this));b.on(a,"seek",this.Yj.bind(this))};_.r.Xj=function(a){a=a.detail;typeof a.bandwidth===_.k&&this.f.notifyLayerSwitch(a.bandwidth/1E3)};_.r.Zj=function(a){var b=this.m,c=this.f;a=a.detail;var d=a.currentState;a.previousState===_.yq&&c.notifyStallEnd(!b.isPaused());switch(d){case _.yq:c.notifyStallStart();break;case _.Hq:this.h?c.notifyResume():(c.notifyFirstImage(),this.h=!0);break;case _.Gq:c.notifyPause()}};
_.r.Yj=function(){var a=1E3*this.m.getPosition();this.f.notifySeek(a)};_.r.release=function(){this.a&&(_.ki(this.a),this.a=null)};_.w(qY,_.bw);_.r=qY.prototype;_.r.onPlayerCreated=function(a){this.m=a};_.r.onContentWillLoad=function(a,b){var c=this,d=a.getConfiguration().broadpeak;if(d){if(uY())return a.onError(new _.N(1,9,11E3));this.j=!0;rY(this,d);sY(this,d);return this.a.getURL(b.url).then(function(e){if(e.isError()){var f=e.getDetailedErrorCode();e=e.getDetailedErrorMessage();c.m.onError(new _.N(1,9,11001,{bpkErrorCode:f,message:e}));tY(c,void 0)}else b.url=e.getURL(),c.f=new oY(c.m,c.l),c.f.init()})}};
_.r.onContentLoaded=function(){!1!==this.j&&this.a.precacheEnded()};_.r.Wj=function(a){a=a.detail;if(7003===a.code)tY(this,SmartLib.BPFormatNotSupportedError);else if(a.severity===_.O)switch(a.category){case 3:tY(this,SmartLib.BPDecodingError);break;case 1:tY(this,SmartLib.BPNetworkingError);break;case 6:tY(this,SmartLib.BPAccessRightError);break;default:tY(this,SmartLib.BPUnspecifiedError)}};_.r.onPlayerWillRelease=function(){uY()||tY(this,SmartLib.BPSessionEndsNormally);this.j=!1};_.r.id=function(){return"broadpeak"};
_.I("clpp.broadpeak.BroadpeakPlugin",qY);qY.isSdkMissing=uY;qY.Id="broadpeak";vY.prototype.create=function(){return new qY};_.Yt(new vY);};
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
else{_=this.clpp._;(f.call(g,this));}
})();