@castlabs/prestoplay 6.20.0 → 6.21.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.
Files changed (65) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +109 -110
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +553 -550
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +78 -77
  10. package/cjs/cl.externs.js +81 -97
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +69 -69
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -29
  15. package/cjs/cl.ima.js +22 -24
  16. package/cjs/cl.mse.js +305 -305
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +13 -13
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.sessions.js +16 -16
  22. package/cjs/cl.simid.js +15 -15
  23. package/cjs/cl.smooth.js +72 -72
  24. package/cjs/cl.thumbnails.js +25 -25
  25. package/cjs/cl.tizen.js +70 -69
  26. package/cjs/cl.ttml.js +29 -29
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +13 -13
  29. package/cjs/cl.vr.js +18 -18
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.yospace.js +9 -0
  32. package/cjs/cl.youbora.js +38 -20
  33. package/cl.adobe.js +3 -3
  34. package/cl.airplay.js +3 -3
  35. package/cl.broadpeak.js +5 -5
  36. package/cl.cast.js +88 -89
  37. package/cl.conviva.js +27 -27
  38. package/cl.core.js +471 -468
  39. package/cl.crypto.js +8 -8
  40. package/cl.dash.js +74 -72
  41. package/cl.externs.js +71 -99
  42. package/cl.freewheel.js +19 -19
  43. package/cl.hls.js +74 -74
  44. package/cl.hlssmpte.js +5 -5
  45. package/cl.htmlcue.js +26 -26
  46. package/cl.ima.js +16 -17
  47. package/cl.mse.js +276 -276
  48. package/cl.muxdata.js +13 -13
  49. package/cl.onboard.js +4 -4
  50. package/cl.persistent.js +11 -11
  51. package/cl.playlist.js +5 -5
  52. package/cl.sessions.js +10 -10
  53. package/cl.simid.js +13 -13
  54. package/cl.smooth.js +59 -59
  55. package/cl.thumbnails.js +19 -19
  56. package/cl.tizen.js +57 -57
  57. package/cl.ttml.js +22 -22
  58. package/cl.verimatrix.js +4 -4
  59. package/cl.vimond.js +8 -8
  60. package/cl.vr.js +14 -14
  61. package/cl.vtt.js +12 -12
  62. package/cl.yospace.js +3 -0
  63. package/cl.youbora.js +27 -15
  64. package/package.json +3 -1
  65. package/typings.d.ts +123 -24
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 $u=" The setting will be ignored.",av="VTT parser encountered an invalid VTT setting: ",bv="application/x-subrip",cv="text/srt",dv='text/vtt; codecs\x3d"vtt"',ev='text/vtt; codecs\x3d"wvtt"',fv=function(a){return a.a===a.f.length?null:(a=_.Zi(a,/[^ \t\n]*/gm))?a[0]:null},gv=function(a){_.Zi(a,/[ \t]+/gm)},hv=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},iv=function(a){a=_.Zi(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)},kv=function(a,b,c){let d;if(d=/^align:(start|middle|center|end|left|right)$/.exec(b))b=d[1],"middle"===b?a.textAlign=_.Us:a.textAlign=_.$s[b.toUpperCase()];else if(d=/^vertical:(lr|rl)$/.exec(b))a.writingMode="lr"===d[1]?_.ig:_.jg;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===_.he||b===_.Lf?_.he:b===_.ie||b===_.Sd?
4
- _.ie:_.bd);else if(d=/^region:(.*)$/.exec(b)){if(b=jv(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=_.at[c[2].toUpperCase()]);else if(c=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(b))a.lineInterpretation=_.Ws,a.line=Number(c[1]),c[2]&&(a.lineAlign=_.at[c[2].toUpperCase()]);else{a=!1;break a}a=!0}return a}return!0},jv=function(a,b){a=a.filter(c=>c.id===b);return a.length?a[0]:(_.B("VTT parser could not find a region with id: ",
5
- b," The region will be ignored."),null)},mv=function(a,b,c){let d,e,f;(new _.em).N("payl",_.$l(g=>{d=_.Ei(g)})).N("iden",_.$l(g=>{e=_.Ei(g)})).N("sttg",_.$l(g=>{f=_.Ei(g)})).parse(a);return d?lv(d,e,f,b,c):null},lv=function(a,b,c,d,e){a=new _.Zs(d,e,a,_.tg);b&&(a.id=b);if(c)for(b=new _.$i(c),c=fv(b);c;)kv(a,c,[])||_.B(av,c,$u),gv(b),c=fv(b);return a},nv=class{a(a){a=_.Ei(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+=hv(c)}return _.Ii(b)}},ov=class{create(){return new nv}probe(a,b){return(a===cv||a===bv)&&b===_.Uf}};var pv=class{constructor(a){this.a=a}parseInit(){}parseMedia(a,b){a=_.Ei(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 _.G(_.E,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=iv(new _.$i(d[1]));if(null==a)throw new _.G(_.E,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 _.$i(f.replace(/\n/g," "));d=new _.dt;fv(e);gv(e);for(var g=fv(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||_.B("VTT parser encountered an invalid VTTRegion setting: ",g,$u);gv(e);g=fv(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 _.$i(l[0]);g=iv(d);const q=_.Zi(d,/[ \t]+--\x3e[ \t]+/g);k=iv(d);if(null==g||null==q||null==k)throw new _.G(_.E,2,2001);g+=h;k+=h;l=l.slice(1).join("\n").trim();g=new _.Zs(g,k,l,_.tg);e&&(g.id=e);gv(d);for(k=fv(d);k;)kv(g,k,c)||_.B(av,k,$u),gv(d),k=fv(d);null!=e&&(g.id=e);c=g}c&&m.push(c)}return{cues:m,styles:f}}};var qv=class extends pv{parseMedia(a,b){return super.parseMedia((new nv).a(a),b)}};var rv=class{constructor(){this.a=null;this.g=new _.R("clpp.vtt.mp4")}parseInit(a){let b=!1;(new _.em).N(_.ze,_.Yl).N(_.Xf,_.Yl).N(_.ue,_.Yl).ca("mdhd",c=>{0===c.version?(c.reader.skip(4),c.reader.skip(4),this.a=_.O(c.reader),c.reader.skip(4)):(c.reader.skip(8),c.reader.skip(8),this.a=_.O(c.reader),c.reader.skip(8));c.reader.skip(4)}).N(_.ye,_.Yl).N(_.Of,_.Yl).ca(_.Qf,_.Zl).N("wvtt",()=>{b=!0}).parse(a);if(!this.a)throw new _.G(_.E,2,2008);if(!b)throw new _.G(_.E,2,2008);}parseMedia(a,b){if(!this.a)throw this.g.error("No init segment for MP4+VTT!"),
10
- new _.G(_.E,2,2008);let c=0,d=[],e;const f=[];let g=!1,h=!1,k=!1,l=null;(new _.em).N("moof",_.Yl).N("traf",_.Yl).ca("tfdt",q=>{g=!0;c=0===q.version?_.O(q.reader):_.Tl(q.reader)}).ca("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?_.O(q):null}).ca("trun",q=>{h=!0;{var u=q.version,v=q.flags;q=q.reader;const y=_.O(q);v&1&&q.skip(4);v&4&&q.skip(4);const A=[];for(let D=0;D<y;D++){const H={duration:null,sampleSize:null,Ke:null};v&256&&(H.duration=_.O(q));v&512&&(H.sampleSize=
11
- _.O(q));v&1024&&q.skip(4);v&2048&&(H.Ke=0===u?_.O(q):_.Sl(q));A.push(H)}d=A}}).N(_.te,_.$l(q=>{k=!0;e=q})).parse(a);if(!k&&!g&&!h)throw new _.G(_.E,2,2008);a=c;var m=new DataView(e.buffer,e.byteOffset,e.byteLength);m=new _.Rm(m,!1);for(const q of d){const u=q.duration||l,v=q.Ke?c+q.Ke:a;a=v+(u||0);let y=0;do{const A=_.O(m);y+=A;var n=_.O(m);n=_.Xl(n);let D=null;"vttc"===n?8<A&&(D=_.Vl(m,A-8)):("vtte"!==n&&this.g.error("Unknown box "+n+"! Skipping!"),m.skip(A-8));u?D&&f.push(mv(D,b.periodStart+v/this.a,
12
- b.periodStart+a/this.a)):this.g.error("WVTT sample duration unknown, and no default found!")}while(q.sampleSize&&y<q.sampleSize)}return{cues:f.filter(_.Zh),styles:[]}}};_.x("clpp.vtt.VttComponent",class extends _.qu{constructor(){super();this.j=new ov}f(){_.Es(_.Uf,pv);_.Es(dv,pv);_.Es(ev,pv);_.Es(_.Dc,rv);_.Es(cv,qv);_.Es(bv,qv);_.Wj.push(this.j)}a(){_.Gs(_.Uf);_.Gs(dv);_.Gs(ev);_.Gs(_.Dc);_.Gs(cv);_.Gs(bv);_.Yj(this.j)}id(){return"subtitles-vtt"}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Fv=" The setting will be ignored.",Gv="VTT parser encountered an invalid VTT setting: ",Hv="application/x-subrip",Iv="text/srt",Jv='text/vtt; codecs\x3d"vtt"',Kv='text/vtt; codecs\x3d"wvtt"',Lv=function(a){return a.a===a.f.length?null:(a=_.$i(a,/[^ \t\n]*/gm))?a[0]:null},Mv=function(a){_.$i(a,/[ \t]+/gm)},Nv=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},Ov=function(a){a=_.$i(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)},Qv=function(a,b,c){let d;if(d=/^align:(start|middle|center|end|left|right)$/.exec(b))b=d[1],"middle"===b?a.textAlign=_.et:a.textAlign=_.kt[b.toUpperCase()];else if(d=/^vertical:(lr|rl)$/.exec(b))a.writingMode="lr"===d[1]?_.hg:_.ig;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===_.ge||b===_.Kf?_.ge:b===_.he||b===_.Sd?
4
+ _.he:_.bd);else if(d=/^region:(.*)$/.exec(b)){if(b=Pv(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=_.lt[c[2].toUpperCase()]);else if(c=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(b))a.lineInterpretation=_.gt,a.line=Number(c[1]),c[2]&&(a.lineAlign=_.lt[c[2].toUpperCase()]);else{a=!1;break a}a=!0}return a}return!0},Pv=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)},Sv=function(a,b,c){let d,e,f;(new _.hm).N("payl",_.cm(g=>{d=_.Fi(g)})).N("iden",_.cm(g=>{e=_.Fi(g)})).N("sttg",_.cm(g=>{f=_.Fi(g)})).parse(a);return d?Rv(d,e,f,b,c):null},Rv=function(a,b,c,d,e){a=new _.jt(d,e,a,_.pg);b&&(a.id=b);if(c)for(b=new _.aj(c),c=Lv(b);c;)Qv(a,c,[])||_.C(Gv,c,Fv),Mv(b),c=Lv(b);return a},Tv=class{a(a){a=_.Fi(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+=Nv(c)}return _.Ji(b)}},Uv=class{create(){return new Tv}probe(a,b){return(a===Iv||a===Hv)&&b===_.Tf}};var Vv=class{constructor(a){this.a=a}parseInit(){}parseMedia(a,b){a=_.Fi(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 _.I(_.F,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=Ov(new _.aj(d[1]));if(null==a)throw new _.I(_.F,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 _.aj(f.replace(/\n/g," "));d=new _.ot;Lv(e);Mv(e);for(var g=Lv(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,Fv);Mv(e);g=Lv(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 _.aj(l[0]);g=Ov(d);const q=_.$i(d,/[ \t]+--\x3e[ \t]+/g);k=Ov(d);if(null==g||null==q||null==k)throw new _.I(_.F,2,2001);g+=h;k+=h;l=l.slice(1).join("\n").trim();g=new _.jt(g,k,l,_.pg);e&&(g.id=e);Mv(d);for(k=Lv(d);k;)Qv(g,k,c)||_.C(Gv,k,Fv),Mv(d),k=Lv(d);null!=e&&(g.id=e);c=g}c&&m.push(c)}return{cues:m,styles:f}}};var Wv=class extends Vv{parseMedia(a,b){return super.parseMedia((new Tv).a(a),b)}};var Xv=class{constructor(){this.a=null;this.g=new _.S("clpp.vtt.mp4")}parseInit(a){let b=!1;(new _.hm).N(_.ye,_.am).N(_.Wf,_.am).N(_.te,_.am).da("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)}).N(_.xe,_.am).N(_.Nf,_.am).da(_.Pf,_.bm).N("wvtt",()=>{b=!0}).parse(a);if(!this.a)throw new _.I(_.F,2,2008);if(!b)throw new _.I(_.F,2,2008);}parseMedia(a,b){if(!this.a)throw this.g.error("No init segment for MP4+VTT!"),
10
+ new _.I(_.F,2,2008);let c=0,d=[],e;const f=[];let g=!1,h=!1,k=!1,l=null;(new _.hm).N("moof",_.am).N("traf",_.am).da("tfdt",q=>{g=!0;c=0===q.version?_.P(q.reader):_.Wl(q.reader)}).da("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}).da("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 H={duration:null,sampleSize:null,Le:null};v&256&&(H.duration=_.P(q));v&512&&(H.sampleSize=
11
+ _.P(q));v&1024&&q.skip(4);v&2048&&(H.Le=0===u?_.P(q):_.Vl(q));A.push(H)}d=A}}).N(_.se,_.cm(q=>{k=!0;e=q})).parse(a);if(!k&&!g&&!h)throw new _.I(_.F,2,2008);a=c;var m=new DataView(e.buffer,e.byteOffset,e.byteLength);m=new _.Um(m,!1);for(const q of d){const u=q.duration||l,v=q.Le?c+q.Le:a;a=v+(u||0);let y=0;do{const A=_.P(m);y+=A;var n=_.P(m);n=_.$l(n);let D=null;"vttc"===n?8<A&&(D=_.Yl(m,A-8)):("vtte"!==n&&this.g.error("Unknown box "+n+"! Skipping!"),m.skip(A-8));u?D&&f.push(Sv(D,b.periodStart+v/this.a,
12
+ b.periodStart+a/this.a)):this.g.error("WVTT sample duration unknown, and no default found!")}while(q.sampleSize&&y<q.sampleSize)}return{cues:f.filter(_.$h),styles:[]}}};_.z("clpp.vtt.VttComponent",class extends _.Au{constructor(){super();this.j=new Uv}f(){_.Ps(_.Tf,Vv);_.Ps(Jv,Vv);_.Ps(Kv,Vv);_.Ps(_.Dc,Xv);_.Ps(Iv,Wv);_.Ps(Hv,Wv);_.Zj.push(this.j)}a(){_.Rs(_.Tf);_.Rs(Jv);_.Rs(Kv);_.Rs(_.Dc);_.Rs(Iv);_.Rs(Hv);_.bk(this.j)}id(){return"subtitles-vtt"}});};f.call(g, window);
package/cl.yospace.js ADDED
@@ -0,0 +1,3 @@
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Bv="clpp.yospace.YospacePlugin",Ev=class extends _.av{constructor(){super();this.a=null;this.g=new _.S(Bv)}uf(){return this.a}onContentWillLoad(a,b){const c=this;return _.x(function*(){if(a.getConfiguration().yospace.enabled)if(typeof window.YospaceAdManagement===_.Ce){c.g.info("Yospace enabled.");var d=a.isLive()?Cv:Dv;a:{var e=b.url;switch(d){case Dv:d=YospaceAdManagement.SessionVOD.create(e);break a;case Cv:d=YospaceAdManagement.SessionLive.create(e);break a;default:d=YospaceAdManagement.SessionDVRLive.create(e)}}d=
2
+ yield d;e=d.getSessionState();e!==YospaceAdManagement.SessionState.INITIALISED?(c.g.error("Failed to initialize Yospace session. State:",e,"URL",b.url),a.onError(new _.I(_.F,9,7003,"Yospace session failed to initialize"))):(a.trigger(new _.E(_.Fg,{detail:d})),b.url=d.getPlaybackUrl(),c.g.info("Yospace session initialized. New URL:",b.url),c.a=d)}else c.g.error("Yospace enabled but SDK not found."),a.onError(new _.I(_.F,9,7003,"Yospace SDK not found."))})}onPlayerWillRelease(a){if(this.a){this.g.info("Shutting down Yospace session.");
3
+ const b=this.a;this.a.shutdown();this.a=null;a.trigger(new _.E(_.Eg,{detail:b}))}}id(){return"yospace"}};_.z(Bv,Ev);Ev.prototype.getSession=Ev.prototype.uf;Ev.Id="yospace";_.Qq(new class{create(){return new Ev}});var Dv=_.Tb,Cv="LIVE";};f.call(g, window);
package/cl.youbora.js CHANGED
@@ -1,15 +1,27 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Su="clpp.npaw.YouboraPlugin",Tu="content.isLive",Uu=function(a,b){if(b.namespace()===_.jd)return a.g.info("Youbora does not report when casting."),!1;const c=b.getConfiguration().youbora;if(!_.Ug(c))return a.g.debug("Youbora plugin is loaded but not configured. Will do nothing."),!1;if(!c.accountCode)return a.g.warn("accountCode key is missing in Youbora config"),b.onError(new _.G(1,9,9101)),!1;if(_.z(window.youbora))return a.g.warn("Youbora SDK not found."),b.onError(new _.G(1,9,
2
- 9100)),!1;"6.8.59"!==youbora.VERSION&&(a.g.warn("Youbora SDK version is not supported. The supported version is 6.8.59, found "+`version ${youbora.VERSION}. Some or all features of YouboraPlugin `+"may not work correctly."),b.onError(new _.G(1,9,9102)));return!0},Vu=a=>(a=a.getConfiguration().youbora)&&a.errorFilter?a.errorFilter:b=>({code:`${b.code}`,message:b.message,severity:b.severity}),Wu=(a,b,c,d)=>{b=Vu(b)(a);if(!b)return c.debug("Error not sent to Youbora",a.code,a.message),null;a=10003===
3
- a.code?"ad error":_.Ud;b.severity===_.E?(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 Xu=a=>{class b extends youbora.Adapter{constructor(c){super(c);this.m=c;this.a=new _.Rs;this.g=new _.R("clpp.npaw.YouboraAdapter");this.h=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.ma())&&(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.Ma())?c.frameRate:null}getPlayerName(){return _.pa}getVersion(){return"6.20.0-castlabsadapter-js"}getPlayerVersion(){return _.da}registerListeners(){this.m&&this.a&&(this.g.debug("registering listeners"),
5
- youbora.Util.logAllEvents(this.m),this.a.on(this.m,_.Mf,this.I.bind(this)),this.a.on(this.m,_.Ud,this.F.bind(this)),this.a.on(this.m,_.fg,this.H.bind(this)),this.a.on(this.m,_.eg,this.G.bind(this)),this.a.on(this.m,_.vc,this.B.bind(this)),this.a.on(this.m,_.Yc,this.C.bind(this)))}unregisterListeners(){this.g.debug(_.Pb);_.ph(this.a)}dispose(){super.dispose()}l(){return this.m.getStats()||_.bo()}o(){return!!this.m.getConfiguration().autoplay}I(c){c=c.detail;this.j("state change",c);if(c)switch(c.currentState){case _.qo:this.o()&&
6
- this.f();break;case _.so:this.f();this.A();this.fireResume();this.fireBufferEnd();break;case _.ro:this.o()&&this.f();this.A();this.fireBufferEnd();this.firePause();break;case _.po:this.fireBufferEnd();this.fireStop();break;case _.ho:this.fireBufferEnd();this.w&&this.plugin.getAdsAdapter()?this.firePause():this.fireStop();break;case _.ko:this.fireBufferBegin();break;default:this.g.debug("Unhandled state",c)}}f(){this.plugin.isInitiated||(this.h=!1,this.fireInit())}A(){var c=this.m.getDrmInfo();c&&
7
- (c=c.keySystem,(c=c.startsWith(_.xd)?"Widevine":c.startsWith(_.sd)?"FairPlay":c.match(/^com\.(microsoft|chromecast)\.playready/)?"PlayReady":c.startsWith(_.Le)?"ClearKey":c.startsWith(_.rd)?"Primetime":c)&&this.plugin.setOptions({"content.drm":c}));this.fireJoin()}F(c){!(c=c.detail)||this.h||10003===c.code&&this.plugin.getAdsAdapter()||(c=Wu(c,this.m,this.g,this))&&c.severity===_.E&&(this.h=!0)}H(){this.m.isEnded()||(this.j(_.Ef),this.f(),this.fireSeekBegin())}G(){this.j(_.Df);this.fireSeekEnd()}B(c){this.g.debug("adsTimeline",
8
- c);c=c.adsTimeline;this.w=!!c&&c.Db()}C(c){this.g.debug("Casting",c);this.fireCasted()}j(c,...d){this.g.debug(`Reporting "${c}" event to Youbora`,...d)}}return new b(a)};var Yu=a=>{class b extends youbora.Adapter{constructor(c){super(c);this.m=c;this.j=this.a=null;this.f=new _.Rs;this.g=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.lb(),this.a.kb(),this.a.Za()));return c}getBitrate(){return this.a&&this.a.Za()}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.Va()){case 0:d=c.Preroll;break;case 2:d=c.Postroll;break;case 1:d=c.Midroll}this.g.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.nb()}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.g.debug("is container visible",c);return c}getPlayerName(){return _.pa}getVersion(){return"6.20.0-castlabsadsadapter-js"}getPlayerVersion(){return _.da}registerListeners(){this.m&&
11
- this.f&&(this.f.on(this.m,_.vc,this.M.bind(this)),this.f.on(this.m,_.rc,this.L.bind(this)),this.f.on(this.m,_.nc,this.I.bind(this)),this.f.on(this.m,_.pc,this.J.bind(this)),this.f.on(this.m,_.fc,this.G.bind(this)),this.f.on(this.m,_.gc,this.o.bind(this,1)),this.f.on(this.m,_.mc,this.o.bind(this,2)),this.f.on(this.m,_.tc,this.o.bind(this,3)),this.f.on(this.m,_.ec,this.F.bind(this)),this.f.on(this.m,_.qc,this.K.bind(this)),this.f.on(this.m,_.Ud,this.H.bind(this)),this.f.on(this.m,_.bc,this.A.bind(this)),
12
- this.f.on(this.m,_.cc,this.B.bind(this)),this.f.on(this.m,_.dc,this.C.bind(this)),this.f.on(this.m,_.oc,this.w.bind(this)))}unregisterListeners(){_.ph(this.f)}dispose(){super.dispose()}M(c){this.g.debug("ad timeline changed",c);this.j=c.adsTimeline}L(c){this.a=c.ad;this.h("ad start",this.a);this.fireStart();this.fireJoin()}G(){this.h("ad ended");this.fireStop()}I(){this.h("ad pause");this.w();this.firePause()}J(){this.h("ad resume");this.w();this.fireResume()}C(){this.l=!0;this.h("ad buffering started");
13
- this.fireBufferBegin()}w(){this.l&&(this.h("ad buffering ended"),this.l=!1,this.fireBufferEnd())}o(c){this.h("ad quartile",c);this.fireQuartile(c)}F(){this.h("ad clicked");const c=this.a&&this.a.xb();this.g.debug("ad click through url: ",c);this.fireClick(c)}K(){this.h("ad skipped");this.fireSkip()}A(c){this.a=c.ad;this.h("ad break start",this.a);this.fireBreakStart()}B(){this.h("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&&Wu(c,this.m,this.g,this)}h(c,...d){this.g.debug(`Reporting "${c}" event to Youbora`,...d)}}return new b(a)};var Zu=class extends _.Ru{constructor(){super();this.a=null;this.g=new _.R(Su);this.m=null}Fe(a){this.a&&(this.a.removeAdsAdapter(),this.a.removeAdapter());if(this.a=a)this.a.setAdapter(Xu(this.m)),this.a.setAdsAdapter(Yu(this.m))}getAdapter(){return this.a&&this.a.getAdapter()}getAdsAdapter(){return this.a&&this.a.getAdsAdapter()}onPlayerCreated(a){this.m=a;Uu(this,a)&&(a=a.getConfiguration().youbora,this.Fe(new youbora.Plugin(a)))}onContentWillLoad(a,b){if(Uu(this,a)){a=a.getConfiguration();var c=
15
- a.youbora;void 0===c[Tu]&&(c[Tu]=b.isLive);void 0===c["content.title"]&&(c["content.title"]=b.name);void 0===c.viewerId&&(c.viewerId=a.viewerId);this.a||this.Fe(new youbora.Plugin(c));this.a.setOptions(c)}}onPlayerWillRelease(){}onPlayerWillDestroy(){}id(){return"youbora"}};_.x(Su,Zu);Zu.prototype.getAdsAdapter=Zu.prototype.getAdsAdapter;Zu.prototype.getAdapter=Zu.prototype.getAdapter;Zu.prototype.setYouboraPlugin=Zu.prototype.Fe;Zu.Id="youbora";_.Hq(new class{create(){return new Zu}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var bv="Unhandled state",cv="accountCode key is missing in Youbora config",dv="ad break start",ev="ad buffering ended",fv="ad buffering started",gv="ad click through url: ",hv="ad timeline changed",iv="clpp.npaw.NpawPlugin",jv="clpp.npaw.YouboraPlugin",kv="content.isLive",lv="content.title",mv="is container visible",nv="youbora",ov=function(a){return a.startsWith(_.xd)?"Widevine":a.startsWith(_.sd)?"FairPlay":a.match(/^com\.(microsoft|chromecast)\.playready/)?"PlayReady":a.startsWith(_.Ke)?
2
+ "ClearKey":a.startsWith(_.rd)?"Primetime":a},pv=function(a){a.a&&(a.g.info("Removing NPAW Plugins",a.a),a.a.removeAdsAdapter(),a.a.removeAdapter())},qv=function(a,b){if(b.namespace()===_.jd)return a.g.info("NPAW does not report when casting."),!1;const c=b.getConfiguration().youbora;return _.Vg(c)?c.accountCode?_.B(window.NpawPlugin)||_.B(window.NpawPluginAdapters)?(a.g.warn("NPAW SDK not found."),b.onError(new _.I(1,9,9100)),!1):!0:(a.g.warn(cv),b.onError(new _.I(1,9,9101)),!1):(a.g.warn("NPAW plugin is loaded but not configured. Will do nothing."),
3
+ !1)},rv=function(a,b){if(b.namespace()===_.jd)return a.g.info("Youbora does not report when casting."),!1;const c=b.getConfiguration().youbora;if(!_.Vg(c))return a.g.debug("Youbora plugin is loaded but not configured. Will do nothing."),!1;if(!c.accountCode)return a.g.warn(cv),b.onError(new _.I(1,9,9101)),!1;if(_.B(window.youbora))return a.g.warn("Youbora SDK not found."),b.onError(new _.I(1,9,9100)),!1;"6.8.59"!==youbora.VERSION&&(a.g.warn("Youbora SDK version is not supported. The supported version is 6.8.59, found "+
4
+ `version ${youbora.VERSION}. Some or all features of YouboraPlugin `+"may not work correctly."),b.onError(new _.I(1,9,9102)));return!0},sv=a=>(a=a.getConfiguration().youbora)&&a.errorFilter?a.errorFilter:b=>({code:`${b.code}`,message:b.message,severity:b.severity}),uv=(a,b,c,d)=>{b=sv(b)(a);if(!b)return c.debug("Error not sent to Youbora",a.code,a.message),null;a=10003===a.code?"ad error":_.r;b.severity===_.F?(d.fireFatalError(b.code,b.message,b.metadata),c.debug(`Reporting "fatal ${a}" to Youbora`,
5
+ b.code,b)):(d.fireError(b.code,b.message,b.metadata),c.debug(`Reporting "${a}" to Youbora`,b.code,b));return b};var vv=a=>{class b extends youbora.Adapter{constructor(c){super(c);this.m=c;this.a=new _.bt;this.g=new _.S("clpp.npaw.YouboraAdapter");this.h=this.o=!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.ja())&&(c=f.width,d=f.height,e=f.bandwidth);c&&d&&e||(f=this.j(),c=c||f.width,d=d||f.height,e=e||f.streamBandwidth);return youbora.Util.buildRenditionString(c,
6
+ d,e)}getIsLive(){return this.m.isLive()}getResource(){const c=this.m.getLoadedSource();return c&&c.url}getBitrate(){return this.j().streamBandwidth}getThroughput(){return this.j().estimatedBandwidth}getPlayrate(){return this.m.getPlaybackRate()}getFramesPerSecond(){var c=this.m.getTrackManager();return c&&(c=c.Da())?c.frameRate:null}getPlayerName(){return _.pa}getVersion(){return"6.21.0-castlabsadapter-js"}getPlayerVersion(){return _.da}registerListeners(){this.m&&this.a&&(this.g.debug("registering listeners"),
7
+ youbora.Util.logAllEvents(this.m),this.a.on(this.m,_.Lf,this.I.bind(this)),this.a.on(this.m,_.r,this.F.bind(this)),this.a.on(this.m,_.eg,this.H.bind(this)),this.a.on(this.m,_.dg,this.G.bind(this)),this.a.on(this.m,_.vc,this.B.bind(this)),this.a.on(this.m,_.Vc,this.C.bind(this)))}unregisterListeners(){this.g.debug(_.Pb);_.qh(this.a)}dispose(){super.dispose()}j(){return this.m.getStats()||_.jo()}w(){return!!this.m.getConfiguration().autoplay}I(c){c=c.detail;this.l("state change",c);if(c)switch(c.currentState){case _.xo:this.w()&&
8
+ this.f();break;case _.zo:this.f();this.A();this.fireResume();this.fireBufferEnd();break;case _.yo:this.w()&&this.f();this.A();this.fireBufferEnd();this.firePause();break;case _.wo:this.fireBufferEnd();this.fireStop();break;case _.oo:this.fireBufferEnd();this.o&&this.plugin.getAdsAdapter()?this.firePause():this.fireStop();break;case _.ro:this.fireBufferBegin();break;default:this.g.debug(bv,c)}}f(){this.plugin.isInitiated||(this.h=!1,this.fireInit())}A(){var c=this.m.getDrmInfo();c&&(c=ov(c.keySystem))&&
9
+ this.plugin.setOptions({"content.drm":c});this.fireJoin()}F(c){!(c=c.detail)||this.h||10003===c.code&&this.plugin.getAdsAdapter()||(c=uv(c,this.m,this.g,this))&&c.severity===_.F&&(this.h=!0)}H(){this.m.isEnded()||(this.l(_.Df),this.f(),this.fireSeekBegin())}G(){this.l(_.Cf);this.fireSeekEnd()}B(c){this.g.debug("adsTimeline",c);this.o=(c=c.adsTimeline)&&c.Db()}C(c){this.g.debug("Casting",c);this.fireCasted()}l(c,...d){this.g.debug(`Reporting "${c}" event to Youbora`,...d)}}return new b(a)};var wv=a=>{class b extends youbora.Adapter{constructor(c){super(c);this.m=c;this.j=this.a=null;this.f=new _.bt;this.g=new _.S("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.bb(),this.a.ab(),this.a.Na()));return c}getBitrate(){return this.a&&this.a.Na()}getPlayhead(){const c=this.m.getAdsManager();return c&&c.getPosition()}getResource(){return this.a&&this.a.getMediaUrl()}getTitle(){return this.a&&
10
+ 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.Oa()){case 0:d=c.Preroll;break;case 2:d=c.Postroll;break;case 1:d=c.Midroll}this.g.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&&
11
+ this.j.getCuePoints().length}getGivenBreaks(){return this.getExpectedBreaks()}getExpectedAds(){return this.a&&this.a.cb()}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.g.debug(mv,c);return c}getPlayerName(){return _.pa}getVersion(){return"6.21.0-castlabsadsadapter-js"}getPlayerVersion(){return _.da}registerListeners(){this.m&&
12
+ this.f&&(this.f.on(this.m,_.vc,this.M.bind(this)),this.f.on(this.m,_.rc,this.L.bind(this)),this.f.on(this.m,_.mc,this.I.bind(this)),this.f.on(this.m,_.oc,this.J.bind(this)),this.f.on(this.m,_.fc,this.G.bind(this)),this.f.on(this.m,_.gc,this.o.bind(this,1)),this.f.on(this.m,_.lc,this.o.bind(this,2)),this.f.on(this.m,_.tc,this.o.bind(this,3)),this.f.on(this.m,_.ec,this.F.bind(this)),this.f.on(this.m,_.qc,this.K.bind(this)),this.f.on(this.m,_.r,this.H.bind(this)),this.f.on(this.m,_.bc,this.A.bind(this)),
13
+ this.f.on(this.m,_.cc,this.B.bind(this)),this.f.on(this.m,_.dc,this.C.bind(this)),this.f.on(this.m,_.nc,this.w.bind(this)))}unregisterListeners(){_.qh(this.f)}dispose(){super.dispose()}M(c){this.g.debug(hv,c);this.j=c.adsTimeline}L(c){this.a=c.ad;this.h("ad start",this.a);this.fireStart();this.fireJoin()}G(){this.h("ad ended");this.fireStop()}I(){this.h("ad pause");this.w();this.firePause()}J(){this.h("ad resume");this.w();this.fireResume()}C(){this.l=!0;this.h(fv);this.fireBufferBegin()}w(){this.l&&
14
+ (this.h(ev),this.l=!1,this.fireBufferEnd())}o(c){this.h("ad quartile",c);this.fireQuartile(c)}F(){this.h("ad clicked");const c=this.a&&this.a.nb();this.g.debug(gv,c);this.fireClick(c)}K(){this.h("ad skipped");this.fireSkip()}A(c){this.a=c.ad;this.h(dv,this.a);this.fireBreakStart()}B(){this.h("ad break stop");this.fireBreakStop();if(this.getPosition()===youbora.Constants.AdPosition.Postroll){const c=this.plugin.getAdapter();c&&c.fireStop()}}H(c){(c=c.detail)&&10003===c.code&&uv(c,this.m,this.g,this)}h(c,
15
+ ...d){this.g.debug(`Reporting "${c}" event to Youbora`,...d)}}return new b(a)};var xv=()=>{class a extends NpawPluginAdapters.video.Shaka{constructor(){super();this.f=this.h=!1;this.a=null}getPlayhead(){return this.getIsLive()?-1:this.player.getPosition()}getDuration(){return this.player.getDuration()}getRendition(){let b=null,c=null,d=null;var e=this.player.getTrackManager();e&&(e=e.ja())&&(b=e.width,c=e.height,d=e.bandwidth);b&&c&&d||(e=this.j(),b=b||e.width,c=c||e.height,d=d||e.streamBandwidth);return this.getNpawUtils().buildRenditionString(b,c,d)}getIsLive(){return this.player.isLive()}getResource(){const b=
16
+ this.player.getLoadedSource();return b&&b.url}getBitrate(){return this.j().streamBandwidth}getThroughput(){return this.j().estimatedBandwidth}getPlayrate(){return this.player.getPlaybackRate()}getFramesPerSecond(){var b=this.player.getTrackManager();return b&&(b=b.Da())?b.frameRate:null}getPlayerName(){return _.pa}getVersion(){return"castlabs-adapter-6.21.0-js"}getPlayerVersion(){return _.da}registerListeners(){const b=this.w();this.player&&b&&(b.on(this.player,_.Lf,this.I.bind(this)),b.on(this.player,
17
+ _.r,this.F.bind(this)),b.on(this.player,_.eg,this.H.bind(this)),b.on(this.player,_.dg,this.G.bind(this)),b.on(this.player,_.vc,this.B.bind(this)),b.on(this.player,_.Vc,this.C.bind(this)))}unregisterListeners(){xv.g.debug(_.Pb);_.qh(this.w())}dispose(){this.unregisterListeners();this.f=this.h=!1;this.a=null}j(){return this.player.getStats()||_.jo()}o(){return!!this.player.getConfiguration().autoplay}I(b){b=b.detail;this.l("state change",b);if(b)switch(b.currentState){case _.xo:this.o()&&this.fireInit();
18
+ break;case _.zo:this.fireInit();this.A();this.fireResume();this.fireBufferEnd();break;case _.yo:this.o()&&this.fireInit();this.A();this.fireBufferEnd();this.firePause();break;case _.wo:this.fireBufferEnd();this.fireStop();break;case _.oo:this.fireBufferEnd();this.h&&this.plugin.getAdsAdapter()?this.firePause():this.fireStop();break;case _.ro:this.fireBufferBegin();break;default:xv.g.debug(bv,b)}}A(){var b=this.player.getDrmInfo();b&&(b=ov(b.keySystem))&&this.plugin.setAnalyticsOptions({"content.drm":b});
19
+ this.fireJoin()}F(b){(b=b.detail)&&!this.f&&this.player&&10003!==b.code&&(b=uv(b,this.player,xv.g,this))&&b.severity===_.F&&(this.f=!0)}H(){this.player.isEnded()||(this.l(_.Df),this.fireInit(),this.fireSeekBegin())}w(){this.a||(this.a=new _.bt);return this.a}G(){this.l(_.Cf);this.fireSeekEnd()}B(b){xv.g.debug("adsTimeline",b);this.h=(b=b.adsTimeline)&&b.Db()}C(b){xv.g.debug("Casting",b);this.fireCasted()}l(b,...c){xv.g.debug(`Reporting "${b}" event to NPAW`,...c)}}return new a};xv.g=new _.S("clpp.npaw.NpawAdapter");var yv=()=>{class a extends NpawPluginAdapters.ads.Ima{constructor(){super();this.j=this.h=this.a=null;this.l=!1}getDuration(){return this.a?this.a.getDuration():null}getRendition(){let b=null;this.a&&(b=this.getNpawUtils().buildRenditionString(this.a.bb(),this.a.ab(),this.a.Na()));return b}getBitrate(){let b=null;this.a&&(b=this.a.Na());return b}getPlayhead(){let b=null;const c=this.player.getAdsManager();c&&(b=c.getPosition());return b}getResource(){let b=null;this.a&&(b=this.a.getMediaUrl());return b}getTitle(){let b=
20
+ null;this.a&&(b=this.a.getTitle());return b}getProvider(){let b=null;this.a&&(b=this.a.getAdvertiserName());return b}getCreativeId(){let b=null;this.a&&(b=this.a.getCreativeId());return b}dispose(){this.unregisterListeners();this.j=this.h=this.a=null}getPosition(){const b=this.getNpawReference().Constants.AdPosition;let c=null;if(this.a)switch(this.a.Oa()){case 0:c=b.Preroll;break;case 2:c=b.Postroll;break;case 1:c=b.Midroll}yv.g.debug("Ad position",c);return c}getIsSkippable(){return this.a&&-1!==
21
+ this.a.getSkipTimeOffset()}getAudioEnabled(){const b=this.player.getAdsManager();return b&&0<b.getVolume()}getExpectedBreaks(){return this.h&&this.h.getCuePoints().length}getGivenBreaks(){return this.getExpectedBreaks()}getExpectedAds(){return this.a&&this.a.cb()}getGivenAds(){return this.getExpectedAds()}getBreaksTime(){return this.h&&this.h.getCuePoints().map(b=>-1===b?this.player.getDuration():b)}getIsFullscreen(){return this.player.getSurface().isFullscreen()}getIsVisible(){var b=this.player.getSurface().getContainer();
22
+ b=this.getNpawUtils().calculateAdViewability(b);yv.g.debug(mv,b);return b}getPlayerName(){return _.pa}getVersion(){return"castlabs-ads-adapter-6.21.0-js"}getPlayerVersion(){return _.da}A(){this.j||(this.j=new _.bt);return this.j}registerListeners(){const b=this.A();this.player&&b&&(b.on(this.player,_.vc,this.O.bind(this)),b.on(this.player,_.rc,this.M.bind(this)),b.on(this.player,_.mc,this.J.bind(this)),b.on(this.player,_.oc,this.K.bind(this)),b.on(this.player,_.fc,this.H.bind(this)),b.on(this.player,
23
+ _.gc,this.o.bind(this,1)),b.on(this.player,_.lc,this.o.bind(this,2)),b.on(this.player,_.tc,this.o.bind(this,3)),b.on(this.player,_.ec,this.G.bind(this)),b.on(this.player,_.qc,this.L.bind(this)),b.on(this.player,_.r,this.I.bind(this)),b.on(this.player,_.bc,this.B.bind(this)),b.on(this.player,_.cc,this.C.bind(this)),b.on(this.player,_.dc,this.F.bind(this)),b.on(this.player,_.nc,this.w.bind(this)))}unregisterListeners(){_.qh(this.A())}O(b){yv.g.debug(hv,b);this.h=b.adsTimeline}M(b){this.a=b.ad;this.f("ad start",
24
+ this.a);this.fireStart();this.fireJoin()}H(){this.f("ad ended");this.fireStop()}J(){this.f("ad pause");this.w();this.firePause()}K(){this.f("ad resume");this.w();this.fireResume()}F(){this.l=!0;this.f(fv);this.fireBufferBegin()}w(){this.l&&(this.f(ev),this.l=!1,this.fireBufferEnd())}o(b){this.f("ad quartile",b);this.fireQuartile(b)}G(){this.f("ad clicked");const b=this.a&&this.a.nb();yv.g.debug(gv,b);this.fireClick(b)}L(){this.f("ad skipped");this.fireSkip()}B(b){this.a=b.ad;this.f(dv,this.a);this.fireBreakStart()}C(){this.f("ad break stop");
25
+ this.fireBreakStop();this.getPosition()===this.getNpawReference().Constants.AdPosition.Postroll&&this.fireStop()}I(b){(b=b.detail)&&10003===b.code&&uv(b,this.player,yv.g,this)}f(b,...c){yv.g.debug(`Reporting "${b}" event to NPAW`,...c)}}return new a};yv.g=new _.S("clpp.npaw.NpawAdsAdapter");var zv=class extends _.av{constructor(){super();this.a=null;this.g=new _.S(iv);this.m=null}Fe(a){pv(this);if(this.a=a)this.a.registerAdapterFromClass(this.m,xv),this.a.registerAdsAdapterFromClass(this.m,yv)}getAdapter(){return this.a&&this.a.getAdapter()}getAdsAdapter(){return this.a&&this.a.getAdsAdapter()}onPlayerCreated(a){this.m=a;qv(this,a)&&(a=a.getConfiguration().youbora,this.Fe(new NpawPlugin(a.accountCode)))}onContentWillLoad(a,b){if(qv(this,a)){a=a.getConfiguration();var c=a.youbora;void 0===
26
+ c[kv]&&(c[kv]=b.isLive);void 0===c[lv]&&(c[lv]=b.name);void 0===c.viewerId&&(c.viewerId=a.viewerId);this.a||this.Fe(new NpawPlugin(c.accountCode));this.a.setAnalyticsOptions(c)}}onPlayerWillRelease(){}onPlayerWillDestroy(){pv(this);this.a.destroy()}id(){return nv}};_.z(iv,zv);zv.prototype.getAdsAdapter=zv.prototype.getAdsAdapter;zv.prototype.getAdapter=zv.prototype.getAdapter;zv.prototype.setNpawPlugin=zv.prototype.Fe;zv.Id=nv;new _.S(iv);var Av=class extends _.av{constructor(){super();this.a=null;this.g=new _.S(jv);this.m=null}Ge(a){this.a&&(this.a.removeAdsAdapter(),this.a.removeAdapter());if(this.a=a)this.a.setAdapter(vv(this.m)),this.a.setAdsAdapter(wv(this.m))}getAdapter(){return this.a&&this.a.getAdapter()}getAdsAdapter(){return this.a&&this.a.getAdsAdapter()}onPlayerCreated(a){this.m=a;rv(this,a)&&(a=a.getConfiguration().youbora,this.Ge(new youbora.Plugin(a)))}onContentWillLoad(a,b){if(rv(this,a)){a=a.getConfiguration();var c=
27
+ a.youbora;void 0===c[kv]&&(c[kv]=b.isLive);void 0===c[lv]&&(c[lv]=b.name);void 0===c.viewerId&&(c.viewerId=a.viewerId);this.a||this.Ge(new youbora.Plugin(c));this.a.setOptions(c)}}onPlayerWillRelease(){}onPlayerWillDestroy(){}id(){return nv}};_.z(jv,Av);Av.prototype.getAdsAdapter=Av.prototype.getAdsAdapter;Av.prototype.getAdapter=Av.prototype.getAdapter;Av.prototype.setYouboraPlugin=Av.prototype.Ge;Av.Id=nv;_.Qq(new class{create(a){return a.youbora&&a.youbora.v7?new zv:new Av}});};f.call(g, window);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@castlabs/prestoplay",
3
3
  "description": "PRESTOplay Video Player",
