@castlabs/prestoplay 6.18.0 → 6.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +7 -7
- package/cjs/cl.cast.js +115 -114
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +581 -577
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +77 -75
- package/cjs/cl.externs.js +175 -293
- package/cjs/cl.freewheel.js +23 -24
- package/cjs/cl.hls.js +70 -71
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +28 -29
- package/cjs/cl.ima.js +24 -24
- package/cjs/cl.mse.js +313 -314
- package/cjs/cl.muxdata.js +15 -15
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.sessions.js +16 -15
- package/cjs/cl.simid.js +15 -15
- package/cjs/cl.smooth.js +71 -72
- package/cjs/cl.thumbnails.js +26 -26
- 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 +12 -13
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.youbora.js +18 -18
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +90 -89
- package/cl.conviva.js +27 -27
- package/cl.core.js +475 -474
- package/cl.crypto.js +9 -9
- package/cl.dash.js +72 -71
- package/cl.externs.js +172 -294
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +74 -72
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +25 -26
- package/cl.ima.js +17 -17
- package/cl.mse.js +277 -274
- package/cl.muxdata.js +13 -13
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +11 -11
- package/cl.playlist.js +5 -5
- package/cl.sessions.js +10 -10
- package/cl.simid.js +13 -13
- package/cl.smooth.js +59 -59
- package/cl.thumbnails.js +19 -19
- package/cl.tizen.js +57 -57
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +9 -8
- package/cl.vr.js +14 -14
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +15 -15
- package/clpp.styles.css +14 -0
- package/package.json +1 -1
- package/typings.d.ts +379 -384
package/cl.tizen.js
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
const b=a.f.get(a.a);if(!b.dd)throw new _.
|
|
3
|
-
a.g.debug("DRM Challenge data: ",b.challenge);const d=atob(b.challenge);var e=new Uint8Array(d.length);for(let h=0;h<d.length;++h)e[h]=d.charCodeAt(h);c=_.Si([b.serverurl&&""!==b.serverurl?b.serverurl:c.dd],_.
|
|
4
|
-
try{webapis.avplay.setDrm(
|
|
5
|
-
"widevine_app_session",a.l.id),webapis.avplay.setDrm(
|
|
6
|
-
a.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
a.
|
|
10
|
-
|
|
11
|
-
a.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
c)}}},
|
|
26
|
-
a.
|
|
27
|
-
|
|
28
|
-
b){this.h=a;this.o=null;this.a=_.Ee;this.l=null;this.j=!1;this.f=new Map;this.D=b;this.g=new _.R("clpp.tizen.DrmEngine")}init(){const a=this;return _.
|
|
29
|
-
{dd:d.licenseUrl||"",customData:c,te:!1});(b=b[_.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
a
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
this.
|
|
39
|
-
this
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
this.
|
|
45
|
-
|
|
46
|
-
this.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
{currentTime:a.currentTime/1E3}))}I(a){const b=this.a.getPosition(),c=b+a.duration/1E3;let d=a.text||"";this.g.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.
|
|
50
|
-
b){this.configuration=this.B=b;this.w=a;this.a.on(
|
|
51
|
-
_.
|
|
52
|
-
a.F);a.a.off(
|
|
53
|
-
_.
|
|
54
|
-
{this.l.release()})}release(){const a=this;return _.
|
|
55
|
-
d;}b.l.load()})}play(){this.trigger(new _.
|
|
56
|
-
a)}getNetworkEngine(){return this.C}setNetworkEngine(a){this.C=a}isLive(){return this.a.isLive()}getStats(){return null}setSourceIndex(a){this.a.setSourceIndex(a)}getSourceIndex(){return this.a.getSourceIndex()}getLoadedSource(){return this.a.getLoadedSource()}canPlay(a,b){return(new
|
|
57
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var gN="An unknown error occurred while trying to get volume",hN="Cannot get loading rendition due to platform limitations",iN="SecurityError",jN="The require privilege is: http://tizen.org/privilege/tv.audio",kN="|STARTBITRATE\x3d",lN=function(a,b,c){const d=e=>{c.call(a,e);a.removeEventListener(b,d)};a.addEventListener(b,d)},oN=function(a){return _.w(function*(){if(a.a!==_.yd&&a.a!==_.wd)throw new _.G(_.E,6,6001,`The key system ${a.a} is not supported by `+"the player or the platform");
|
|
2
|
+
const b=a.f.get(a.a);if(!b.dd)throw new _.G(_.E,6,6012,`No license server given for ${a.a}`);try{a.a===_.yd?yield mN(a):yield nN(a,b),a.o={keySystem:a.a,licenseServerUri:b.dd,distinctiveIdentifierRequired:!1,persistentStateRequired:b.te,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],keyIds:[],periodId:null}}catch(c){throw a.g.error(`Error while configuring CDM for ${a.a}`,c),new _.G(_.E,6,6005,{message:JSON.stringify(c)});}})},qN=function(a,b){_.w(function*(){var c=a.f.get(a.a);
|
|
3
|
+
a.g.debug("DRM Challenge data: ",b.challenge);const d=atob(b.challenge);var e=new Uint8Array(d.length);for(let h=0;h<d.length;++h)e[h]=d.charCodeAt(h);c=_.Si([b.serverurl&&""!==b.serverurl?b.serverurl:c.dd],_.Oi());c.type=3;c.body=e.buffer;c.method=_.vb;try{var f=yield a.D.Hb.fetch(c).W;if(a.j){var g=_.I(f.data);const h=g.byteLength;e="";for(f=0;f<h;f++)e+=String.fromCharCode(g[f]);const k=`${b.session_id}PARAM_START_POSITION`+`${btoa(e)}PARAM_START_POSITION`;a.g.debug("Widevine license params",k);
|
|
4
|
+
try{webapis.avplay.setDrm(pN,"widevine_license_data",k)}catch(l){a.g.error("License response rejected by CDM");const m=new _.G(_.E,6,6008,{browserError:JSON.stringify(l)});a.D.onError(m)}}}catch(h){a.g.error("License request failed.",JSON.stringify(h)),g=new _.G(_.E,6,6007,{message:_.Sa,url:h.data.url,status:h.data.status||NaN,response:h.data.response||"",headers:h.data.headers||{}},h),a.D.onError(g)}})},mN=function(a){return _.w(function*(){try{webapis.avplay.setDrm(pN,"Initialize",""),webapis.avplay.setDrm(pN,
|
|
5
|
+
"widevine_app_session",a.l.id),webapis.avplay.setDrm(pN,"widevine_data_type",a.l.type)}catch(b){throw b;}})},nN=function(a,b){return _.w(function*(){var c={};c[rN]=!b.te;c[sN]=b.dd;""!==b.customData&&(c[tN]=b.customData);c=JSON.stringify(c);a.g.debug("PlayReady properties: ",c);try{webapis.avplay.setDrm(uN,"SetProperties",c)}catch(d){throw d;}})},vN=function(a){return _.w(function*(){tizen.systeminfo.getPropertyValue("DISPLAY",b=>{a.A=b.resolutionWidth/1920;a.g.debug("Display resolution ratio: ",
|
|
6
|
+
a.A)},b=>{a.g.debug("Could not load DISPLAY property");throw b;})})},xN=function(a){try{webapis.avplay.setListener({onbufferingstart:a.I.bind(a),onbufferingprogress:a.H.bind(a),onbufferingcomplete:a.G.bind(a),onstreamcompleted:a.L.bind(a),oncurrentplaytime:b=>{a.trigger(new _.C(wN,{currentTime:b}))},onevent:a.K.bind(a),onsubtitlechange:a.M.bind(a),ondrmevent:a.J.bind(a),onerror:a.T.bind(a)})}catch(b){a.g.error(b)}},yN=function(a){const b=!!a.m.getTrackManager().Ka();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",
|
|
7
|
+
c)}},zN=function(a,b){try{const c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,Sh:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",kN+d)}catch(c){a.g.debug(c)}},AN=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+kN+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",c),c;}},BN=function(a){let b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case iN:a.g.warn("The application doesn't have the privilege to get the mute state.",
|
|
8
|
+
jN);break;default:a.g.warn(gN,c)}}return!!b},CN=function(a){return a.f&&a.a?a.a.Dh:webapis.avplay.getTotalTrackInfo()},DN=function(a){return a.f&&a.a?a.a.qg:webapis.avplay.getCurrentStreamInfo()},EN=function(a){return{position:a.getPosition(),state:a.m.getState(),Xe:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:BN(a),volume:a.getVolume(),Dh:CN(a),qg:DN(a)}},FN=function(){return new Promise((a,b)=>{if(window.webapis)a();else{const c=document.createElement("script");
|
|
9
|
+
lN(c,_.qe,d=>a(d));lN(c,_.Vd,d=>b(d));c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},GN=function(a){return _.w(function*(){yield FN();const b=new Promise(c=>{(new _.Wj(c)).fa(5)});if(!(yield Promise.race([vN(a).then(()=>!0),b.then(()=>!1)])))return a.g.debug("Took to long for the SDK to be ready"),Promise.reject("SDK Timeout")})},HN=function(a){return _.w(function*(){a.g.debug("avplay.prepare()");return new Promise((b,c)=>{try{webapis.avplay.prepareAsync(()=>
|
|
10
|
+
{a.g.debug("AVPlay is ready!");yN(a);b()},d=>{a.g.debug("prepareAsync failed",d);c(d)})}catch(d){a.g.debug("Failed to prepare media player for playback"),c(d)}})})},IN=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case iN:a.g.warn("The application does not have the privilege to set mute.",jN);break;default:a.g.warn(gN,c)}}},NN=function(a,b,c){return _.w(function*(){a.l=_.jo(b);const d=a.F,e=c||{estimatedBandwidth:0,currentBandwidth:0,nextBandwidth:null,currentPosition:0};
|
|
11
|
+
a.g.debug(`Loading manifest URL: ${a.l[d].url}`);let f=b.startTime||void 0;a.f&&(a.trigger(new _.C(JN)),f=c.currentPosition);try{let g=a.l[d].url;if(a.l[d].type===_.Bc&&!g.includes(".mpd")){const h=new URL(g);h.searchParams.append("cl-ext",".mpd");g=h.toString()}webapis.avplay.open(g);e.nextBandwidth?(AN(a,e.nextBandwidth),a.o=!1):(a.o||zN(a,e),a.o=!0);xN(a);if(b.drm&&b.drm.env){const h={onError:k=>a.m.onError(k),Hb:a.m.getNetworkEngine()};a.h=new KN(b.drm,h);yield a.h.init()}else a.g.debug("No DRM configuration was provided. Assuming clear content");
|
|
12
|
+
a.f||a.trigger(new _.C(LN));yield HN(a);a.f||a.trigger(new _.C(MN));f&&typeof f===_.r&&0<f&&a.seek(f).catch(h=>{a.g.debug("Couldn't set start position",h)});a.f||(b.volume&&a.setVolume(b.volume),b.muted&&IN(a,b.muted),b.autoplay&&a.m.play().catch(h=>{a.g.debug("Autoplay failed",h)}))}catch(g){throw a.g.debug("Error while attempting to load source."),g;}})},PN=function(a,b,c){a.g.debug("switchVideoTrack()");try{const d={estimatedBandwidth:parseInt(webapis.avplay.getStreamingProperty("CURRENT_BANDWITH"),
|
|
13
|
+
10),currentBandwidth:b,nextBandwidth:c,currentPosition:a.getPosition()};a.a=EN(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(()=>{const e=a.a.Xe;a.f=!1;a.a=null;return e===ON?a.pause():a.play()})}catch(d){return Promise.reject(d)}},QN=function(a,b){var c=a.m.getTextDisplayer();c&&c.setTextVisibility(b);c=a.m.h;try{c||webapis.avplay.setSilentSubtitle(!b)}catch(d){a.g.debug("Could not set text track visibility",d)}},SN=function(a,b,c){b=b.toUpperCase();
|
|
14
|
+
b===RN&&QN(a,!0);const d=a.j[b];d&&(d.Ld.stop(),a.j[b]=null,a.g.debug(`Cancelled pending track switch for ${b}`));return new Promise((e,f)=>{const g=(h,k,l)=>{l=void 0===l?!1:l;try{webapis.avplay.setSelectTrack(h,k),a.j[h]=null,e()}catch(m){a.g.debug(`Could not set ${h} track. Trying again...`+`AVPlay state: ${a.getState()}, `+`buffering: ${a.w}`,m),!1===l&&(a.j[h]={type:h,index:k,Ue:0,Ld:new _.Wj(()=>g(h,c,!0))}),(k=a.j[h])&&3>k.Ue?(!a.w&&++k.Ue,k.Ld.fa(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),
|
|
15
|
+
k&&k.Ld.stop(),a.j[h]=null,f())}};g(b,c)})},UN=function(a,b){if(a.f!==b)if(a.f===_.bo&&b!==_.co)a.g.debug(_.nA+`${TN(b)}`);else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.Yn?(a.o=(new Date).getTime(),a.m.trigger(new _.C(_.Wc,{detail:{bufferedTimeMS:-1,reason:a.h}}))):a.j===_.Yn&&a.m.trigger(new _.C(_.Sc,{detail:{bufferedTimeMS:c-a.o,reason:a.h}}));b={currentState:a.f,previousState:a.j,timeSinceLastStateChangeMS:c-a.w};a.w=c;a.m.trigger(new _.C(_.Mf,{detail:b}));a.g.debug("State changed:",TN(a.j),
|
|
16
|
+
"-\x3e",TN(a.f))}},TN=function(a){return Object.keys(_.ao)[a]},WN=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case VN:c=_.go;break;case ON:c=_.fo;break;default:a.m.isEnded()?c=_.Vn:a.g.debug("Inconsistent AVPlay playback state:",b)}UN(a,c)}},XN=function(a){return _.w(function*(){const b=a.m.getConfiguration();let c;(c=yield _.mp(a.B.url,a.m.getNetworkEngine(),b.manifest.attemptParameters,a.B.type||null))&&c.configure(b.manifest);return c})},YN=function(a){if(!a)return!1;a=a.periods;let b=
|
|
17
|
+
!1;for(let c=0;c<a.length;c++)b=b||0<a[c].textStreams.length;return b},ZN=function(a){const b=document.createElement(_.t),c=new _.TG,d=new _.$F,e=a.m.getTextDisplayer();return new _.VG(b,c,e,d,a.m.getConfiguration())},$N=function(a){const b={configuration:{},Lb:()=>a.m.getPosition(),$:a.h,Hb:a.m.getNetworkEngine(),ne:a.G.bind(a),me:a.F.bind(a),onError:a.T.bind(a),zf:()=>{},onEvent:()=>{},Df:a.H.bind(a),Gd:()=>{},ud:()=>new _.LH,Rd:()=>!1,Rc:null};return new _.mH(a.a,b)},aO=function(a){const b=a.m.getPosition();
|
|
18
|
+
let c=null;for(const d of a.a.periods)d.startTime<=b&&(c=d);return c},bO=function(a){a.g.debug("getTextStreams()",a.a);if(a.a){var b=[],c=a.a.periods;a.g.debug("getting text streams");for(var d=0;d<c.length;d++)if(a.g.debug(c[d].startTime,a.m.getPosition()),c[d].startTime<=a.m.getPosition()){b=c[d].textStreams;break}a=b}else a=[];b=[];c=0;for(d=0;d<a.length;d++){const e=new _.jj(String(c++),_.J);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=a[d].kind||_.VA;const f=new _.tj(String(a[d].id),
|
|
19
|
+
e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},cO=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.f){const b=_.hE(a.f,_.F);let c=null;if(b){a=bO(a);for(let d=0;d<a.length;d++)if(a[d].renditions[0].id===String(b.id)){c=a[d].renditions[0];break}}return c}return null},dO=function(a,b){a.g.debug("Set active track",b);if(b&&(a.o=b.language,a.A=b.roles[0]||"",a.C=b.kind===_.Xd,a.a&&a.f)){a.setTextVisibility(!0);const c=aO(a),d=b.renditions[0];(b=
|
|
20
|
+
c.textStreams.find(e=>String(e.id)===d.id))?(a.w?(a.g.debug("Switching period defer text selection"),a.l=b):(_.tE(a.f,b,!0,0),a.m.trigger(new _.C(_.Nk))),a.o=b.language):a.g.error(_.mA,d.id)}},eO=function(a){const b=a.ma();b&&a.m.trigger(new _.C(_.Pc,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},fO=function(a,b){a.m.trigger(new _.C(_.sg,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,abrSelection:a.a.o}}))},gO=function(a,b){let c=null;try{c=
|
|
21
|
+
JSON.parse(b)}catch(d){a.g.warn("Couldn't retrieve extra infos from stream."),c=null}return c},hO=function(a,b){a=a.f[_.L]||[];const c=[];for(let d=0;d<a.length;d++)for(let e=0;e<a[d].renditions.length;e++)_.Zg(a[d].renditions[e],b,Object.keys(b))&&c.push(a[d].renditions[e]);return c[0]||null},iO=function(a){const b=a.m.getConfiguration();var c=_.yh(b.preferredAudioLanguage||[]);const d=a.f[_.K]||[];if(d.length){var e=null;c.some(g=>{e=_.pB(g,d.map(h=>h.language));return!!e});if(e){var f=d.filter(g=>
|
|
22
|
+
g.language===e);c=f[0];1<f.length&&b.preferredAudioRole&&(f=f.filter(g=>0<=g.roles.indexOf(b.preferredAudioRole)),0<f.length&&(c=f[0]));a.g.debug("Setting audio track with preferred language:",e);a.va(c)}else a.g.debug("Preferred language(s) not available")}else a.g.debug("Could not set preferred audio language")},mO=function(a,b){var c=(l,m)=>{for(let n=0;n<l.length;n++)if(l[n].language===m)return l[n];return null};const d={};if(0>=b.length)return d;var e=b.filter(l=>l.type===_.Tb),f=b.filter(l=>
|
|
23
|
+
l.type===_.Oz);const g=[];for(var h=0;h<f.length;h++){const l=gO(a,f[h].extra_info);if(l){var k=_.$h(l.language||_.ag);k=_.fj(k);k=c(g,k);k||(k=new _.jj(String(a.o++),_.K),g.push(k));k.renditions.push(jO(f[h].index,l,k))}else a.g.warn("Skipping audio stream with no extra info")}c=new _.jj(String(a.o++),_.L);for(f=0;f<e.length;f++)(h=gO(a,e[f].extra_info))?c.renditions.push(kO(e[f].index,h,c)):a.g.warn("Skipping video stream with no extra info");e=[];e=a.h?bO(a.h):lO(a,b);d[_.L]=[c];d[_.K]=g;d[_.J]=
|
|
24
|
+
e;return d},oO=function(a,b){if(b===_.J&&a.h)return cO(a.h);var c=DN(a.a)||[];if(0===c.length)return null;c=c.filter(e=>e.type===b.toUpperCase())[0];var d=null;b===_.L&&(d=gO(a,c.extra_info),d=hO(a,{width:d.Width,height:d.Height}));b===_.K&&(c?(d=nO(a,c,_.K),a.j=d):d=a.j);b===_.J&&(c?(d=nO(a,c,_.J),a.l=d):d=a.l);return d},pO=function(a,b){if(b){const c=b.track.type.toUpperCase();SN(a.a,c,Number(b.id)).then(()=>{c===_.Oz&&(a.j=b,a.m.trigger(new _.C(_.Mk)));c===RN&&(a.l=b,a.m.trigger(new _.C(_.Nk)))}).catch(()=>
|
|
25
|
+
{a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},jO=function(a,b,c){const d=_.$h(b.language||_.ag);c.language=_.fj(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.Lc;a=new _.tj(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=b.bit_rate||null;return a},kO=function(a,b,c){c.mimeType=_.qg;a=new _.tj(String(a),c);a.track=c;a.width=b.Width||null;a.height=b.Height||null;a.bandwidth=b.Bit_rate?Number(b.Bit_rate):
|
|
26
|
+
null;a.codec=b.fourCC||null;return a},qO=function(a,b,c){b=_.$h(b.track_lang||_.ag);c.mimeType="text/ttml";c.language=_.fj(b);c.originalLanguage=b;c.kind=_.VA;return new _.tj(String(a),c)},lO=function(a,b){b=b.filter(d=>d.type===RN);const c=[];for(let d=0;d<b.length;d++){const e=gO(a,b[d].extra_info);if(!e){a.g.warn("Skipping text stream with no extra info");continue}const f=new _.jj(String(a.o++),_.J);f.renditions.push(qO(b[d].index,e,f));c.push(f)}return c},nO=function(a,b,c){a=a.f[c]||[];b=String(b.index);
|
|
27
|
+
c=null;for(let d=0;d<a.length;d++)for(let e=0;e<a[d].renditions.length;e++)if(a[d].renditions[e].id===b){c=a[d].renditions[e];break}return c},rO=function(a){if("NONE"!==a.a.getState()){var b=a.j.getBoundingClientRect();{a=a.a;const c=Math.floor(b.left*a.A),d=Math.floor(b.top*a.A),e=Math.floor(b.width*a.A);b=Math.floor(b.height*a.A);a.g.debug("Setting display area to","x:",c,"y:",d,"width:",e,"height:",b);webapis.avplay.setDisplayRect(c,d,e,b);0===c&&0===d&&1920===e&&1080===b&&webapis.avplay.setDisplayMethod("PLAYER_DISPLAY_MODE_LETTER_BOX")}}else a.g.debug("Could not apply dimension. Player state "+
|
|
28
|
+
a.a.getState())},KN=class{constructor(a,b){this.h=a;this.o=null;this.a=_.Ee;this.l=null;this.j=!1;this.f=new Map;this.D=b;this.g=new _.R("clpp.tizen.DrmEngine")}init(){const a=this;return _.w(function*(){var b=_.ul[a.h.env]||null;if(!b)throw a.g.debug(_.va,_.zb+a.h.env+_.aa),new _.G(_.E,6,6015,`DRM environment '${a.h.env}' is missing.`);a.l={id:String(Math.floor(1E4*Math.random())),type:"MPEG-DASH"};var c=Object.keys(a.h.customData||{}).length?btoa(JSON.stringify(a.h.customData)):"";b=_.wl(b,a.h.customData);
|
|
29
|
+
const d=b[_.wd];d&&a.f.set(_.wd,{dd:d.licenseUrl||"",customData:c,te:!1});(b=b[_.yd])&&a.f.set(_.yd,{dd:b.licenseUrl||"",customData:c,te:!1});if(0===a.f.size)throw new _.G(_.E,6,6E3);if((c=a.h.preferredDrmSystem)&&a.f.get(c))a.a=c;else if(a.f.get(_.wd))a.a=_.wd;else if(a.f.get(_.yd))a.a=_.yd;else throw new _.G(_.E,6,6001,"Configuration for the target system is missing.");yield oN(a);a.j=!0})}release(){const a=this;return _.w(function*(){a.j=!1;a.o=null;a.a=_.Ee;a.l=null;a.f=new Map})}getDrmInfo(){return this.o}},
|
|
30
|
+
rN="DeleteLicenseAfterUse",sN="LicenseServer",tN="CustomData";var BO=class extends _.rt{constructor(a){super();this.m=a;this.h=null;this.g=new _.R("clpp.tizen.Middleware");this.C=1;this.B=!1;this.l=null;this.F=0;this.o=!0;this.f=!1;this.a=null;this.A=1;this.w=!1;this.j={}}I(){this.w=!0;this.f||this.trigger(new _.C(JN))}H(a){this.w=!0;this.trigger(new _.C(sO,{percent:a}))}G(){this.w=!1;this.trigger(new _.C(tO))}L(){this.trigger(new _.C(uO))}K(a,b){this.trigger(new _.C(vO,{eventid:a,data:b}))}M(a,b,c,d,e){this.trigger(new _.C(wO,{duration:a,text:b,subtitleType:c,
|
|
31
|
+
attriCount:d,attributes:e}))}J(a,b){this.trigger(new _.C(xO,{drmType:a,drmData:b}));this.h&&(a=this.h,a.j&&(a.a===_.yd&&"Challenge"===b.name?qN(a,b):"DrmError"===b.name&&(a.g.debug("DrmError event",b),b=new _.G(_.E,6,6005,{message:JSON.stringify(b)}),a.D.onError(b))))}T(a){this.trigger(new _.C(yO,{eventType:a}))}play(){const a=this.getState(),b=()=>new Promise((c,d)=>{let e=null;const f=()=>{c();clearTimeout(e)};this.one(wN,f,this);e=setTimeout(()=>{this.off(wN,f);d("Timeout")},3E4)});if(a===zO)return(new Promise((c,
|
|
32
|
+
d)=>{webapis.avplay.prepareAsync(()=>{yN(this);c(webapis.avplay.play())},e=>{this.trigger(new _.C(yO));d(e)})})).then(()=>b());if(a===ON||a===AO)try{return webapis.avplay.play(),b()}catch(c){return Promise.reject(c)}return a===VN?Promise.resolve():Promise.reject("Player is in invalid state")}pause(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===ON?Promise.resolve():Promise.reject()}setPlaybackRate(a){const b=this.getState();if(b===AO||b===VN||b===ON){try{webapis.avplay.setSpeed(a),
|
|
33
|
+
this.C=a}catch(c){return this.g.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.C)}return!0}this.g.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1}getPlaybackRate(){return this.C}load(a,b){const c=this;return _.w(function*(){c.g.debug("configure()",b||"");try{yield GN(c),yield NN(c,a,b)}catch(d){throw new _.G(_.E,7,7003,null,d);}})}getState(){if(this.f&&this.a)return this.a.Xe;try{return webapis.avplay.getState()}catch(a){this.T(JSON.stringify(a))}}seek(a){const b=
|
|
34
|
+
1E3*a;return new Promise((c,d)=>{this.B=!0;this.m.trigger(new _.C(_.gg));webapis.avplay.seekTo(b,()=>{this.B=!1;this.m.trigger(new _.C(_.fg));c()},()=>{this.B=!1;d()})})}getPosition(){if(this.f&&this.a)return this.a.position;try{return webapis.avplay.getCurrentTime()/1E3}catch(a){this.T(JSON.stringify(a))}}getDuration(){if(this.f&&this.a)return this.a.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.T(JSON.stringify(a))}}release(){return new Promise((a,b)=>{try{this.h&&(this.h.release(),
|
|
35
|
+
this.h=null);webapis.avplay.stop();webapis.avplay.close();for(const c in this.j){const d=this.j[c];d&&d.Ld.stop()}this.j={};this.C=1;this.B=!1;this.a=this.l=null;return a()}catch(c){return b(c)}})}getVolume(){let a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case iN:this.g.debug("The application does not have the privilege to get the volume.",jN);break;default:this.g.debug(gN,b)}}return a}setVolume(a){try{tizen.tvaudiocontrol.setVolume(Math.max(0,Math.min(100*a,100)))}catch(b){switch(b.name){case "InvalidValueError":this.g.warn("Invalid value passed for setVolume.",
|
|
36
|
+
"The passed value value should be in the range of 0 to 1.");break;case iN:this.g.warn("The application does not have the privilege to set the volume.",jN);break;default:this.g.warn("An unknown error occurred while trying to set volume",b)}}}isLive(){if(this.f&&this.a)return this.a.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.T(JSON.stringify(a))}}stop(){try{webapis.avplay.stop()}catch(a){this.g.debug(a)}}getDrmInfo(){this.h&&this.h.getDrmInfo();return null}setSourceIndex(a){this.F=
|
|
37
|
+
a}getSourceIndex(){return this.F}getLoadedSource(){return this.l&&this.l[this.getSourceIndex()]}},zO="IDLE",AO="READY",VN="PLAYING",ON="PAUSED",RN="TEXT",uN="PLAYREADY",pN="WIDEVINE_CDM";var CO=class{constructor(a){this.m=a;this.a=this.m.a;this.f=_.co;this.j=_.Mt;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.h=2;this.g=new _.R("clpp.tizen.StateManager")}initialize(){this.a.on(JN,this.C,this);this.a.on(sO,this.B,this);this.a.on(tO,this.A,this);this.a.on(LN,this.H,this);this.a.on(MN,this.G,this);this.a.on(uO,this.F,this)}release(){UN(this,_.co);this.l=!1;this.o=-1;this.h=2}destroy(){this.release();this.a.off(JN,this.C);this.a.off(sO,this.B);this.a.off(tO,this.A);this.a.off(LN,
|
|
38
|
+
this.H);this.a.off(MN,this.G);this.a.off(uO,this.F);this.m=this.a=null}C(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;UN(this,_.Yn)}B(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",TN(this.f))}A(){this.g.debug("Buffering complete. Player state: ",this.a.getState());if(!this.l){this.l=!0;var a=this.m.getConfiguration().autoplay;const b=this.a.getState()===AO;if(!a&&b){UN(this,_.fo);return}}if(a=this.f!==_.eo)a=this.a.getState(),a=a===
|
|
39
|
+
VN||a===ON;a&&WN(this)}H(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===zO?UN(this,_.eo):this.g.error("AVPlay prepares while state is not IDLE")}G(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())}F(){UN(this,_.Vn)}getState(){return this.f}};var JN="onbufferingstart",sO="onbufferingprogress",tO="onbufferingcomplete",uO="onstreamcompleted",wN="oncurrentplaytime",vO="onevent",wO="onsubtitlechange",xO="ondrmevent",yO="onerror",LN="preparingstart",MN="preparingend";var DO=class{constructor(){this.o=this.A=this.f=this.h=this.B=this.m=this.j=this.a=null;this.C=!1;this.w=!0;this.l=null;this.g=new _.R("clpp.tizen.TextStreamer")}initialize(a){this.m=a}load(a){const b=this;return _.w(function*(){if(b.m)if(b.B=a,b.j=yield XN(b),b.j){var c={configurationId:"",networkingEngine:b.m.getNetworkEngine(),filterNewPeriod:()=>{},filterAllPeriods:()=>{},onEvent:()=>{},onError:()=>{}};try{b.a=yield b.j.start(a.url,c)}catch(d){b.g.warn(d);try{b.a=yield b.j.start(a.url.replace("https://",
|
|
40
|
+
"http://"),c)}catch(e){b.g.error(e),b.a=null}}if(b.a&&YN(b.a)){b.h=ZN(b);try{yield b.h.open();b.f=$N(b);const d=b.m.getConfiguration();b.f.h=d.streaming;b.o=d.preferredTextLanguage;b.A=d.preferredTextRole;b.C=d.preferForcedSubtitles}catch(d){b.g.debug("Could not setup media source..."),b.h=null,b.f=null,b.j=null,b.a=null}}}else b.g.debug("Could not find manifest parser for source. Make sure parsers are registered.");else b.g.debug("Text streamer is not initialized. Will not load()")})}G(a){this.g.debug(_.MA,
|
|
41
|
+
a);this.w=!0;let b=_.pD(a.textStreams,this.o||"",this.A||"",this.C)[0]||null;this.l&&(a.textStreams.includes(this.l)&&(b=this.l),this.l=null);return{variant:null,text:b}}F(){this.g.debug("canSwitch_");this.w=!1;this.l&&(_.tE(this.f,this.l,!0,0),this.l=null)}T(){this.g.debug("onError_")}H(){this.j&&this.j.update&&this.j.update()}start(){const a=this;return _.w(function*(){if(a.f)try{a.f.start()}catch(b){a.g.error("Error while starting streaming engine",b)}})}setTextVisibility(a){this.g.debug("Set text visibility",
|
|
42
|
+
a);this.h&&this.h.getTextDisplayer().setTextVisibility(a)}release(){const a=this;return _.w(function*(){a.m=null;a.a=null;a.B=null;a.A=null;a.o=null;a.w=!0;a.l=null})}destroy(){const a=this;return _.w(function*(){a.j&&(yield a.j.stop(),a.j=null);a.f&&(yield a.f.destroy(),a.f=null,a.w=!0);a.h&&(yield a.h.destroy(),a.h=null)})}};var W=class extends _.S{constructor(){super();this.h=this.a=this.m=null;this.f={};this.g=new _.R("clpp.tizen.TrackManager");this.w=this.l=this.j=null;this.B=!1;this.o=1}C(a){var b=a.eventid;a=a.data;switch(b){case "PLAYER_MSG_BITRATE_CHANGE":0<Object.keys(this.f).length||(this.g.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+gO(this,b[0].extra_info).Bit_rate,b=hO(this,{bandwidth:b}))&&(this.w=b,fO(this,b));break;case "PLAYER_MSG_RESOLUTION_CHANGED":eO(this);
|
|
43
|
+
break;default:this.g.debug("Event type: "+b+" data: "+a)}}A(a){a.detail.currentState===_.go&&this.m.off(_.Mf,this.A)}initialize(a){this.m=a;this.a=this.m.a;this.m.on(_.Mf,b=>{this.B||(b=b.detail,b.currentState===_.go&&(this.g.debug("Current state",b.currentState),this.B=!0,iO(this)))});this.a.on(vO,this.C,this)}release(){this.f={};this.h=this.w=this.l=this.j=null;this.B=!1;this.o=1}load(){if(this.a&&!(0<Object.keys(this.f).length)){this.h=this.m.h;this.m.off(_.Mf,this.A);this.m.on(_.Mf,this.A,this);
|
|
44
|
+
try{const a=CN(this.a);this.f=mO(this,a);const b=this.f[_.K]||[];b.length&&(this.j=b[0].renditions[0]||null);eO(this)}catch(a){this.g.debug("Could not load track manager")}}}destroy(){this.a.off(vO,this.C);this.a=this.m=null}getVideoTracks(){return this.f[_.L]||[]}getAudioTracks(){return this.f[_.K]||[]}ha(){return this.f[_.J]||[]}ma(){return oO(this,_.L)}Ta(){return oO(this,_.K)}Ka(){return oO(this,_.J)}jb(){return this.w}zb(){this.g.info(hN);return null}Ab(){this.g.info(hN);return null}La(){const a=
|
|
45
|
+
this.ma();return a?a.track:null}la(){const a=this.Ta();return a?a.track:null}ta(){const a=this.Ka();return a?a.track:null}ub(a){null===a?(a=this.ma(),PN(this.a,a.bandwidth,null).then(()=>{eO(this)})):0<a.renditions.length&&this.ab(a.renditions[0])}va(a){a?pO(this,a.renditions[0]):this.g.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")}Na(a){a?(a=a.renditions[0],this.h?dO(this.h,a.track):pO(this,a)):(this.g.debug("Disabling text tracks"),this.l=null,QN(this.a,
|
|
46
|
+
!1),this.m.trigger(new _.C(_.Nk)))}ab(a){const b=this.ma();this.a.o||a.width!==b.width||a.height!==b.height||a.bandwidth!==b.bandwidth?(this.w=a,fO(this,a),PN(this.a,b.bandwidth,a.bandwidth).then(()=>{eO(this)}).catch(c=>{const d=new _.G(_.E,7,7200,{tizenerror:c});this.g.debug("Error while switching video track",c);this.m.onError(d)})):this.g.debug("Trying to switch to already active rendition. Doing nothing...")}sb(a){pO(this,a)}tb(a){this.h?dO(this.h,a.track):pO(this,a)}addTextTrack(){}pa(){return this.a.o}};
|
|
47
|
+
W.prototype.isAbrEnabled=W.prototype.pa;W.prototype.addTextTrack=W.prototype.addTextTrack;W.prototype.setTextRendition=W.prototype.tb;W.prototype.setAudioRendition=W.prototype.sb;W.prototype.setVideoRendition=W.prototype.ab;W.prototype.setTextTrack=W.prototype.Na;W.prototype.setAudioTrack=W.prototype.va;W.prototype.setVideoTrack=W.prototype.ub;W.prototype.getTextTrack=W.prototype.ta;W.prototype.getAudioTrack=W.prototype.la;W.prototype.getVideoTrack=W.prototype.La;
|
|
48
|
+
W.prototype.getLoadingTextRendition=W.prototype.Ab;W.prototype.getLoadingAudioRendition=W.prototype.zb;W.prototype.getLoadingVideoRendition=W.prototype.jb;W.prototype.getTextRendition=W.prototype.Ka;W.prototype.getAudioRendition=W.prototype.Ta;W.prototype.getVideoRendition=W.prototype.ma;W.prototype.getTextTracks=W.prototype.ha;W.prototype.getAudioTracks=W.prototype.getAudioTracks;W.prototype.getVideoTracks=W.prototype.getVideoTracks;var HO=class extends _.rt{constructor(){super();this.a=new BO(this);this.f=new CO(this);this.configuration=this.B=_.al();this.w=null;this.g=new _.R("clpp.tizen.Player");this.j=null;this.l=new W;this.C=new _.gr;this.o=this.h=null;this.A=!1}H(){this.g.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.C(_.Ud));this.configuration.loop?this.seek(this.configuration.startTime||0).catch(()=>{this.g.debug("Could not loop playback")}):this.a.stop()}F(a){this.trigger(new _.C(_.Xf,
|
|
49
|
+
{currentTime:a.currentTime/1E3}))}I(a){const b=this.a.getPosition(),c=b+a.duration/1E3;let d=a.text||"";this.g.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.Ai(d))&&this.o.append([new _.ft(b,c,d)],[])}G(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)}J(){this.A||(this.g.debug("Initial buffering completed..."),this.A=!0)}T(a){this.g.debug(`Error: TYPE: ${a.eventType}`);UN(this.f,_.bo);a=new _.G(_.E,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.C(_.Vd,{detail:a}))}init(a,
|
|
50
|
+
b){this.configuration=this.B=b;this.w=a;this.a.on(uO,this.H,this);this.a.on(wN,this.F,this);this.a.on(wO,this.I,this);this.a.on(xO,this.G,this);this.a.on(yO,this.T,this);this.a.on(tO,this.J,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();a=EO;EO+=1;a="__clpp_tizen_player_"+a;this.j=_.Dp(_.Fe,{id:a,type:"application/avplayer"});this.w.addElementToContainer(this.j,!0);var c=this.w.getMedia();if(c){a=this.j;{b=[_.Dg,_.$d,"position",
|
|
51
|
+
_.ge,"top"];const e={};c=null!==c.parentElement?window.getComputedStyle(c,null):c.style;if(!b||0===b.length)for(d in b||(b=[]),c)b.push(d);for(const f of b)e[f]=c[f];var d=e}_.Fp(a,d);rO(this)}}getSurface(){return this.w}getConfiguration(){return this.configuration}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.qb)}appendLoad(){return Promise.reject(_.qb)}seekWith(){return Promise.reject(_.qb)}setSeekInterceptor(){}destroy(){const a=this;return _.w(function*(){yield a.release();
|
|
52
|
+
a.a.off(uO,a.H);a.a.off(wN,a.F);a.a.off(wO,a.I);a.a.off(xO,a.G);a.a.off(yO,a.T);a.a.off(tO,a.J);a.h&&(yield a.h.destroy(),a.h=null);a.j&&(a.j.parentElement.removeChild(a.j),a.j=null);a.l.destroy();a.f.destroy();a.l=null;a.f=null})}namespace(){return FO}getPlaybackRate(){return this.a.getPlaybackRate()}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}setPlaybackRate(a){this.a.setPlaybackRate(a)}getPosition(){return this.getMediaPosition()}getMediaPosition(){return 0<(this.configuration.startTime||
|
|
53
|
+
0)&&!this.A?0:this.f.getState()===_.Vn?this.getDuration():this.a.getPosition()||0}seek(a){return typeof a===_.r&&0<=a?(this.isLive()||(a=Math.min(a,this.getDuration())),this.a.seek(a)):Promise.reject()}getPresentationStartTime(){return null}getSeekRange(){return{start:0,end:0}}getVolume(){const a=this.a.getVolume();return typeof a===_.r?a/100:null}setVolume(a){this.a.setVolume(a)}getDuration(){return this.getMediaDuration()}getMediaDuration(){return this.a.getDuration()}getBufferInfo(){this.g.warn(_.qa);
|
|
54
|
+
return new _.qt}getTrackManager(){return this.l}unload(){return this.a.release().then(()=>{this.l.release()})}release(){const a=this;return _.w(function*(){a.h&&(yield a.h.release());a.o&&(yield a.o.destroy(),a.o=null);yield a.a.release();a.l.release();a.f.release();a.A=!1})}load(a){const b=this;return _.w(function*(){b.configuration=_.dl(b.B,a);var c=_.Ln(b.configuration,[_.ce,"native"]);b.o=c.create(b);c=_.jo(b.configuration)[0];if(b.configuration.tizen&&b.configuration.tizen.sideStreamText){b.h=
|
|
55
|
+
new DO;b.h.initialize(b);try{yield b.h.load(c),b.h.start()}catch(d){b.g.error(d)}}try{yield b.a.load(b.configuration)}catch(d){throw b.onError(d),d;}b.l.load()})}play(){this.trigger(new _.C(_.Te));rO(this);return this.a.play().then(()=>{WN(this.f)})}pause(){return this.a.pause().then(()=>{WN(this.f)})}getState(){return this.f.getState()}getPeriods(){return[]}onError(a){const b=new _.C(_.Vd,{detail:a});a.severity===_.E&&(UN(this.f,_.bo),this.a.release());this.trigger(b);b.defaultPrevented&&(b.a=!0)}getDrmInfo(){return this.a.getDrmInfo()}isEnded(){return this.f.getState()===
|
|
56
|
+
_.Vn}isPaused(){return this.a.getState()===ON}isMuted(){return BN(this.a)}setMuted(a){IN(this.a,a)}getNetworkEngine(){return this.C}setNetworkEngine(a){this.C=a}setCmsdManager(){}isLive(){return this.a.isLive()}getStats(){return null}setSourceIndex(a){this.a.setSourceIndex(a)}getSourceIndex(){return this.a.getSourceIndex()}getLoadedSource(){return this.a.getLoadedSource()}canPlay(a,b){return(new GO).canPlay(a,b)}getTimelineCues(){return[]}getCueTimeline(){return null}getTextDisplayer(){return this.o}resetAbr(){}};
|
|
57
|
+
HO.prototype.getTextDisplayer=HO.prototype.getTextDisplayer;HO.prototype.setNetworkEngine=HO.prototype.setNetworkEngine;HO.prototype.getNetworkEngine=HO.prototype.getNetworkEngine;var FO="clpp.tizen",EO=0,GO=class{a(){return FO}canPlay(a){a=a.type;const b=!!window.webapis;if((a===_.Bc||a===_.Rk||a===_.Gc)&&b){if(_.ak(2))return 2;if(_.ak(3)||_.ak(4)||_.ak(5)||_.ak(6))return _.B("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0}f(a){return a===_.na}create(){return new HO}};_.x("clpp.tizen.TizenComponent",class extends _.su{f(){_.Vk(new GO)}a(){var a=FO;a&&_.Tk[a]&&(delete _.Tk[a],_.Uk.info("Removed Player factory: '"+a+"'"))}id(){return"tizen"}});};f.call(g, window);
|
package/cl.ttml.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
|
|
3
|
-
"
|
|
4
|
-
e);for(const e of a.j)d.appendChild(
|
|
5
|
-
|
|
6
|
-
{l in k.attributes&&(g[l]=k.attributes[l])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(
|
|
7
|
-
|
|
8
|
-
"lineHeight","opacity","padding",
|
|
9
|
-
f.get(this.o))){g.region=f.build(a,e);g.textAlign=
|
|
10
|
-
a.getAttribute("imagetype"),a=a.j.trim(),d="PNG"===e&&"Base64"===d&&0<a.length?`data:image/png;base64,${a}`:null,g.backgroundImage=d||"");return g}};var
|
|
11
|
-
d,1,100);c.widthUnits=
|
|
12
|
-
this.a){d=this.a.textOutline.split(" ");e="black";let g=".4em";const h=d[0]&&d[0].trim(),k=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!
|
|
13
|
-
"monospace").replace("monospaceSerif","monospace").replace("proportionalSansSerif","sans-serif").replace("proportionalSerif","sans-serif").replace("sansSerif","sans-serif").replace("default","sans-serif")};`:"");a:{if(
|
|
14
|
-
|
|
15
|
-
["color","color"],[
|
|
16
|
-
_.
|
|
17
|
-
new
|
|
18
|
-
g=new
|
|
19
|
-
c.getId()),c=d,g=a,
|
|
20
|
-
c.f.set(b,g),c.o.push(g),c=g):c=null,c&&a.l.push(c.getId());e=d
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Vv='application/mp4; codecs\x3d"stpp.ttml"',Wv='application/mp4; codecs\x3d"stpp.ttml.im1i"',Xv='application/mp4; codecs\x3d"stpp.ttml.im1t"',Yv="backgroundColor",Zv="direction",$v="displayAlign",aw="region",bw="textAlign",cw="textDecoration",dw="writingMode",lw=function(a,b){var c=null;if(ew.test(a)){{a=ew.exec(a);c=Number(a[1]);const d=Number(a[2]);let e=Number(a[3]),f=Number(a[4]);f+=(Number(a[5])||0)/b.f;e+=f/b.frameRate;c=e+60*d+3600*c}}else fw.test(a)?c=gw(fw,a):hw.test(a)?
|
|
2
|
+
c=gw(hw,a):iw.test(a)?(a=iw.exec(a),c=Number(a[1])/b.frameRate):jw.test(a)?(a=jw.exec(a),c=Number(a[1])/b.a):kw.test(a)&&(c=gw(kw,a));return c},gw=function(a,b){a=a.exec(b);return null==a||""===a[0]?null:(Number(a[4])||0)/1E3+(Number(a[3])||0)+60*(Number(a[2])||0)+3600*(Number(a[1])||0)},mw=function(a){return a.split(":").pop()},nw=function(a){return a.replace(/(\d*\.?\d+)c/g,"$1em")},pw=function(a,b){for(;ow.test(a);){const c=ow.exec(a)[0];a=a.replace(c,`${parseInt(c,10)/b}em`)}return a},qw=function(a){return a?
|
|
3
|
+
a.replace(/(\d*\.?\d+)%/g,(b,c)=>`${c/100}em`):""},rw=function(a,b,c){a=a.f;for(let d=a.length-1;0<=d;d--){const e=b.get(a[d]);if(c in e.a)return e.getAttribute(c)}return null},sw=function(a,b,c){a=rw(a,b,bw);if(!a&&c&&(a=rw(c,b,bw),!a&&"rltb"===rw(c,b,dw)))return _.yf;switch(a){case _.cd:return _.at;case _.yf:case _.Td:return _.yf;default:return _.ge}},tw=function(a,b,c){if(_.wi(a.w))return document.createTextNode(_.Ai(a.w||""));if(a.A)return _.Dp("br");const d=_.Dp("span");for(const e of a.f)_.Ep(d,
|
|
4
|
+
e);for(const e of a.j)d.appendChild(tw(c.get(e),b,c));return d},ww=function(a,b,c,d){const e=uw.exec(a);a=vw.exec(a);return typeof b===_.r&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},xw=function(a,b){return typeof b===_.r&&0<b?_.it:vw.test(a)?0:_.it},yw=function(a,b,c){return typeof a===_.r?a:typeof b===_.r?b:c},zw=function(a,b){a=a.getAttribute("extent");return(a=vw.exec(a))?Number(a[b]):null},Bw=function(a){a=a.getAttribute("cellResolution");return(a=Aw.exec(a))?Number(a[2]):null},
|
|
5
|
+
Dw=function(){return`${"inline-"}${Cw++}`},Fw=function(a){return Ew.some(b=>b in a.attributes)},Gw=function(a,b){if(0===b.length)return[];const c=[];for(const d of b)a.a.has(d)&&c.push(...Gw(a,a.a.get(d).f),d);return c},Hw=function(a){return a.o.map(b=>b.build(a.l,a.w,a.A,a.h,a.a,a.j,a.f)).filter(b=>null!=b)},Iw=function(a){return mw(a.h.nodeName)},Lw=function(a,b){if(a.a.has(b))return a.a.get(b);var c=null,d=null;let e=[],f=[],g={};const h=b.parentNode;if(h&&a.a.has(h)){const k=a.a.get(h);e=[...k.l];
|
|
6
|
+
-1===["#text","span","br"].indexOf(b.nodeName)&&(c=k.a,d=k.j,f=[...k.f],g={},Jw.forEach(l=>{l in k.attributes&&(g[l]=k.attributes[l])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(aw)&&(c=b.getAttribute(aw));b.hasAttribute(_.Rf)&&f.push(...b.getAttribute(_.Rf).split(" "));d=Array.from(b.attributes).map(k=>k.name);for(const k of d)d=mw(k),g[d]=b.getAttribute(k);d=g.backgroundImage}c=new Kw(b,c,d,e,f,g);a.a.set(b,c);return c},Mw=function(a){return`${String(Math.floor(a/3600)).padStart(2,"0")}:${String(Math.floor(a/
|
|
7
|
+
60%60)).padStart(2,"0")}:${String(Math.floor(a%60)).padStart(2,"0")}.${String(Math.floor(1E3*a%1E3)).padStart(3,"0")}`},ew=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,fw=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,hw=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,iw=/^(\d*(?:\.\d*)?)f$/,jw=/^(\d*(?:\.\d*)?)t$/,kw=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,uw=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,vw=/^(\d+)px (\d+)px$/,Aw=/^(\d+) (\d+)$/,
|
|
8
|
+
ow=/(\d+)px/,Nw=/^(\d+px|\d+em|\d*\.?\d+c)$/,Ew=[Yv,"color",Zv,$v,"fontFamily","fontSize","fontStyle","fontWeight","lineHeight","opacity","padding",bw,cw,"textOutline",dw,"zIndex"],Jw=["begin",_.Td];var Ow=class{constructor(a,b,c){this.h=a;this.f=b;this.a=c}getId(){return this.h}getAttribute(a){return this.a[a]}};var Pw=class extends Ow{constructor(a,b,c){super(a,b,c)}};var Qw=class extends Pw{constructor(a,b,c,d,e,f,g){super(a,f,g);this.w=b;this.A=c;this.o=d;this.l=e;this.j=[]}build(a,b,c,d,e,f,g){let h=lw(this.a.begin,b);b=lw(this.a.end,b);if(null===h||null===b)return null;h+=c;b+=c;c=_.Dp(_.Fd);for(const k of this.j)c.appendChild(tw(g.get(k),e,g));g=new _.ft(h,b,c.innerHTML.trim(),_.Zf);g.cssClassList=[...this.f];g.textAlign=sw(this,e,null);g.writingMode=_.bt;g.line=-1;g.lineInterpretation=_.ct;g.lineAlign=_.dt;g.containerRows=yw(null,Bw(a),15);if(this.o&&(f=
|
|
9
|
+
f.get(this.o))){g.region=f.build(a,e);g.textAlign=sw(this,e,f);a:switch(rw(f,e,dw)){case "tb":case "tblr":a=_.kg;break a;case "tbrl":a=_.lg;break a;default:a=_.bt}g.writingMode=a;a:switch(rw(f,e,$v)){case _.cd:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(rw(f,e,$v)){case _.cd:a=1;break a;default:a=_.ct}g.lineInterpretation=a;a:switch(rw(f,e,$v)){case _.cd:e=_.cd;break a;default:e=_.dt}g.lineAlign=e}this.l&&(d=d.get(this.l))&&(a=d,d=a.getAttribute("encoding"),e=a.getAttribute("imageType")||
|
|
10
|
+
a.getAttribute("imagetype"),a=a.j.trim(),d="PNG"===e&&"Base64"===d&&0<a.length?`data:image/png;base64,${a}`:null,g.backgroundImage=d||"");return g}};var Rw=class extends Ow{constructor(a,b,c){super(a,[],c);this.j=b||""}};var Sw=class{constructor(a,b,c,d){this.frameRate=Number(a)||30;this.f=Number(b)||1;this.a=Number(d);0===this.a&&(this.a=a?this.frameRate*this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=Number(a[1])/Number(a[2]))}};var Tw=class extends Pw{constructor(a,b,c){super(a,b,c)}build(a,b){const c=new _.kt;c.id=this.getId();const d=yw(a.j.containerWidth,zw(a,1),720);a=yw(a.j.containerHeight,zw(a,2),480);a:switch(rw(this,b,$v)){case "after":var e="flex-start";break a;case _.cd:e=_.cd;break a;default:e="flex-end"}c.displayAlign=e;a:switch(rw(this,b,dw)){case "tb":case "tblr":e="row-reverse";break a;case "tbrl":e="row";break a;default:e=_.sd}c.writingMode=e;e=this.getAttribute("extent")||rw(this,b,"extent");c.width=ww(e,
|
|
11
|
+
d,1,100);c.widthUnits=xw(e,d);c.height=ww(e,a,2,100);c.heightUnits=xw(e,a);b=this.getAttribute("origin")||rw(this,b,"origin");c.viewportAnchorX=ww(b,d,1,0);c.viewportAnchorY=ww(b,a,2,0);c.viewportAnchorUnits=xw(b,d);c.cssClassList=[...this.f];return c}};var Uw=class extends Ow{constructor(a,b){super("root-container",[],b);this.j=a}};var Ww=class extends Ow{constructor(a,b,c){super(a,b,c)}build(a){var b=null;var c=Bw(a);c&&(b=yw(a.j.containerHeight,zw(a,2),480)/c);b=yw(a.j.fontSizeRadix,b,16);a=[];c=`::ttml .${this.h}, ::ttml .${this.h} * {`;for(const [g,h]of Vw.entries())g in this.a&&(c+=`${h}:${nw(this.a[g])};`);a:{if("unicodeBidi"in this.a){var d=this.a.unicodeBidi;var e="";switch(d){case "normal":case "embed":e=d;break;case "bidiOverride":e="bidi-override"}if(0<e.length){d=`unicode-bidi:${e};`;break a}}d=""}c+=d;a:{if("textOutline"in
|
|
12
|
+
this.a){d=this.a.textOutline.split(" ");e="black";let g=".4em";const h=d[0]&&d[0].trim(),k=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!Nw.test(h)&&Nw.test(k)&&Nw.test(l)?(e=h,g=k):2===d.length&&!Nw.test(h)&&Nw.test(k)?(e=h,g=k):2===d.length&&Nw.test(h)&&Nw.test(k)&&(g=h);if(""!==g){g=nw(g);d="text-shadow:"+`0 0 ${g} ${e},`+`0 0 ${g} ${e},`+`0 0 ${g} ${e};`;break a}}d=""}c+=d;"textShadow"in this.a?(d=qw(this.a.textShadow),d=nw(d),d=`text-shadow:${d};`):d="";c=c+d+("fontFamily"in this.a?`font-family:${this.a.fontFamily.replace("monospaceSansSerif",
|
|
13
|
+
"monospace").replace("monospaceSerif","monospace").replace("proportionalSansSerif","sans-serif").replace("proportionalSerif","sans-serif").replace("sansSerif","sans-serif").replace("default","sans-serif")};`:"");a:{if(cw in this.a){d=this.a.textDecoration.split(" ");e=[];for(f of d)switch(f){case "underline":case "overline":e.push(f);break;case "lineThrough":e.push("line-through")}if(0<e.length){var f=`text-decoration:${e.join(" ")};`;break a}}f=""}"padding"in this.a?(d="border: solid transparent;border-width:"+
|
|
14
|
+
nw(this.a.padding),d+=";"):d="";f=c=c+f+d;"lineHeight"in this.a?(c="",d=this.a.lineHeight,d=nw(d),d=pw(d,b),c+="line-height:",c+=d,c+=";"):c="";a.push(f+c+"}");a:{if("fontSize"in this.a&&(f=this.a.fontSize.split(" "),c=null,1===f.length&&(c=f[0]),2===f.length&&(c=f[1]),c)){c=c.trim();c=nw(c);c=pw(c,b);b=`font-size:${c};`;break a}b=null}b&&(f=`::ttml .${this.h} .clpp-text-wrapper {`,f+=b,f+="}",a.push(f),f=`::ttml .clpp-text-wrapper__${this.h} {`,f+=b,f+="}",a.push(f));return a}},Vw=new Map([[Yv,"background-color"],
|
|
15
|
+
["color","color"],[Zv,Zv],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var Xw=class{constructor(a){this.B=a;this.w=this.l=null;this.A=0;this.h=new Map;this.a=new Map;this.j=new Map;this.f=new Map;this.o=[]}},Cw=0;var $w=class{constructor(a){this.a=a.firstChild;this.f=new Set}Wc(){return!!this.a}next(){if(!this.a)return null;let a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!Yw.has(mw(a.nodeName))||Zw.has(mw(a.nodeName))||!a.firstChild||this.f.has(a.firstChild)?a.nextSibling?a=a.nextSibling:a=a.parentNode:a=a.firstChild;while(a&&(this.f.has(a)||a.nodeType!==Node.TEXT_NODE&&!Yw.has(mw(a.nodeName))));const b=this.a;this.a=a;return b}},Yw=new Set(["tt","head","layout",_.ye,_.de,aw,"styling",_.Rf,"body",
|
|
16
|
+
_.Fd,"p","span","br"]),Zw=new Set([_.Rf,_.de]);var Kw=class{constructor(a,b,c,d,e,f){this.h=a;this.a=b;this.j=c;this.l=d;this.f=e;this.attributes=f}getId(){return this.attributes.id}};var ax=class{constructor(){this.a=new Map}};var bx=class{constructor(a){this.a=a;this.f=new DOMParser}parseInit(){}parseMedia(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.Rg(this.a.ttml||{}),e=_.I(a,0,c[0]);e=_.ni(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.Vf)}catch(m){throw new _.G(_.E,2,2005,"Failed to parse TTML.");}d=new Xw(d);e=new ax;f=new $w(f);b=b.periodStart;typeof b===_.r&&(d.A=b);b=c[0];for(var g=1;g<c.length;++g){var h=c[g],k=_.I(a,b,h);k=_.Bi(k);const m=`urn:mpeg:14496-30:subs:${g}`;d.h.set(m,
|
|
17
|
+
new Rw(m,k,{imageType:"PNG",encoding:"Base64"}));b+=h}for(;f.Wc();)a=f.next(),a=Lw(e,a),c=d,b=a,"tt"===Iw(b)&&(c.l=new Uw(c.B,Object.assign({},b.attributes))),c=d,b=a,"tt"===Iw(b)&&(c.w=new Sw(b.attributes.frameRate,b.attributes.subFrameRate,b.attributes.frameRateMultiplier,b.attributes.tickRate)),c=d,b=a,Iw(b)!==_.de||b.attributes.begin||b.attributes.end||(g=`#${b.getId()}`,c.h.set(g,new Rw(g,b.h.textContent,b.attributes))),c=d,g=a,Iw(g)===_.de&&g.attributes.begin&&g.attributes.end?(b=`#${Dw()}`,
|
|
18
|
+
g=new Rw(b,g.h.textContent,g.attributes),c.h.set(b,g),c=g):c=null,c&&(a.j=c.getId()),c=d,b=a,Iw(b)===_.Rf&&(g=b.getId()||Dw(),h=new Ww(g,b.f,Object.assign({},b.attributes)),c.a.set(g,h),b.a&&c.j.get(b.a).f.push(g)),c=d,g=a,Iw(g)!==_.Rf&&Fw(g)?(b=Dw(),g=new Ww(b,[],Object.assign({},g.attributes)),c.a.set(b,g),c=g):c=null,c&&a.f.push(c.getId()),c=d,g=a,Iw(g)!==_.Fd||!g.attributes.extent&&!g.attributes.origin?c=null:(b=Dw(),g=new Tw(b,Gw(c,g.f),Object.assign({},g.attributes)),c.j.set(b,g),c=g),c&&(a.a=
|
|
19
|
+
c.getId()),c=d,g=a,Iw(g)!==aw?c=null:(b=g.getId(),g=new Tw(b,Gw(c,g.f),Object.assign({},g.attributes)),c.j.set(b,g),c=g),c&&(a.a=c.getId()),c=d,g=a,b=g.l,-1===["#text","span","br"].indexOf(Iw(g))||0===b.length?c=null:(h=b[b.length-1],c.f.has(h)?(b=Dw(),g=new Qw(b,"#text"===g.h.nodeName?g.h.textContent:null,"br"===Iw(g),g.a,g.j,Gw(c,g.f),g.attributes),c.f.set(b,g),(c=c.f.get(h))&&c.j.push(b),c=g):c=null),c&&a.l.push(c.getId()),c=d,g=a,"p"===Iw(g)||g.j?(b=Dw(),g=new Qw(b,null,!1,g.a,g.j,Gw(c,g.f),g.attributes),
|
|
20
|
+
c.f.set(b,g),c.o.push(g),c=g):c=null,c&&a.l.push(c.getId());e=Hw(d);f=[];for(l of d.a.values())f.push(...l.build(d.l));var l=f;return{cues:e,styles:l}}};var cx=class{constructor(a){this.a=new bx(a);this.g=new _.R("clpp.ttml.Mp4TtmlParser")}parseInit(a){let b=!1;(new _.Tl).N(_.Be,_.Ml).N(_.Yf,_.Ml).N(_.we,_.Ml).N(_.Ae,_.Ml).N(_.Of,_.Ml).ca(_.Qf,_.Nl).N("stpp",c=>{b=!0;c.parser.stop()}).parse(a);if(!b)throw new _.G(_.E,2,2007);}parseMedia(a,b){let c=!1,d=[],e=[];const f=[];(new _.Tl).N("moof",_.Ml).N("traf",_.Ml).ca("subs",g=>{const h=_.O(g.reader);for(let k=0;k<h;++k){g.reader.skip(4);const l=_.Fl(g.reader);for(let m=0;m<l;++m){const n=1===g.version?
|
|
21
|
+
_.O(g.reader):_.Fl(g.reader);f.push(n);g.reader.skip(6)}}}).N(_.ve,_.Ol(g=>{c=!0;g=this.a.parseMedia(g,b,f);d=d.concat(g.cues);e=e.concat(g.styles)})).parse(a);c||this.g.warn("Couldn't find the mdat box");return{cues:d,styles:e}}};var dx=class{constructor(a){this.f=a}a(a){var b=new bx(this.f);({cues:a}=b.parseMedia(a,{periodStart:0,segmentStart:null,segmentEnd:0}));b="WEBVTT\n\n";for(const d of a){a=b;b=Mw(d.startTime)+" --\x3e "+Mw(d.endTime);{var c=d;const e=[];switch(c.textAlign){case _.ge:e.push("align:left");break;case _.yf:e.push("align:right");break;case _.at:e.push("align:middle");break;case _.ge:e.push("align:start");break;case _.yf:e.push("align:end")}switch(c.writingMode){case _.kg:e.push("vertical:lr");break;case _.lg:e.push("vertical:rl")}c=
|
|
22
|
+
e.length?" "+e.join(" "):""}b=a+(b+c+"\n");b+=d.payload+"\n\n"}return _.ri(b)}},ex=class{probe(a,b){return a===_.Fc&&b===_.Uf}create(a){return new dx(a)}};_.x("clpp.ttml.TtmlComponent",class extends _.su{constructor(){super();this.j=new ex}f(){_.bs(_.Fc,bx);_.bs(_.Dc,cx);_.bs(Vv,cx);_.bs(Xv,cx);_.bs(Wv,cx);_.Gj.push(this.j)}a(){_.ds(_.Fc);_.ds(_.Dc);_.ds(Vv);_.ds(Xv);_.ds(Wv);_.Ij(this.j)}id(){return"subtitles-ttml"}});};f.call(g, window);
|
package/cl.verimatrix.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
|
|
3
|
-
modifiers:{licenseRequest:this.h.bind(this)}});_.
|
|
4
|
-
b);_.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Kv="VerimatrixVCAS",Lv="clpp.verimatrix.Vcas",Mv="clpp.verimatrix.VcasComponent",Ov=function(a,b){return a.C===Nv?(a=Object.assign({},{deviceId:_.Ci(_.ti(a.A))},a.a&&{authenticator:_.Ci(_.ti(a.a))}),b+_.mj(a)):b},Uv=class extends _.wt{constructor(a){super(Kv);const b={};b[Pv]=Pv;b[Qv]=Qv;const {deviceId:c,authenticator:d,licenseRequestVuidLocation:e=Nv,httpHeaderNames:f=b,widevineLicenseUrl:g,playReadyLicenseUrl:h,fairPlayLicenseUrl:k,fairPlayCertificateUrl:l,fairPlaySiteId:m,fairPlayAssetIdStrategy:n=
|
|
2
|
+
Rv}=a;this.A=c;this.a=d;this.C=e;this.B=f;this.w=Ov(this,g);this.o=Ov(this,h);this.l=Ov(this,k);this.j=l;this.G=m;this.F=n;this.g=new _.R(Lv);_.xi(this.w)?this.g.warn(_.Xb):this.Wa(_.yd,{licenseUrl:this.w,videoRobustness:[_.Gb,void 0],audioRobustness:[_.Fb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.xi(this.o)?this.g.warn(_.wb):this.Wa(_.wd,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],
|
|
3
|
+
modifiers:{licenseRequest:this.h.bind(this)}});_.xi(this.l)?this.g.warn(_.Va):_.xi(this.j)?this.g.warn(_.Ta):this.Wa(_.ud,{licenseUrl:this.l,certificateUrl:this.j,modifiers:{licenseRequest:this.J.bind(this),licenseResponse:this.K.bind(this),extractContentId:this.H.bind(this)}})}h(a,b){if(this.C===Sv){a=this.B[Qv];const c={};c[this.B[Pv]]=this.A;this.a&&(c[a]=this.a);Object.keys(c).forEach(d=>{b.headers[d]=c[d]})}}H(a,b){a=_.Sl(b);switch(this.F){case Tv:a=_.mj({r:a,ci:this.G},!0)}return a}J(a,b){this.h(a,
|
|
4
|
+
b);_.Xl(b)}K(a,b){_.Yl(b)}};_.x(Lv,Uv);Uv.prototype.constructor=Uv.prototype.constructor;Uv.NAME=Kv;var Nv="query-string",Sv="http-header";Uv.LicenseRequestVuidLocation={QUERY_STRING:Nv,HTTP_HEADER:Sv};var Pv="DeviceId",Qv="Authenticator";Uv.LicenseRequestHttpHeader={DEVICE_ID_HEADER:Pv,AUTHENTICATOR_HEADER:Qv};var Rv="keyid",Tv="contentid-siteid";Uv.FairPlayAssetIdStrategy={KEYID:Rv,CONTENTID_SITEID:Tv};_.x(Mv,class extends _.su{constructor(){super();this.g=new _.R(Mv)}a(){delete _.ul.VerimatrixVCAS}h(a){a=a.getConfiguration();if(a.drm&&a.drm.env===Kv){({customData:a}=a.drm);if(!a)throw new _.G(_.E,7,7100,_.zd);a=new Uv(a);this.g.info("Registering the Verimatrix VCAS Ultra environment");_.vl(a)}}id(){return"verimatrix-vcas"}});};f.call(g, window);
|
package/cl.vimond.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
e;this.a=new _.
|
|
3
|
-
this.j=!1}I(a){const b=this;return _.
|
|
4
|
-
a.o} seconds ago`);a.o=n}a.h.stop();a.h.
|
|
5
|
-
"")}e.videoProtocol=f;const u=
|
|
6
|
-
b.f;q.timestamp=(new Date).toISOString();b.g.debug("Fire an event");const y=_.Si(b.l);y.method=_.
|
|
7
|
-
a
|
|
8
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Bv="Registering listeners",Cv="clpp.vimond.VimondPlugin",Dv=function(a,b){const c=a.m.getState();if(1===b)return["str-start",_.df];if(a.h)return[_.Td,_.Pe];if(c===_.Vn)return[_.Td,null];if(c===_.bo)return[_.Vd,_.Pe];b=_.Pe;if(c===_.Yn||c===_.go||a.f)b=_.df;return["period",b]},Ev=function(a,b){a.m.trigger(new _.C(_.tg,{detail:b}))},Fv=function(a,b,c){b&&(a.B=!0,a.h.stop());a.m.onError(new _.G(b?_.E:1,9,9201,c))},Gv=class{constructor(a,b,c,d,e){this.l=a;this.o=c;this.h=b;this.a=d;this.j=
|
|
2
|
+
e;this.g=new _.R("clpp.vimond.VimondService");this.f=0}Ne(a){this.h=a}};var Hv=class{constructor(a){this.m=a;this.a=new _.Fs;this.g=new _.R("clpp.vimond.VimondAdapter");this.f=this.h=!1;this.m&&this.a&&(this.g.debug(Bv),this.a.on(this.m,_.uf,this.o.bind(this)),this.a.on(this.m,_.cc,this.j.bind(this)),this.a.on(this.m,_.dc,this.l.bind(this)))}getPosition(){return Math.floor(this.m.getPosition())}o(){this.h=!0}j(){this.f=!0}l(){this.f=!1}};var Iv=class{constructor(a,b,c,d,e){this.K=a;this.L=b;this.M=c;this.m=d;this.F=e;this.a=new _.Fs;this.l=!0;this.f=this.j=this.B=!1;this.C=null;this.h=new _.Wj(this.A.bind(this));this.g=new _.R("clpp.vimond.VimondDispatcher");this.o=this.w=0;this.m&&this.a&&(this.g.debug(Bv),this.a.on(this.m,_.Mf,this.I.bind(this)),this.a.on(this.m,_.Xf,this.J.bind(this)),this.a.on(this.m,_.cc,this.G.bind(this)),this.a.on(this.m,_.dc,this.H.bind(this)))}J(){this.f||(this.f=1<Math.abs(this.w-this.m.getPosition()));
|
|
3
|
+
this.w=this.m.getPosition()}G(){this.g.debug("Ad break started");this.j=!0}H(){this.g.debug("Ad break stopped");this.j=!1}I(a){const b=this;return _.w(function*(){const c=a.detail,d=c.currentState;b.g.debug(`State changed, prev: ${c.previousState} curr: ${d}`);b.B||b.j||(d!==b.C||b.f?b.l&&d!==_.go||(b.f&&[_.fo,_.Yn].includes(d)?b.g.debug("Seeking"):(b.f&&d===_.go&&(b.g.debug("Seeked"),b.f=!1),[_.go,_.fo,_.bo,_.Vn].includes(d)&&(b.C=d,yield b.A(),d===_.Vn&&b.h.stop()))):b.g.debug("Ignore transition"))})}A(){const a=
|
|
4
|
+
this;return _.w(function*(){{const n=Math.floor(Date.now()/1E3);0<a.o&&a.g.debug(`Last event was ${n-a.o} seconds ago`);a.o=n}a.h.stop();a.h.fa(a.l?10:a.K);a.l=!1;try{{var b=a.F;b.f++;const q=_.Qg(b.o);q.client.buildName=_.ra;q.client.buildVersion=_.da;var c=q.client;{const A=b.a.m.getDrmInfo();var d=A?A.keySystem:""}c.drm=d;q.client.pageUrl=document.location.href;q.client.streamUrl=b.a.m.getLoadedSource().url;q.client.userAgent=navigator.userAgent;q.client.videoFormat=b.a.m.getLoadedSource().type||
|
|
5
|
+
"";var e=q.client;{const A=b.a.m.getLoadedSource();var f=((new _.Rl(A.url)).scheme||"").replace(":","")}e.videoProtocol=f;const u=Dv(b.a,b.f);q.client.playerEvent=u[0]||"";q.client.playerState=u[1]||"";q.progress.vod&&(q.progress.vod.position=b.a.getPosition());const v=q.progress.live;if(v){{var g=b.a;const A=g.m.getPresentationStartTime()||0,D=Math.floor(A+g.m.getPosition());var h=(new Date(1E3*D)).toISOString()}v.position=h;{var k=b.a;const A=k.m.getPosition(),D=k.m.getSeekRange().end;var l=30>
|
|
6
|
+
Math.abs(D-A)}v.onLiveEdge=l;typeof v.liveResumePossible!==_.Rc&&(v.liveResumePossible=!0)}q.progress.eventNumber=b.f;q.timestamp=(new Date).toISOString();b.g.debug("Fire an event");const y=_.Si(b.l);y.method=_.vb;y.contentType="application/json";y.headers.Authorization=`Bearer ${b.h}`;y.body=_.ti(JSON.stringify(q));var m=b.j.fetch(y).W}const n=yield m;Ev(a,n)}catch(n){m=n.code,b=n.data,[1002,1003].includes(m)?(a.g.debug("Unreachable service"),Ev(a,b),Fv(a,a.L,b)):1001===m?(a.g.debug("Generic service error"),
|
|
7
|
+
Ev(a,b),Fv(a,a.M,b)):a.g.error(n.toString())}})}};var Jv=class extends _.Fu{constructor(){super();this.a=!1;this.g=new _.R(Cv);this.j=this.h=this.f=null}onPlayerCreated(){}onContentWillLoad(a){var b=a.getConfiguration();(this.a=!_.z(b.vimond)&&typeof b.vimond===_.Fe)?a.namespace()===_.kd&&(this.a=!1,this.g.info("Vimond does not report when casting.")):this.g.warn("Vimond plugin is loaded but not configured. Will do nothing.");if(this.a){b=a.getConfiguration().vimond;for(var c of["authToken","playerEventRequest"])if(!b[c]){this.g.warn(`${c} key is missing`);
|
|
8
|
+
a.onError(new _.G(1,9,9200));return}this.g.debug(_.sa);c=b.failIfUnreachable;typeof c!==_.Rc&&(c=!0);var d=b.failOnError;typeof d!==_.Rc&&(d=!0);this.f=new Hv(a);this.h=new Gv(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new Iv(b.playerEventRequest.eventInterval,c,d,a,this.h)}}onPlayerWillRelease(){if(this.a){if(this.f){var a=this.f;a.g.debug(_.Pb);_.nh(a.a)}this.j&&(a=this.j,a.g.debug(_.Pb),_.nh(a.a),a.h.stop());this.j=this.h=this.f=null}}onPlayerWillDestroy(){}id(){return"vimond"}Ne(a){this.a&&
|
|
9
|
+
this.h&&this.h.Ne(a)}};_.x(Cv,Jv);Jv.prototype.updateAuthToken=Jv.prototype.Ne;Jv.Id="vimond";_.jr(new class{create(){return new Jv}});};f.call(g, window);
|