@castlabs/prestoplay 6.6.1 → 6.7.0
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/CHANGELOG.md +13 -1
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +6 -6
- package/cjs/cl.cast.js +110 -110
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +423 -423
- package/cjs/cl.crypto.js +10 -10
- package/cjs/cl.dash.js +71 -71
- package/cjs/cl.externs.js +47 -41
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +68 -49
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +31 -31
- package/cjs/cl.ima.js +24 -23
- package/cjs/cl.mse.js +263 -260
- package/cjs/cl.muxdata.js +11 -12
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.smooth.js +71 -71
- package/cjs/cl.thumbnails.js +23 -23
- package/cjs/cl.tizen.js +71 -71
- package/cjs/cl.ttml.js +27 -27
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +13 -13
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.youbora.js +19 -19
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +88 -88
- package/cl.conviva.js +27 -27
- package/cl.core.js +346 -344
- package/cl.crypto.js +8 -8
- package/cl.dash.js +67 -67
- package/cl.externs.js +47 -41
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +57 -40
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +25 -25
- package/cl.ima.js +17 -16
- package/cl.mse.js +228 -228
- package/cl.muxdata.js +9 -8
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +10 -10
- package/cl.playlist.js +5 -5
- package/cl.smooth.js +58 -59
- package/cl.thumbnails.js +17 -17
- package/cl.tizen.js +57 -57
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +15 -15
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +14 -14
- package/package.json +1 -1
- package/typings.d.ts +108 -7
package/cl.vtt.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
a[1].match(/\d+:\d+:\d+/)&&(b+=`${a[0].match(/\w+/)}\n`,++c);if(a[c].match(/\d+:\d+:\d+/)){const d=a[1].match(/(\d+):(\d+):(\d+)(?:,(\d+))?\s*--?>\s*(\d+):(\d+):(\d+)(?:,(\d+))?/);if(d)b+=`${d[1]}:${d[2]}:${d[3]}.${d[4]} --> `,b+=`${d[5]}:${d[6]}:${d[7]}.${d[8]}\n`,++c;else return""}else return"";a[c]&&(b+=`${a[c]}\n\n`);return b},
|
|
3
|
-
c+60*b+3600*(Number(a[1])||0)},
|
|
4
|
-
_.uc);else if(d=/^region:(.*)$/.exec(b)){if(b=
|
|
5
|
-
b," The region will be ignored."),null)},
|
|
6
|
-
"WEBVTT\n\n";for(const c of a)b+=
|
|
7
|
-
8589934592;a=b.periodStart+e/9E4-a}}else this.a.streaming.relativeTextTimestamp&&null!==b.segmentStart&&(a=b.segmentStart);b=[];for(var f of c)if(/^region/.test(f.toLowerCase())){e=new _.
|
|
8
|
-
Number(h[1]),k.regionAnchorY=Number(h[2]);else if(h=/^viewportanchor:(\d{1,2}|100)%,(\d{1,2}|100)%$/.exec(l))k.viewportAnchorX=Number(h[1]),k.viewportAnchorY=Number(h[2]);else if(/^scroll:up$/.exec(l))k.scroll="up";else{k=!1;break a}k=!0}k||_.
|
|
9
|
-
n.split("\n");h=a;c=b;if(1==l.length&&!l[0]||/^NOTE($|[ \t])/.test(l[0])||"STYLE"==l[0]){c=null;break a}e=null;l[0].includes("--\x3e")||(e=l[0],l.splice(0,1));d=new _.
|
|
10
|
-
new _.
|
|
11
|
-
_.
|
|
12
|
-
b.periodStart+a/this.a)):this.f.error("WVTT sample duration unknown, and no default found!")}while(q.sampleSize&&
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var tq=" The setting will be ignored.",uq="VTT parser encountered an invalid VTT setting: ",vq="application/x-subrip",wq="text/srt",xq='text/vtt; codecs\x3d"vtt"',yq='text/vtt; codecs\x3d"wvtt"',zq=function(a){return a.a==a.f.length?null:(a=_.bh(a,/[^ \t\n]*/gm))?a[0]:null},Aq=function(a){_.bh(a,/[ \t]+/gm)},Bq=function(a){let b="";for(a=a.split(/\n/);3<a.length;){for(var c=3;c<a.length;++c)a[2]+=`\n${a[c]}`;a.splice(3,a.length-3)}if(3!==a.length)return"";c=0;!a[0].match(/\d+:\d+:\d+/)&&
|
|
2
|
+
a[1].match(/\d+:\d+:\d+/)&&(b+=`${a[0].match(/\w+/)}\n`,++c);if(a[c].match(/\d+:\d+:\d+/)){const d=a[1].match(/(\d+):(\d+):(\d+)(?:,(\d+))?\s*--?>\s*(\d+):(\d+):(\d+)(?:,(\d+))?/);if(d)b+=`${d[1]}:${d[2]}:${d[3]}.${d[4]} --> `,b+=`${d[5]}:${d[6]}:${d[7]}.${d[8]}\n`,++c;else return""}else return"";a[c]&&(b+=`${a[c]}\n\n`);return b},Cq=function(a){a=_.bh(a,/(?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{2,3})/g);if(null==a)return null;const b=Number(a[2]),c=Number(a[3]);return 59<b||59<c?null:Number(a[4])/1E3+
|
|
3
|
+
c+60*b+3600*(Number(a[1])||0)},Eq=function(a,b,c){let d;if(d=/^align:(start|middle|center|end|left|right)$/.exec(b))b=d[1],"middle"==b?a.textAlign=_.xo:a.textAlign=_.Do[b.toUpperCase()];else if(d=/^vertical:(lr|rl)$/.exec(b))a.writingMode="lr"==d[1]?_.Ge:_.Ie;else if(d=/^size:([\d.]+)%$/.exec(b))a.size=Number(d[1]);else if(d=/^position:([\d.]+)%(?:,(line-left|line-right|center|start|end))?$/.exec(b))a.position=Number(d[1]),d[2]&&(b=d[2],a.positionAlign=b==_.ld||b==_.je?_.ld:b==_.md||b==_.Yc?_.md:
|
|
4
|
+
_.uc);else if(d=/^region:(.*)$/.exec(b)){if(b=Dq(c,d[1]))a.region=b}else{a:{if(c=/^line:([\d.]+)%(?:,(start|end|center))?$/.exec(b))a.lineInterpretation=1,a.line=Number(c[1]),c[2]&&(a.lineAlign=_.Eo[c[2].toUpperCase()]);else if(c=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(b))a.lineInterpretation=_.zo,a.line=Number(c[1]),c[2]&&(a.lineAlign=_.Eo[c[2].toUpperCase()]);else{a=!1;break a}a=!0}return a}return!0},Dq=function(a,b){a=a.filter(c=>c.id==b);return a.length?a[0]:(_.C("VTT parser could not find a region with id: ",
|
|
5
|
+
b," The region will be ignored."),null)},Gq=function(a,b,c){let d,e,f;(new _.Mj).L("payl",_.Hj(g=>{d=_.Fg(g)})).L("iden",_.Hj(g=>{e=_.Fg(g)})).L("sttg",_.Hj(g=>{f=_.Fg(g)})).parse(a);return d?Fq(d,e,f,b,c):null},Fq=function(a,b,c,d,e){a=new _.Co(d,e,a);b&&(a.id=b);if(c)for(b=new _.ch(c),c=zq(b);c;)Eq(a,c,[])||_.C(uq,c,tq),Aq(b),c=zq(b);return a},Hq=class{a(a){a=_.Fg(a);a=a.replace(/\r+/g,"");a=a.replace(/^\s+|\s+$/g,"");a=a.replace(/<[a-zA-Z\\/][^>]*>/g,"");a=a.split("\n\n");let b="";if(0<a.length){b+=
|
|
6
|
+
"WEBVTT\n\n";for(const c of a)b+=Bq(c)}return _.Jg(b)}},Iq=class{create(){return new Hq}probe(a,b){return(a===wq||a===vq)&&b===_.te}};var Jq=class{constructor(a){this.a=a}parseInit(){}parseMedia(a,b){a=_.Fg(a);a=a.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");var c=a.split(/\n{2,}/m);if(!/^WEBVTT($|[ \t\n])/m.test(c[0]))throw new _.H(_.G,2,2E3);a=b.periodStart;if(c[0].includes("X-TIMESTAMP-MAP")){var d=c[0].match(/LOCAL:((?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{3}))/m),e=c[0].match(/MPEGTS:(\d+)/m);if(d&&e){a=Cq(new _.ch(d[1]));if(null==a)throw new _.H(_.G,2,2E3);e=Number(e[1]);for(d=b.segmentStart;95443.7176888889<=d;)d-=95443.7176888889,e+=
|
|
7
|
+
8589934592;a=b.periodStart+e/9E4-a}}else this.a.streaming.relativeTextTimestamp&&null!==b.segmentStart&&(a=b.segmentStart);b=[];for(var f of c)if(/^region/.test(f.toLowerCase())){e=new _.ch(f.replace(/\n/g," "));d=new _.Ho;zq(e);Aq(e);for(var g=zq(e);g;){a:{var h;var k=d;var l=g;if(h=/^id:(.*)$/.exec(l))k.id=h[1];else if(h=/^width:(\d{1,2}|100)%$/.exec(l))k.width=Number(h[1]);else if(h=/^lines:(\d+)$/.exec(l))k.height=Number(h[1]),k.heightUnits=2;else if(h=/^regionanchor:(\d{1,2}|100)%,(\d{1,2}|100)%$/.exec(l))k.regionAnchorX=
|
|
8
|
+
Number(h[1]),k.regionAnchorY=Number(h[2]);else if(h=/^viewportanchor:(\d{1,2}|100)%,(\d{1,2}|100)%$/.exec(l))k.viewportAnchorX=Number(h[1]),k.viewportAnchorY=Number(h[2]);else if(/^scroll:up$/.exec(l))k.scroll="up";else{k=!1;break a}k=!0}k||_.C("VTT parser encountered an invalid VTTRegion setting: ",g,tq);Aq(e);g=zq(e)}e=d;b.push(e)}f=[];for(var m of c)if(/^style/.test(m.toLowerCase())){e=m.replace(/^style/i,"").replace(/\n/g," ");d=/[^{}]+{[^{}]*}/g;do(g=d.exec(e))&&f.push(g[0]);while(g)}m=[];for(const n of c)if(n.includes("--\x3e")){a:{l=
|
|
9
|
+
n.split("\n");h=a;c=b;if(1==l.length&&!l[0]||/^NOTE($|[ \t])/.test(l[0])||"STYLE"==l[0]){c=null;break a}e=null;l[0].includes("--\x3e")||(e=l[0],l.splice(0,1));d=new _.ch(l[0]);g=Cq(d);const q=_.bh(d,/[ \t]+--\x3e[ \t]+/g);k=Cq(d);if(null==g||null==q||null==k)throw new _.H(_.G,2,2001);g+=h;k+=h;l=l.slice(1).join("\n").trim();g=new _.Co(g,k,l,_.Pe);e&&(g.id=e);Aq(d);for(k=zq(d);k;)Eq(g,k,c)||_.C(uq,k,tq),Aq(d),k=zq(d);null!=e&&(g.id=e);c=g}c&&m.push(c)}return{cues:m,styles:f}}};var Kq=class extends Jq{parseMedia(a,b){return super.parseMedia((new Hq).a(a),b)}};var Lq=class{constructor(){this.a=null;this.f=new _.O("clpp.vtt.mp4")}parseInit(a){let b=!1;(new _.Mj).L(_.wd,_.Fj).L(_.we,_.Fj).L(_.rd,_.Fj).Y("mdhd",c=>{0==c.version?(c.reader.skip(4),c.reader.skip(4),this.a=_.N(c.reader),c.reader.skip(4)):(c.reader.skip(8),c.reader.skip(8),this.a=_.N(c.reader),c.reader.skip(8));c.reader.skip(4)}).L(_.vd,_.Fj).L(_.me,_.Fj).Y(_.oe,_.Gj).L("wvtt",()=>{b=!0}).parse(a);if(!this.a)throw new _.H(_.G,2,2008);if(!b)throw new _.H(_.G,2,2008);}parseMedia(a,b){if(!this.a)throw this.f.error("No init segment for MP4+VTT!"),
|
|
10
|
+
new _.H(_.G,2,2008);let c=0,d=[],e;const f=[];let g=!1,h=!1,k=!1,l=null;(new _.Mj).L("moof",_.Fj).L("traf",_.Fj).Y("tfdt",q=>{g=!0;c=0==q.version?_.N(q.reader):_.Bj(q.reader)}).Y("tfhd",q=>{var t=q.flags;q=q.reader;q.skip(4);t&1&&q.skip(8);t&2&&q.skip(4);l=t&8?_.N(q):null}).Y("trun",q=>{h=!0;{var t=q.version,u=q.flags;q=q.reader;const x=_.N(q);u&1&&q.skip(4);u&4&&q.skip(4);const A=[];for(let E=0;E<x;E++){const D={duration:null,sampleSize:null,ae:null};u&256&&(D.duration=_.N(q));u&512&&(D.sampleSize=
|
|
11
|
+
_.N(q));u&1024&&q.skip(4);u&2048&&(D.ae=0==t?_.N(q):_.zj(q));A.push(D)}d=A}}).L(_.qd,_.Hj(q=>{k=!0;e=q})).parse(a);if(!k&&!g&&!h)throw new _.H(_.G,2,2008);a=c;var m=new DataView(e.buffer,e.byteOffset,e.byteLength);m=new _.vk(m,!1);for(const q of d){const t=q.duration||l,u=q.ae?c+q.ae:a;a=u+(t||0);let x=0;do{const A=_.N(m);x+=A;var n=_.N(m);n=_.Ej(n);let E=null;"vttc"==n?8<A&&(E=_.Cj(m,A-8)):("vtte"!=n&&this.f.error("Unknown box "+n+"! Skipping!"),m.skip(A-8));t?E&&f.push(Gq(E,b.periodStart+u/this.a,
|
|
12
|
+
b.periodStart+a/this.a)):this.f.error("WVTT sample duration unknown, and no default found!")}while(q.sampleSize&&x<q.sampleSize)}return{cues:f.filter(_.cg),styles:[]}}};_.z("clpp.vtt.VttComponent",class extends _.Mp{constructor(){super();this.h=new Iq}f(){_.io[_.te]=Jq;_.io[xq]=Jq;_.io[yq]=Jq;_.io[_.Yb]=Lq;_.io[wq]=Kq;_.io[vq]=Kq;_.Sh.push(this.h)}a(){_.jo(_.te);_.jo(xq);_.jo(yq);_.jo(_.Yb);_.jo(wq);_.jo(vq);_.Uh(this.h)}id(){return _.re}});};f.call(g, window);
|
package/cl.youbora.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
9100)),!1;"6.8.49"!==youbora.VERSION&&(a.f.warn("Youbora SDK version is not supported. The supported version is 6.8.49, found "+`version ${youbora.VERSION}. Some or all features of YouboraPlugin `+"may not work correctly."),b.onError(new _.
|
|
3
|
-
a.code?"ad error":_.$c;b.severity===_.
|
|
4
|
-
d,e)}getIsLive(){return this.l.isLive()}getResource(){const c=this.l.getLoadedSource();return c&&c.url}getBitrate(){return this.m().streamBandwidth}getThroughput(){return this.m().estimatedBandwidth}getPlayrate(){return this.l.getPlaybackRate()}getFramesPerSecond(){var c=this.l.getTrackManager();return c&&(c=c.
|
|
5
|
-
youbora.Util.logAllEvents(this.l),this.a.on(this.l,_.ke,this.I.bind(this)),this.a.on(this.l,_.$c,this.F.bind(this)),this.a.on(this.l,_.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var lq="clpp.npaw.YouboraPlugin",mq="content.isLive",nq=function(a,b){if(b.namespace()===_.Ac)return a.f.info("Youbora does not report when casting."),!1;const c=b.getConfiguration().youbora;if(!_.pf(c))return a.f.warn("Youbora plugin is loaded but not configured. Will do nothing."),!1;if(!c.accountCode)return a.f.warn("accountCode key is missing in Youbora config"),b.onError(new _.H(1,9,9101)),!1;if(_.B(window.youbora))return a.f.warn("Youbora SDK not found."),b.onError(new _.H(1,9,
|
|
2
|
+
9100)),!1;"6.8.49"!==youbora.VERSION&&(a.f.warn("Youbora SDK version is not supported. The supported version is 6.8.49, found "+`version ${youbora.VERSION}. Some or all features of YouboraPlugin `+"may not work correctly."),b.onError(new _.H(1,9,9102)));return!0},oq=a=>(a=a.getConfiguration().youbora)&&a.errorFilter?a.errorFilter:b=>({code:`${b.code}`,message:b.message,severity:b.severity}),pq=(a,b,c,d)=>{b=oq(b)(a);if(!b)return c.debug("Error not sent to Youbora",a.code,a.message),null;a=10003===
|
|
3
|
+
a.code?"ad error":_.$c;b.severity===_.G?(d.fireFatalError(b.code,b.message,b.metadata),c.debug(`Reporting "fatal ${a}" to Youbora`,b.code,b)):(d.fireError(b.code,b.message,b.metadata),c.debug(`Reporting "${a}" to Youbora`,b.code,b));return b};var qq=a=>{class b extends youbora.Adapter{constructor(c){super(c);this.l=c;this.a=new _.uo;this.f=new _.O("clpp.npaw.YouboraAdapter");this.h=this.w=!1;this.registerListeners()}getPlayhead(){return this.getIsLive()?-1:this.l.getPosition()}getDuration(){return this.l.getDuration()}getRendition(){let c,d,e;var f=this.l.getTrackManager();f&&(f=f.ia())&&(c=f.width,d=f.height,e=f.bandwidth);c&&d&&e||(f=this.m(),c=c||f.width,d=d||f.height,e=e||f.streamBandwidth);return youbora.Util.buildRenditionString(c,
|
|
4
|
+
d,e)}getIsLive(){return this.l.isLive()}getResource(){const c=this.l.getLoadedSource();return c&&c.url}getBitrate(){return this.m().streamBandwidth}getThroughput(){return this.m().estimatedBandwidth}getPlayrate(){return this.l.getPlaybackRate()}getFramesPerSecond(){var c=this.l.getTrackManager();return c&&(c=c.Ga())?c.frameRate:null}getPlayerName(){return _.oa}getVersion(){return"6.7.0-castlabsadapter-js"}getPlayerVersion(){return _.da}registerListeners(){this.l&&this.a&&(this.f.debug("registering listeners"),
|
|
5
|
+
youbora.Util.logAllEvents(this.l),this.a.on(this.l,_.ke,this.I.bind(this)),this.a.on(this.l,_.$c,this.F.bind(this)),this.a.on(this.l,_.De,this.H.bind(this)),this.a.on(this.l,_.Ce,this.G.bind(this)),this.a.on(this.l,_.Ob,this.B.bind(this)),this.a.on(this.l,_.qc,this.C.bind(this)))}unregisterListeners(){this.f.debug(_.pb);_.Nf(this.a)}dispose(){super.dispose()}m(){return this.l.getStats()||_.Cl()}o(){return!!this.l.getConfiguration().autoplay}I(c){c=c.detail;this.j("state change",c);if(c)switch(c.currentState){case _.Ql:this.o()&&
|
|
6
6
|
this.g();break;case _.Sl:this.g();this.A();this.fireResume();this.fireBufferEnd();break;case _.Rl:this.o()&&this.g();this.A();this.fireBufferEnd();this.firePause();break;case _.Pl:this.fireBufferEnd();this.fireStop();break;case _.Hl:this.fireBufferEnd();this.w&&this.plugin.getAdsAdapter()?this.firePause():this.fireStop();break;case _.Kl:this.fireBufferBegin();break;default:this.f.debug("Unhandled state",c)}}g(){this.plugin.isInitiated||(this.h=!1,this.fireInit())}A(){var c=this.l.getDrmInfo();c&&
|
|
7
|
-
(c=c.keySystem,(c=c.startsWith(_.Kc)?"Widevine":c.startsWith(_.Ic)?"FairPlay":c.match(/^com\.(microsoft|chromecast)\.playready/)?"PlayReady":c.startsWith(_.
|
|
8
|
-
c);c=c.adsTimeline;this.w=!!c&&c.
|
|
9
|
-
this.a.getTitle()}getProvider(){return this.a&&this.a.getAdvertiserName()}getCreativeId(){return this.a&&this.a.getCreativeId()}getPosition(){const c=youbora.Constants.AdPosition;let d=null;if(this.a)switch(this.a.
|
|
10
|
-
this.j.getCuePoints().length}getGivenBreaks(){return this.getExpectedBreaks()}getExpectedAds(){return this.a&&this.a.
|
|
11
|
-
this.f&&(this.f.on(this.l,_.Ob,this.
|
|
12
|
-
this.f.on(this.l,_.
|
|
13
|
-
this.fireBufferBegin()}w(){this.m&&(this.g("ad buffering ended"),this.m=!1,this.fireBufferEnd())}o(c){this.g("ad quartile",c);this.fireQuartile(c)}F(){this.g("ad clicked");const c=this.a&&this.a.
|
|
14
|
-
c&&c.fireStop()}}H(c){(c=c.detail)&&10003===c.code&&
|
|
15
|
-
a.youbora;void 0===c[
|
|
7
|
+
(c=c.keySystem,(c=c.startsWith(_.Kc)?"Widevine":c.startsWith(_.Ic)?"FairPlay":c.match(/^com\.(microsoft|chromecast)\.playready/)?"PlayReady":c.startsWith(_.Kd)?"ClearKey":c.startsWith(_.Hc)?"Primetime":c)&&this.plugin.setOptions({"content.drm":c}));this.fireJoin()}F(c){!(c=c.detail)||this.h||10003===c.code&&this.plugin.getAdsAdapter()||(c=pq(c,this.l,this.f,this))&&c.severity===_.G&&(this.h=!0)}H(){this.j(_.fe);this.l.isEnded()||(this.g(),this.fireSeekBegin())}G(){this.j(_.ee);this.fireSeekEnd()}B(c){this.f.debug("adsTimeline",
|
|
8
|
+
c);c=c.adsTimeline;this.w=!!c&&c.fb()}C(c){this.f.debug("Casting",c);this.fireCasted()}j(c,...d){this.f.debug(`Reporting "${c}" event to Youbora`,...d)}}return new b(a)};var rq=a=>{class b extends youbora.Adapter{constructor(c){super(c);this.l=c;this.j=this.a=null;this.f=new _.uo;this.h=new _.O("clpp.npaw.YouboraAdsAdapter");this.registerListeners();this.m=!1}getDuration(){return this.a&&this.a.getDuration()}getRendition(){let c=null;this.a&&(c=youbora.Util.buildRenditionString(this.a.qb(),this.a.pb(),this.a.eb()));return c}getBitrate(){return this.a&&this.a.eb()}getPlayhead(){const c=this.l.getAdsManager();return c&&c.getPosition()}getResource(){return this.a&&this.a.getMediaUrl()}getTitle(){return this.a&&
|
|
9
|
+
this.a.getTitle()}getProvider(){return this.a&&this.a.getAdvertiserName()}getCreativeId(){return this.a&&this.a.getCreativeId()}getPosition(){const c=youbora.Constants.AdPosition;let d=null;if(this.a)switch(this.a.Qa()){case 0:d=c.Preroll;break;case 2:d=c.Postroll;break;case 1:d=c.Midroll}this.h.debug("Ad position",d);return d}getIsSkippable(){return this.a&&-1!==this.a.getSkipTimeOffset()}getAudioEnabled(){const c=this.l.getAdsManager();return c&&0<c.getVolume()}getExpectedBreaks(){return this.j&&
|
|
10
|
+
this.j.getCuePoints().length}getGivenBreaks(){return this.getExpectedBreaks()}getExpectedAds(){return this.a&&this.a.sb()}getGivenAds(){return this.getExpectedAds()}getBreaksTime(){return this.j&&this.j.getCuePoints().map(c=>-1===c?this.l.getDuration():c)}getIsFullscreen(){return this.l.getSurface().isFullscreen()}getIsVisible(){var c=this.l.getSurface().getContainer();c=youbora.Util.calculateAdViewability(c);this.h.debug("is container visible",c);return c}getPlayerName(){return _.oa}getVersion(){return"6.7.0-castlabsadsadapter-js"}getPlayerVersion(){return _.da}registerListeners(){this.l&&
|
|
11
|
+
this.f&&(this.f.on(this.l,_.Ob,this.O.bind(this)),this.f.on(this.l,_.Kb,this.M.bind(this)),this.f.on(this.l,_.Gb,this.I.bind(this)),this.f.on(this.l,_.Ib,this.J.bind(this)),this.f.on(this.l,_.Bb,this.G.bind(this)),this.f.on(this.l,_.Cb,this.o.bind(this,1)),this.f.on(this.l,_.Fb,this.o.bind(this,2)),this.f.on(this.l,_.Mb,this.o.bind(this,3)),this.f.on(this.l,_.Ab,this.F.bind(this)),this.f.on(this.l,_.Jb,this.K.bind(this)),this.f.on(this.l,_.$c,this.H.bind(this)),this.f.on(this.l,_.xb,this.A.bind(this)),
|
|
12
|
+
this.f.on(this.l,_.yb,this.B.bind(this)),this.f.on(this.l,_.zb,this.C.bind(this)),this.f.on(this.l,_.Hb,this.w.bind(this)))}unregisterListeners(){_.Nf(this.f)}dispose(){super.dispose()}O(c){this.h.debug("ad timeline changed",c);this.j=c.adsTimeline}M(c){this.a=c.ad;this.g("ad start",this.a);this.fireStart();this.fireJoin()}G(){this.g("ad ended");this.fireStop()}I(){this.g("ad pause");this.w();this.firePause()}J(){this.g("ad resume");this.w();this.fireResume()}C(){this.m=!0;this.g("ad buffering started");
|
|
13
|
+
this.fireBufferBegin()}w(){this.m&&(this.g("ad buffering ended"),this.m=!1,this.fireBufferEnd())}o(c){this.g("ad quartile",c);this.fireQuartile(c)}F(){this.g("ad clicked");const c=this.a&&this.a.Gb();this.h.debug("ad click through url: ",c);this.fireClick(c)}K(){this.g("ad skipped");this.fireSkip()}A(c){this.a=c.ad;this.g("ad break start",this.a);this.fireBreakStart()}B(){this.g("ad break stop");this.fireBreakStop();if(this.getPosition()===youbora.Constants.AdPosition.Postroll){const c=this.plugin.getAdapter();
|
|
14
|
+
c&&c.fireStop()}}H(c){(c=c.detail)&&10003===c.code&&pq(c,this.l,this.h,this)}g(c,...d){this.h.debug(`Reporting "${c}" event to Youbora`,...d)}}return new b(a)};var sq=class extends _.kq{constructor(){super();this.a=null;this.f=new _.O(lq);this.l=null}Xd(a){this.a&&(this.a.removeAdsAdapter(),this.a.removeAdapter());if(this.a=a)this.a.setAdapter(qq(this.l)),this.a.setAdsAdapter(rq(this.l))}getAdapter(){return this.a&&this.a.getAdapter()}getAdsAdapter(){return this.a&&this.a.getAdsAdapter()}onPlayerCreated(a){this.l=a;nq(this,a)&&(a=a.getConfiguration().youbora,this.Xd(new youbora.Plugin(a)))}onContentWillLoad(a,b){if(nq(this,a)){a=a.getConfiguration();var c=
|
|
15
|
+
a.youbora;void 0===c[mq]&&(c[mq]=b.isLive);void 0===c["content.title"]&&(c["content.title"]=b.name);void 0===c.viewerId&&(c.viewerId=a.viewerId);this.a||this.Xd(new youbora.Plugin(c));this.a.setOptions(c)}}onPlayerWillRelease(){}onPlayerWillDestroy(){}id(){return"youbora"}};_.z(lq,sq);sq.prototype.getAdsAdapter=sq.prototype.getAdsAdapter;sq.prototype.getAdapter=sq.prototype.getAdapter;sq.prototype.setYouboraPlugin=sq.prototype.Xd;sq.Id="youbora";_.Sm(new class{create(){return new sq}});};f.call(g, window);
|
package/package.json
CHANGED
package/typings.d.ts
CHANGED
|
@@ -719,6 +719,16 @@ export namespace clpp {
|
|
|
719
719
|
* Default value, -1, means the bitrate will be selected by the SDK.
|
|
720
720
|
*/
|
|
721
721
|
bitrate: number;
|
|
722
|
+
/**
|
|
723
|
+
* Disables SDK for SmartTVs devices (Tizen and WebOS).
|
|
724
|
+
* Could be used to disable ad playback in case of issues on devices using
|
|
725
|
+
* single video element for both ads and content.
|
|
726
|
+
* WARNING NOTE:
|
|
727
|
+
* This is an experimental feature and is currently disabled by default. We're
|
|
728
|
+
* planning to enable it by default in the future, but for now, we don't
|
|
729
|
+
* recommend using it in production. Default: `true`.
|
|
730
|
+
*/
|
|
731
|
+
disableCustomPlayback: boolean;
|
|
722
732
|
/**
|
|
723
733
|
* Enables preloading of video assets.
|
|
724
734
|
*/
|
|
@@ -874,17 +884,85 @@ export namespace clpp {
|
|
|
874
884
|
*/
|
|
875
885
|
export type MuxDataConfiguration = {
|
|
876
886
|
/**
|
|
877
|
-
* Your environment key.
|
|
887
|
+
* Your MUX Data environment key.
|
|
878
888
|
*/
|
|
879
889
|
envKey: string;
|
|
880
890
|
/**
|
|
881
|
-
* The MUX
|
|
891
|
+
* The MUX Data SDK API instance. By default PRESTOPlay looks for the MUX
|
|
892
|
+
* Data SDK API in the global namespace variable `window.mux`, but that can
|
|
893
|
+
* be overridden by passing the API instance explicitly here through this
|
|
894
|
+
* config.
|
|
882
895
|
*/
|
|
883
896
|
muxLib?: Object;
|
|
884
897
|
/**
|
|
885
|
-
* Pass
|
|
898
|
+
* Pass additional or overriding MUX SDK options, which will be passed
|
|
899
|
+
* to the call of `mux.init()`.
|
|
900
|
+
*/
|
|
901
|
+
muxOptionsOverride?: clpp.MuxOverride;
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
/**
|
|
905
|
+
* Options metadata.
|
|
906
|
+
*/
|
|
907
|
+
export type MuxOptionsData = {
|
|
908
|
+
/**
|
|
909
|
+
* A key identifying a MUX Data environment/bucket/project.
|
|
910
|
+
*/
|
|
911
|
+
env_key: string;
|
|
912
|
+
/**
|
|
913
|
+
* The name of the plugin being built (some descriptive string).
|
|
914
|
+
*/
|
|
915
|
+
player_mux_plugin_name?: string;
|
|
916
|
+
/**
|
|
917
|
+
* The version of the plugin being built (a version string).
|
|
918
|
+
*/
|
|
919
|
+
player_mux_plugin_version?: string;
|
|
920
|
+
/**
|
|
921
|
+
* Player Software being used to play the Video (e.g. Video.js, JW Player,
|
|
922
|
+
* etc.). Note this was previously named player_software
|
|
923
|
+
*/
|
|
924
|
+
player_software_name?: string;
|
|
925
|
+
/**
|
|
926
|
+
* Player Software Version (e.g. 2.45.5).
|
|
927
|
+
*/
|
|
928
|
+
player_software_version?: string;
|
|
929
|
+
/**
|
|
930
|
+
* As you make changes to your player you can compare how new versions of your
|
|
931
|
+
* player perform. This is not the player software version (e.g. Video.js
|
|
932
|
+
* 5.0.0), which is tracked automatically by the SDK.
|
|
933
|
+
*/
|
|
934
|
+
player_version?: string;
|
|
935
|
+
/**
|
|
936
|
+
* Your internal ID for the video.
|
|
937
|
+
*/
|
|
938
|
+
video_id?: string;
|
|
939
|
+
/**
|
|
940
|
+
* Title of the video player (e.g.: 'Awesome Show: Pilot')
|
|
941
|
+
*/
|
|
942
|
+
video_title?: string;
|
|
943
|
+
/**
|
|
944
|
+
* An ID representing the viewer who is watching the stream. Use this to look
|
|
945
|
+
* up video views for an individual viewer. If no value is specified, a unique
|
|
946
|
+
* ID will be generated by the SDK. Note: You should not use any value that is
|
|
947
|
+
* personally identifiable on its own (such as email address, username, etc).
|
|
948
|
+
* Instead, you should supply an anonymized viewer ID which you have stored
|
|
949
|
+
* within your own system.
|
|
950
|
+
*/
|
|
951
|
+
viewer_user_id?: string;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
/**
|
|
955
|
+
* Overriding options to pass to the MUX Data SDK.
|
|
956
|
+
*/
|
|
957
|
+
export type MuxOverride = {
|
|
958
|
+
/**
|
|
959
|
+
* Data about the viewer, video and the integration.
|
|
960
|
+
*/
|
|
961
|
+
data?: clpp.MuxOptionsData;
|
|
962
|
+
/**
|
|
963
|
+
* Controls whether debug log statements are logged to the console.
|
|
886
964
|
*/
|
|
887
|
-
|
|
965
|
+
debug?: boolean;
|
|
888
966
|
}
|
|
889
967
|
|
|
890
968
|
/**
|
|
@@ -1102,7 +1180,7 @@ export namespace clpp {
|
|
|
1102
1180
|
*/
|
|
1103
1181
|
muted?: boolean;
|
|
1104
1182
|
/**
|
|
1105
|
-
* Mux Data configuration.
|
|
1183
|
+
* Mux Data Analytics configuration.
|
|
1106
1184
|
*/
|
|
1107
1185
|
muxdata?: Partial<clpp.MuxDataConfiguration>;
|
|
1108
1186
|
/**
|
|
@@ -4107,8 +4185,8 @@ export namespace clpp {
|
|
|
4107
4185
|
*/
|
|
4108
4186
|
DASH_DUPLICATE_REPRESENTATION_ID = 4018,
|
|
4109
4187
|
/**
|
|
4110
|
-
* HLS manifest
|
|
4111
|
-
*
|
|
4188
|
+
* HLS manifest is invalid because multiple #EXT-X-MAP tags
|
|
4189
|
+
* were found attached to the same segment.
|
|
4112
4190
|
*/
|
|
4113
4191
|
HLS_MULTIPLE_MEDIA_INIT_SECTIONS_FOUND = 4020,
|
|
4114
4192
|
/**
|
|
@@ -4244,6 +4322,20 @@ export namespace clpp {
|
|
|
4244
4322
|
* HLS media playlist does not contain any media segments.
|
|
4245
4323
|
*/
|
|
4246
4324
|
HLS_PLAYLIST_EMPTY = 4043,
|
|
4325
|
+
/**
|
|
4326
|
+
* Some tag or attribute value in the HLS playlist is invalid.
|
|
4327
|
+
*/
|
|
4328
|
+
HLS_INVALID_VALUE = 4044,
|
|
4329
|
+
/**
|
|
4330
|
+
* Encountered a complex HLS playlist with discontinuities.
|
|
4331
|
+
* Discontinuity in HLS is not fully supported yet,
|
|
4332
|
+
* only certain simple playlists are supported.
|
|
4333
|
+
*/
|
|
4334
|
+
HLS_DISCONTINUITY_NOT_SUPPORTED = 4045,
|
|
4335
|
+
/**
|
|
4336
|
+
* Encountered a feature of HLS which is not currently supported.
|
|
4337
|
+
*/
|
|
4338
|
+
HLS_UNSUPPORTED_FEATURE = 4046,
|
|
4247
4339
|
/**
|
|
4248
4340
|
* The StreamingEngine called onChooseStreams() but the callback receiver
|
|
4249
4341
|
* did not return the correct number or type of Streams.
|
|
@@ -6170,6 +6262,11 @@ export namespace clpp {
|
|
|
6170
6262
|
* of request modifiers that will be applied to this request
|
|
6171
6263
|
*/
|
|
6172
6264
|
requestModifiers: Array<clpp.net.RequestModifier>;
|
|
6265
|
+
/**
|
|
6266
|
+
* Timestamp when the request
|
|
6267
|
+
* was started. Optional and only set and used now for purposes of analytics.
|
|
6268
|
+
*/
|
|
6269
|
+
requestStartTimestamp: number|null;
|
|
6173
6270
|
/**
|
|
6174
6271
|
* The list
|
|
6175
6272
|
* of request modifiers that will be applied to this request
|
|
@@ -6252,6 +6349,10 @@ export namespace clpp {
|
|
|
6252
6349
|
* The associated request
|
|
6253
6350
|
*/
|
|
6254
6351
|
request?: clpp.net.Request;
|
|
6352
|
+
/**
|
|
6353
|
+
* Optional. The time it took to get the first byte of the response, in ms.
|
|
6354
|
+
*/
|
|
6355
|
+
responseStartMs?: number;
|
|
6255
6356
|
/**
|
|
6256
6357
|
* The HTTP status code
|
|
6257
6358
|
*/
|