4
- "version": "6.20.0",
4
+ "version": "6.21.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/castlabs/prestoplay-web.git"
@@ -26,6 +26,8 @@
26
26
  "@broadpeak/smartlib-all-compatibility": "5.0.1-4c69e21",
27
27
  "@broadpeak/smartlib-analytics": "5.0.1-4c69e21",
28
28
  "mux.js": "^5.14.1",
29
+ "npaw-plugin": "7.3.4",
30
+ "npaw-plugin-adapters": "7.3.4",
29
31
  "youboralib": "6.8.59"
30
32
  },
31
33
  "peerDependenciesMeta": {
package/typings.d.ts CHANGED
@@ -490,15 +490,13 @@ export namespace clpp {
490
490
  */
491
491
  distinctiveIdentifierRequired: boolean;
492
492
  /**
493
- * Defaults to [], e.g., no override.
493
+ * Defaults to [], i.e. no override.
494
494
  *
495
495
  * A list of initialization data which override any initialization data found
496
496
  * in the content. See also {@link clpp.InitDataOverride}.
497
497
  */
498
498
  initData: Array<clpp.InitDataOverride>;
499
499
  /**
500
- * Defaults to []
501
- *
502
500
  * If not empty, it contains the default key IDs for this key system, as
503
501
  * lowercase hex strings.
504
502
  */
@@ -615,7 +613,7 @@ export namespace clpp {
615
613
  * The server that handles an 'individualization-request'. If the server isn't
616
614
  * given, it will default to the license server.
617
615
  */
618
- individualizationServer: string;
616
+ individualizationServer?: string;
619
617
  /**
620
618
  * The URL to the license server.
621
619
  */
@@ -835,11 +833,11 @@ export namespace clpp {
835
833
  */
836
834
  initDataType: string;
837
835
  /**
838
- * The key Id that corresponds to this initData.
836
+ * The key ID that corresponds to this initData.
839
837
  */
840
838
  keyId: string|null;
841
839
  /**
842
- * The period ID
840
+ * The period ID.
843
841
  */
844
842
  periodId: string|null;
845
843
  }
@@ -850,11 +848,11 @@ export namespace clpp {
850
848
  */
851
849
  export type InitDataTransformerParams = {
852
850
  /**
853
- * The current DRM info
851
+ * The current DRM info.
854
852
  */
855
853
  drmInfo: clpp.DrmInfo|null;
856
854
  /**
857
- * The current DRM system configuration
855
+ * The current DRM system configuration.
858
856
  */
859
857
  drmSystemConfig: clpp.FairplayDrmSystem|clpp.PlayreadyDrmSystem|clpp.WidevineDrmSystem;
860
858
  /**
@@ -862,19 +860,19 @@ export namespace clpp {
862
860
  */
863
861
  emeApi: clpp.drm.eme.EmeFactory.Apis;
864
862
  /**
865
- * The initData from `encrypted` event
863
+ * The initData from `encrypted` event.
866
864
  */
867
865
  initData: Uint8Array;
868
866
  /**
869
- * The initData type from `encrypted` event
867
+ * The initData type from `encrypted` event.
870
868
  */
871
869
  initDataType: string;
872
870
  /**
873
- * The current player configuration
871
+ * The current player configuration.
874
872
  */
875
873
  playerConfig: clpp.PlayerConfiguration;
876
874
  /**
877
- * The current session context
875
+ * The current session context.
878
876
  */
879
877
  sessionContext: clpp.SessionContext;
880
878
  }
@@ -958,6 +956,19 @@ export namespace clpp {
958
956
  codecSwitchingStrategy?: clpp.CodecSwitchingStrategy;
959
957
  }
960
958
 
959
+ /**
960
+ * Configuration that applies to the MSE player. MSE player is the default
961
+ * player engine used on most browsers and smart TVs.
962
+ */
963
+ export type MseConfiguration = {
964
+ /**
965
+ * If true, the X-Playback-Session-Id HTTP header is added to any HTTP
966
+ * request related to the playback of an asset. This allows for easy mapping
967
+ * between HTTP requests and a specific playback session.
968
+ */
969
+ sendPlaybackSessionIdHeader?: boolean;
970
+ }
971
+
961
972
  /**
962
973
  * Mux Data plugin configuration.
963
974
  */
@@ -1445,6 +1456,10 @@ export namespace clpp {
1445
1456
  * The VR plugin configuration.
1446
1457
  */
1447
1458
  vr?: Partial<clpp.VrConfiguration>;
1459
+ /**
1460
+ * Yospace plugin configuration.
1461
+ */
1462
+ yospace?: Partial<clpp.YospaceConfiguration>;
1448
1463
  /**
1449
1464
  * Youbora plugin configuration.
1450
1465
  */
@@ -2870,14 +2885,17 @@ export namespace clpp {
2870
2885
  * Set this to `true` if the application requires the key system to support
2871
2886
  * distinctive identifiers.
2872
2887
  */
2873
- distinctiveIdentifierRequired: boolean;
2888
+ distinctiveIdentifierRequired?: boolean;
2874
2889
  /**
2875
2890
  * The server that handles an 'individualization-request'. If the server
2876
2891
  * isn't given, it will default to the license server.
2877
2892
  */
2878
2893
  individualizationServer: string;
2879
2894
  /**
2880
- * The URL to the license server
2895
+ * The URL to the license server.
2896
+ * If a DASH manifest contains License Acquisition URL(s) then this
2897
+ * can be set to an empty string and the license server URL will be
2898
+ * taken from the manifest.
2881
2899
  */
2882
2900
  licenseUrl: string;
2883
2901
  /**
@@ -2891,7 +2909,7 @@ export namespace clpp {
2891
2909
  * Set this to `true` if the application requires the key system to support
2892
2910
  * persistent state, e.g., for persistent license storage.
2893
2911
  */
2894
- persistentStateRequired: boolean;
2912
+ persistentStateRequired?: boolean;
2895
2913
  /**
2896
2914
  * Defaults to null.
2897
2915
  *
@@ -2902,7 +2920,7 @@ export namespace clpp {
2902
2920
  * certificate to avoid the round-trip on the second request and there is
2903
2921
  * usually no need to explicitly specify the certificate here.
2904
2922
  */
2905
- serverCertificate: Uint8Array|null;
2923
+ serverCertificate?: Uint8Array|null;
2906
2924
  /**
2907
2925
  * The EME video robustness level. Please note that
2908
2926
  * you usually do not need to specify this, the player will find
@@ -2912,6 +2930,16 @@ export namespace clpp {
2912
2930
  videoRobustness?: clpp.drm.WidevineRobustnessLevel|Array<(clpp.drm.WidevineRobustnessLevel|undefined)>;
2913
2931
  }
2914
2932
 
2933
+ /**
2934
+ * Configuration section for the Yospace plugin.
2935
+ */
2936
+ export type YospaceConfiguration = {
2937
+ /**
2938
+ * True to enable the Yospace plugin.
2939
+ */
2940
+ enabled?: boolean;
2941
+ }
2942
+
2915
2943
  /**
2916
2944
  * Configuration section for Youbora analytics. In addition to the listed
2917
2945
  * options, all options defined by Nice People At Work are available and will be
@@ -2926,6 +2954,10 @@ export namespace clpp {
2926
2954
  * Youbora. If it returns `null`, the error will not be sent.
2927
2955
  */
2928
2956
  errorFilter?: clpp.YouboraErrorFilter;
2957
+ /**
2958
+ * Enable integration for NPAW Plugin SDK v7
2959
+ */
2960
+ v7?: boolean;
2929
2961
  }
2930
2962
 
2931
2963
  /**
@@ -3373,6 +3405,14 @@ export namespace clpp {
3373
3405
  * Triggered when CMSD headers were detected as part of a network response.
3374
3406
  */
3375
3407
  CMSD_EVENT = "cmsd-event",
3408
+ /**
3409
+ * Triggered by the Yospace plugin when the Yospace session has been created.
3410
+ */
3411
+ YOSPACE_SESSION_STARTED = "yospace-session-started",
3412
+ /**
3413
+ * Triggered by the Yospace plugin when the Yospace session has been shut down.
3414
+ */
3415
+ YOSPACE_SESSION_ENDED = "yospace-session-ended",
3376
3416
  }
3377
3417
 
3378
3418
  /**
@@ -6319,26 +6359,24 @@ export namespace clpp {
6319
6359
 
6320
6360
  namespace EmeFactory {
6321
6361
  /**
6322
- * Existing EME Manager implementations.
6362
+ * Versions of Encrypted Media Extensions (EME) API.
6323
6363
  */
6324
6364
  export enum Apis {
6325
6365
  /**
6326
- * Standard EME manager built on top the normal (latest) EME API.
6366
+ * Standard EME. (Used by default on all platforms where it is available.)
6327
6367
  */
6328
6368
  STANDARD = "STANDARD",
6329
6369
  /**
6330
- * EME manager based on Apple-prefixed EME implementation. Used by default
6331
- * on Apple devices.
6370
+ * Apple-prefixed EME.
6332
6371
  */
6333
6372
  APPLE = "APPLE",
6334
6373
  /**
6335
- * EME manager built on version v0.1b of EME standard. Used by default only
6336
- * when necessary (i.e. on old Tizen / WebOS devices).
6374
+ * EME manager built on version v0.1b of EME standard. Typically used on
6375
+ * older smart TV devices where there is no alternative.
6337
6376
  */
6338
6377
  WEBKIT = "WEBKIT",
6339
6378
  /**
6340
- * Manager made to fulfill EME API on non-supported platforms. Shall not be
6341
- * used intentionally.
6379
+ * Internal dummy implementation of the EME API. Please do not use this.
6342
6380
  */
6343
6381
  NOP = "NOP",
6344
6382
  }
@@ -7450,6 +7488,57 @@ export namespace clpp {
7450
7488
  }
7451
7489
 
7452
7490
  namespace npaw {
7491
+ export class NpawPlugin {
7492
+ /**
7493
+ * TODO: DE-7624
7494
+ * We do keep youbora id for now, until we migrate to v7 as default
7495
+ * and change also the naming.
7496
+ */
7497
+ static Id: string;
7498
+ /**
7499
+ * Gives access to the underlying NPAW Plugin Video Adapter.
7500
+ * Can be used i.e. to emit custom errors using `fireError(code, message)` or
7501
+ * `fireFatalError(code, message)` or to emit specific events.
7502
+ * Use it with caution and only if you know what you are doing, as it might
7503
+ * break integration.
7504
+ * For more details, check {@link https://documentation.npaw.com/integration-docs/docs/custom-video-events-js#custom-event-code-example}
7505
+ */
7506
+ getAdapter(): any|null;
7507
+ /**
7508
+ * Gives access to the underlying NPAW Plugin Ads Adapter.
7509
+ * Can be used i.e. to emit custom errors using `fireError(code, message)` or
7510
+ * `fireFatalError(code, message)` or to emit specific events.
7511
+ * Use it with caution and only if you know what you are doing, as it might
7512
+ * break integration.
7513
+ * For more details, check {@link https://documentation.npaw.com/integration-docs/docs/custom-video-events-js#custom-event-code-example}
7514
+ */
7515
+ getAdsAdapter(): any|null;
7516
+ /**
7517
+ * Sets NPAW V7 Plugin.
7518
+ * Use it before playback if you want to use Castlabs
7519
+ * Player with App Analytics Integration
7520
+ * Options added in player configuration will be passed to NPAW Plugin.
7521
+ *
7522
+ * @example
7523
+ *
7524
+ * const plugin = new NpawPlugin({
7525
+ * // your custom options
7526
+ * });
7527
+ * const player = new clpp.Player('video', {
7528
+ * license: '...',
7529
+ * youbora: {
7530
+ * accountCode: 'account_code',
7531
+ * },
7532
+ * });
7533
+ * clpp.install(clpp.dash.DashComponent);
7534
+ * player.getPlugin(clpp.npaw.NpawPlugin.Id).setNpawPlugin(plugin);
7535
+ *
7536
+ * // Now you can start playback.
7537
+ * player.load('http://example.com/Manifest.mpd');
7538
+ */
7539
+ setNpawPlugin(plugin: NpawPlugin|null): void;
7540
+ }
7541
+
7453
7542
  export class YouboraPlugin {
7454
7543
  static Id: string;
7455
7544
  /**
@@ -8922,4 +9011,14 @@ export namespace clpp {
8922
9011
 
8923
9012
  }
8924
9013
  }
9014
+
9015
+ namespace yospace {
9016
+ export class YospacePlugin {
9017
+ static Id: string;
9018
+ /**
9019
+ * Get the current {@link https://developer.yospace.com/sdk-documentation/javascript/api/yosdk/latest/Session.html | Yospace playback session}.
9020
+ */
9021
+ getSession(): any|null;
9022
+ }
9023
+ }
8925
9024
  }