@castlabs/prestoplay 6.10.0 → 6.11.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 +27 -0
- 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 +112 -112
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +467 -435
- package/cjs/cl.crypto.js +9 -10
- package/cjs/cl.dash.js +72 -72
- package/cjs/cl.externs.js +132 -33
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +78 -74
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +29 -29
- package/cjs/cl.ima.js +24 -24
- package/cjs/cl.mse.js +274 -274
- package/cjs/cl.muxdata.js +14 -14
- 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 +24 -24
- package/cjs/cl.tizen.js +71 -71
- package/cjs/cl.ttml.js +29 -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 +20 -20
- 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 +395 -368
- package/cl.crypto.js +9 -9
- package/cl.dash.js +67 -66
- package/cl.externs.js +128 -33
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +64 -61
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +17 -17
- package/cl.mse.js +238 -239
- package/cl.muxdata.js +12 -12
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +11 -11
- package/cl.playlist.js +5 -5
- package/cl.smooth.js +59 -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 +14 -14
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +15 -15
- package/clpp.styles.css +15 -0
- package/package.json +1 -1
- package/typings.d.ts +202 -19
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
|
-
_.
|
|
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||_.C("VTT parser encountered an invalid VTTRegion setting: ",g,
|
|
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 _.H(_.G,2,2008);let c=0,d=[],e;const f=[];let g=!1,h=!1,k=!1,l=null;(new _.
|
|
11
|
-
_.P(q));v&1024&&q.skip(4);v&2048&&(E.
|
|
12
|
-
b.periodStart+a/this.a)):this.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Ar=" The setting will be ignored.",Br="VTT parser encountered an invalid VTT setting: ",Cr="application/x-subrip",Dr="text/srt",Er='text/vtt; codecs\x3d"vtt"',Fr='text/vtt; codecs\x3d"wvtt"',Gr=function(a){return a.a==a.f.length?null:(a=_.Bh(a,/[^ \t\n]*/gm))?a[0]:null},Hr=function(a){_.Bh(a,/[ \t]+/gm)},Ir=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},Jr=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)},Lr=function(a,b,c){let d;if(d=/^align:(start|middle|center|end|left|right)$/.exec(b))b=d[1],"middle"==b?a.textAlign=_.yp:a.textAlign=_.Ep[b.toUpperCase()];else if(d=/^vertical:(lr|rl)$/.exec(b))a.writingMode="lr"==d[1]?_.cf:_.df;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==_.yd||b==_.Fe?_.yd:b==_.zd||b==_.jd?_.zd:
|
|
4
|
+
_.zc);else if(d=/^region:(.*)$/.exec(b)){if(b=Kr(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=_.Fp[c[2].toUpperCase()]);else if(c=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(b))a.lineInterpretation=_.Ap,a.line=Number(c[1]),c[2]&&(a.lineAlign=_.Fp[c[2].toUpperCase()]);else{a=!1;break a}a=!0}return a}return!0},Kr=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)},Nr=function(a,b,c){let d,e,f;(new _.tk).L("payl",_.ok(g=>{d=_.gh(g)})).L("iden",_.ok(g=>{e=_.gh(g)})).L("sttg",_.ok(g=>{f=_.gh(g)})).parse(a);return d?Mr(d,e,f,b,c):null},Mr=function(a,b,c,d,e){a=new _.Dp(d,e,a,_.lf);b&&(a.id=b);if(c)for(b=new _.Ch(c),c=Gr(b);c;)Lr(a,c,[])||_.C(Br,c,Ar),Hr(b),c=Gr(b);return a},Or=class{a(a){a=_.gh(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+=Ir(c)}return _.kh(b)}},Pr=class{create(){return new Or}probe(a,b){return(a===Dr||a===Cr)&&b===_.Qe}};var Qr=class{constructor(a){this.a=a}parseInit(){}parseMedia(a,b){a=_.gh(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=Jr(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 _.Ip;Gr(e);Hr(e);for(var g=Gr(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,Ar);Hr(e);g=Gr(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=Jr(d);const q=_.Bh(d,/[ \t]+--\x3e[ \t]+/g);k=Jr(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 _.Dp(g,k,l,_.lf);e&&(g.id=e);Hr(d);for(k=Gr(d);k;)Lr(g,k,c)||_.C(Br,k,Ar),Hr(d),k=Gr(d);null!=e&&(g.id=e);c=g}c&&m.push(c)}return{cues:m,styles:f}}};var Rr=class extends Qr{parseMedia(a,b){return super.parseMedia((new Or).a(a),b)}};var Sr=class{constructor(){this.a=null;this.h=new _.R("clpp.vtt.mp4")}parseInit(a){let b=!1;(new _.tk).L(_.Jd,_.mk).L(_.Te,_.mk).L(_.Ed,_.mk).Z("mdhd",c=>{0==c.version?(c.reader.skip(4),c.reader.skip(4),this.a=_.P(c.reader),c.reader.skip(4)):(c.reader.skip(8),c.reader.skip(8),this.a=_.P(c.reader),c.reader.skip(8));c.reader.skip(4)}).L(_.Id,_.mk).L(_.Ie,_.mk).Z(_.Ke,_.nk).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.h.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 _.tk).L("moof",_.mk).L("traf",_.mk).Z("tfdt",q=>{g=!0;c=0==q.version?_.P(q.reader):_.hk(q.reader)}).Z("tfhd",q=>{var u=q.flags;q=q.reader;q.skip(4);u&1&&q.skip(8);u&2&&q.skip(4);l=u&8?_.P(q):null}).Z("trun",q=>{h=!0;{var u=q.version,v=q.flags;q=q.reader;const y=_.P(q);v&1&&q.skip(4);v&4&&q.skip(4);const A=[];for(let D=0;D<y;D++){const E={duration:null,sampleSize:null,oe:null};v&256&&(E.duration=_.P(q));v&512&&(E.sampleSize=
|
|
11
|
+
_.P(q));v&1024&&q.skip(4);v&2048&&(E.oe=0==u?_.P(q):_.gk(q));A.push(E)}d=A}}).L(_.Dd,_.ok(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 _.gl(m,!1);for(const q of d){const u=q.duration||l,v=q.oe?c+q.oe:a;a=v+(u||0);let y=0;do{const A=_.P(m);y+=A;var n=_.P(m);n=_.lk(n);let D=null;"vttc"==n?8<A&&(D=_.jk(m,A-8)):("vtte"!=n&&this.h.error("Unknown box "+n+"! Skipping!"),m.skip(A-8));u?D&&f.push(Nr(D,b.periodStart+v/this.a,
|
|
12
|
+
b.periodStart+a/this.a)):this.h.error("WVTT sample duration unknown, and no default found!")}while(q.sampleSize&&y<q.sampleSize)}return{cues:f.filter(_.Cg),styles:[]}}};_.z("clpp.vtt.VttComponent",class extends _.Pq{constructor(){super();this.j=new Pr}f(){_.jp[_.Qe]=Qr;_.jp[Er]=Qr;_.jp[Fr]=Qr;_.jp[_.cc]=Sr;_.jp[Dr]=Rr;_.jp[Cr]=Rr;_.si.push(this.j)}a(){_.kp(_.Qe);_.kp(Er);_.kp(Fr);_.kp(_.cc);_.kp(Dr);_.kp(Cr);_.ui(this.j)}id(){return"subtitles-vtt"}});};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.
|
|
3
|
-
a.code?"ad error":_.
|
|
4
|
-
d,e)}getIsLive(){return this.
|
|
5
|
-
youbora.Util.logAllEvents(this.
|
|
6
|
-
this.
|
|
7
|
-
(c=c.keySystem,(c=c.startsWith(_.
|
|
8
|
-
c);c=c.adsTimeline;this.w=!!c&&c.hb()}C(c){this.
|
|
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.ub()}getGivenAds(){return this.getExpectedAds()}getBreaksTime(){return this.j&&this.j.getCuePoints().map(c=>-1===c?this.
|
|
11
|
-
this.f&&(this.f.on(this.
|
|
12
|
-
this.f.on(this.
|
|
13
|
-
this.fireBufferBegin()}w(){this.
|
|
14
|
-
c&&c.fireStop()}}H(c){(c=c.detail)&&10003===c.code&&
|
|
15
|
-
a.youbora;void 0===c[
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var sr="clpp.npaw.YouboraPlugin",tr="content.isLive",ur=function(a,b){if(b.namespace()===_.Gc)return a.h.info("Youbora does not report when casting."),!1;const c=b.getConfiguration().youbora;if(!_.Mf(c))return a.h.warn("Youbora plugin is loaded but not configured. Will do nothing."),!1;if(!c.accountCode)return a.h.warn("accountCode key is missing in Youbora config"),b.onError(new _.H(1,9,9101)),!1;if(_.B(window.youbora))return a.h.warn("Youbora SDK not found."),b.onError(new _.H(1,9,
|
|
2
|
+
9100)),!1;"6.8.49"!==youbora.VERSION&&(a.h.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},vr=a=>(a=a.getConfiguration().youbora)&&a.errorFilter?a.errorFilter:b=>({code:`${b.code}`,message:b.message,severity:b.severity}),wr=(a,b,c,d)=>{b=vr(b)(a);if(!b)return c.debug("Error not sent to Youbora",a.code,a.message),null;a=10003===
|
|
3
|
+
a.code?"ad error":_.ld;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 xr=a=>{class b extends youbora.Adapter{constructor(c){super(c);this.m=c;this.a=new _.vp;this.h=new _.R("clpp.npaw.YouboraAdapter");this.g=this.w=!1;this.registerListeners()}getPlayhead(){return this.getIsLive()?-1:this.m.getPosition()}getDuration(){return this.m.getDuration()}getRendition(){let c,d,e;var f=this.m.getTrackManager();f&&(f=f.ia())&&(c=f.width,d=f.height,e=f.bandwidth);c&&d&&e||(f=this.l(),c=c||f.width,d=d||f.height,e=e||f.streamBandwidth);return youbora.Util.buildRenditionString(c,
|
|
4
|
+
d,e)}getIsLive(){return this.m.isLive()}getResource(){const c=this.m.getLoadedSource();return c&&c.url}getBitrate(){return this.l().streamBandwidth}getThroughput(){return this.l().estimatedBandwidth}getPlayrate(){return this.m.getPlaybackRate()}getFramesPerSecond(){var c=this.m.getTrackManager();return c&&(c=c.Ka())?c.frameRate:null}getPlayerName(){return _.na}getVersion(){return"6.11.0-castlabsadapter-js"}getPlayerVersion(){return _.da}registerListeners(){this.m&&this.a&&(this.h.debug("registering listeners"),
|
|
5
|
+
youbora.Util.logAllEvents(this.m),this.a.on(this.m,_.Ge,this.I.bind(this)),this.a.on(this.m,_.ld,this.F.bind(this)),this.a.on(this.m,_.af,this.H.bind(this)),this.a.on(this.m,_.$e,this.G.bind(this)),this.a.on(this.m,_.Vb,this.B.bind(this)),this.a.on(this.m,_.vc,this.C.bind(this)))}unregisterListeners(){this.h.debug(_.vb);_.jg(this.a)}dispose(){super.dispose()}l(){return this.m.getStats()||_.nm()}o(){return!!this.m.getConfiguration().autoplay}I(c){c=c.detail;this.j("state change",c);if(c)switch(c.currentState){case _.Bm:this.o()&&
|
|
6
|
+
this.f();break;case _.Dm:this.f();this.A();this.fireResume();this.fireBufferEnd();break;case _.Cm:this.o()&&this.f();this.A();this.fireBufferEnd();this.firePause();break;case _.Am:this.fireBufferEnd();this.fireStop();break;case _.sm:this.fireBufferEnd();this.w&&this.plugin.getAdsAdapter()?this.firePause():this.fireStop();break;case _.vm:this.fireBufferBegin();break;default:this.h.debug("Unhandled state",c)}}f(){this.plugin.isInitiated||(this.g=!1,this.fireInit())}A(){var c=this.m.getDrmInfo();c&&
|
|
7
|
+
(c=c.keySystem,(c=c.startsWith(_.Sc)?"Widevine":c.startsWith(_.Pc)?"FairPlay":c.match(/^com\.(microsoft|chromecast)\.playready/)?"PlayReady":c.startsWith(_.Zd)?"ClearKey":c.startsWith(_.Oc)?"Primetime":c)&&this.plugin.setOptions({"content.drm":c}));this.fireJoin()}F(c){!(c=c.detail)||this.g||10003===c.code&&this.plugin.getAdsAdapter()||(c=wr(c,this.m,this.h,this))&&c.severity===_.G&&(this.g=!0)}H(){this.j(_.Be);this.m.isEnded()||(this.f(),this.fireSeekBegin())}G(){this.j(_.Ae);this.fireSeekEnd()}B(c){this.h.debug("adsTimeline",
|
|
8
|
+
c);c=c.adsTimeline;this.w=!!c&&c.hb()}C(c){this.h.debug("Casting",c);this.fireCasted()}j(c,...d){this.h.debug(`Reporting "${c}" event to Youbora`,...d)}}return new b(a)};var yr=a=>{class b extends youbora.Adapter{constructor(c){super(c);this.m=c;this.j=this.a=null;this.f=new _.vp;this.h=new _.R("clpp.npaw.YouboraAdsAdapter");this.registerListeners();this.l=!1}getDuration(){return this.a&&this.a.getDuration()}getRendition(){let c=null;this.a&&(c=youbora.Util.buildRenditionString(this.a.sb(),this.a.rb(),this.a.gb()));return c}getBitrate(){return this.a&&this.a.gb()}getPlayhead(){const c=this.m.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.Ta()){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.m.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.ub()}getGivenAds(){return this.getExpectedAds()}getBreaksTime(){return this.j&&this.j.getCuePoints().map(c=>-1===c?this.m.getDuration():c)}getIsFullscreen(){return this.m.getSurface().isFullscreen()}getIsVisible(){var c=this.m.getSurface().getContainer();c=youbora.Util.calculateAdViewability(c);this.h.debug("is container visible",c);return c}getPlayerName(){return _.na}getVersion(){return"6.11.0-castlabsadsadapter-js"}getPlayerVersion(){return _.da}registerListeners(){this.m&&
|
|
11
|
+
this.f&&(this.f.on(this.m,_.Vb,this.N.bind(this)),this.f.on(this.m,_.Pb,this.M.bind(this)),this.f.on(this.m,_.Lb,this.I.bind(this)),this.f.on(this.m,_.Nb,this.J.bind(this)),this.f.on(this.m,_.Gb,this.G.bind(this)),this.f.on(this.m,_.Hb,this.o.bind(this,1)),this.f.on(this.m,_.Kb,this.o.bind(this,2)),this.f.on(this.m,_.Rb,this.o.bind(this,3)),this.f.on(this.m,_.Fb,this.F.bind(this)),this.f.on(this.m,_.Ob,this.K.bind(this)),this.f.on(this.m,_.ld,this.H.bind(this)),this.f.on(this.m,_.Cb,this.A.bind(this)),
|
|
12
|
+
this.f.on(this.m,_.Db,this.B.bind(this)),this.f.on(this.m,_.Eb,this.C.bind(this)),this.f.on(this.m,_.Mb,this.w.bind(this)))}unregisterListeners(){_.jg(this.f)}dispose(){super.dispose()}N(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.l=!0;this.g("ad buffering started");
|
|
13
|
+
this.fireBufferBegin()}w(){this.l&&(this.g("ad buffering ended"),this.l=!1,this.fireBufferEnd())}o(c){this.g("ad quartile",c);this.fireQuartile(c)}F(){this.g("ad clicked");const c=this.a&&this.a.Ib();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&&wr(c,this.m,this.h,this)}g(c,...d){this.h.debug(`Reporting "${c}" event to Youbora`,...d)}}return new b(a)};var zr=class extends _.rr{constructor(){super();this.a=null;this.h=new _.R(sr);this.m=null}ke(a){this.a&&(this.a.removeAdsAdapter(),this.a.removeAdapter());if(this.a=a)this.a.setAdapter(xr(this.m)),this.a.setAdsAdapter(yr(this.m))}getAdapter(){return this.a&&this.a.getAdapter()}getAdsAdapter(){return this.a&&this.a.getAdsAdapter()}onPlayerCreated(a){this.m=a;ur(this,a)&&(a=a.getConfiguration().youbora,this.ke(new youbora.Plugin(a)))}onContentWillLoad(a,b){if(ur(this,a)){a=a.getConfiguration();var c=
|
|
15
|
+
a.youbora;void 0===c[tr]&&(c[tr]=b.isLive);void 0===c["content.title"]&&(c["content.title"]=b.name);void 0===c.viewerId&&(c.viewerId=a.viewerId);this.a||this.ke(new youbora.Plugin(c));this.a.setOptions(c)}}onPlayerWillRelease(){}onPlayerWillDestroy(){}id(){return"youbora"}};_.z(sr,zr);zr.prototype.getAdsAdapter=zr.prototype.getAdsAdapter;zr.prototype.getAdapter=zr.prototype.getAdapter;zr.prototype.setYouboraPlugin=zr.prototype.ke;zr.Id="youbora";_.En(new class{create(){return new zr}});};f.call(g, window);
|
package/clpp.styles.css
CHANGED
|
@@ -145,3 +145,18 @@
|
|
|
145
145
|
.clpp-text-container .bg_black {
|
|
146
146
|
background-color: rgba(0, 0, 0, 1);
|
|
147
147
|
}
|
|
148
|
+
|
|
149
|
+
.clpp-mc-playlist {
|
|
150
|
+
position: absolute;
|
|
151
|
+
}
|
|
152
|
+
.clpp-mc-playlist .clpp-mc-playlist-item {
|
|
153
|
+
position: absolute;
|
|
154
|
+
width: 100%;
|
|
155
|
+
height: 100%;
|
|
156
|
+
}
|
|
157
|
+
.clpp-mc-playlist .clpp-mc-playlist-item video {
|
|
158
|
+
z-index: 0;
|
|
159
|
+
}
|
|
160
|
+
.clpp-mc-playlist .clpp-mc-playlist-item video.clpp-visible {
|
|
161
|
+
z-index: 1;
|
|
162
|
+
}
|
package/package.json
CHANGED
package/typings.d.ts
CHANGED
|
@@ -228,6 +228,13 @@ export namespace clpp {
|
|
|
228
228
|
* seconds. This keeps us from changing too often and annoying the user.
|
|
229
229
|
*/
|
|
230
230
|
switchInterval: number;
|
|
231
|
+
/**
|
|
232
|
+
* Defaults to false.
|
|
233
|
+
*
|
|
234
|
+
* Enables reading CMSD data in media requests.
|
|
235
|
+
* Only dynamic header estimatedThroughput is currently supported.
|
|
236
|
+
*/
|
|
237
|
+
useCmsd: boolean;
|
|
231
238
|
/**
|
|
232
239
|
* By default ABR algorithm switches video quality as soon as he has enough
|
|
233
240
|
* data to do it, initially ignoring `switchInterval` value. Set it to true
|
|
@@ -1982,7 +1989,7 @@ export namespace clpp {
|
|
|
1982
1989
|
*
|
|
1983
1990
|
* The minimum number of seconds of content that the Player must
|
|
1984
1991
|
* buffer before it can begin playback or can continue playback after it has
|
|
1985
|
-
* entered into a buffering state (i.e., after it has depleted one
|
|
1992
|
+
* entered into a buffering state (i.e., after it has depleted one or
|
|
1986
1993
|
* more of its buffers).
|
|
1987
1994
|
*/
|
|
1988
1995
|
rebufferingGoal: number;
|
|
@@ -2565,10 +2572,11 @@ export namespace clpp {
|
|
|
2565
2572
|
export type WidevineDrmSystem = {
|
|
2566
2573
|
/**
|
|
2567
2574
|
* The EME audio robustness level. Please note that
|
|
2568
|
-
* you do not need to specify this
|
|
2575
|
+
* you usually do not need to specify this, the player will find
|
|
2569
2576
|
* an appropriate value based on the current platform and browser.
|
|
2577
|
+
* You can also configure an array ordered by priority in descending order.
|
|
2570
2578
|
*/
|
|
2571
|
-
audioRobustness
|
|
2579
|
+
audioRobustness?: clpp.drm.WidevineRobustnessLevel|Array<(clpp.drm.WidevineRobustnessLevel|undefined)>;
|
|
2572
2580
|
/**
|
|
2573
2581
|
* Defaults to false.
|
|
2574
2582
|
*
|
|
@@ -2610,10 +2618,11 @@ export namespace clpp {
|
|
|
2610
2618
|
serverCertificate: Uint8Array|null;
|
|
2611
2619
|
/**
|
|
2612
2620
|
* The EME video robustness level. Please note that
|
|
2613
|
-
* you do not need to specify this
|
|
2621
|
+
* you usually do not need to specify this, the player will find
|
|
2614
2622
|
* an appropriate value based on the current platform and browser.
|
|
2623
|
+
* You can also configure an array ordered by priority in descending order.
|
|
2615
2624
|
*/
|
|
2616
|
-
videoRobustness
|
|
2625
|
+
videoRobustness?: clpp.drm.WidevineRobustnessLevel|Array<(clpp.drm.WidevineRobustnessLevel|undefined)>;
|
|
2617
2626
|
}
|
|
2618
2627
|
|
|
2619
2628
|
/**
|
|
@@ -3389,15 +3398,11 @@ export namespace clpp {
|
|
|
3389
3398
|
*/
|
|
3390
3399
|
release(): Promise<void>;
|
|
3391
3400
|
/**
|
|
3392
|
-
* Removes a specified component from the player.
|
|
3393
|
-
* Please note that this operation will only run if the player has been
|
|
3394
|
-
* released or is in IDLE state.
|
|
3395
|
-
*
|
|
3396
3401
|
* @param component Component constructor
|
|
3397
3402
|
*
|
|
3398
3403
|
* @example
|
|
3399
3404
|
*
|
|
3400
|
-
*
|
|
3405
|
+
* const player = new clpp.Player(...);
|
|
3401
3406
|
* player.use(clpp.smooth.SmoothComponent);
|
|
3402
3407
|
* player.load('https://example.com/smooth/Manifest');
|
|
3403
3408
|
* ...
|
|
@@ -3511,19 +3516,13 @@ export namespace clpp {
|
|
|
3511
3516
|
*/
|
|
3512
3517
|
setVolume(volume: number): void;
|
|
3513
3518
|
/**
|
|
3514
|
-
* Registers specified component to player.
|
|
3515
|
-
* Please note that every component is automatically unregistered during
|
|
3516
|
-
* player disposal, so desired components should be installed again.
|
|
3517
|
-
*
|
|
3518
3519
|
* @param component component constructor.
|
|
3519
3520
|
*
|
|
3520
3521
|
* @example
|
|
3521
3522
|
*
|
|
3522
|
-
*
|
|
3523
|
+
* const player = new clpp.Player(...);
|
|
3523
3524
|
* player.use(clpp.smooth.SmoothComponent);
|
|
3524
|
-
* player
|
|
3525
|
-
* player = new clpp.Player(...);
|
|
3526
|
-
* player.use(clpp.smooth.SmoothComponent); // need to add component again
|
|
3525
|
+
* // The player can now play Smooth Streaming content
|
|
3527
3526
|
*/
|
|
3528
3527
|
use(component: Function): void;
|
|
3529
3528
|
}
|
|
@@ -4432,6 +4431,11 @@ export namespace clpp {
|
|
|
4432
4431
|
* Encountered a feature of HLS which is not currently supported.
|
|
4433
4432
|
*/
|
|
4434
4433
|
HLS_UNSUPPORTED_FEATURE = 4046,
|
|
4434
|
+
/**
|
|
4435
|
+
* The content of the media playlist is incompatible with new content
|
|
4436
|
+
* after an update.
|
|
4437
|
+
*/
|
|
4438
|
+
HLS_INCOMPATIBLE_PLAYLIST_UPDATE = 4047,
|
|
4435
4439
|
/**
|
|
4436
4440
|
* The StreamingEngine called onChooseStreams() but the callback receiver
|
|
4437
4441
|
* did not return the correct number or type of Streams.
|
|
@@ -5687,8 +5691,18 @@ export namespace clpp {
|
|
|
5687
5691
|
}
|
|
5688
5692
|
|
|
5689
5693
|
export class DrmEnvironment {
|
|
5694
|
+
/**
|
|
5695
|
+
* @param name DRM environment name
|
|
5696
|
+
*/
|
|
5690
5697
|
constructor(name: string);
|
|
5691
|
-
|
|
5698
|
+
/**
|
|
5699
|
+
* Set the default configuration for a given DRM system.
|
|
5700
|
+
*
|
|
5701
|
+
* @param identifier DRM system identifier
|
|
5702
|
+
* @param config DRM
|
|
5703
|
+
* system configuration
|
|
5704
|
+
*/
|
|
5705
|
+
setDrmSystem(identifier: clpp.drm.KeySystem, config: clpp.PlayreadyDrmSystem|clpp.FairplayDrmSystem|clpp.WidevineDrmSystem): void;
|
|
5692
5706
|
}
|
|
5693
5707
|
|
|
5694
5708
|
export class HeaderDrm {
|
|
@@ -6718,6 +6732,175 @@ export namespace clpp {
|
|
|
6718
6732
|
}
|
|
6719
6733
|
}
|
|
6720
6734
|
|
|
6735
|
+
namespace plist {
|
|
6736
|
+
/**
|
|
6737
|
+
* A playlist item.
|
|
6738
|
+
* It consists of an asset/config, a player instances selected
|
|
6739
|
+
* to play this asset and the underlying video element to which the player is
|
|
6740
|
+
* attached.
|
|
6741
|
+
*/
|
|
6742
|
+
export type Item = {
|
|
6743
|
+
/**
|
|
6744
|
+
* Source configuration.
|
|
6745
|
+
*/
|
|
6746
|
+
config: clpp.PlayerConfiguration;
|
|
6747
|
+
/**
|
|
6748
|
+
* The index of the item in the playlist.
|
|
6749
|
+
*/
|
|
6750
|
+
index: number;
|
|
6751
|
+
/**
|
|
6752
|
+
* A player instance.
|
|
6753
|
+
*/
|
|
6754
|
+
player: clpp.Player|null;
|
|
6755
|
+
/**
|
|
6756
|
+
* A promise that resolves when the item is preloaded.
|
|
6757
|
+
*/
|
|
6758
|
+
preloadPromise: Promise<void>;
|
|
6759
|
+
/**
|
|
6760
|
+
* The role of the item.
|
|
6761
|
+
*/
|
|
6762
|
+
role: string;
|
|
6763
|
+
/**
|
|
6764
|
+
* The state of the item (e.g. 'preloading', 'preloaded', 'preload-failed').
|
|
6765
|
+
*/
|
|
6766
|
+
state: string;
|
|
6767
|
+
/**
|
|
6768
|
+
* The video element attached to the player.
|
|
6769
|
+
*/
|
|
6770
|
+
videoEl: HTMLVideoElement|null;
|
|
6771
|
+
}
|
|
6772
|
+
|
|
6773
|
+
/**
|
|
6774
|
+
* Playlist options.
|
|
6775
|
+
*/
|
|
6776
|
+
export type Options = {
|
|
6777
|
+
/**
|
|
6778
|
+
* ID of the HTML element to be used as a container
|
|
6779
|
+
* for video elements created by this playlist
|
|
6780
|
+
*/
|
|
6781
|
+
anchorId: string;
|
|
6782
|
+
/**
|
|
6783
|
+
* A custom callback to toggle the visibility of a video element. By default
|
|
6784
|
+
* this is done via z-index.
|
|
6785
|
+
*/
|
|
6786
|
+
toggleVisible?: Function;
|
|
6787
|
+
/**
|
|
6788
|
+
* Transition method, can be "pause" or "keep-playing". In cause of "pause"
|
|
6789
|
+
* the current video will be paused when calling
|
|
6790
|
+
* {@link clpp.plist.McPlaylist.playNext} or
|
|
6791
|
+
* {@link clpp.plist.McPlaylist.playPrev}.
|
|
6792
|
+
*/
|
|
6793
|
+
transition?: string;
|
|
6794
|
+
}
|
|
6795
|
+
|
|
6796
|
+
/**
|
|
6797
|
+
* Multi-controller playlist intended for fast live TV channel zapping.
|
|
6798
|
+
* It is based on an architecture which leverages multiple video elements
|
|
6799
|
+
* and multiple instances of {@link clpp.Player} to preload assets in order to
|
|
6800
|
+
* reduce zap time.
|
|
6801
|
+
* Known limitations:
|
|
6802
|
+
*
|
|
6803
|
+
* It does not support multi-period DASH or discontinuous HLS.
|
|
6804
|
+
* It does not support plugins (e.g. analytics).
|
|
6805
|
+
* `setItems()` can only be called once.
|
|
6806
|
+
* `setIndex()` can only be called once.
|
|
6807
|
+
* Only one next item and one previous item are preloaded and it is only
|
|
6808
|
+
* possible to go to the next / previous item, it is not possible to jump
|
|
6809
|
+
* to an arbitrary item.
|
|
6810
|
+
* It only works in auto-play mode (`autoplay: true` must be configured).
|
|
6811
|
+
*
|
|
6812
|
+
*/
|
|
6813
|
+
export class McPlaylist {
|
|
6814
|
+
/**
|
|
6815
|
+
* Multi-controller playlist intended for fast live TV channel zapping.
|
|
6816
|
+
* It is based on an architecture which leverages multiple video elements
|
|
6817
|
+
* and multiple instances of {@link clpp.Player} to preload assets in order to
|
|
6818
|
+
* reduce zap time.
|
|
6819
|
+
* Known limitations:
|
|
6820
|
+
*
|
|
6821
|
+
* It does not support multi-period DASH or discontinuous HLS.
|
|
6822
|
+
* It does not support plugins (e.g. analytics).
|
|
6823
|
+
* `setItems()` can only be called once.
|
|
6824
|
+
* `setIndex()` can only be called once.
|
|
6825
|
+
* Only one next item and one previous item are preloaded and it is only
|
|
6826
|
+
* possible to go to the next / previous item, it is not possible to jump
|
|
6827
|
+
* to an arbitrary item.
|
|
6828
|
+
* It only works in auto-play mode (`autoplay: true` must be configured).
|
|
6829
|
+
*
|
|
6830
|
+
*
|
|
6831
|
+
* @param options configuration options of
|
|
6832
|
+
* the playlist
|
|
6833
|
+
*/
|
|
6834
|
+
constructor(options: clpp.plist.Options);
|
|
6835
|
+
/**
|
|
6836
|
+
* Request that this object be destroyed, releasing all resources.
|
|
6837
|
+
* It also shuts down all active operations.
|
|
6838
|
+
* Returns a Promise which is resolved when destruction
|
|
6839
|
+
* is complete. This Promise should never be rejected.
|
|
6840
|
+
*/
|
|
6841
|
+
destroy(): Promise<void>;
|
|
6842
|
+
/**
|
|
6843
|
+
* Returns the currently playing/loading item.
|
|
6844
|
+
*/
|
|
6845
|
+
getCurrent(): clpp.plist.Item|null;
|
|
6846
|
+
/**
|
|
6847
|
+
* Returns the currently playing player.
|
|
6848
|
+
*/
|
|
6849
|
+
getCurrentPlayer(): clpp.Player|null;
|
|
6850
|
+
/**
|
|
6851
|
+
* Returns the next (preloaded) item.
|
|
6852
|
+
*/
|
|
6853
|
+
getNext(): clpp.plist.Item|null;
|
|
6854
|
+
/**
|
|
6855
|
+
* Returns all the currently preloading items.
|
|
6856
|
+
*/
|
|
6857
|
+
getPreloading(): Array<clpp.plist.Item>;
|
|
6858
|
+
/**
|
|
6859
|
+
* Returns the previous (preloaded) item.
|
|
6860
|
+
*/
|
|
6861
|
+
getPrev(): clpp.plist.Item|null;
|
|
6862
|
+
/**
|
|
6863
|
+
* Returns true if there is a next item to play.
|
|
6864
|
+
*/
|
|
6865
|
+
hasNext(): boolean;
|
|
6866
|
+
/**
|
|
6867
|
+
* Returns true if there is a previous item to play.
|
|
6868
|
+
*/
|
|
6869
|
+
hasPrev(): boolean;
|
|
6870
|
+
/**
|
|
6871
|
+
* Play the first item.
|
|
6872
|
+
* Make sure to set items via {@link clpp.plist.McPlaylist.setItems} and
|
|
6873
|
+
* select the index to start from via {@link clpp.plist.McPlaylist.setIndex}
|
|
6874
|
+
* before calling this method.
|
|
6875
|
+
* To switch to the next or previous item use methods
|
|
6876
|
+
* {@link clpp.plist.McPlaylist.playNext} and
|
|
6877
|
+
* {@link clpp.plist.McPlaylist.playPrev}.
|
|
6878
|
+
*/
|
|
6879
|
+
playFirst(): Promise<void>;
|
|
6880
|
+
/**
|
|
6881
|
+
* Play the next item in the playlist.
|
|
6882
|
+
*/
|
|
6883
|
+
playNext(): Promise<void>;
|
|
6884
|
+
/**
|
|
6885
|
+
* Play the previous item in the playlist.
|
|
6886
|
+
*/
|
|
6887
|
+
playPrev(): Promise<void>;
|
|
6888
|
+
/**
|
|
6889
|
+
* Sets the index of the item to start with.
|
|
6890
|
+
*
|
|
6891
|
+
* @param index index of the current item to play
|
|
6892
|
+
*/
|
|
6893
|
+
setIndex(index: number): void;
|
|
6894
|
+
/**
|
|
6895
|
+
* Sets playlist items to be played.
|
|
6896
|
+
*
|
|
6897
|
+
* @param configs source configs
|
|
6898
|
+
* of items in the playlist
|
|
6899
|
+
*/
|
|
6900
|
+
setItems(configs: Array<clpp.PlayerConfiguration>): void;
|
|
6901
|
+
}
|
|
6902
|
+
}
|
|
6903
|
+
|
|
6721
6904
|
namespace smooth {
|
|
6722
6905
|
export class SmoothComponent {
|
|
6723
6906
|
|