@castlabs/prestoplay 6.2.6-rc-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README +48 -0
- package/cjs/cl.adobe.js +8 -0
- package/cjs/cl.airplay.js +8 -0
- package/cjs/cl.broadpeak.js +11 -0
- package/cjs/cl.cast.js +111 -0
- package/cjs/cl.conviva.js +37 -0
- package/cjs/cl.core.js +420 -0
- package/cjs/cl.crypto.js +15 -0
- package/cjs/cl.dash.js +73 -0
- package/cjs/cl.externs.js +3870 -0
- package/cjs/cl.freewheel.js +29 -0
- package/cjs/cl.hls.js +48 -0
- package/cjs/cl.hlssmpte.js +11 -0
- package/cjs/cl.htmlcue.js +35 -0
- package/cjs/cl.ima.js +28 -0
- package/cjs/cl.mse.js +263 -0
- package/cjs/cl.muxdata.js +16 -0
- package/cjs/cl.onboard.js +8 -0
- package/cjs/cl.persistent.js +19 -0
- package/cjs/cl.playlist.js +10 -0
- package/cjs/cl.smooth.js +75 -0
- package/cjs/cl.thumbnails.js +28 -0
- package/cjs/cl.tizen.js +76 -0
- package/cjs/cl.ttml.js +31 -0
- package/cjs/cl.verimatrix.js +10 -0
- package/cjs/cl.vimond.js +18 -0
- package/cjs/cl.vtt.js +19 -0
- package/cjs/cl.youbora.js +23 -0
- package/cjs/polyfill.min.js +47 -0
- package/cl.adobe.js +3 -0
- package/cl.airplay.js +3 -0
- package/cl.broadpeak.js +5 -0
- package/cl.cast.js +83 -0
- package/cl.conviva.js +27 -0
- package/cl.core.js +364 -0
- package/cl.crypto.js +9 -0
- package/cl.dash.js +62 -0
- package/cl.externs.js +3798 -0
- package/cl.freewheel.js +19 -0
- package/cl.hls.js +36 -0
- package/cl.hlssmpte.js +5 -0
- package/cl.htmlcue.js +24 -0
- package/cl.ima.js +16 -0
- package/cl.mse.js +224 -0
- package/cl.muxdata.js +9 -0
- package/cl.onboard.js +4 -0
- package/cl.persistent.js +11 -0
- package/cl.playlist.js +4 -0
- package/cl.smooth.js +58 -0
- package/cl.thumbnails.js +17 -0
- package/cl.tizen.js +57 -0
- package/cl.ttml.js +21 -0
- package/cl.verimatrix.js +4 -0
- package/cl.vimond.js +8 -0
- package/cl.vtt.js +12 -0
- package/cl.youbora.js +15 -0
- package/clpp.styles.css +147 -0
- package/package.json +43 -0
package/README
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# PRESTOplay for Web Apps
|
|
2
|
+
|
|
3
|
+
PRESTOplay for Web Apps is our SDK framework for deploying fantastic HTML/JavaScript
|
|
4
|
+
video players across web-enabled platforms.
|
|
5
|
+
|
|
6
|
+
You can start using PRESTOplay now for your local development, and
|
|
7
|
+
visit us [to get your license](https://castlabs.com/free-trials/prestoplay/).
|
|
8
|
+
|
|
9
|
+
Documentation, manuals, tutorials and demos can be found at [https://demo.castlabs.com](https://demo.castlabs.com).
|
|
10
|
+
|
|
11
|
+
## Installation and getting started
|
|
12
|
+
|
|
13
|
+
You can install the PRESTOplay SDK using a package manager such as `npm` or `yarn` using:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
npm install @castlabs/prestoplay
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Once installed, you can follow the [getting started guide](https://demo.castlabs.com/#/docs/getting_started) for a full
|
|
20
|
+
example, but here is how it would look like:
|
|
21
|
+
|
|
22
|
+
```javascript
|
|
23
|
+
const player = new clpp.Player("video");
|
|
24
|
+
player.use(clpp.dash.DashComponent);
|
|
25
|
+
|
|
26
|
+
player.load({
|
|
27
|
+
source: "https://content.players.castlabs.com/demos/clear-segmented/manifest.mpd"
|
|
28
|
+
})
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
There is also an accompanying stylesheet that can be found in:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
node_modules/@castlabs/prestoplay/clpp.styles.css
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## Support and Help
|
|
39
|
+
|
|
40
|
+
* [Documentation](https://demo.castlabs.com/#/docs)
|
|
41
|
+
* [Demo and Configuration](https://demo.castlabs.com/#/player/config)
|
|
42
|
+
* [Support and Helpdesk](https://castlabs.com/support/)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## License
|
|
46
|
+
|
|
47
|
+
* [Legal terms and conditions](https://castlabs.com/legal/)
|
|
48
|
+
|
package/cjs/cl.adobe.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
(function(){var g={}; var _ = _ || {}
|
|
2
|
+
var f=function(window){var LK=function(){this.l=this.f=null;this.a="";this.g=new _.C("clpp.adobe.AdobePlugin")},OK=function(a){a.f=new _.Vf;a.f.on(a.l,_.Ce,function(){return MK(a)});a.f.on(a.l,_.Be,function(){s.Media.play(a.a,a.l.getPosition())});a.f.on(a.l,_.jd,function(){return NK(a)});a.f.on(a.l,_.he,function(b){b=b.detail;switch(b.currentState){case _.Ml:a.a.length||NK(a);s.Media.play(a.a,a.l.getPosition());break;case _.Ll:case _.Dl:MK(a);break;case _.Fl:case _.yl:case _.Jl:a.g.info("Close session for "+a.a+" in player state "+
|
|
3
|
+
(b.currentState+".")),MK(a),s.Media.close(a.a),a.a=""}})},NK=function(a){var b=a.l.getLoadedSource();a.a=b?b.name||b.url:"";a.g.info("Open session for "+a.a+" with duration "+a.l.getDuration());s.Media.open(a.a,a.l.getDuration(),_.oa)},MK=function(a){s.Media.stop(a.a,a.l.getPosition())},PK=function(){};_.u(LK,_.So);LK.prototype.onPlayerCreated=function(a){window.s&&s.Media?(this.l=a,OK(this)):this.g.warn("Adobe API not available.")};
|
|
4
|
+
LK.prototype.onPlayerWillDestroy=function(){this.f&&(this.f.release(),this.f=null);this.l=null;this.a=""};LK.prototype.id=function(){return"adobe"};_.A("clpp.adobe.AdobeAnalyticsPlugin",LK);LK.Id="adobe";PK.prototype.create=function(){return new LK};_.fn(new PK);};
|
|
5
|
+
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
6
|
+
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
7
|
+
else{_=this.clpp._;(f.call(g,this));}
|
|
8
|
+
})();
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
(function(){var g={}; var _ = _ || {}
|
|
2
|
+
var f=function(window){var JK=function(){var a=this;this.a=this.l=null;this.j=this.f=this.h=!1;this.m=new _.lh(function(){a.l.play()["catch"](function(){})});this.g=new _.Vf},KK=function(){};_.u(JK,_.So);_.h=JK.prototype;_.h.onPlayerCreated=function(a){this.l=a;this.a=a.getSurface().getMedia()};_.h.onContentWillLoad=function(){this.a&&(this.g.on(this.a,"webkitplaybacktargetavailabilitychanged",this.Hi.bind(this)),this.g.on(this.a,"webkitcurrentplaybacktargetiswirelesschanged",this.gj.bind(this)))};
|
|
3
|
+
_.h.onPlayerWillRelease=function(){this.m.stop();this.g.release()};_.h.id=function(){return"airplay"};_.h.Hi=function(a){switch(a.availability){case "available":this.f=!0;break;case "not-available":this.f=!1}this.l.trigger(new _.D(_.Ob,{canCast:this.f}))};_.h.gj=function(){var a=(this.h=this.a.webkitCurrentPlaybackTargetIsWireless)?_.Nb:_.Mb;if(this.j||!this.l.isPaused()||this.l.getState()===_.Ml)this.j?this.l.play()["catch"](function(){}):this.m.Z(.01);this.l.trigger(new _.D(a))};_.h.bb=function(){return this.h};
|
|
4
|
+
_.h.Wd=function(){return this.f};_.h.xj=function(){this.f&&(this.j=!this.l.isPaused(),this.a.webkitShowPlaybackTargetPicker())};_.A("clpp.airplay.AirPlayPlugin",JK);JK.prototype.showCastMenu=JK.prototype.xj;JK.prototype.canCast=JK.prototype.Wd;JK.prototype.isCasting=JK.prototype.bb;JK.Id="airplay";KK.prototype.create=function(){return new JK};_.fn(new KK);};
|
|
5
|
+
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
6
|
+
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
7
|
+
else{_=this.clpp._;(f.call(g,this));}
|
|
8
|
+
})();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
(function(){var g={}; var _ = _ || {}
|
|
2
|
+
var f=function(window){var BK=function(a,b){this.l=a;this.f=b;this.a=new _.Vf;this.g=!1},CK=function(a){var b=GenericPlayerApi.call(this)||this;b.l=a;b.a=_.gi();return b},DK=function(){this.h=this.f=this.a=this.g=this.l=null;this.j=new _.Vf},EK=function(a,b){var c=b.analyticsAddress||null,d=b.nanoCDNHost||null,e=b.broadpeakDomainNames||"",f=b.uuid||null;a.g||(a.g=SmartLib.getInstance(),a.g.init(c,d,e),typeof f===_.le&&a.g.setUUID(f))},FK=function(a,b){var c=b.customParameters||{};a.a=a.g.createStreamingSession();for(var d in c)a.a.setCustomParameter(d,
|
|
3
|
+
c[d]);a.j.on(a.l,_.Wc,a.S.bind(a));a.h=new CK(a.l);a.a.attachPlayer(a.h)},GK=function(a,b){_.Yf(a.j);a.f&&(a.f.release(),a.f=null);a.a&&(a.a.stopStreamingSession(b),a.a=null)},HK=function(){return!window.SmartLib||!window.GenericPlayerApi},IK=function(){};_.h=BK.prototype;_.h.init=function(){var a=this.l,b=this.a;b.on(a,_.he,this.Jg.bind(this));b.on(a,_.gc,this.Hg.bind(this));b.on(a,"seek",this.Ig.bind(this))};
|
|
4
|
+
_.h.Hg=function(a){a=a.detail;typeof a.bandwidth===_.zd&&this.f.notifyLayerSwitch(a.bandwidth/1E3)};_.h.Jg=function(a){var b=this.l,c=this.f;a=a.detail;var d=a.currentState;a.previousState===_.Dl&&c.notifyStallEnd(!b.isPaused());switch(d){case _.Dl:c.notifyStallStart();break;case _.Ml:this.g?c.notifyResume():(c.notifyFirstImage(),this.g=!0);break;case _.Ll:c.notifyPause()}};_.h.Ig=function(){var a=1E3*this.l.getPosition();this.f.notifySeek(a)};_.h.release=function(){this.a&&(_.Yf(this.a),this.a=null)};_.u(CK,GenericPlayerApi);_.h=CK.prototype;_.h.getPlayerName=function(){return _.oa};_.h.getVersion=function(){return _.da};_.h.getOSName=function(){return this.a.os};_.h.getDeviceVersion=function(){return this.a.osVersion.name};_.h.getDeviceType=function(){return"browser"};_.h.getTotalDuration=function(){return this.l.isLive()?0:1E3*this.l.getDuration()};_.h.getCurrentPosition=function(){return 1E3*this.l.getPosition()};
|
|
5
|
+
_.h.getCurrentBitrate=function(){var a=this.l.getStats();return(a?a.streamBandwidth:0)/1E3};_.u(DK,_.So);_.h=DK.prototype;_.h.onPlayerCreated=function(a){this.l=a};_.h.onContentWillLoad=function(a,b){var c=this,d=a.getConfiguration().broadpeak;if(d){if(HK())return a.onError(new _.J(1,9,11E3));EK(this,d);FK(this,d);return this.a.getURL(b.url).then(function(e){if(e.isError()){var f=e.getDetailedErrorCode();e=e.getDetailedErrorMessage();c.l.onError(new _.J(1,9,11001,{bpkErrorCode:f,message:e}));GK(c,void 0)}else b.url=e.getURL(),c.f=new BK(c.l,c.h),c.f.init()})}};
|
|
6
|
+
_.h.S=function(a){a=a.detail;if(7003===a.code)GK(this,SmartLib.BPFormatNotSupportedError);else if(a.severity===_.K)switch(a.category){case 3:GK(this,SmartLib.BPDecodingError);break;case 1:GK(this,SmartLib.BPNetworkingError);break;case 6:GK(this,SmartLib.BPAccessRightError);break;default:GK(this,SmartLib.BPUnspecifiedError)}};_.h.onPlayerWillRelease=function(){HK()||GK(this,SmartLib.BPSessionEndsNormally)};_.h.id=function(){return"broadpeak"};_.A("clpp.broadpeak.BroadpeakPlugin",DK);
|
|
7
|
+
DK.isSdkMissing=HK;DK.Id="broadpeak";IK.prototype.create=function(){return new DK};_.fn(new IK);};
|
|
8
|
+
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
9
|
+
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
10
|
+
else{_=this.clpp._;(f.call(g,this));}
|
|
11
|
+
})();
|
package/cjs/cl.cast.js
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
(function(){var g={}; var _ = _ || {}
|
|
2
|
+
var f=function(window){var YI="Cannot seek during ads playout.",ZI="Cannot switch track",$I="Media session does not exist.",aJ="No receivers available",bJ="Reset ABR functionality not available on cast.",cJ="SDK not yet ready",dJ="Sender is destroyed.",eJ="clpp.cast.CastProxy",fJ="clpp.cast.Player",gJ="clpp.cast.Receiver",hJ="urn:x-cast:castlabs",iJ="urn:x-cast:com.google.cast.media",jJ=function(a){return _.z(function(b){return 1==b.a?_.v(b,a.gc(_.Fd),2):_.v(b,a.gc(_.Ed),0)})},kJ=function(a,b){this.log=new _.C(b);this.a=
|
|
3
|
+
a;this.j=null;this.g=_.yl;this.m=_.zl;this.h=2;this.B=Date.now();this.A=-1},lJ=function(a){return JSON.stringify(a,function(b,c){if("license"!==b&&typeof c!==_.Yc){if(c instanceof Event){var d={},e;for(e in c){var f=c[e];typeof f===_.Ad?"detail"===e&&(d[e]=f):e in Event||(d[e]=f)}return d}return typeof c===_.zd?isNaN(c)?"NaN":isFinite(c)?c:0>c?"-Infinity":"Infinity":c}})},mJ=function(a){if(typeof a!==_.le)return a;try{return JSON.parse(a,function(b,c){return"NaN"===c?NaN:"-Infinity"===c?-Infinity:
|
|
4
|
+
"Infinity"===c?Infinity:c})}catch(b){return a}},nJ=function(a,b,c,d){var e,f,g,k,l,m,n,p;return _.z(function(q){if(1==q.a){if(b.includes(a.mimeType))return q["return"](a);g=f=e=null;for(k=0;k<b.length&&!f;)g=b[k++],f=_.ph(d,a.mimeType,g);if(!f||!g)return q.G(2);l=_.fh(a.url);return _.v(q,c.fetch(l).N,3)}2!=q.a&&(m=q.f)&&m.data&&(n=f.a(_.Q(m.data)),p=URL.createObjectURL(new Blob([n])),e={url:p,kind:a.kind,language:a.language,label:a.label,mimeType:g});return q["return"](e)})},oJ=function(a,b){if(window.chrome&&
|
|
5
|
+
chrome.cast&&chrome.cast.media){var c=chrome.cast.media.HlsSegmentFormat;var d=chrome.cast.media.HlsVideoSegmentFormat}else if(window.cast&&cast.framework&&cast.framework.messages)c=cast.framework.messages.HlsSegmentFormat,d=cast.framework.messages.HlsVideoSegmentFormat;else return;switch(a){case _.Ie:return d.FMP4;case _.He:return b===_.yg?d.MPEG2_TS:c.TS;case _.$b:return c.AAC;case _.ac:return c.AC3;case _.bc:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.cc:return c.FMP4}},pJ=function(a){kJ.call(this,
|
|
6
|
+
a,"clpp.cast.SenderStateManager");this.o=this.f=null;this.w=this.C.bind(this)},qJ=function(){this.h=new _.C("clpp.cast.SenderTrackManager");this.a=null;this.g=[];this.f={}},rJ=function(a){return(a=a.a?a.a.a:null)?a.activeTrackIds.map(function(b){return b.toString()}):[]},tJ=function(a,b){var c=rJ(a);return sJ(a,b).find(function(d){return c.includes(d.id)})||null},sJ=function(a,b){return a.g.filter(function(c){return c.type===b})},vJ=function(a,b,c){var d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=
|
|
7
|
+
[+c.id];if(b!==_.L){var e=a.ia();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);d.editTracksInfo(c,function(){a.f[b]=null;uJ(a,b)},function(f){a.f[b]=null;a.h.debug(ZI,f)})}else b===_.L&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,function(){uJ(a,b)},function(f){a.h.debug(ZI,f)}))},uJ=function(a,b){b===_.N?a.a.trigger(new _.D(_.Gh)):b===_.L&&a.a.trigger(new _.D(_.Hh))},zJ=function(a,b,c,d){_.Mh.call(this);this.m=new _.C(_.wc);this.ba=a;this.w=new _.nh(b);
|
|
8
|
+
this.$=c;this.ka=d;this.h=this.K=_.Ri();this.D=[];this.C=0;this.M=new _.ji;this.I=this.o=this.a=null;this.B=this.A=!1;this.Ga="";this.Ma=1E6;this.g=new qJ;this.g.Fb(this);this.j=new pJ(this);this.J=new _.Vf;this.f=null;this.H=new Set;this.T=this.Ki.bind(this);this.Ha=this.aj.bind(this);this.ca=this.Ui.bind(this);this.X=this.Oi.bind(this);this.P=null;window.cast||Object.defineProperty(window,"cast",{get:function(){return window.cast_},set:function(e){window.cast_=e;window.setTimeout(function(){wJ(!0)},
|
|
9
|
+
0)}});xJ(this);yJ.add(this)},AJ=function(a){var b,c;return _.z(function(d){if(1==d.a)return yJ["delete"](a),a.A&&(a.A=!1,b=cast.framework.CastContext.getInstance(),b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.T),b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.Ha)),c=[],a.g&&(c.push(a.g.destroy()),a.g=null),a.j&&(c.push(a.j.destroy()),a.j=null),_.v(d,Promise.all(c),2);a.B=!1;a.w&&(a.w.stop(),a.w=null);a.$=null;a.ka=null;_.w(d)})},
|
|
10
|
+
xJ=function(a){if(!a.A&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&cast.framework&&cast.framework.CastContext&&a.ba.length){a.A=!0;a.w.Pe();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.ba;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.T);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,
|
|
11
|
+
a.Ha);EJ&&a.w.Z(.02)}},OJ=function(a,b){JJ(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.ca);b.addMessageListener(hJ,a.X)},JJ=function(a,b){b!==a.a&&(a.a=b,a.a&&(a.J.release(),a.I=null,a.o=null,a.o=new cast.framework.RemotePlayer,a.I=new cast.framework.RemotePlayerController(a.o),a.J.on(a.I,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.Kg.bind(a)),a.g&&a.g.load(),a.j&&a.j.init(),a.trigger(new _.D(_.jd))))},PJ=function(a){return _.z(function(b){return a.bb()?
|
|
12
|
+
b.G(0):_.v(b,cast.framework.CastContext.getInstance().requestSession(),0)})},QJ=function(a,b){var c,d,e,f,g,k,l,m,n,p,q;return _.z(function(r){switch(r.a){case 1:return c=chrome.cast.media.StreamType,d=_.$o,_.v(r,PJ(a),2);case 2:if(!b)return r["return"]();e=cast.framework.CastContext.getInstance();f=e.getCurrentSession();g=new chrome.cast.media.MediaInfo(b.source.url,b.source.type);g.streamType=b.isLive?c.LIVE:c.BUFFERED;k=b;l=k.Ab;m=k.audioMimeType;g.hlsVideoSegmentFormat=oJ(l,d.VIDEO);g.hlsSegmentFormat=
|
|
13
|
+
oJ(m,d.AUDIO);if(!b.Ja){r.G(3);break}if(!a.P){r.G(4);break}return _.v(r,Promise.resolve(a.P(b.Ja)),5);case 5:if(n=r.f)b.Ja=n;case 4:a.h=b.Ja;a.D=_.Ql(a.h);a.C=a.D.findIndex(function(x){return x.url===b.source.url});if(!b.Ja.remoteTextTracks){r.G(6);break}return _.v(r,Promise.all(b.Ja.remoteTextTracks.map(a.Ph.bind(a))),7);case 7:p=r.f,g.tracks=p.filter(function(x){return x}),b.Ja.remoteTextTracks=void 0;case 6:delete b.Ja.autoplay,b.Ja.startTime=null,g.customData={playerConfiguration:lJ(b.Ja)};case 3:return b.source.name&&
|
|
14
|
+
a.Ed(b.source.name),a.f&&(g.metadata=a.f),q=new chrome.cast.media.LoadRequest(g),typeof b.autoplay===_.hc&&(q.autoplay=b.autoplay),typeof b.currentTime===_.zd&&(q.currentTime=b.currentTime),_.v(r,f.loadMedia(q),0)}})},RJ=function(a,b,c){c=void 0===c?0:c;var d,e;return _.z(function(f){(d=a.g.ia())&&d.language&&(a.h.preferredTextLanguage=d.language);(e=a.g.ha())&&e.language&&(a.h.preferredAudioLanguage=e.language);return _.v(f,QJ(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),autoplay:b,
|
|
15
|
+
Ja:a.h}),0)})},wJ=function(a){if(a){a=_.t(yJ);for(var b=a.next();!b.done;b=a.next())xJ(b.value)}},TJ=function(a,b,c){_.Mh.call(this);var d=this;this.f=a;this.h=b;this.j=typeof c===_.Yc?c:function(e,f){d.f&&e!==_.Fl&&e!==_.yl&&d.f.load(f)};this.a=SJ(this);this.g=new _.C(eJ);this.addDelegate(this.f)},SJ=function(a){return new zJ(a.h,function(){a.trigger(new _.D(_.nc))},function(b,c){var d=a.f.getConfiguration();d.source=c.source;d.autoplay=!1;d.startTime=c.currentTime?Math.max(c.currentTime-1,0):null;
|
|
16
|
+
d.ima&&d.startTime&&(d.ima.playAdsAfterTime=d.startTime);c.Ze&&(d.preferredAudioLanguage=c.Ze);c.hg&&(d.preferredTextLanguage=c.hg);_.Ym(a.f,null);a.trigger(new _.D("castingended"));a.j(b,d)},function(){return UJ(a)})},UJ=function(a){var b;return _.z(function(c){if(1==c.a)return a.trigger(new _.D(_.mc)),b=a.f.a,b!==a.a&&a.f&&a.a?_.v(c,a.f.release(),2):c["return"]();_.Ym(a.f,a.a);_.w(c)})},VJ=function(a){kJ.call(this,a,"clpp.cast.StateManager");this.I=this.Og.bind(this);this.H=this.Ng.bind(this);this.w=
|
|
17
|
+
this.Qi.bind(this);this.o=this.Ii.bind(this);this.K=this.Qg.bind(this);this.J=this.Pg.bind(this);this.M=this.dj.bind(this);this.D=this.Ti.bind(this);this.C=this.S.bind(this);this.f=this.Mg.bind(this)},WJ=function(a){this.Qb=a;this.a=this.f.bind(this)},XJ=function(){return[cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,cast.framework.events.EventType.TIMED_METADATA_CHANGED,cast.framework.events.EventType.TIMED_METADATA_ENTER,cast.framework.events.EventType.TIMED_METADATA_EXIT]},YJ=function(a){var b=
|
|
18
|
+
a.dashTimedMetadata,c=_.Ae;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.ze)?_.eg:_.cg,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b&&b.eventElement}},ZJ=function(){this.g=new _.C("clpp.cast.TrackManager");this.l=null;this.o=1E9;this.h=[];this.j=[];this.m=this.ij.bind(this);this.a=this.f=null},$J=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},bK=function(a){a.a=$J().getTextTracksManager();var b=a.a.getTracks();
|
|
19
|
+
a.j=aK(_.L,b)},cK=function(a,b,c,d){c=_.vh(c).filter(function(k){return k});var e=!1,f=[];b===_.N?f=a.getAudioTracks():b===_.L&&(f=a.ea());if(c=c.find(function(k){var l=_.rh(k);return f.some(function(m){m=_.rh(m.language||"");return _.sh(l,m)})})){var g=_.rh(c);c=f.filter(function(k){k=_.rh(k.language||"");return _.sh(g,k)});f=c.length?c:f;e=e||!!c.length}_.Zg(d)&&(c=f.filter(function(k){return k.roles.includes(d)}),f=c.length?c:f,e=e||!!c.length);e&&f[0]&&(e=f[0],a.g.info("Will select track",e),
|
|
20
|
+
b===_.N?a.ma(e):b===_.L&&a.ua(e))},aK=function(a,b){for(var c=[],d=_.t(b),e=d.next();!e.done;e=d.next()){e=e.value;var f=new _.wg(e.trackId.toString(),a);f.roles=e.roles||[];f.kind=e.subtype||null;f.language=e.language||null;f.label=e.name||null;f.src=e.trackContentId||null;f.mimeType=e.trackContentType||null;e.customData&&(f.mimeType=e.customData.mimeType||f.mimeType,f.src=e.customData.url||f.src);f.renditions.push(new _.Dg(f.id,f));c.push(f)}return c},dK=function(){_.Mh.call(this);this.C=new _.C(fJ);
|
|
21
|
+
this.g=this.o=_.Ri();this.w=null;this.j=-1;this.D=new _.ji;this.f=this.m=this.h=this.a=this.A=null;this.B=!1},eK=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},hK=function(a,b){function c(){b.protectionSystem=cast.framework.ContentProtection.NONE;b.licenseUrl=void 0;b.licenseRequestHandler=void 0;b.licenseHandler=void 0}if(a&&a.drm){var d=a.drm,e=_.rj(d);if(e){var f=[_.Ec];_.Ql(a)[0].type!==_.Wb&&f.unshift(_.Fc);d.preferredDrmSystem===_.Ec&&f.reverse();for(var g,
|
|
22
|
+
k;f.length&&!k;)g=f.shift(),k=e.Wa[g];k?(d=g===_.Fc?cast.framework.ContentProtection.WIDEVINE:g===_.Ec?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=d,b.licenseUrl=k.licenseUrl,d={ldlDelay:0,customData:{}},fK(b,k,a,d),gK(b,k,a,d)):c()}else c()}else c()},fK=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=function(e){var f=_.fh(e.url);e.headers&&(f.headers=e.headers);f.body=e.content;f.allowCrossSiteCredentials=e.withCredentials;b.modifiers.licenseRequest(c,
|
|
23
|
+
f,d);e.url=f.uris[0];e.headers=f.headers;e.content=f.body;e.withCredentials=f.allowCrossSiteCredentials}:a.licenseRequestHandler=void 0},gK=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=function(e){e=_.gh({},e.buffer,200,"");b.modifiers.licenseResponse(c,e,d);return _.Q(e.data)}:a.licenseHandler=void 0},Z=function(a,b,c,d,e){this.a=a;this.f=b;this.h=typeof c===_.zd?c:1;this.j=typeof d===_.zd?d:1;this.g=typeof e===_.zd?e:0},iK=function(a){this.a=a},kK=function(a){this.l=a;this.a=null;
|
|
24
|
+
this.g=this.Rg.bind(this);this.f=[cast.framework.events.EventType.PLAYER_LOADING,cast.framework.events.EventType.BREAK_CLIP_LOADING,cast.framework.events.EventType.BREAK_STARTED,cast.framework.events.EventType.BREAK_ENDED,cast.framework.events.EventType.BREAK_CLIP_STARTED,cast.framework.events.EventType.BREAK_CLIP_ENDED,cast.framework.events.EventType.PLAYING,cast.framework.events.EventType.PAUSE,cast.framework.events.EventType.BUFFERING];jK().addEventListener(this.f,this.g)},nK=function(a,b,c){var d,
|
|
25
|
+
e,f,g,k,l,m;return _.z(function(n){if(1==n.a){d=b.adTagUrl;if(!d)return n["return"]();_.pf(n,2);lK=!1;e=_.fh(d);return _.v(n,c.fetch(e).N,4)}if(2!=n.a){if((f=n.f)&&f.data)if(g=_.Qg(f.data),k=new DOMParser,l=k.parseFromString(g,_.te),l.getElementsByTagName("vmap:VMAP").length)_.B("VMAP detected."),a.vmapAdsRequest=mK(g);else if(l.getElementsByTagName("VAST").length){_.B("VAST detected.");var p=new cast.framework.messages.BreakClip("bc1");p.vastAdsRequest=mK(g);var q=new cast.framework.messages.Break("b1",
|
|
26
|
+
[p.id],0);a.breakClips=[p];a.breaks=[q]}else _.B("Unsupported schema."),lK=!0;return _.qf(n,0)}m=_.rf(n);_.B("Failed to fetch an ad",m);lK=!0;_.w(n)})},mK=function(a){var b=new cast.framework.messages.VastAdsRequest;b.adsResponse=a;return b},jK=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},pK=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=oK(a,c))&&(d={ad:c});a.l.trigger(new _.D(b,d))}},qK=function(a,
|
|
27
|
+
b){var c=new _.J(1,10,10003,{errorType:b});a.l.onError(c)},oK=function(a,b){var c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){var d=null,e=null,f;typeof b.breakClipId===_.le&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===_.le&&(e=a.a.getBreakById(b.breakId),!e&&d&&(e=a.a.getBreaks().find(function(g){return g.breakClipIds.includes(d.id)})||null),e&&(f=a.a.getBreaks().filter(function(g){return 0<=g.position}).sort(function(g,k){return g.position-k.position}).findIndex(function(g){return g===
|
|
28
|
+
e})));c=new Z(d,e,b.index,b.total,f)}return c},rK=function(){this.a=!1;this.h=new _.C(gJ);this.f=this.l=null;this.g=new Set;this.A=this.Si.bind(this);this.w=this.Lg.bind(this);this.j=null;this.o=new _.Vf;this.m=null},tK=function(){return sK||(sK=new rK)},vK=function(a,b){a.h.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat,d=cast.framework.CastReceiverContext.getInstance();c=d.getPlayerManager().getMediaInformation().hlsVideoSegmentFormat===c.FMP4?_.Ie:_.He;b=b.replace(/\r\n|\r(?=[^\n]|$)/gm,
|
|
29
|
+
"\n");for(var e=b.split(/\n+/m),f=[],g=0;g<e.length;){var k=e[g].trim();if(e[g].startsWith("#EXT-X-STREAM-INF")){var l=uK(k,_.ka),m=uK(k,"RESOLUTION"),n=_.t([]),p=n.next().value;n=n.next().value;m&&(m=_.t(m.split("x").map(function(q){return+q})),p=m.next().value,n=m.next().value);if(!d.canDisplayType(c,l,p,n)){g+=2;continue}}f.push(k);++g}return f.join("\n")},uK=function(a,b){b+="\x3d";var c=a.indexOf(b);if(0<=c){var d=a.substring(c+b.length);d.startsWith('"')?(d=d.substring(1),d=d.substring(0,d.indexOf('"'))):
|
|
30
|
+
(c=d.indexOf(","),0<=c&&(d=d.substring(0,c)))}return d},wK=function(a){this.f=a;this.a=null;this.g=new _.Vf;this.h=[cast.framework.RemotePlayerEventType.IS_PLAYING_BREAK_CHANGED,cast.framework.RemotePlayerEventType.CURRENT_BREAK_CLIP_NUMBER_CHANGED,cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED]},yK=function(a,b){var c=null,d=xK(a);d&&(c={ad:d});a.f.trigger(new _.D(b,c))},xK=function(a){var b=null;if(a.a&&a.a.mediaInfo){b=a.a.mediaInfo;
|
|
31
|
+
var c=null,d=null,e=a.a.currentBreakClipNumber;if(b.breaks&&(c=b.breaks.find(function(k){return k.id===a.a.breakId})||null)){var f=c.breakClipIds.length;var g=0>=c.position?c.position:b.breaks.filter(function(k){return 0<=k.position}).sort(function(k,l){return k.position-l.position}).findIndex(function(k){return k===c})}b.breakClips&&(d=b.breakClips.find(function(k){return k.id===a.a.breakClipId})||null);b=new Z(d,c,e,f,g)}return b},zK=function(){},AK=function(){};_.h=kJ.prototype;_.h.release=function(){this.ga(_.yl)};
|
|
32
|
+
_.h.destroy=function(){this.j=this.a=null;return Promise.resolve()};_.h.getState=function(){return this.g};_.h.onError=function(a){a.severity===_.K&&this.ga(_.Jl)};
|
|
33
|
+
_.h.ga=function(a){if(a!==this.g)if(this.g===_.Jl&&a!==_.yl)this.log.debug("Player is in ERROR state and can not switch to",a);else{var b=Date.now();this.m=this.g;this.g=a;this.g===_.Dl?(this.A=b,this.a.trigger(new _.D(_.jc,{detail:{bufferedTimeMS:-1,reason:this.h}}))):this.m===_.Dl&&this.a.trigger(new _.D(_.ic,{detail:{bufferedTimeMS:b-this.A,reason:this.h}}));a={currentState:this.g,previousState:this.m,timeSinceLastStateChangeMS:b-this.B};this.B=b;this.j&&_.ol(this.j,this.g);this.a.trigger(new _.D(_.he,
|
|
34
|
+
{detail:a}))}};_.A("clpp.cast.CastUtils",function(){});_.u(pJ,kJ);pJ.prototype.init=function(){var a=this.a,b=a.a;b&&(this.f&&this.f.removeUpdateListener(this.w),this.f=b,this.f.addUpdateListener(this.w),this.o=a.o)};pJ.prototype.destroy=function(){var a=this;return _.z(function(b){a.f&&(a.f.removeUpdateListener(a.w),a.f=null);return _.v(b,kJ.prototype.destroy.call(a),0)})};pJ.prototype.ga=function(a){var b=this.a.o;b&&b.isPlayingBreak||kJ.prototype.ga.call(this,a)};
|
|
35
|
+
pJ.prototype.C=function(){if(this.f&&this.o&&!this.o.isPlayingBreak)switch(this.f.playerState){case chrome.cast.media.PlayerState.IDLE:switch(this.f.idleReason){case chrome.cast.media.IdleReason.FINISHED:this.ga(_.Fl);break;case chrome.cast.media.IdleReason.ERROR:this.ga(_.Jl);break;default:this.ga(_.yl)}break;case chrome.cast.media.PlayerState.PLAYING:this.ga(_.Ml);break;case chrome.cast.media.PlayerState.PAUSED:this.ga(_.Ll);break;case chrome.cast.media.PlayerState.BUFFERING:this.ga(_.Dl)}};_.u(qJ,_.P);_.h=qJ.prototype;_.h.Fb=function(a){this.a=a};_.h.release=function(){this.g=[];this.f={}};
|
|
36
|
+
_.h.load=function(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.g=(a=a.tracks)?a.map(function(b){switch(b.type){case chrome.cast.media.TrackType.VIDEO:var c=_.yg;break;case chrome.cast.media.TrackType.AUDIO:c=_.N;break;case chrome.cast.media.TrackType.TEXT:c=_.L}c=new _.wg(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;c.label=b.name;c.src=b.trackContentId;c.mimeType=b.trackContentType;b.customData&&(c.src=b.customData.url||c.src,c.mimeType=b.customData.mimeType||c.mimeType);
|
|
37
|
+
c.renditions.push(new _.Dg(c.id,c));return c}):[],this.a.trigger(new _.D(_.cp)))};_.h.destroy=function(){this.a=null};_.h.getVideoTracks=function(){return sJ(this,_.yg)};_.h.getAudioTracks=function(){return sJ(this,_.N)};_.h.ea=function(){return sJ(this,_.L)};_.h.fa=function(){var a=this.Ca();return a?a.renditions[0]:null};_.h.za=function(){var a=this.ha();return a?a.renditions[0]:null};_.h.Ba=function(){var a=this.ia();return a?a.renditions[0]:null};_.h.Pa=function(){return this.f[_.yg]||null};
|
|
38
|
+
_.h.Ya=function(){return this.f[_.N]||null};_.h.Za=function(){return this.f[_.L]||null};_.h.Ca=function(){return tJ(this,_.yg)};_.h.ha=function(){return tJ(this,_.N)};_.h.ia=function(){return tJ(this,_.L)};_.h.Va=function(a){vJ(this,_.yg,a)};_.h.ma=function(a){vJ(this,_.N,a)};_.h.ua=function(a){vJ(this,_.L,a)};_.h.Ua=function(a){this.Va(a&&a.track)};_.h.gb=function(a){this.ma(a&&a.track)};_.h.hb=function(a){this.ua(a&&a.track)};_.h.addTextTrack=function(){return _.z(function(a){_.w(a)})};_.h.ja=function(){return!0};
|
|
39
|
+
qJ.prototype.isAbrEnabled=qJ.prototype.ja;qJ.prototype.addTextTrack=qJ.prototype.addTextTrack;qJ.prototype.setTextRendition=qJ.prototype.hb;qJ.prototype.setAudioRendition=qJ.prototype.gb;qJ.prototype.setVideoRendition=qJ.prototype.Ua;qJ.prototype.setTextTrack=qJ.prototype.ua;qJ.prototype.setAudioTrack=qJ.prototype.ma;qJ.prototype.setVideoTrack=qJ.prototype.Va;qJ.prototype.getTextTrack=qJ.prototype.ia;qJ.prototype.getAudioTrack=qJ.prototype.ha;qJ.prototype.getVideoTrack=qJ.prototype.Ca;
|
|
40
|
+
qJ.prototype.getLoadingTextRendition=qJ.prototype.Za;qJ.prototype.getLoadingAudioRendition=qJ.prototype.Ya;qJ.prototype.getLoadingVideoRendition=qJ.prototype.Pa;qJ.prototype.getTextRendition=qJ.prototype.Ba;qJ.prototype.getAudioRendition=qJ.prototype.za;qJ.prototype.getVideoRendition=qJ.prototype.fa;qJ.prototype.getTextTracks=qJ.prototype.ea;qJ.prototype.getAudioTracks=qJ.prototype.getAudioTracks;qJ.prototype.getVideoTracks=qJ.prototype.getVideoTracks;_.u(zJ,_.Mh);_.h=zJ.prototype;_.h.init=function(a,b){this.h=this.K=b};_.h.unload=function(){var a=this;return new Promise(function(b,c){a.g&&a.g.release();a.a&&!a.a.idleReason||b();a.a.stop(null,b,c)})};_.h.release=function(){var a=this;return this.unload().then(function(){a.j&&a.j.release()})};_.h.destroy=function(){return _.z(function(a){_.w(a)})};_.h.bd=function(a){this.P=a};_.h.ac=function(){return this.A};_.h.bb=function(){return this.B};_.h.he=function(){return this.Ga};
|
|
41
|
+
_.h.sendMessage=function(a,b){var c=this,d,e,f;return _.z(function(g){switch(g.a){case 1:e=cast.framework.CastContext.getInstance().getCurrentSession();if(!e){d=new _.J(1,8,8004,void 0);g.G(2);break}_.pf(g,3);return _.v(g,e.sendMessage(a,lJ(b)),5);case 5:_.qf(g,2);break;case 3:f=_.rf(g),d=new _.J(1,8,8E3,{detailedErrorCode:f});case 2:if(d)c.onError(d);_.w(g)}})};
|
|
42
|
+
_.h.cast=function(){var a=this,b,c;return _.z(function(d){if(1==d.a){if(!a.ac())throw a.m.warn(cJ),new _.J(1,8,8001,void 0);if(!EJ)throw a.m.warn(aJ),new _.J(1,8,8002,void 0);if(a.bb())throw a.m.warn("Already casting"),new _.J(1,8,8003,void 0);_.pf(d,2);return _.v(d,PJ(a),4)}if(2!=d.a)return _.qf(d,0);b=_.rf(d);c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=b;throw new _.J(1,8,8E3,c);})};
|
|
43
|
+
_.h.ce=function(){this.bb()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)};_.h.addMessageListener=function(a){typeof a===_.Yc&&this.H.add(a)};_.h.removeMessageListener=function(a){typeof a===_.Yc&&this.H["delete"](a)};_.h.play=function(){var a=this;return this.isEnded()?RJ(this,!0):new Promise(function(b,c){if(!a.a)return c($I);a.a.play(null,b,c)})};_.h.pause=function(){var a=this;return new Promise(function(b,c){a.isEnded()&&b();if(!a.a)return c($I);a.a.pause(null,b,c)})};
|
|
44
|
+
_.h.isPaused=function(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED};_.h.isEnded=function(){return this.getState()===_.Fl};_.h.seek=function(a){var b=this;return this.isEnded()?RJ(this,!1,a):new Promise(function(c,d){b.a||d($I);b.o.isPlayingBreak&&d(YI);var e=new chrome.cast.media.SeekRequest;e.currentTime=a;b.trigger(new _.D(_.Ce));b.a.seek(e,function(){b.trigger(new _.D(_.Be));c()},d)})};_.h.getPosition=function(){return this.a&&this.a.getEstimatedTime()||0};
|
|
45
|
+
_.h.getDuration=function(){return this.a&&this.a.media&&typeof this.a.media.duration===_.zd?this.a.media.duration:0};_.h.setDrmCustomDataModifier=function(){};_.h.setCdnErrorCallback=function(){};_.h.getPlaybackRate=function(){return this.a&&this.a.playbackRate||0};_.h.setPlaybackRate=function(a){this.a&&0<a&&this.sendMessage(iJ,{type:"SET_PLAYBACK_RATE",requestId:Math.round(1E3*Math.random()),mediaSessionId:this.a.mediaSessionId,playbackRate:a})};_.h.getVolume=function(){return this.a&&this.a.volume.level};
|
|
46
|
+
_.h.setVolume=function(a){this.a&&0<=a&&1>=a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(a)),this.a.setVolume(a))};_.h.isMuted=function(){return this.a&&this.a.volume.muted};_.h.setMuted=function(a){this.a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(void 0,a)),this.a.setVolume(a))};_.h.getPresentationStartTime=function(){return this.a&&this.a.media.startAbsoluteTime||0};
|
|
47
|
+
_.h.getSeekRange=function(){var a={start:0,end:this.getDuration()};if(this.isLive()){var b=this.a.getEstimatedLiveSeekableRange();b&&typeof b.start===_.zd&&typeof b.end===_.zd&&(a={start:b.start,end:b.end})}return a};_.h.getState=function(){return this.j?this.j.getState():_.zl};_.h.getStats=function(){return this.a&&this.a.customData&&this.a.customData.stats?mJ(this.a.customData.stats):_.ul()};_.h.isLive=function(){return-1===this.getDuration()};
|
|
48
|
+
_.h.load=function(a){var b=this,c,d;return _.z(function(e){if(!b.ac())return b.m.warn(cJ),e["return"]();if(!EJ)return b.m.warn(aJ),e["return"]();b.D=_.Ql(a);_.Wi(a)&&(b.h=_.Vi(b.K,a));c=b.D[b.C];d={source:c,isLive:c.isLive,autoplay:b.h.autoplay,Ja:b.h,Ab:c.Ab,audioMimeType:c.audioMimeType};return _.v(e,QJ(b,d),0)})};_.h.getBufferInfo=function(){return new _.Lh};_.h.getTrackManager=function(){return this.g};_.h.getConfiguration=function(){return this.h};_.h.getSurface=function(){return null};
|
|
49
|
+
_.h.setNetworkEngine=function(a){this.M=a};_.h.getNetworkEngine=function(){return this.M};_.h.getSourceIndex=function(){return this.C};_.h.setSourceIndex=function(a){this.C=a};_.h.getLoadedSource=function(){return this.D[this.C]};_.h.getPeriods=function(){return[]};_.h.getDrmInfo=function(){return null};_.h.getTimelineCues=function(){return[]};_.h.resetAbr=function(){this.m.warn(bJ)};_.h.onError=function(a){if(a&&(this.trigger(new _.D(_.Wc,{detail:a})),this.j))this.j.onError(a)};_.h.namespace=function(){return _.wc};
|
|
50
|
+
_.h.canPlay=function(){return this.ac()?2:0};_.h.Le=function(a){this.f=a};_.h.Xd=function(){this.f=null};_.h.Ed=function(a){this.f||(this.f={metadataType:chrome.cast.media.MetadataType.GENERIC});this.f.title=a};_.h.Ke=function(a){this.f||(this.f={metadataType:chrome.cast.media.MetadataType.GENERIC});this.f.images=[{url:a}]};_.h.Je=function(a){this.f||(this.f={});this.f.metadataType=chrome.cast.media.MetadataType.MUSIC_TRACK;this.f.artist=a};
|
|
51
|
+
_.h.Me=function(a){this.f||(this.f={metadataType:chrome.cast.media.MetadataType.GENERIC});this.f.releaseDate=a};_.h.Ki=function(a){var b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;EJ=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.Ga=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.w.Pe()};
|
|
52
|
+
_.h.aj=function(a){this.m.debug("state: "+a.sessionState+", details:",a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.B=!0;OJ(this,a.session);break;case cast.framework.SessionState.SESSION_RESUMED:this.bb()||(this.B=!0,OJ(this,a.session),this.ka());break;case cast.framework.SessionState.SESSION_ENDED:if(this.bb()&&this.a){var b=this.a.media,c=this.g.ha(),d=this.g.ia();c=c&&c.language||void 0;d=d&&d.language||void 0;this.$(this.getState(),{source:{url:b.contentId,type:b.contentType,
|
|
53
|
+
isLive:b.streamType===chrome.cast.media.StreamType.LIVE},currentTime:this.getPosition(),hg:d,Ze:c})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.ca);a.session.removeMessageListener(hJ,this.X);this.B=!1;this.a=null;this.J.release();this.o=this.I=null}};_.h.Ui=function(a){this.m.debug("New media session",a.mediaSession);JJ(this,a.mediaSession)};_.h.Oi=function(a,b){if(a===hJ&&0<this.H.size){var c=mJ(b);this.H.forEach(function(d){return d(c)})}};
|
|
54
|
+
_.h.Kg=function(a){this.trigger(new _.D(_.ue,{currentTime:a.value}))};_.h.Ph=function(a){var b=this,c,d;return _.z(function(e){if(1==e.a)return c=null,_.v(e,nJ(a,[_.se,_.Vb],b.M,b.h),2);if(d=e.f)c=new chrome.cast.media.Track(b.Ma++,chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=d.label||null,c.trackContentId=d.url,c.trackContentType=d.mimeType,c.customData={mimeType:a.mimeType,url:a.url};return e["return"](c)})};_.h.getTextDisplayer=function(){return null};
|
|
55
|
+
zJ.prototype.getTextDisplayer=zJ.prototype.getTextDisplayer;zJ.prototype.getNetworkEngine=zJ.prototype.getNetworkEngine;zJ.prototype.setNetworkEngine=zJ.prototype.setNetworkEngine;var EJ=!1,yJ=new Set;window.__onGCastApiAvailable=wJ;_.u(TJ,_.Mh);_.h=TJ.prototype;_.h.destroy=function(){var a=this;return _.z(function(b){if(1==b.a)return a.a?_.v(b,AJ(a.a),3):b.G(2);2!=b.a&&(a.a=null);a.removeDelegate(a.f);_.w(b)})};_.h.Wd=function(){return!!this.a&&this.a.ac()&&EJ};_.h.bb=function(){return!!this.a&&this.a.bb()};_.h.he=function(){return this.a?this.a.he():""};_.h.bd=function(a){this.a&&this.a.bd(a)};
|
|
56
|
+
_.h.cast=function(a){var b=this,c,d,e;return _.z(function(f){switch(f.a){case 1:if(!b.a)return f["return"]();var g=null,k=b.f.getLoadedSource();if(k){var l=b.f.getTrackManager();g=l.getVideoTracks()[0];if(g&&g.mimeType)var m=g.mimeType;g=b.f.getConfiguration();var n=l.ha();if(n){if(n.mimeType)var p=n.mimeType;n.language&&(g.preferredAudioLanguage=n.language);n.roles.length&&(g.preferredAudioRole=n.roles[0])}if(l=l.ia())l.language&&(g.preferredTextLanguage=l.language),l.roles.length&&(g.preferredTextRole=
|
|
57
|
+
l.roles[0]);l=k&&typeof k.isLive===_.hc?k.isLive:b.f.isLive();g={source:k,isLive:l,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),Ab:m,audioMimeType:p,Ja:g}}c=g;_.pf(f,2);return _.v(f,b.a.cast(),4);case 4:return b.f&&b.a?_.v(f,UJ(b),5):f["return"]();case 5:if(!b.a)return f["return"]();c&&(c.autoplay=!b.f.isPaused());if(a)return _.v(f,b.f.load(a),7);if(b.a.a){f.G(7);break}return _.v(f,QJ(b.a,c),7);case 7:_.qf(f,0);break;case 2:d=_.rf(f),b.g.error("Error while trying to cast",
|
|
58
|
+
d),e=new _.D(_.Wc,{detail:d}),b.trigger(e),_.w(f)}})};_.h.ce=function(){this.a&&this.a.ce()};_.h.Gg=function(a){var b=this;return _.z(function(c){if(1==c.a){if(a===b.h)return c["return"]();b.h=a;return b.a?_.v(c,AJ(b.a),2):c.G(2)}b.a=SJ(b);_.w(c)})};_.h.sendMessage=function(a){var b=this;return _.z(function(c){return b.a?_.v(c,b.a.sendMessage(hJ,a),0):(b.g.warn(dJ),c["return"]())})};_.h.addMessageListener=function(a){this.a?this.a.addMessageListener(a):this.g.warn(dJ)};
|
|
59
|
+
_.h.removeMessageListener=function(a){this.a?this.a.removeMessageListener(a):this.g.warn(dJ)};_.h.Le=function(a){this.a&&this.a.Le(a)};_.h.Xd=function(){this.a&&this.a.Xd()};_.h.Ed=function(a){this.a&&this.a.Ed(a)};_.h.Ke=function(a){this.a&&this.a.Ke(a)};_.h.Je=function(a){this.a&&this.a.Je(a)};_.h.Me=function(a){this.a&&this.a.Me(a)};_.A(eJ,TJ);TJ.prototype.setContentReleaseDate=TJ.prototype.Me;TJ.prototype.setContentArtist=TJ.prototype.Je;TJ.prototype.setContentImage=TJ.prototype.Ke;
|
|
60
|
+
TJ.prototype.setContentTitle=TJ.prototype.Ed;TJ.prototype.clearContentMetadata=TJ.prototype.Xd;TJ.prototype.setContentMetadata=TJ.prototype.Le;TJ.prototype.removeMessageListener=TJ.prototype.removeMessageListener;TJ.prototype.addMessageListener=TJ.prototype.addMessageListener;TJ.prototype.sendMessage=TJ.prototype.sendMessage;TJ.prototype.changeReceiverId=TJ.prototype.Gg;TJ.prototype.forceDisconnect=TJ.prototype.ce;TJ.prototype.cast=TJ.prototype.cast;TJ.prototype.setPlayerConfigInterceptor=TJ.prototype.bd;
|
|
61
|
+
TJ.prototype.getReceiverName=TJ.prototype.he;TJ.prototype.isCasting=TJ.prototype.bb;TJ.prototype.canCast=TJ.prototype.Wd;TJ.prototype.destroy=TJ.prototype.destroy;_.u(VJ,kJ);_.h=VJ.prototype;
|
|
62
|
+
_.h.init=function(){var a=cast.framework.events.EventType,b=cast.framework.CastReceiverContext.getInstance().getPlayerManager();b.addEventListener(a.PLAYING,this.I);b.addEventListener(a.PAUSE,this.H);b.addEventListener(a.MEDIA_FINISHED,this.w);b.addEventListener(a.BUFFERING,this.o);b.addEventListener(a.SEEKING,this.K);b.addEventListener(a.SEEKED,this.J);b.addEventListener(a.STALLED,this.M);b.addEventListener(a.PLAYER_LOADING,this.D);b.addEventListener(a.ERROR,this.C);b.addEventListener(a.BITRATE_CHANGED,this.f)};
|
|
63
|
+
_.h.destroy=function(){var a=this,b,c;return _.z(function(d){b=cast.framework.events.EventType;c=cast.framework.CastReceiverContext.getInstance().getPlayerManager();c.removeEventListener(b.PLAYING,a.I);c.removeEventListener(b.PAUSE,a.H);c.removeEventListener(b.MEDIA_FINISHED,a.w);c.removeEventListener(b.BUFFERING,a.o);c.removeEventListener(b.SEEKING,a.K);c.removeEventListener(b.SEEKED,a.J);c.removeEventListener(b.STALLED,a.M);c.removeEventListener(b.PLAYER_LOADING,a.D);c.removeEventListener(b.ERROR,
|
|
64
|
+
a.C);c.removeEventListener(b.BITRATE_CHANGED,a.f);return _.v(d,kJ.prototype.destroy.call(a),0)})};_.h.Og=function(){this.a.trigger(new _.D(_.Pd));this.ga(_.Ml)};_.h.Ng=function(){this.ga(_.Ll)};_.h.Qi=function(){this.ga(_.Fl)};_.h.Ii=function(a){a.isBuffering?this.ga(_.Dl):(a=this.a.isPaused()?_.Ll:_.Ml,this.ga(a))};_.h.Qg=function(){this.h=1;this.a.trigger(new _.D(_.Ce))};_.h.Pg=function(){this.a.trigger(new _.D(_.Be))};_.h.dj=function(){this.h=2};_.h.Ti=function(){this.ga(_.Kl)};
|
|
65
|
+
_.h.Mg=function(a){var b=this.a.getStats();this.a.trigger(new _.D(_.gc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))};_.h.S=function(a){a=new _.J(_.K,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.a.trigger(new _.D(_.Wc,{detail:a}));this.ga(_.Jl)};WJ.prototype.init=function(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(XJ(),this.a)};WJ.prototype.release=function(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(XJ(),this.a)};WJ.prototype.getTimelineCues=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(function(a){return YJ(a)})};
|
|
66
|
+
WJ.prototype.f=function(a){if(a instanceof cast.framework.events.TimedMetadataEvent){var b=null;switch(a.type){case cast.framework.events.EventType.TIMED_METADATA_CHANGED:b=_.fg;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.hg;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.ig}b&&this.Qb(new _.D(b,{detail:YJ(a.timedMetadataInfo)}))}else for(a=_.t(this.getTimelineCues()),b=a.next();!b.done;b=a.next())this.Qb(new _.D(_.fg,{detail:b.value}))};_.u(ZJ,_.P);_.h=ZJ.prototype;_.h.Fb=function(a){this.l=a;$J().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.m)};_.h.release=function(){this.h=[];this.j=[];this.a=this.f=null};_.h.load=function(){};_.h.destroy=function(){this.l=null;$J().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.m)};_.h.getVideoTracks=function(){return[]};_.h.getAudioTracks=function(){return this.h};_.h.ea=function(){return this.j};_.h.fa=function(){return null};
|
|
67
|
+
_.h.za=function(){var a=this.ha();return a&&a.renditions[0]};_.h.Ba=function(){var a=this.ia();return a&&a.renditions[0]};_.h.Pa=function(){return null};_.h.Ya=function(){return null};_.h.Za=function(){return null};_.h.Ca=function(){return null};_.h.ha=function(){var a=null;if(this.f){var b=this.f.getActiveId();typeof b===_.zd&&(b=b.toString(),a=this.getAudioTracks().find(function(c){return c.id===b})||null)}return a};
|
|
68
|
+
_.h.ia=function(){var a=null;if(this.a){var b=this.a.getActiveIds()[0];typeof b===_.zd&&(b=b.toString(),a=this.ea().find(function(c){return c.id===b})||null)}return a};_.h.Va=function(){this.g.warn("Video tracks unavailable on Cast")};_.h.ma=function(a){a&&this.f&&this.f.setActiveById(+a.id)};_.h.ua=function(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))};_.h.Ua=function(){this.g.warn("Video renditions unavailable on Cast")};_.h.gb=function(a){this.ma(a&&a.track)};
|
|
69
|
+
_.h.hb=function(a){this.ua(a&&a.track)};
|
|
70
|
+
_.h.addTextTrack=function(a){var b=this,c,d,e;return _.z(function(f){if(1==f.a)return c=b.l.getConfiguration(),_.v(f,nJ(a,Object.values(cast.framework.messages.CaptionMimeType),b.l.getNetworkEngine(),c),2);if((d=f.f)&&b.a){e=new cast.framework.messages.Track(b.o++,cast.framework.messages.TrackType.TEXT);e.isInBand=!1;e.language=d.language;e.name=d.label;e.subtype=d.kind;e.trackContentId=d.url;e.trackContentType=d.mimeType;e.customData={mimeType:a.mimeType,url:a.url};try{b.a.addTracks([e]),bK(b)}catch(g){throw b.g.warn("failed on track",
|
|
71
|
+
a),g;}}_.w(f)})};_.h.ja=function(){return!0};_.h.ij=function(){this.f=$J().getAudioTracksManager();var a=this.f.getTracks();this.h=aK(_.N,a);bK(this);a=this.l.getConfiguration();cK(this,_.N,a.preferredAudioLanguage,a.preferredAudioRole);cK(this,_.L,a.preferredTextLanguage,a.preferredTextRole)};ZJ.prototype.isAbrEnabled=ZJ.prototype.ja;ZJ.prototype.addTextTrack=ZJ.prototype.addTextTrack;ZJ.prototype.setTextRendition=ZJ.prototype.hb;ZJ.prototype.setAudioRendition=ZJ.prototype.gb;
|
|
72
|
+
ZJ.prototype.setVideoRendition=ZJ.prototype.Ua;ZJ.prototype.setTextTrack=ZJ.prototype.ua;ZJ.prototype.setAudioTrack=ZJ.prototype.ma;ZJ.prototype.setVideoTrack=ZJ.prototype.Va;ZJ.prototype.getTextTrack=ZJ.prototype.ia;ZJ.prototype.getAudioTrack=ZJ.prototype.ha;ZJ.prototype.getVideoTrack=ZJ.prototype.Ca;ZJ.prototype.getLoadingTextRendition=ZJ.prototype.Za;ZJ.prototype.getLoadingAudioRendition=ZJ.prototype.Ya;ZJ.prototype.getLoadingVideoRendition=ZJ.prototype.Pa;ZJ.prototype.getTextRendition=ZJ.prototype.Ba;
|
|
73
|
+
ZJ.prototype.getAudioRendition=ZJ.prototype.za;ZJ.prototype.getVideoRendition=ZJ.prototype.fa;ZJ.prototype.getTextTracks=ZJ.prototype.ea;ZJ.prototype.getAudioTracks=ZJ.prototype.getAudioTracks;ZJ.prototype.getVideoTracks=ZJ.prototype.getVideoTracks;_.u(dK,_.Mh);_.h=dK.prototype;_.h.init=function(a,b){var c=this;this.A=a;b&&(this.g=this.o=b);var d=eK();d.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.Vi.bind(this));d.setMediaPlaybackInfoHandler(this.yg.bind(this));this.a=new VJ(this);this.a.init();this.h=new ZJ;this.h.Fb(this);this.m=new WJ(function(e){return c.trigger(e)});this.m.init()};
|
|
74
|
+
_.h.unload=function(){var a=eK();a.getPlayerState()!==cast.framework.messages.PlayerState.IDLE&&a.stop();this.h&&this.h.release();this.m&&this.m.release();this.f=null;return Promise.resolve()};_.h.release=function(){var a=this;return this.unload().then(function(){a.a&&a.a.release()})};_.h.destroy=function(){var a=this;return _.z(function(b){if(1==b.a)return a.A=null,a.o=_.Ri(),a.g=a.o,a.j=-1,a.w=null,a.a?_.v(b,a.a.destroy(),3):b.G(2);2!=b.a&&(a.a=null);a.h&&(a.h.destroy(),a.h=null);_.w(b)})};
|
|
75
|
+
_.h.play=function(){var a=eK();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");a.play();return Promise.resolve()};_.h.pause=function(){var a=eK();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()};_.h.isPaused=function(){return eK().getPlayerState()===cast.framework.messages.PlayerState.PAUSED};
|
|
76
|
+
_.h.isEnded=function(){return eK().getPlayerState()===cast.framework.messages.PlayerState.IDLE};_.h.seek=function(a){var b=eK();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(YI);b.seek(a);return Promise.resolve()};_.h.getPosition=function(){return eK().getCurrentTimeSec()};_.h.getDuration=function(){return eK().getDurationSec()};_.h.getPlaybackRate=function(){return eK().getPlaybackRate()};
|
|
77
|
+
_.h.setPlaybackRate=function(a){if(0<a){var b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;eK().sendLocalMediaRequest(b)}};_.h.getVolume=function(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().level||null};_.h.setVolume=function(a){0<=a&&1>=a&&cast.framework.CastReceiverContext.getInstance().setSystemVolumeLevel(a)};_.h.setMuted=function(a){cast.framework.CastReceiverContext.getInstance().setSystemVolumeMuted(a)};
|
|
78
|
+
_.h.isMuted=function(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().muted||null};_.h.getLoadedSource=function(){var a=eK().getMediaInformation();if(a){var b=eK().getPlaybackConfig();b=!!b&&b.protectionSystem!==cast.framework.ContentProtection.NONE;var c=this.w&&-1!==this.j?this.w[this.j]:null;c=c?c.name:void 0;!c&&a.metadata&&(c=a.metadata.title);return{url:a.contentId,type:a.contentType,ak:b,name:c}}return null};_.h.getDrmInfo=function(){return null};
|
|
79
|
+
_.h.getPresentationStartTime=function(){var a=eK().getMediaInformation();return a?a.startAbsoluteTime||0:0};_.h.getSeekRange=function(){var a={start:0,end:this.getDuration()};if(this.isLive()){var b=eK().getLiveSeekableRange();b&&typeof b.start===_.zd&&typeof b.end===_.zd&&(a={start:b.start,end:b.end})}return a};_.h.getState=function(){return this.a?this.a.getState():_.zl};
|
|
80
|
+
_.h.getStats=function(){var a=_.ul();if(this.f){a=eK().getStats();this.f.m=a.estimatedBandwidth||NaN;this.f.A=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.j=a.width||NaN;b.f=c;b=this.f;c=typeof a.decodedFrames===_.zd?a.decodedFrames:NaN;b.h=typeof a.droppedFrames===_.zd?a.droppedFrames:NaN;b.g=c;a=this.f.getStats()}return a};_.h.isLive=function(){return-1===this.getDuration()};
|
|
81
|
+
_.h.load=function(a){var b=this,c,d;return _.z(function(e){b.f=new _.tl;b.a.j=b.f.a;b.w=_.Ql(a);_.Wi(a)&&(b.g=_.Vi(b.o,a));if(b.B)return b.B=!1,e["return"]();c=b.w[b.j];d=new cast.framework.messages.LoadRequestData;d.autoplay=b.g.autoplay;typeof b.g.startTime===_.zd&&(d.currentTime=b.g.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:lJ(b.g),local:!0};return _.v(e,eK().load(d),0)})};_.h.getBufferInfo=function(){this.C.warn(_.ma);return new _.Lh};
|
|
82
|
+
_.h.getTrackManager=function(){return this.h};_.h.getConfiguration=function(){return this.g};_.h.getSurface=function(){return this.A};_.h.setNetworkEngine=function(a){this.D=a};_.h.getNetworkEngine=function(){return this.D};_.h.getSourceIndex=function(){return this.j};_.h.setSourceIndex=function(a){this.j=a};_.h.getPeriods=function(){return[]};_.h.namespace=function(){return fJ};_.h.getTimelineCues=function(){return this.m&&this.m.getTimelineCues()||[]};_.h.resetAbr=function(){this.C.warn(bJ)};
|
|
83
|
+
_.h.onError=function(a){this.trigger(new _.D(_.Wc,{detail:a}))};_.h.canPlay=function(){return _.qi()?2:0};_.h.Vi=function(a){a.customData||(a.customData={});a.customData.stats=lJ(this.getStats());return a};_.h.yg=function(a,b){var c=null;a.media.customData&&(c=mJ(a.media.customData.playerConfiguration));var d=c?c.abr:null;d&&typeof d.defaultBandwidthEstimate===_.zd?b.initialBandwidth=d.defaultBandwidthEstimate:b.initialBandwidth=void 0;hK(c,b);return b};_.h.getTextDisplayer=function(){return null};
|
|
84
|
+
_.h.setDrmCustomDataModifier=function(){};_.h.setCdnErrorCallback=function(){};dK.prototype.getTextDisplayer=dK.prototype.getTextDisplayer;dK.prototype.getNetworkEngine=dK.prototype.getNetworkEngine;dK.prototype.setNetworkEngine=dK.prototype.setNetworkEngine;_.h=Z.prototype;_.h.mb=function(){return"Google Cast Framework"};_.h.nb=function(){return cast.framework.VERSION};_.h.sb=function(){return 0};_.h.aa=function(){return""};_.h.getCreativeId=function(){return""};_.h.getApiFramework=function(){return null};_.h.getAdSystem=function(){return""};_.h.getAdvertiserName=function(){return""};_.h.getTitle=function(){return this.a.title||""};_.h.getDuration=function(){return this.a.duration||0};_.h.getSkipTimeOffset=function(){return this.a.whenSkippable||0};
|
|
85
|
+
_.h.cc=function(){return!1};_.h.Hb=function(){return this.a.clickThroughUrl||null};_.h.getMediaUrl=function(){return this.a.contentUrl||this.a.contentId||null};_.h.pb=function(){return 0};_.h.ob=function(){return 0};_.h.$a=function(){return 0};_.h.Qa=function(){switch(this.Ib()){case 0:return 0;case -1:return 2;default:return 1}};_.h.getPodIndex=function(){return this.g};_.h.Ib=function(){return this.f.position};_.h.Jb=function(){return this.h};_.h.rb=function(){return this.j};
|
|
86
|
+
_.h.getWrapperAdIds=function(){return[]};_.h.getWrapperAdSystems=function(){return[]};_.h.getWrapperCreativeIds=function(){return[]};Z.prototype.getWrapperCreativeIds=Z.prototype.getWrapperCreativeIds;Z.prototype.getWrapperAdSystems=Z.prototype.getWrapperAdSystems;Z.prototype.getWrapperAdIds=Z.prototype.getWrapperAdIds;Z.prototype.getSequenceLength=Z.prototype.rb;Z.prototype.getPositionInSequence=Z.prototype.Jb;Z.prototype.getPodTimeOffset=Z.prototype.Ib;Z.prototype.getPodIndex=Z.prototype.getPodIndex;
|
|
87
|
+
Z.prototype.getPodType=Z.prototype.Qa;Z.prototype.getMediaBitrate=Z.prototype.$a;Z.prototype.getMediaHeight=Z.prototype.ob;Z.prototype.getMediaWidth=Z.prototype.pb;Z.prototype.getMediaUrl=Z.prototype.getMediaUrl;Z.prototype.getClickThroughUrl=Z.prototype.Hb;Z.prototype.isBumper=Z.prototype.cc;Z.prototype.getSkipTimeOffset=Z.prototype.getSkipTimeOffset;Z.prototype.getDuration=Z.prototype.getDuration;Z.prototype.getTitle=Z.prototype.getTitle;Z.prototype.getAdvertiserName=Z.prototype.getAdvertiserName;
|
|
88
|
+
Z.prototype.getAdSystem=Z.prototype.getAdSystem;Z.prototype.getApiFramework=Z.prototype.getApiFramework;Z.prototype.getCreativeId=Z.prototype.getCreativeId;Z.prototype.getId=Z.prototype.aa;Z.prototype.getTechnology=Z.prototype.sb;Z.prototype.getAdManagerVersion=Z.prototype.nb;Z.prototype.getAdManagerName=Z.prototype.mb;iK.prototype.getCuePoints=function(){return this.a.map(function(a){return a.position})};iK.prototype.Kb=function(){return!!this.a.find(function(a){return 0===a.position})};iK.prototype.ab=function(){return!!this.a.find(function(a){return-1===a.position})};iK.prototype.hasPostroll=iK.prototype.ab;iK.prototype.hasPreroll=iK.prototype.Kb;iK.prototype.getCuePoints=iK.prototype.getCuePoints;_.h=kK.prototype;_.h.load=function(){var a=this;return _.z(function(b){lK&&(lK=!1,qK(a,0));_.w(b)})};_.h.start=function(){return _.z(function(a){jK().play();_.w(a)})};_.h.resume=function(){-1!==this.getPosition()&&jK().play()};_.h.pause=function(){-1!==this.getPosition()&&jK().pause()};_.h.skip=function(){};_.h.getVolume=function(){return this.l.getVolume()||0};_.h.setVolume=function(a){this.l.setVolume(a)};
|
|
89
|
+
_.h.getPosition=function(){var a=this.a&&this.a.getBreakClipCurrentTimeSec();return typeof a===_.zd?a:-1};_.h.dispose=function(){var a=this;return _.z(function(b){jK().removeEventListener(a.f,a.g);_.w(b)})};
|
|
90
|
+
_.h.Rg=function(a){var b=cast.framework.events.EndedReason;switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=jK().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.l.trigger(new _.D(_.Lb,{adsTimeline:new iK(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:pK(this,_.Ab,a);break;case cast.framework.events.EventType.BREAK_STARTED:pK(this,_.tb,a);break;case cast.framework.events.EventType.BREAK_ENDED:pK(this,_.ub,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:pK(this,
|
|
91
|
+
_.Hb,a);break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(pK(this,_.Gb,a),pK(this,_.Ib,a)):a.endedReason===b.STOPPED?pK(this,_.Ib,a):a.endedReason===b.END_OF_STREAM?(pK(this,_.xb,a),pK(this,_.Ib,a)):a.endedReason===b.ERROR&&qK(this,1);break;case cast.framework.events.EventType.PLAYING:pK(this,_.Fb,a);break;case cast.framework.events.EventType.PAUSE:pK(this,_.Db,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?pK(this,_.vb,a):pK(this,_.Fb,a)}};
|
|
92
|
+
kK.prototype.getPosition=kK.prototype.getPosition;kK.prototype.setVolume=kK.prototype.setVolume;kK.prototype.getVolume=kK.prototype.getVolume;kK.prototype.skip=kK.prototype.skip;kK.prototype.pause=kK.prototype.pause;kK.prototype.resume=kK.prototype.resume;var lK=!1;_.h=rK.prototype;_.h.init=function(a){var b=this;a&&(this.f=new dK,_.Ym(a,this.f),this.l=a,this.o.on(window,"unload",function(){return _.z(function(c){return b.l&&b.l.getState()!==_.yl?_.v(c,jJ(b.l),0):c.G(0)})}))};
|
|
93
|
+
_.h.start=function(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=cast.framework.CastReceiverContext.getInstance(),b=a.getPlayerManager(),c=new cast.framework.CastReceiverOptions;c.customNamespaces={};c.customNamespaces[hJ]=cast.framework.system.MessageType.JSON;var d=new cast.framework.PlaybackConfig;d.manifestHandler=this.pi.bind(this);d.shakaConfig={streaming:{ignoreTextStreamFailures:!0}};c.playbackConfig=d;if(d=this.l&&this.l.getSurface().getMedia())c.mediaElement=
|
|
94
|
+
d;c.disableIdleTimeout=!0;c.maxInactivity=Infinity;b.setMessageInterceptor(cast.framework.messages.MessageType.LOAD,this.oi.bind(this));b.addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.start(c);a.addCustomMessageListener(hJ,this.w)}};
|
|
95
|
+
_.h.stop=function(){if(this.a){this.a=!1;this.o.release();var a=cast.framework.CastReceiverContext.getInstance();a.getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(hJ,this.w);a.stop();this.l=this.f=null}};_.h.bd=function(a){this.j=a};_.h.vj=function(a){this.m=a};_.h.on=function(a,b){cast.framework.CastReceiverContext.getInstance().addEventListener(a,b)};
|
|
96
|
+
_.h.off=function(a,b){cast.framework.CastReceiverContext.getInstance().removeEventListener(a,b)};_.h.addMessageListener=function(a){typeof a===_.Yc&&this.g.add(a)};_.h.removeMessageListener=function(a){typeof a===_.Yc&&this.g["delete"](a)};_.h.sendMessage=function(a,b){cast.framework.CastReceiverContext.getInstance().sendCustomMessage(hJ,b,lJ(a))};_.h.ac=function(){return this.a};
|
|
97
|
+
_.h.di=function(){var a=null,b=cast.framework.CastReceiverContext.getInstance().getPlayerManager().getMediaInformation();b&&b.metadata&&(a=b.metadata);return _.H.xa(a)};
|
|
98
|
+
_.h.pi=function(a){a=a.trim();if(a.startsWith("#EXTM3U"))return vK(this,a);try{var b=(new DOMParser).parseFromString(a,_.te)}catch(r){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.h.debug("Detected DASH, parsing");b=cast.framework.CastReceiverContext.getInstance();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){for(var e=c[d].getElementsByTagName(_.fa),f=e.length-1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.Ge||g===_.Zb){g=e[f].getAttribute(_.pd);
|
|
99
|
+
for(var k=e[f].getElementsByTagName(_.cb),l=k.length-1;0<=l;--l){var m=k[l].getAttribute(_.pd)||g,n=k[l].getAttribute(_.Ac),p=k[l].getAttribute(_.Ve)||void 0,q=k[l].getAttribute(_.Zc)||void 0;void 0!==p&&(p=+p);void 0!==q&&(q=+q);b.canDisplayType(m,n,p,q)||e[f].removeChild(k[l])}e[f].getElementsByTagName(_.cb).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.fa).length||a.removeChild(c[d])}return(new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.kb)[0]){a=c;this.h.debug("Detected Smooth, parsing");
|
|
100
|
+
b=cast.framework.CastReceiverContext.getInstance();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.Ge){e=c[d].getElementsByTagName(_.ab);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.Oa)||void 0,k=e[f].getAttribute(_.Na)||void 0,void 0!==g&&(g=+g),void 0!==k&&(k=+k),b.canDisplayType(_.Ie,void 0,g,k)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.ab).length||a.removeChild(c[d])}a=(new XMLSerializer).serializeToString(a)}return a};
|
|
101
|
+
_.h.oi=function(a){var b=this,c,d,e,f;return _.z(function(g){switch(g.a){case 1:a.media.customData&&(c=mJ(a.media.customData.playerConfiguration));if(!b.l||!c){g.G(2);break}if(!b.j){g.G(3);break}return _.v(g,Promise.resolve(b.j(c)),4);case 4:c=(d=g.f)||c;case 3:if(!c.ima){g.G(5);break}return _.v(g,nK(a.media,c.ima,b.l.getNetworkEngine()),5);case 5:typeof c.startTime===_.zd&&c.startTime!==a.currentTime&&(a.currentTime=c.startTime);if(a.media.customData.local){g.G(7);break}b.f.B=!0;return _.v(g,_.bn(b.l,
|
|
102
|
+
c),8);case 8:return _.v(g,_.cn(b.l),9);case 9:e=b.l.getLoadedSource(),a.media.contentId=e.url,a.media.contentType=e.type,e.Ab&&(a.media.hlsVideoSegmentFormat=oJ(e.Ab,_.yg)),e.audioMimeType&&(a.media.hlsSegmentFormat=oJ(e.audioMimeType,_.N));case 7:void 0===a.autoplay&&(a.autoplay=b.l.getConfiguration().autoplay);case 2:if(!b.m){g.G(10);break}return _.v(g,Promise.resolve(b.m(a)),11);case 11:(f=g.f)&&(a=f);case 10:return g["return"](a)}})};
|
|
103
|
+
_.h.Si=function(a){!this.l||a.media.customData&&a.media.customData.local||_.en(this.l)};_.h.Lg=function(a){if(0<this.g.size){var b=mJ(a.data);this.g.forEach(function(c){return c(b)})}};_.A(gJ,rK);rK.prototype.getContentMetadata=rK.prototype.di;rK.prototype.isApiReady=rK.prototype.ac;rK.prototype.sendMessage=rK.prototype.sendMessage;rK.prototype.removeMessageListener=rK.prototype.removeMessageListener;rK.prototype.addMessageListener=rK.prototype.addMessageListener;rK.prototype.off=rK.prototype.off;
|
|
104
|
+
rK.prototype.on=rK.prototype.on;rK.prototype.setLoadRequestDataInterceptor=rK.prototype.vj;rK.prototype.setPlayerConfigInterceptor=rK.prototype.bd;rK.prototype.stop=rK.prototype.stop;rK.prototype.start=rK.prototype.start;rK.prototype.init=rK.prototype.init;rK.getInstance=tK;var sK=null;_.h=wK.prototype;_.h.load=function(){var a=this,b,c,d,e,f;return _.z(function(g){a.a=a.f.o;if(a.a)for(b=a.a.controller,c=a.fj.bind(a),d=_.t(a.h),e=d.next();!e.done;e=d.next())f=e.value,a.g.on(b,f,c);_.w(g)})};_.h.start=function(){return _.z(function(a){_.w(a)})};_.h.resume=function(){this.a&&this.a.isPlayingBreak&&this.a.isPaused&&this.a.controller.playOrPause()};_.h.pause=function(){this.a&&this.a.isPlayingBreak&&!this.a.isPaused&&this.a.controller.playOrPause()};
|
|
105
|
+
_.h.skip=function(){var a=this.f.a;a&&this.f.sendMessage(iJ,{type:"SKIP_AD",requestId:Math.round(1E3*Math.random()),mediaSessionId:a.mediaSessionId})};_.h.getVolume=function(){return this.f.getVolume()||0};_.h.setVolume=function(a){this.f.setVolume(a)};_.h.getPosition=function(){var a=-1,b=this.f.a;b&&(b=b.getEstimatedBreakClipTime(),typeof b===_.zd&&(a=b));return a};_.h.dispose=function(){var a=this;return _.z(function(b){a.g.release();_.w(b)})};
|
|
106
|
+
_.h.fj=function(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.D(_.Lb,{adsTimeline:new iK(a.breaks)})));break;case "isPlayingBreak":a.value?yK(this,_.tb):(yK(this,_.xb),yK(this,_.Ib),yK(this,_.ub));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(yK(this,_.xb),yK(this,_.Ib)),yK(this,_.Hb));break;case "isPaused":this.a.isPlayingBreak&&(a.value?yK(this,_.Db):yK(this,_.Fb))}};wK.prototype.getPosition=wK.prototype.getPosition;
|
|
107
|
+
wK.prototype.setVolume=wK.prototype.setVolume;wK.prototype.getVolume=wK.prototype.getVolume;wK.prototype.skip=wK.prototype.skip;wK.prototype.pause=wK.prototype.pause;wK.prototype.resume=wK.prototype.resume;zK.prototype.name=function(){return"clpp.cast.ads.SenderAdsManagerFactory"};zK.prototype.V=function(a,b){return a.namespace()!==_.wc?!1:!(!b||!b.ima)};zK.prototype.create=function(a){return new wK(a.a)};zK.prototype.create=zK.prototype.create;zK.prototype.isSupported=zK.prototype.V;zK.prototype.name=zK.prototype.name;_.dm(new zK);AK.prototype.name=function(){return"clpp.cast.ads.AdsManagerFactory"};AK.prototype.V=function(a,b){return tK().ac()?!(!b||!b.ima):!1};AK.prototype.create=function(a){return new kK(a)};AK.prototype.create=AK.prototype.create;AK.prototype.isSupported=AK.prototype.V;AK.prototype.name=AK.prototype.name;_.dm(new AK);};
|
|
108
|
+
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
109
|
+
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
110
|
+
else{_=this.clpp._;(f.call(g,this));}
|
|
111
|
+
})();
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
(function(){var g={}; var _ = _ || {}
|
|
2
|
+
var f=function(window){var wI="Ad Error",xI="onAdBreakStarted()",yI="onAdBreakStopped()",zI=function(a){function b(l,m){l in k||!m||(k[l]=m)}var c=_.gi(),d=Conviva.Constants.DeviceType.DESKTOP,e=Conviva.Constants.DeviceCategory.WEB,f=c.os;c=c.osVersion.name;var g="";_.ri()&&(g="Apple");_.qi()?(g="Google",d=Conviva.Constants.DeviceType.SETTOP,e=Conviva.Constants.DeviceCategory.CHROMECAST):_.si()?(d=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?e=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:
|
|
3
|
+
_.ri()&&(e=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):_.fi()||_.ei()||_.ni("Hisense")?(d=Conviva.Constants.DeviceType.SMARTTV,e=Conviva.Constants.DeviceCategory.SMART_TV,_.fi()?(c="",g="LG",e=Conviva.Constants.DeviceCategory.LG_TV):_.ei()?(g="Samsung",e=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.ni("Hisense")&&(c="",g="Hisense")):_.ni("Xbox One")&&(g="Microsoft",d=Conviva.Constants.DeviceType.CONSOLE,e=Conviva.Constants.DeviceCategory.XBOX);var k=a.deviceMetadata||{};b(Conviva.Constants.DeviceMetadata.TYPE,
|
|
4
|
+
a.deviceType||d);b(Conviva.Constants.DeviceMetadata.OS_NAME,f);b(Conviva.Constants.DeviceMetadata.OS_VERSION,c);b(Conviva.Constants.DeviceMetadata.CATEGORY,a.deviceCategory||e);b(Conviva.Constants.DeviceMetadata.BRAND,a.deviceBrand||g);return k},AI=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},BI=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},DI=function(a,b,c,d){var e={};e[Conviva.Constants.PLAYER_NAME]=c;e[Conviva.Constants.VIEWER_ID]=
|
|
5
|
+
b;e[Conviva.Constants.IS_LIVE]=AI(!!d);e[Conviva.Constants.ASSET_NAME]=wI;a&&(e[Conviva.Constants.ASSET_NAME]=a.getTitle(),e[Conviva.Constants.STREAM_URL]=a.getMediaUrl(),e[Conviva.Constants.DURATION]=a.getDuration(),e["c3.ad.id"]=CI(a.aa()),e["c3.ad.creativeId"]=CI(a.getCreativeId()),e["c3.ad.system"]=CI(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=CI(a.getApiFramework()),e["c3.ad.advertiser"]=CI(a.getAdvertiserName()),e["c3.ad.position"]=BI(a.getPodIndex()),e["c3.ad.technology"]=0===a.sb()?
|
|
6
|
+
Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=CI(a.mb()),e["c3.ad.adManagerVersion"]=CI(a.nb()),e["c3.ad.advertiserCategory"]=CI(null),e["c3.ad.advertiserId"]=CI(null),e["c3.ad.breakId"]=CI(null),e["c3.ad.campaignName"]=CI(null),e["c3.ad.category"]=CI(null),e["c3.ad.classification"]=CI(null),e["c3.ad.creativeName"]=CI(null),e["c3.ad.sequence"]=CI(a.Jb()),e["c3.ad.sessionStartEvent"]=CI(null),e["c3.ad.unitName"]=CI(null),e["c3.ad.dayPart"]=CI(null),
|
|
7
|
+
b=a.getWrapperAdIds().slice(-1)[0]||a.aa(),c=a.getWrapperAdSystems().slice(-1)[0]||a.getAdSystem(),a=a.getWrapperCreativeIds().slice(-1)[0]||a.getCreativeId(),e["c3.ad.firstAdId"]=CI(b),e["c3.ad.firstAdSystem"]=CI(c),e["c3.ad.firstCreativeId"]=CI(a));return e},CI=function(a){return a?""+a:"NA"},EI=function(a,b){this.l=a;this.B=b;this.A="";this.w=_.oa;this.f=new _.C("clpp.conviva.ad");this.g=new _.Vf;this.a=null;this.j=this.m=this.o=this.h=!1},GI=function(a,b){a.f.debug("Initialize Ad Insights");a.o=
|
|
8
|
+
!1;a.j=!1;a.A=b.viewerId;a.w=b.playerName||_.oa;FI(a)},HI=function(a,b){if(!a.m){a.j=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.B()),b){var c=DI(b,a.A,a.w,a.l.isLive()),d=String(b.nb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.mb();e[Conviva.Constants.FRAMEWORK_VERSION]=d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(f){a.f.error("Could not create ad analytics session",f)}}},KI=function(a,b,c){c=void 0===c?wI:c;if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);
|
|
9
|
+
switch(b){case II:a.a.reportAdFailed(c,DI(null,a.A,a.w));break;case JI:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.h=!1}},FI=function(a){a.g.on(a.l,_.tb,a.Sg.bind(a));a.g.on(a.l,_.ub,a.Tg.bind(a));a.g.on(a.l,_.Hb,a.Zg.bind(a));a.g.on(a.l,_.Eb,a.zd.bind(a));a.g.on(a.l,_.Db,a.zd.bind(a));a.g.on(a.l,_.Fb,a.zd.bind(a));a.g.on(a.l,_.vb,a.zd.bind(a));a.g.on(a.l,_.Ib,a.$g.bind(a));a.g.on(a.l,_.Gb,a.Yg.bind(a));a.g.on(a.l,_.wb,a.Ug.bind(a));a.g.on(a.l,_.zb,a.Wg.bind(a));
|
|
10
|
+
a.g.on(a.l,_.Ab,a.Xg.bind(a));a.g.on(a.l,_.yb,a.Vg.bind(a));a.g.on(a.l,_.Cb,a.yi.bind(a));a.g.on(a.l,_.Jb,a.ah.bind(a));a.g.on(a.l,_.Wc,function(b){var c=b.detail;if(10003===c.code&&(a.f.debug("onAdError()"),!a.j)){b=Conviva.Constants.ErrorSeverity;switch(c.data.errorType){case 0:c="Ad Load Error";break;case 1:c="Ad Play Error";break;default:c=wI}null===a.a&&HI(a,null);a.a.reportAdError(c,b.FATAL);a.j=!0;a.f.debug("Ad Playback Failure");KI(a,II,c)}})},LI=function(a,b){this.l=a;this.g=new _.Vf;this.f=
|
|
11
|
+
null;this.o=!1;this.H=!0;this.B=this.h=this.A=this.C=this.m=!1;this.P=0;this.K=!1;this.w=null;this.J=!1;this.a=b;this.M=this.D=null;this.j=[];this.I=0},PI=function(a,b,c,d){a.m||(a.a.debug("Initialize conviva"),a.H=!1,a.D=_.H.xa(c),a.M=d,a.l=b,MI(a,a.D),a.g.on(a.l,_.Pd,a.Wi.bind(a)),a.g.on(a.l,_.he,a.gh.bind(a)),a.g.on(a.l,_.gc,a.df.bind(a)),a.g.on(a.l,_.Ce,a.fh.bind(a)),a.g.on(a.l,_.Be,a.eh.bind(a)),a.g.on(a.l,_.tb,a.bh.bind(a)),a.g.on(a.l,_.ub,a.dh.bind(a)),a.g.on(a.l,_.Lb,a.Ei.bind(a)),a.g.on(a.l,
|
|
12
|
+
_.ec,a.Gi.bind(a)),a.g.on(a.l,_.Wc,a.ef.bind(a)),NI(a)&&(a.a.debug("Start a new session: A new video starts in autoplay."),OI(a)))},QI=function(a){if(!a.m&&a.f){var b=AI(a.l.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.l.getDuration();a.f.setContentInfo(c)}},RI=function(a){return null!==a.f&&a.C},NI=function(a){return a.l.getConfiguration().autoplay||!1},MI=function(a,b){var c={};c[Conviva.Constants.LOG_LEVEL]=Conviva.Constants.LogLevel.DEBUG;b.serviceUrl&&(a.a.warn("Touchstone URL is set. Do not set this in production!"),
|
|
13
|
+
c[Conviva.Constants.GATEWAY_URL]=b.serviceUrl.replace(/\/$/,""));Conviva.Analytics.init(b.customerKey,null,c);Conviva.Analytics.setDeviceMetadata(zI(b));b.connectionType&&Conviva.Analytics.reportDeviceMetric(Conviva.Constants.Network.CONNECTION_TYPE,b.connectionType);a.f=Conviva.Analytics.buildVideoAnalytics();a.o=!1;c={};c[Conviva.Constants.FRAMEWORK_NAME]=_.oa;c[Conviva.Constants.FRAMEWORK_VERSION]=_.da;a.f.setPlayerInfo(c)},OI=function(a){if(!a.m)if(a.C)a.a.warn("Current session still active. No-op.");
|
|
14
|
+
else{var b=a.l.getLoadedSource()||a.M,c=a.l.getConfiguration().conviva||null,d=c&&c.viewerId||"N/A",e=c&&c.defaultResource||"N/A";a.a.debug(a.l.getConfiguration().source);var f={},g=new _.Hj(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.Ij(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.oa;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.H.R(c.customTags))for(var k in c.customTags)f[k]=c.customTags[k];a.f.reportPlaybackRequested(f);
|
|
15
|
+
a.f.setCallback(function(){a.a.debug("reportMiscellaneousMetrics()");if(RI(a)){var l=1E3*a.l.getPosition();a.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,l);if(l=a.l.getStats()){l=l.decodedFrames;var m=l-a.I;a.I=l;isFinite(m)&&(a.a.debug("Current FPS",m),a.f.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,m))}}});a.C=!0;a.h=!0;a.J=!1;0<a.j.length&&(a.a.debug("Report deferred events"),a.j.forEach(function(l){l.yf(l.Ve)}));a.j=[]}},SI=function(a){a.a.debug("terminateSession()");
|
|
16
|
+
a.f&&(a.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED),a.f.reportPlaybackEnded(),a.f.release(),Conviva.Analytics.release(),a.o=!0,a.C=!1,a.A=!1,a.h=!1,a.w=null,a.B=!1,a.P=0,a.K=!1,a.j=[],a.I=0)},TI=function(){this.g=this.f=null;this.a=!1;this.h=new _.C("clpp.conviva")},UI=function(a){var b=[];typeof a===_.Ad&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.J(1,9,9001,{missingKeys:b});},VI=function(a,
|
|
17
|
+
b){var c=b.getConfiguration();a.a=!_.H.R(c.conviva)&&typeof c.conviva===_.Ad;a.a?"undefined"===typeof window.Conviva?(a.h.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.J(1,9,9E3),a.S(b,c)):b.namespace()===_.wc&&(a.a=!1,a.h.debug("Conviva does not report when casting.")):a.h.warn("Conviva plugin is loaded but not configured. Will do nothing.")},WI=function(){};_.h=EI.prototype;_.h.release=function(){this.f.debug("Release Ad Indights");this.o?this.f.debug(_.ia):(_.Yf(this.g),this.a&&KI(this,XI),this.g.release(),this.o=!0,this.h=this.j=!1)};_.h.destroy=function(){this.f.debug(_.Jc);this.m?this.f.debug(_.ha):this.m=!0};_.h.Sg=function(){this.f.debug(xI)};_.h.Tg=function(){this.f.debug(yI)};
|
|
18
|
+
_.h.Zg=function(a){this.f.debug("onAdStarted()");a=a.ad;this.h||(this.f.warn("Ad load event was not triggered. This will have incidence on VSF"),HI(this,a));this.h=!1;this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.PLAYING);this.a.reportAdMetric(Conviva.Constants.Playback.RESOLUTION,a.pb(),a.ob());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.$a())};
|
|
19
|
+
_.h.zd=function(a){var b=this;this.f.debug("onAdStateChanged()");if(this.a){var c=function(d){b.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,d)};switch(a.type){case _.Eb:case _.Fb:c(Conviva.Constants.PlayerState.PLAYING);break;case _.Db:c(Conviva.Constants.PlayerState.PAUSED);break;case _.vb:c(Conviva.Constants.PlayerState.BUFFERING)}}};_.h.$g=function(){this.f.debug("onAdStopped()");this.a&&!this.j&&KI(this,XI)};_.h.Yg=function(){this.f.debug("onAdSkipped()");this.a&&KI(this,JI)};
|
|
20
|
+
_.h.Ug=function(){this.f.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")};_.h.Wg=function(){this.f.debug("onAdImpression()");if(this.a){var a=Conviva.Constants.Events;this.a.reportAdPlayerEvent(a.AD_IMPRESSION_START);this.a.reportAdPlayerEvent(a.AD_IMPRESSION_END)}};
|
|
21
|
+
_.h.Xg=function(a){var b=this;this.f.debug("onAdLoaded()");var c=a.ad;if(-1!==c.getPodIndex()||this.l.getPosition()>=this.l.getDuration()-5)b.h=!0,HI(b,c);else this.g.on(this.l,_.ue,function(){b.l.getPosition()>=b.l.getDuration()-5&&(b.g.off(b.l,_.ue),b.h=!0,HI(b,c))})};_.h.Vg=function(){this.f.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)};_.h.yi=function(){this.f.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)};
|
|
22
|
+
_.h.ah=function(){this.f.debug("onAdThirdQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)};var JI=0,XI=1,II=2;_.h=LI.prototype;_.h.release=function(){this.a.debug("Release conviva");this.H?this.a.debug(_.ia):(_.Yf(this.g),RI(this)||this.o||!NI(this)||this.f&&this.f.reportPlaybackFailed("Exit Before Video Start"),RI(this)&&SI(this),this.f=null,this.H=!0)};_.h.destroy=function(){this.a.debug(_.Jc);this.m?this.a.debug(_.ha):this.m=!0};_.h.reportAppEvent=function(a,b){var c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.a.debug("Report app event error",d),c=!1}return c};
|
|
23
|
+
_.h.Wi=function(){this.a.debug("onPlayRequest()");RI(this)||NI(this)?RI(this)&&this.A&&!this.h&&(this.a.debug("Resuming VST monitoring ..."),RI(this)&&!this.h&&(this.f.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_ENDED),this.h=!0),this.A=!1):(this.a.debug("Creating conviva session. On Play Requested / No autoplay"),OI(this))};
|
|
24
|
+
_.h.gh=function(a){function b(d){if(c.o&&(c.a.debug("Creating conviva session (On Seek / Replay)"),MI(c,c.D),OI(c),QI(c),RI(c))){var e=c.l.getTrackManager();e=e.fa()||e.Pa();e.width&&e.height&&c.f.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,e.width,e.height);e.bandwidth&&c.f.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,e.bandwidth/1E3)}RI(c)&&c.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,d)}var c=this;this.a.debug(_.Gd);switch(a.detail.currentState){case _.Ml:b(Conviva.Constants.PlayerState.PLAYING);
|
|
25
|
+
break;case _.Ll:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Dl:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.Fl:this.a.debug("onVideoEnded()"),RI(this)&&(this.w&&this.w.ab()?(this.a.debug("Waiting for postroll Ad before terminating session"),this.K=!0):SI(this))}};
|
|
26
|
+
_.h.df=function(a){this.a.debug(_.Bd);if(RI(this)){if(a=a.detail,typeof a.width===_.zd&&typeof a.height===_.zd&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,a.width,a.height),a.bandwidth&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,a.bandwidth/1E3),(a=a.rendition)&&a.track&&(a=a.track)&&a.frameRate){var b={};b[Conviva.Constants.ENCODED_FRAMERATE]=a.frameRate;this.f.setContentInfo(b)}}else this.j.push({yf:this.df.bind(this),Ve:a})};
|
|
27
|
+
_.h.fh=function(){this.a.debug("onSeeking()");RI(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)};_.h.eh=function(){this.a.debug("onSeeked()");RI(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)};_.h.Ei=function(a){this.a.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a};
|
|
28
|
+
_.h.bh=function(a){this.a.debug(xI);var b=a.ad;a=0===b.Qa();var c=BI(b.getPodIndex());RI(this)||NI(this)||!a||OI(this);if(RI(this)){a=0===b.sb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;var d=0,e={};1===b.rb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.P;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.qi()?b.CONTENT:b.SEPARATE;this.f.reportAdBreakStarted(a,
|
|
29
|
+
b,e);this.B=!0}else this.a.debug("Bug: should already have a valid session")};_.h.dh=function(){this.a.debug(yI);RI(this)&&this.B&&(this.f.reportAdBreakEnded(),this.B=!1,this.K&&SI(this))};
|
|
30
|
+
_.h.ef=function(a){this.a.debug(_.Dd);if(this.o&&this.J)this.a.debug("Session ended in VPF; ignoring subsequent errors");else{var b=a.detail||null,c=b&&b.message||"Player error",d=Conviva.Constants.ErrorSeverity.WARNING;b&&b.severity&&b.severity===_.K&&(d=Conviva.Constants.ErrorSeverity.FATAL,RI(this)||OI(this));RI(this)?(this.a.debug("Report error",c,d),this.f.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.a.debug("Video Playback Failure"),this.J=!0,SI(this))):this.j.push({yf:this.ef.bind(this),
|
|
31
|
+
Ve:a})}};_.h.Gi=function(){this.a.debug("onAutoPlayBlocked()");RI(this)&&(this.a.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,RI(this)&&this.h&&(this.f.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))};_.h=TI.prototype;_.h.onPlayerCreated=function(a){this.f=new LI(a,this.h)};_.h.onContentWillLoad=function(a,b){var c=this;VI(this,a);if(this.a){var d=a.getConfiguration();d=_.H.xa(d.conviva||{});try{UI(d);var e=d.enableAdInsights||!1;PI(this.f,a,d,b);e&&(this.g=new EI(a,function(){return c.f.f}),GI(this.g,d))}catch(f){f instanceof _.J?this.S(a,f):this.S(a,new _.J(1,9,9002,f,f))}}};_.h.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);this.a&&QI(this.f)};
|
|
32
|
+
_.h.onPlayerWillDestroy=function(){this.a&&(this.a=!1,this.f.destroy(),this.f=null,this.g&&(this.g.destroy(),this.g=null))};_.h.onPlayerWillRelease=function(){this.a&&(this.f.release(),this.g&&this.g.release())};_.h.id=function(){return"conviva"};_.h.S=function(a,b){a.trigger(new _.D(_.Wc,{detail:b}))};_.h.reportAppEvent=function(a,b){return this.f?this.f.reportAppEvent(a,b):!1};_.A("clpp.conviva.ConvivaPlugin",TI);TI.prototype.reportAppEvent=TI.prototype.reportAppEvent;TI.Id="conviva";
|
|
33
|
+
WI.prototype.create=function(){return new TI};_.fn(new WI);};
|
|
34
|
+
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
35
|
+
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
36
|
+
else{_=this.clpp._;(f.call(g,this));}
|
|
37
|
+
})();
|