@castlabs/prestoplay 6.19.1 → 6.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/README.md +8 -6
- 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 +108 -108
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +571 -567
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +77 -77
- package/cjs/cl.externs.js +34 -35
- package/cjs/cl.freewheel.js +21 -20
- package/cjs/cl.hls.js +71 -70
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +29 -28
- package/cjs/cl.ima.js +24 -24
- package/cjs/cl.mse.js +311 -309
- package/cjs/cl.muxdata.js +15 -15
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +13 -13
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.sessions.js +16 -16
- package/cjs/cl.simid.js +15 -15
- package/cjs/cl.smooth.js +72 -71
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +69 -69
- package/cjs/cl.ttml.js +29 -28
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +13 -12
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.youbora.js +16 -16
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +88 -88
- package/cl.conviva.js +27 -27
- package/cl.core.js +459 -455
- package/cl.crypto.js +9 -9
- package/cl.dash.js +72 -72
- package/cl.externs.js +34 -35
- package/cl.freewheel.js +18 -18
- package/cl.hls.js +74 -74
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -25
- package/cl.ima.js +17 -17
- package/cl.mse.js +278 -276
- package/cl.muxdata.js +13 -13
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +10 -10
- 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 +8 -9
- package/cl.vr.js +14 -14
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +14 -14
- package/clpp.styles.css +0 -8
- package/package.json +1 -1
- package/typings.d.ts +36 -14
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.
|
|
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=_.
|
|
4
|
-
try{webapis.avplay.setDrm(
|
|
5
|
-
"widevine_app_session",a.l.id),webapis.avplay.setDrm(
|
|
6
|
-
a.
|
|
7
|
-
c)}},
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
a.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
this.h
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
this.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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.a.off(
|
|
53
|
-
0)&&!this.A?0:this.f.getState()===_.
|
|
54
|
-
return new _.
|
|
55
|
-
new
|
|
56
|
-
_.
|
|
57
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var sN="An unknown error occurred while trying to get volume",tN="Cannot get loading rendition due to platform limitations",uN="SecurityError",vN="The require privilege is: http://tizen.org/privilege/tv.audio",wN="|STARTBITRATE\x3d",xN=function(a,b,c){const d=e=>{c.call(a,e);a.removeEventListener(b,d)};a.addEventListener(b,d)},AN=function(a){return _.w(function*(){if(a.a!==_.xd&&a.a!==_.vd)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.cd)throw new _.G(_.E,6,6012,`No license server given for ${a.a}`);try{a.a===_.xd?yield yN(a):yield zN(a,b),a.o={keySystem:a.a,licenseServerUri:b.cd,distinctiveIdentifierRequired:!1,persistentStateRequired:b.se,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)});}})},CN=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=_.ij([b.serverurl&&""!==b.serverurl?b.serverurl:c.cd],_.ej());c.type=3;c.body=e.buffer;c.method=_.tb;try{var f=yield a.D.Hb.fetch(c).W;if(a.j){var g=_.J(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(BN,"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:_.Ra,url:h.data.url,status:h.data.status||NaN,response:h.data.response||"",headers:h.data.headers||{}},h),a.D.onError(g)}})},yN=function(a){return _.w(function*(){try{webapis.avplay.setDrm(BN,"Initialize",""),webapis.avplay.setDrm(BN,
|
|
5
|
+
"widevine_app_session",a.l.id),webapis.avplay.setDrm(BN,"widevine_data_type",a.l.type)}catch(b){throw b;}})},zN=function(a,b){return _.w(function*(){var c={};c[DN]=!b.se;c[EN]=b.cd;""!==b.customData&&(c[FN]=b.customData);c=JSON.stringify(c);a.g.debug("PlayReady properties: ",c);try{webapis.avplay.setDrm(GN,"SetProperties",c)}catch(d){throw d;}})},IN=function(a,b){if(a.f!==b)if(a.f===_.oo&&b!==_.po)a.g.debug(_.yA+`${HN(b)}`);else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.ko?(a.o=(new Date).getTime(),
|
|
6
|
+
a.m.trigger(new _.C(_.Sc,{detail:{bufferedTimeMS:-1,reason:a.h}}))):a.j===_.ko&&a.m.trigger(new _.C(_.Rc,{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:",HN(a.j),"-\x3e",HN(a.f))}},HN=function(a){return Object.keys(_.no)[a]},LN=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case JN:c=_.so;break;case KN:c=_.ro;break;default:a.m.isEnded()?c=_.ho:a.g.debug("Inconsistent AVPlay playback state:",
|
|
7
|
+
b)}IN(a,c)}},MN=function(a){return _.w(function*(){const b=a.m.getConfiguration();let c;(c=yield _.cs(a.B.url,a.m.getNetworkEngine(),b.manifest.attemptParameters,a.B.type||null))&&c.configure(b.manifest);return c})},NN=function(a){if(!a)return!1;a=a.periods;let b=!1;for(let c=0;c<a.length;c++)b=b||0<a[c].textStreams.length;return b},ON=function(a){const b=document.createElement(_.t),c=new _.$G,d=new _.gG,e=a.m.getTextDisplayer();return new _.bH(b,c,e,d,a.m.getConfiguration())},PN=function(a){const b=
|
|
8
|
+
{configuration:{},Lb:()=>a.m.getPosition(),$:a.h,Hb:a.m.getNetworkEngine(),me:a.G.bind(a),le:a.F.bind(a),onError:a.T.bind(a),Bf:()=>{},onEvent:()=>{},Ff:a.H.bind(a),Fd:()=>{},td:()=>new _.TH,Qd:()=>!1,Pc:null};return new _.tH(a.a,b)},QN=function(a){const b=a.m.getPosition();let c=null;for(const d of a.a.periods)d.startTime<=b&&(c=d);return c},RN=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,
|
|
9
|
+
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 _.Cj(String(c++),_.K);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=a[d].kind||_.fB;const f=new _.Kj(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},SN=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.f){const b=_.dF(a.f,_.F);let c=null;if(b){a=RN(a);for(let d=
|
|
10
|
+
0;d<a.length;d++)if(a[d].renditions[0].id===String(b.id)){c=a[d].renditions[0];break}}return c}return null},TN=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===_.Wd,a.a&&a.f)){a.setTextVisibility(!0);const c=QN(a),d=b.renditions[0];(b=c.textStreams.find(e=>String(e.id)===d.id))?(a.w?(a.g.debug("Switching period defer text selection"),a.l=b):(_.pF(a.f,b,!0,0),a.m.trigger(new _.C(_.dl))),a.o=b.language):a.g.error(_.xA,d.id)}},UN=function(a){const b=
|
|
11
|
+
a.ma();b&&a.m.trigger(new _.C(_.Oc,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},VN=function(a,b){a.m.trigger(new _.C(_.ng,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,abrSelection:a.a.o}}))},WN=function(a,b){let c=null;try{c=JSON.parse(b)}catch(d){a.g.warn("Couldn't retrieve extra infos from stream."),c=null}return c},XN=function(a,b){a=a.f[_.M]||[];const c=[];for(let d=0;d<a.length;d++)for(let e=0;e<a[d].renditions.length;e++)_.Xg(a[d].renditions[e],
|
|
12
|
+
b,Object.keys(b))&&c.push(a[d].renditions[e]);return c[0]||null},YN=function(a){const b=a.m.getConfiguration();var c=_.Qh(b.preferredAudioLanguage||[]);const d=a.f[_.L]||[];if(d.length){var e=null;c.some(g=>{e=_.AB(g,d.map(h=>h.language));return!!e});if(e){var f=d.filter(g=>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")},
|
|
13
|
+
dO=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===ZN),f=b.filter(l=>l.type===$N);const g=[];for(var h=0;h<f.length;h++){const l=WN(a,f[h].extra_info);if(l){var k=_.qi(l.language||_.$f);k=_.yj(k);k=c(g,k);k||(k=new _.Cj(String(a.o++),_.L),g.push(k));k.renditions.push(aO(f[h].index,l,k))}else a.g.warn("Skipping audio stream with no extra info")}c=new _.Cj(String(a.o++),_.M);for(f=0;f<
|
|
14
|
+
e.length;f++)(h=WN(a,e[f].extra_info))?c.renditions.push(bO(e[f].index,h,c)):a.g.warn("Skipping video stream with no extra info");e=[];e=a.h?RN(a.h):cO(a,b);d[_.M]=[c];d[_.L]=g;d[_.K]=e;return d},gO=function(a,b){if(b===_.K&&a.h)return SN(a.h);var c=eO(a.a)||[];if(0===c.length)return null;c=c.filter(e=>e.type===b.toUpperCase())[0];var d=null;b===_.M&&(d=WN(a,c.extra_info),d=XN(a,{width:d.Width,height:d.Height}));b===_.L&&(c?(d=fO(a,c,_.L),a.j=d):d=a.j);b===_.K&&(c?(d=fO(a,c,_.K),a.l=d):d=a.l);return d},
|
|
15
|
+
jO=function(a,b){if(b){const c=b.track.type.toUpperCase();hO(a.a,c,Number(b.id)).then(()=>{c===$N&&(a.j=b,a.m.trigger(new _.C(_.bl)));c===iO&&(a.l=b,a.m.trigger(new _.C(_.dl)))}).catch(()=>{a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},aO=function(a,b,c){const d=_.qi(b.language||_.$f);c.language=_.yj(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.Kc;a=new _.Kj(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=
|
|
16
|
+
b.bit_rate||null;return a},bO=function(a,b,c){c.mimeType=_.lg;a=new _.Kj(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):null;a.codec=b.fourCC||null;return a},kO=function(a,b,c){b=_.qi(b.track_lang||_.$f);c.mimeType="text/ttml";c.language=_.yj(b);c.originalLanguage=b;c.kind=_.fB;return new _.Kj(String(a),c)},cO=function(a,b){b=b.filter(d=>d.type===iO);const c=[];for(let d=0;d<b.length;d++){const e=WN(a,b[d].extra_info);if(!e){a.g.warn("Skipping text stream with no extra info");
|
|
17
|
+
continue}const f=new _.Cj(String(a.o++),_.K);f.renditions.push(kO(b[d].index,e,f));c.push(f)}return c},fO=function(a,b,c){a=a.f[c]||[];b=String(b.index);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},lO=function(a){return a.f&&a.a?a.a.Hh:webapis.avplay.getTotalTrackInfo()},nO=function(a,b,c){a.g.debug("switchVideoTrack()");try{const d={estimatedBandwidth:parseInt(webapis.avplay.getStreamingProperty("CURRENT_BANDWITH"),
|
|
18
|
+
10),currentBandwidth:b,nextBandwidth:c,currentPosition:a.getPosition()};a.a=mO(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(()=>{const e=a.a.We;a.f=!1;a.a=null;return e===KN?a.pause():a.play()})}catch(d){return Promise.reject(d)}},oO=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)}},hO=function(a,b,c){b=b.toUpperCase();
|
|
19
|
+
b===iO&&oO(a,!0);const d=a.j[b];d&&(d.Kd.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,Te:0,Kd:new _.mk(()=>g(h,c,!0))}),(k=a.j[h])&&3>k.Te?(!a.w&&++k.Te,k.Kd.fa(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),
|
|
20
|
+
k&&k.Kd.stop(),a.j[h]=null,f())}};g(b,c)})},eO=function(a){return a.f&&a.a?a.a.tg:webapis.avplay.getCurrentStreamInfo()},pO=function(a){return _.w(function*(){tizen.systeminfo.getPropertyValue("DISPLAY",b=>{a.A=b.resolutionWidth/1920;a.g.debug("Display resolution ratio: ",a.A)},b=>{a.g.debug("Could not load DISPLAY property");throw b;})})},rO=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),
|
|
21
|
+
oncurrentplaytime:b=>{a.trigger(new _.C(qO,{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)}},sO=function(a){const b=!!a.m.getTrackManager().La();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",c)}},tO=function(a,b){try{const c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,Wh:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",
|
|
22
|
+
wN+d)}catch(c){a.g.debug(c)}},uO=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+wN+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",c),c;}},vO=function(a){let b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case uN:a.g.warn("The application doesn't have the privilege to get the mute state.",vN);break;default:a.g.warn(sN,c)}}return!!b},mO=function(a){return{position:a.getPosition(),state:a.m.getState(),We:a.getState(),playbackRate:a.getPlaybackRate(),
|
|
23
|
+
isLive:a.isLive(),duration:a.getDuration(),isMuted:vO(a),volume:a.getVolume(),Hh:lO(a),tg:eO(a)}},wO=function(){return new Promise((a,b)=>{if(window.webapis)a();else{const c=document.createElement("script");xN(c,_.le,d=>a(d));xN(c,_.Ud,d=>b(d));c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},xO=function(a){return _.w(function*(){yield wO();const b=new Promise(c=>{(new _.mk(c)).fa(5)});if(!(yield Promise.race([pO(a).then(()=>!0),b.then(()=>!1)])))return a.g.debug("Took to long for the SDK to be ready"),
|
|
24
|
+
Promise.reject("SDK Timeout")})},yO=function(a){return _.w(function*(){a.g.debug("avplay.prepare()");return new Promise((b,c)=>{try{webapis.avplay.prepareAsync(()=>{a.g.debug("AVPlay is ready!");sO(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)}})})},zO=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case uN:a.g.warn("The application does not have the privilege to set mute.",vN);break;default:a.g.warn(sN,
|
|
25
|
+
c)}}},EO=function(a,b,c){return _.w(function*(){a.l=_.vo(b);const d=a.F,e=c||{estimatedBandwidth:0,currentBandwidth:0,nextBandwidth:null,currentPosition:0};a.g.debug(`Loading manifest URL: ${a.l[d].url}`);let f=b.startTime||void 0;a.f&&(a.trigger(new _.C(AO)),f=c.currentPosition);try{let g=a.l[d].url;if(a.l[d].type===_.Ac&&!g.includes(".mpd")){const h=new URL(g);h.searchParams.append("cl-ext",".mpd");g=h.toString()}webapis.avplay.open(g);e.nextBandwidth?(uO(a,e.nextBandwidth),a.o=!1):(a.o||tO(a,e),
|
|
26
|
+
a.o=!0);rO(a);if(b.drm&&b.drm.env){const h={onError:k=>a.m.onError(k),Hb:a.m.getNetworkEngine()};a.h=new BO(b.drm,h);yield a.h.init()}else a.g.debug("No DRM configuration was provided. Assuming clear content");a.f||a.trigger(new _.C(CO));yield yO(a);a.f||a.trigger(new _.C(DO));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&&zO(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."),
|
|
27
|
+
g;}})},FO=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 "+a.a.getState())},BO=class{constructor(a,
|
|
28
|
+
b){this.h=a;this.o=null;this.a=_.Ce;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=_.Gl[a.h.env]||null;if(!b)throw a.g.debug(_.ta,_.yb+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=_.Il(b,a.h.customData);const d=b[_.vd];d&&a.f.set(_.vd,
|
|
29
|
+
{cd:d.licenseUrl||"",customData:c,se:!1});(b=b[_.xd])&&a.f.set(_.xd,{cd:b.licenseUrl||"",customData:c,se:!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(_.vd))a.a=_.vd;else if(a.f.get(_.xd))a.a=_.xd;else throw new _.G(_.E,6,6001,"Configuration for the target system is missing.");yield AN(a);a.j=!0})}release(){const a=this;return _.w(function*(){a.j=!1;a.o=null;a.a=_.Ce;a.l=null;a.f=new Map})}getDrmInfo(){return this.o}},DN="DeleteLicenseAfterUse",
|
|
30
|
+
EN="LicenseServer",FN="CustomData";var LO=class{constructor(a){this.m=a;this.a=this.m.a;this.f=_.po;this.j=_.Yt;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(AO,this.C,this);this.a.on(GO,this.B,this);this.a.on(HO,this.A,this);this.a.on(CO,this.H,this);this.a.on(DO,this.G,this);this.a.on(IO,this.F,this)}release(){IN(this,_.po);this.l=!1;this.o=-1;this.h=2}destroy(){this.release();this.a.off(AO,this.C);this.a.off(GO,this.B);this.a.off(HO,this.A);this.a.off(CO,
|
|
31
|
+
this.H);this.a.off(DO,this.G);this.a.off(IO,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;IN(this,_.ko)}B(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",HN(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()===JO;if(!a&&b){IN(this,_.ro);return}}if(a=this.f!==_.qo)a=this.a.getState(),a=a===
|
|
32
|
+
JN||a===KN;a&&LN(this)}H(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===KO?IN(this,_.qo):this.g.error("AVPlay prepares while state is not IDLE")}G(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())}F(){IN(this,_.ho)}getState(){return this.f}};var MO=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 MN(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://",
|
|
33
|
+
"http://"),c)}catch(e){b.g.error(e),b.a=null}}if(b.a&&NN(b.a)){b.h=ON(b);try{yield b.h.open();b.f=PN(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(_.XA,
|
|
34
|
+
a);this.w=!0;let b=_.bE(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&&(_.pF(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",
|
|
35
|
+
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 QO=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 NO:0<Object.keys(this.f).length||(this.g.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+WN(this,b[0].extra_info).Bit_rate,b=XN(this,{bandwidth:b}))&&(this.w=b,VN(this,b));break;case OO:UN(this);break;default:this.g.debug("Event type: "+
|
|
36
|
+
b+" data: "+a)}}A(a){a.detail.currentState===_.so&&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===_.so&&(this.g.debug("Current state",b.currentState),this.B=!0,YN(this)))});this.a.on(PO,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);try{const a=lO(this.a);this.f=dO(this,a);
|
|
37
|
+
const b=this.f[_.L]||[];b.length&&(this.j=b[0].renditions[0]||null);UN(this)}catch(a){this.g.debug("Could not load track manager")}}}destroy(){this.a.off(PO,this.C);this.a=this.m=null}getVideoTracks(){return this.f[_.M]||[]}getAudioTracks(){return this.f[_.L]||[]}ha(){return this.f[_.K]||[]}ma(){return gO(this,_.M)}Ua(){return gO(this,_.L)}La(){return gO(this,_.K)}jb(){return this.w}zb(){this.g.info(tN);return null}Ab(){this.g.info(tN);return null}Ma(){const a=this.ma();return a?a.track:null}la(){const a=
|
|
38
|
+
this.Ua();return a?a.track:null}ta(){const a=this.La();return a?a.track:null}ub(a){null===a?(a=this.ma(),nO(this.a,a.bandwidth,null).then(()=>{UN(this)})):0<a.renditions.length&&this.ab(a.renditions[0])}va(a){a?jO(this,a.renditions[0]):this.g.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")}Oa(a){a?(a=a.renditions[0],this.h?TN(this.h,a.track):jO(this,a)):(this.g.debug("Disabling text tracks"),this.l=null,oO(this.a,!1),this.m.trigger(new _.C(_.dl)))}ab(a){const b=
|
|
39
|
+
this.ma();this.a.o||a.width!==b.width||a.height!==b.height||a.bandwidth!==b.bandwidth?(this.w=a,VN(this,a),nO(this.a,b.bandwidth,a.bandwidth).then(()=>{UN(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){jO(this,a)}tb(a){this.h?TN(this.h,a.track):jO(this,a)}addTextTrack(){}pa(){return this.a.o}};QO.prototype.isAbrEnabled=QO.prototype.pa;
|
|
40
|
+
QO.prototype.addTextTrack=QO.prototype.addTextTrack;QO.prototype.setTextRendition=QO.prototype.tb;QO.prototype.setAudioRendition=QO.prototype.sb;QO.prototype.setVideoRendition=QO.prototype.ab;QO.prototype.setTextTrack=QO.prototype.Oa;QO.prototype.setAudioTrack=QO.prototype.va;QO.prototype.setVideoTrack=QO.prototype.ub;QO.prototype.getTextTrack=QO.prototype.ta;QO.prototype.getAudioTrack=QO.prototype.la;QO.prototype.getVideoTrack=QO.prototype.Ma;QO.prototype.getLoadingTextRendition=QO.prototype.Ab;
|
|
41
|
+
QO.prototype.getLoadingAudioRendition=QO.prototype.zb;QO.prototype.getLoadingVideoRendition=QO.prototype.jb;QO.prototype.getTextRendition=QO.prototype.La;QO.prototype.getAudioRendition=QO.prototype.Ua;QO.prototype.getVideoRendition=QO.prototype.ma;QO.prototype.getTextTracks=QO.prototype.ha;QO.prototype.getAudioTracks=QO.prototype.getAudioTracks;QO.prototype.getVideoTracks=QO.prototype.getVideoTracks;var UO=class extends _.Dt{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(AO))}H(a){this.w=!0;this.trigger(new _.C(GO,{percent:a}))}G(){this.w=!1;this.trigger(new _.C(HO))}L(){this.trigger(new _.C(IO))}K(a,b){this.trigger(new _.C(PO,{eventid:a,data:b}))}M(a,b,c,d,e){this.trigger(new _.C(RO,{duration:a,text:b,subtitleType:c,
|
|
42
|
+
attriCount:d,attributes:e}))}J(a,b){this.trigger(new _.C(SO,{drmType:a,drmData:b}));this.h&&(a=this.h,a.j&&(a.a===_.xd&&"Challenge"===b.name?CN(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(TO,{eventType:a}))}play(){const a=this.getState(),b=()=>new Promise((c,d)=>{let e=null;const f=()=>{c();clearTimeout(e)};this.one(qO,f,this);e=setTimeout(()=>{this.off(qO,f);d("Timeout")},3E4)});if(a===KO)return(new Promise((c,
|
|
43
|
+
d)=>{webapis.avplay.prepareAsync(()=>{sO(this);c(webapis.avplay.play())},e=>{this.trigger(new _.C(TO));d(e)})})).then(()=>b());if(a===KN||a===JO)try{return webapis.avplay.play(),b()}catch(c){return Promise.reject(c)}return a===JN?Promise.resolve():Promise.reject("Player is in invalid state")}pause(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===KN?Promise.resolve():Promise.reject()}setPlaybackRate(a){const b=this.getState();if(b===JO||b===JN||b===KN){try{webapis.avplay.setSpeed(a),
|
|
44
|
+
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 xO(c),yield EO(c,a,b)}catch(d){throw new _.G(_.E,7,7003,null,d);}})}getState(){if(this.f&&this.a)return this.a.We;try{return webapis.avplay.getState()}catch(a){this.T(JSON.stringify(a))}}seek(a){const b=
|
|
45
|
+
1E3*a;return new Promise((c,d)=>{this.B=!0;this.m.trigger(new _.C(_.fg));webapis.avplay.seekTo(b,()=>{this.B=!1;this.m.trigger(new _.C(_.eg));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(),
|
|
46
|
+
this.h=null);webapis.avplay.stop();webapis.avplay.close();for(const c in this.j){const d=this.j[c];d&&d.Kd.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 uN:this.g.debug("The application does not have the privilege to get the volume.",vN);break;default:this.g.debug(sN,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.",
|
|
47
|
+
"The passed value value should be in the range of 0 to 1.");break;case uN:this.g.warn("The application does not have the privilege to set the volume.",vN);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=
|
|
48
|
+
a}getSourceIndex(){return this.F}getLoadedSource(){return this.l&&this.l[this.getSourceIndex()]}},KO="IDLE",JO="READY",JN="PLAYING",KN="PAUSED",ZN=_.Sb,$N="AUDIO",iO="TEXT",OO="PLAYER_MSG_RESOLUTION_CHANGED",NO="PLAYER_MSG_BITRATE_CHANGE",GN="PLAYREADY",BN="WIDEVINE_CDM";var YO=class extends _.Dt{constructor(){super();this.a=new UO(this);this.f=new LO(this);this.configuration=this.B=_.nl();this.w=null;this.g=new _.R("clpp.tizen.Player");this.j=null;this.l=new QO;this.C=new _.yq;this.o=this.h=null;this.A=!1}H(){this.g.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.C(_.Td));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(_.Wf,
|
|
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=_.Ri(d))&&this.o.append([new _.Zs(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}`);IN(this.f,_.oo);a=new _.G(_.E,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.C(_.Ud,{detail:a}))}init(a,
|
|
50
|
+
b){this.configuration=this.B=b;this.w=a;this.a.on(IO,this.H,this);this.a.on(qO,this.F,this);this.a.on(RO,this.I,this);this.a.on(SO,this.G,this);this.a.on(TO,this.T,this);this.a.on(HO,this.J,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();a=VO;VO+=1;a="__clpp_tizen_player_"+a;this.j=_.Mo(_.De,{id:a,type:"application/avplayer"});this.w.addElementToContainer(this.j,!0);var c=this.w.getMedia();if(c){a=this.j;{b=[_.Bg,_.Zd,"position",
|
|
51
|
+
_.ee,"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}_.Oo(a,d);FO(this)}}getSurface(){return this.w}getConfiguration(){return this.configuration}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.pb)}appendLoad(){return Promise.reject(_.pb)}seekWith(){return Promise.reject(_.pb)}setSeekInterceptor(){}destroy(){const a=this;return _.w(function*(){yield a.release();
|
|
52
|
+
a.a.off(IO,a.H);a.a.off(qO,a.F);a.a.off(RO,a.I);a.a.off(SO,a.G);a.a.off(TO,a.T);a.a.off(HO,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 WO}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()===_.ho?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(_.oa);
|
|
54
|
+
return new _.Ct}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=_.pl(b.B,a);var c=_.Xn(b.configuration,[_.ae,"native"]);b.o=c.create(b);c=_.vo(b.configuration)[0];if(b.configuration.tizen&&b.configuration.tizen.sideStreamText){b.h=
|
|
55
|
+
new MO;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(_.Re));FO(this);return this.a.play().then(()=>{LN(this.f)})}pause(){return this.a.pause().then(()=>{LN(this.f)})}getState(){return this.f.getState()}getPeriods(){return[]}onError(a){const b=new _.C(_.Ud,{detail:a});a.severity===_.E&&(IN(this.f,_.oo),this.a.release());this.trigger(b);b.defaultPrevented&&(b.a=!0)}getDrmInfo(){return this.a.getDrmInfo()}isEnded(){return this.f.getState()===
|
|
56
|
+
_.ho}isPaused(){return this.a.getState()===KN}isMuted(){return vO(this.a)}setMuted(a){zO(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 XO).canPlay(a,b)}getTimelineCues(){return[]}getCueTimeline(){return null}getTextDisplayer(){return this.o}resetAbr(){}};
|
|
57
|
+
YO.prototype.getTextDisplayer=YO.prototype.getTextDisplayer;YO.prototype.setNetworkEngine=YO.prototype.setNetworkEngine;YO.prototype.getNetworkEngine=YO.prototype.getNetworkEngine;var WO="clpp.tizen",VO=0,XO=class{a(){return WO}canPlay(a){a=a.type;const b=!!window.webapis;if((a===_.Ac||a===_.hl||a===_.Fc)&&b){if(_.qk(2))return 2;if(_.qk(3)||_.qk(4)||_.qk(5)||_.qk(6))return _.B("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0}f(a){return a===_.la}create(){return new YO}};_.x("clpp.tizen.TizenComponent",class extends _.qu{f(){_.mh(new XO)}a(){var a=WO;a&&_.kh[a]&&(delete _.kh[a],_.lh.info("Removed Player factory: '"+a+"'"))}id(){return"tizen"}});var AO="onbufferingstart",GO="onbufferingprogress",HO="onbufferingcomplete",IO="onstreamcompleted",qO="oncurrentplaytime",PO="onevent",RO="onsubtitlechange",SO="ondrmevent",TO="onerror",CO="preparingstart",DO="preparingend";};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
|
-
c=
|
|
3
|
-
|
|
4
|
-
e);for(const e of a.j)d.appendChild(
|
|
5
|
-
|
|
6
|
-
-1===["#text","span","br"].indexOf(b.nodeName)&&(c=k.a,d=k.j,f=[...k.f],g={},
|
|
7
|
-
60%60)).padStart(2,"0")}:${String(Math.floor(a%60)).padStart(2,"0")}.${String(Math.floor(1E3*a%1E3)).padStart(3,"0")}`},
|
|
8
|
-
|
|
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=
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var gw='application/mp4; codecs\x3d"stpp.ttml"',hw='application/mp4; codecs\x3d"stpp.ttml.im1i"',iw='application/mp4; codecs\x3d"stpp.ttml.im1t"',jw="backgroundColor",kw="direction",lw="displayAlign",mw="region",nw="textAlign",ow="textDecoration",pw="writingMode",qw=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},yw=function(a,b){var c=null;if(rw.test(a)){{a=rw.exec(a);c=Number(a[1]);const d=Number(a[2]);let e=
|
|
2
|
+
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 sw.test(a)?c=tw(sw,a):uw.test(a)?c=tw(uw,a):vw.test(a)?(a=vw.exec(a),c=Number(a[1])/b.frameRate):ww.test(a)?(a=ww.exec(a),c=Number(a[1])/b.a):xw.test(a)&&(c=tw(xw,a));return c},tw=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)},zw=function(a){return a.split(":").pop()},Aw=function(a){return a.replace(/(\d*\.?\d+)c/g,
|
|
3
|
+
"$1em")},Cw=function(a,b){for(;Bw.test(a);){const c=Bw.exec(a)[0];a=a.replace(c,`${parseInt(c,10)/b}em`)}return a},Dw=function(a){return a?a.replace(/(\d*\.?\d+)%/g,(b,c)=>`${c/100}em`):""},Ew=function(a,b,c){a=qw(a,b,nw);if(!a&&c&&(a=qw(c,b,nw),!a&&"rltb"===qw(c,b,pw)))return _.yf;switch(a){case _.bd:return _.Us;case _.yf:case _.Sd:return _.yf;default:return _.ee}},Fw=function(a,b,c){if(_.Ni(a.w))return document.createTextNode(_.Ri(a.w||""));if(a.A)return _.Mo("br");const d=_.Mo("span");for(const e of a.f)_.No(d,
|
|
4
|
+
e);for(const e of a.j)d.appendChild(Fw(c.get(e),b,c));return d},Iw=function(a,b,c,d){const e=Gw.exec(a);a=Hw.exec(a);return typeof b===_.r&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},Jw=function(a,b){return typeof b===_.r&&0<b?_.bt:Hw.test(a)?0:_.bt},Kw=function(a,b,c){return typeof a===_.r?a:typeof b===_.r?b:c},Lw=function(a,b){a=a.getAttribute("extent");return(a=Hw.exec(a))?Number(a[b]):null},Nw=function(a){a=a.getAttribute("cellResolution");return(a=Mw.exec(a))?Number(a[2]):null},
|
|
5
|
+
Pw=function(){return`${"inline-"}${Ow++}`},Rw=function(a){return Qw.some(b=>b in a.attributes)},Sw=function(a,b){if(0===b.length)return[];const c=[];for(const d of b)a.a.has(d)&&c.push(...Sw(a,a.a.get(d).f),d);return c},Tw=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)},Uw=function(a){return zw(a.h.nodeName)},Xw=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={},Vw.forEach(l=>{l in k.attributes&&(g[l]=k.attributes[l])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(mw)&&(c=b.getAttribute(mw));b.hasAttribute(_.Rf)&&f.push(...b.getAttribute(_.Rf).split(" "));d=Array.from(b.attributes).map(k=>k.name);for(const k of d)d=zw(k),g[d]=b.getAttribute(k);d=g.backgroundImage}c=new Ww(b,c,d,e,f,g);a.a.set(b,c);return c},Yw=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")}`},Zw=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 $w=class extends Zw{constructor(a,b,c){super(a,[],c);this.j=b||""}};var ax=class extends Zw{constructor(a,b,c){super(a,b,c)}};var rw=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,sw=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,uw=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,vw=/^(\d*(?:\.\d*)?)f$/,ww=/^(\d*(?:\.\d*)?)t$/,xw=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,Gw=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,Hw=/^(\d+)px (\d+)px$/,Mw=/^(\d+) (\d+)$/,Bw=/(\d+)px/,bx=/^(\d+px|\d+em|\d*\.?\d+c)$/,Qw=[jw,"color",kw,lw,"fontFamily","fontSize","fontStyle","fontWeight",
|
|
8
|
+
"lineHeight","opacity","padding",nw,ow,"textOutline",pw,"zIndex"],Vw=["begin",_.Sd];var cx=class extends ax{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=yw(this.a.begin,b);b=yw(this.a.end,b);if(null===h||null===b)return null;h+=c;b+=c;c=_.Mo(_.Ed);for(const k of this.j)c.appendChild(Fw(g.get(k),e,g));g=new _.Zs(h,b,c.innerHTML.trim(),_.Yf);g.cssClassList=[...this.f];g.textAlign=Ew(this,e,null);g.writingMode=_.Vs;g.line=-1;g.lineInterpretation=_.Ws;g.lineAlign=_.Xs;g.containerRows=Kw(null,Nw(a),15);if(this.o&&(f=
|
|
9
|
+
f.get(this.o))){g.region=f.build(a,e);g.textAlign=Ew(this,e,f);a:switch(qw(f,e,pw)){case "tb":case "tblr":a=_.ig;break a;case "tbrl":a=_.jg;break a;default:a=_.Vs}g.writingMode=a;a:switch(qw(f,e,lw)){case _.bd:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(qw(f,e,lw)){case _.bd:a=1;break a;default:a=_.Ws}g.lineInterpretation=a;a:switch(qw(f,e,lw)){case _.bd:e=_.bd;break a;default:e=_.Xs}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 dx=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 ex=class extends ax{constructor(a,b,c){super(a,b,c)}build(a,b){const c=new _.dt;c.id=this.getId();const d=Kw(a.j.containerWidth,Lw(a,1),720);a=Kw(a.j.containerHeight,Lw(a,2),480);a:switch(qw(this,b,lw)){case "after":var e="flex-start";break a;case _.bd:e=_.bd;break a;default:e="flex-end"}c.displayAlign=e;a:switch(qw(this,b,pw)){case "tb":case "tblr":e="row-reverse";break a;case "tbrl":e="row";break a;default:e=_.qd}c.writingMode=e;e=this.getAttribute("extent")||qw(this,b,"extent");c.width=Iw(e,
|
|
11
|
+
d,1,100);c.widthUnits=Jw(e,d);c.height=Iw(e,a,2,100);c.heightUnits=Jw(e,a);b=this.getAttribute("origin")||qw(this,b,"origin");c.viewportAnchorX=Iw(b,d,1,0);c.viewportAnchorY=Iw(b,a,2,0);c.viewportAnchorUnits=Jw(b,d);c.cssClassList=[...this.f];return c}};var fx=class extends Zw{constructor(a,b){super("root-container",[],b);this.j=a}};var hx=class extends Zw{constructor(a,b,c){super(a,b,c)}build(a){var b=null;var c=Nw(a);c&&(b=Kw(a.j.containerHeight,Lw(a,2),480)/c);b=Kw(a.j.fontSizeRadix,b,16);a=[];c=`::ttml .${this.h}, ::ttml .${this.h} * {`;for(const [g,h]of gx.entries())g in this.a&&(c+=`${h}:${Aw(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&&!bx.test(h)&&bx.test(k)&&bx.test(l)?(e=h,g=k):2===d.length&&!bx.test(h)&&bx.test(k)?(e=h,g=k):2===d.length&&bx.test(h)&&bx.test(k)&&(g=h);if(""!==g){g=Aw(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=Dw(this.a.textShadow),d=Aw(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(ow 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
|
+
Aw(this.a.padding),d+=";"):d="";f=c=c+f+d;"lineHeight"in this.a?(c="",d=this.a.lineHeight,d=Aw(d),d=Cw(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=Aw(c);c=Cw(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}},gx=new Map([[jw,"background-color"],
|
|
15
|
+
["color","color"],[kw,kw],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var ix=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=[]}},Ow=0;var lx=class{constructor(a){this.a=a.firstChild;this.f=new Set}Vc(){return!!this.a}next(){if(!this.a)return null;let a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!jx.has(zw(a.nodeName))||kx.has(zw(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&&!jx.has(zw(a.nodeName))));const b=this.a;this.a=a;return b}},jx=new Set(["tt","head","layout",_.we,_.be,mw,"styling",_.Rf,"body",
|
|
16
|
+
_.Ed,"p","span","br"]),kx=new Set([_.Rf,_.be]);var Ww=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 mx=class{constructor(){this.a=new Map}};var nx=class{constructor(a){this.a=a;this.f=new DOMParser}parseInit(){}parseMedia(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.Pg(this.a.ttml||{}),e=_.J(a,0,c[0]);e=_.Ei(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 ix(d);e=new mx;f=new lx(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=_.J(a,b,h);k=_.Si(k);const m=`urn:mpeg:14496-30:subs:${g}`;d.h.set(m,
|
|
17
|
+
new $w(m,k,{imageType:"PNG",encoding:"Base64"}));b+=h}for(;f.Vc();)a=f.next(),a=Xw(e,a),c=d,b=a,"tt"===Uw(b)&&(c.l=new fx(c.B,Object.assign({},b.attributes))),c=d,b=a,"tt"===Uw(b)&&(c.w=new dx(b.attributes.frameRate,b.attributes.subFrameRate,b.attributes.frameRateMultiplier,b.attributes.tickRate)),c=d,b=a,Uw(b)!==_.be||b.attributes.begin||b.attributes.end||(g=`#${b.getId()}`,c.h.set(g,new $w(g,b.h.textContent,b.attributes))),c=d,g=a,Uw(g)===_.be&&g.attributes.begin&&g.attributes.end?(b=`#${Pw()}`,
|
|
18
|
+
g=new $w(b,g.h.textContent,g.attributes),c.h.set(b,g),c=g):c=null,c&&(a.j=c.getId()),c=d,b=a,Uw(b)===_.Rf&&(g=b.getId()||Pw(),h=new hx(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,Uw(g)!==_.Rf&&Rw(g)?(b=Pw(),g=new hx(b,[],Object.assign({},g.attributes)),c.a.set(b,g),c=g):c=null,c&&a.f.push(c.getId()),c=d,g=a,Uw(g)!==_.Ed||!g.attributes.extent&&!g.attributes.origin?c=null:(b=Pw(),g=new ex(b,Sw(c,g.f),Object.assign({},g.attributes)),c.j.set(b,g),c=g),c&&(a.a=
|
|
19
|
+
c.getId()),c=d,g=a,Uw(g)!==mw?c=null:(b=g.getId(),g=new ex(b,Sw(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(Uw(g))||0===b.length?c=null:(h=b[b.length-1],c.f.has(h)?(b=Pw(),g=new cx(b,"#text"===g.h.nodeName?g.h.textContent:null,"br"===Uw(g),g.a,g.j,Sw(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"===Uw(g)||g.j?(b=Pw(),g=new cx(b,null,!1,g.a,g.j,Sw(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=Tw(d);f=[];for(l of d.a.values())f.push(...l.build(d.l));var l=f;return{cues:e,styles:l}}};var ox=class{constructor(a){this.f=a}a(a){var b=new nx(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=Yw(d.startTime)+" --\x3e "+Yw(d.endTime);{var c=d;const e=[];switch(c.textAlign){case _.ee:e.push("align:left");break;case _.yf:e.push("align:right");break;case _.Us:e.push("align:middle");break;case _.ee:e.push("align:start");break;case _.yf:e.push("align:end")}switch(c.writingMode){case _.ig:e.push("vertical:lr");break;case _.jg:e.push("vertical:rl")}c=
|
|
21
|
+
e.length?" "+e.join(" "):""}b=a+(b+c+"\n");b+=d.payload+"\n\n"}return _.Ii(b)}},px=class{probe(a,b){return a===_.Ec&&b===_.Uf}create(a){return new ox(a)}};var qx=class{constructor(a){this.a=new nx(a);this.g=new _.R("clpp.ttml.Mp4TtmlParser")}parseInit(a){let b=!1;(new _.em).N(_.ze,_.Yl).N(_.Xf,_.Yl).N(_.ue,_.Yl).N(_.ye,_.Yl).N(_.Of,_.Yl).ca(_.Qf,_.Zl).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 _.em).N("moof",_.Yl).N("traf",_.Yl).ca("subs",g=>{const h=_.O(g.reader);for(let k=0;k<h;++k){g.reader.skip(4);const l=_.Rl(g.reader);for(let m=0;m<l;++m){const n=1===g.version?
|
|
22
|
+
_.O(g.reader):_.Rl(g.reader);f.push(n);g.reader.skip(6)}}}).N(_.te,_.$l(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}}};_.x("clpp.ttml.TtmlComponent",class extends _.qu{constructor(){super();this.j=new px}f(){_.Es(_.Ec,nx);_.Es(_.Cc,qx);_.Es(gw,qx);_.Es(iw,qx);_.Es(hw,qx);_.Wj.push(this.j)}a(){_.Gs(_.Ec);_.Gs(_.Cc);_.Gs(gw);_.Gs(iw);_.Gs(hw);_.Yj(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 Wv="VerimatrixVCAS",Xv="clpp.verimatrix.Vcas",Yv="clpp.verimatrix.VcasComponent",$v=function(a,b){return a.C===Zv?(a=Object.assign({},{deviceId:_.Ti(_.Ki(a.A))},a.a&&{authenticator:_.Ti(_.Ki(a.a))}),b+_.Fj(a)):b},fw=class extends _.It{constructor(a){super(Wv);const b={};b[aw]=aw;b[bw]=bw;const {deviceId:c,authenticator:d,licenseRequestVuidLocation:e=Zv,httpHeaderNames:f=b,widevineLicenseUrl:g,playReadyLicenseUrl:h,fairPlayLicenseUrl:k,fairPlayCertificateUrl:l,fairPlaySiteId:m,fairPlayAssetIdStrategy:n=
|
|
2
|
+
cw}=a;this.A=c;this.a=d;this.C=e;this.B=f;this.w=$v(this,g);this.o=$v(this,h);this.l=$v(this,k);this.j=l;this.G=m;this.F=n;this.g=new _.R(Xv);_.Oi(this.w)?this.g.warn(_.Wb):this.Xa(_.xd,{licenseUrl:this.w,videoRobustness:[_.Gb,void 0],audioRobustness:[_.Fb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.Oi(this.o)?this.g.warn(_.ub):this.Xa(_.vd,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],
|
|
3
|
+
modifiers:{licenseRequest:this.h.bind(this)}});_.Oi(this.l)?this.g.warn(_.Ta):_.Oi(this.j)?this.g.warn(_.Sa):this.Xa(_.sd,{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===dw){a=this.B[bw];const c={};c[this.B[aw]]=this.A;this.a&&(c[a]=this.a);Object.keys(c).forEach(d=>{b.headers[d]=c[d]})}}H(a,b){a=_.dm(b);switch(this.F){case ew:a=_.Fj({r:a,gi:this.G},!0)}return a}J(a,b){this.h(a,
|
|
4
|
+
b);_.im(b)}K(a,b){_.mm(b)}};_.x(Xv,fw);fw.prototype.constructor=fw.prototype.constructor;fw.NAME=Wv;var Zv="query-string",dw="http-header";fw.LicenseRequestVuidLocation={QUERY_STRING:Zv,HTTP_HEADER:dw};var aw="DeviceId",bw="Authenticator";fw.LicenseRequestHttpHeader={DEVICE_ID_HEADER:aw,AUTHENTICATOR_HEADER:bw};var cw="keyid",ew="contentid-siteid";fw.FairPlayAssetIdStrategy={KEYID:cw,CONTENTID_SITEID:ew};_.x(Yv,class extends _.qu{constructor(){super();this.g=new _.R(Yv)}a(){delete _.Gl.VerimatrixVCAS}h(a){a=a.getConfiguration();if(a.drm&&a.drm.env===Wv){({customData:a}=a.drm);if(!a)throw new _.G(_.E,7,7100,_.yd);a=new fw(a);this.g.info("Registering the Verimatrix VCAS Ultra environment");_.Hl(a)}}id(){return"verimatrix-vcas"}});};f.call(g, window);
|
package/cl.vimond.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
e;this.
|
|
3
|
-
this.
|
|
4
|
-
|
|
5
|
-
""
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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);
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Nv="Registering listeners",Ov="clpp.vimond.VimondPlugin",Pv=function(a,b){a.m.trigger(new _.C(_.rg,{detail:b}))},Qv=function(a,b,c){b&&(a.B=!0,a.h.stop());a.m.onError(new _.G(b?_.E:1,9,9201,c))},Rv=function(a,b){const c=a.m.getState();if(1===b)return["str-start",_.bf];if(a.h)return[_.Sd,_.Ne];if(c===_.ho)return[_.Sd,null];if(c===_.oo)return[_.Ud,_.Ne];b=_.Ne;if(c===_.ko||c===_.so||a.f)b=_.bf;return["period",b]},Sv=class{constructor(a,b,c,d,e){this.K=a;this.L=b;this.M=c;this.m=d;this.F=
|
|
2
|
+
e;this.a=new _.Rs;this.l=!0;this.f=this.j=this.B=!1;this.C=null;this.h=new _.mk(this.A.bind(this));this.g=new _.R("clpp.vimond.VimondDispatcher");this.o=this.w=0;this.m&&this.a&&(this.g.debug(Nv),this.a.on(this.m,_.Mf,this.I.bind(this)),this.a.on(this.m,_.Wf,this.J.bind(this)),this.a.on(this.m,_.bc,this.G.bind(this)),this.a.on(this.m,_.cc,this.H.bind(this)))}J(){this.f||(this.f=1<Math.abs(this.w-this.m.getPosition()));this.w=this.m.getPosition()}G(){this.g.debug("Ad break started");this.j=!0}H(){this.g.debug("Ad break stopped");
|
|
3
|
+
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!==_.so||(b.f&&[_.ro,_.ko].includes(d)?b.g.debug("Seeking"):(b.f&&d===_.so&&(b.g.debug("Seeked"),b.f=!1),[_.so,_.ro,_.oo,_.ho].includes(d)&&(b.C=d,yield b.A(),d===_.ho&&b.h.stop()))):b.g.debug("Ignore transition"))})}A(){const a=this;return _.w(function*(){{const n=Math.floor(Date.now()/1E3);0<a.o&&a.g.debug(`Last event was ${n-
|
|
4
|
+
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=_.Og(b.o);q.client.buildName=_.pa;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||"";var e=q.client;{const A=b.a.m.getLoadedSource();var f=((new _.cm(A.url)).scheme||"").replace(":",
|
|
5
|
+
"")}e.videoProtocol=f;const u=Rv(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>Math.abs(D-A)}v.onLiveEdge=l;typeof v.liveResumePossible!==_.Pc&&(v.liveResumePossible=!0)}q.progress.eventNumber=
|
|
6
|
+
b.f;q.timestamp=(new Date).toISOString();b.g.debug("Fire an event");const y=_.ij(b.l);y.method=_.tb;y.contentType="application/json";y.headers.Authorization=`Bearer ${b.h}`;y.body=_.Ki(JSON.stringify(q));var m=b.j.fetch(y).W}const n=yield m;Pv(a,n)}catch(n){m=n.code,b=n.data,[1002,1003].includes(m)?(a.g.debug("Unreachable service"),Pv(a,b),Qv(a,a.L,b)):1001===m?(a.g.debug("Generic service error"),Pv(a,b),Qv(a,a.M,b)):a.g.error(n.toString())}})}};var Tv=class{constructor(a,b,c,d,e){this.l=a;this.o=c;this.h=b;this.a=d;this.j=e;this.g=new _.R("clpp.vimond.VimondService");this.f=0}Ne(a){this.h=a}};var Uv=class{constructor(a){this.m=a;this.a=new _.Rs;this.g=new _.R("clpp.vimond.VimondAdapter");this.f=this.h=!1;this.m&&this.a&&(this.g.debug(Nv),this.a.on(this.m,_.uf,this.o.bind(this)),this.a.on(this.m,_.bc,this.j.bind(this)),this.a.on(this.m,_.cc,this.l.bind(this)))}getPosition(){return Math.floor(this.m.getPosition())}o(){this.h=!0}j(){this.f=!0}l(){this.f=!1}};var Vv=class extends _.Ru{constructor(){super();this.a=!1;this.g=new _.R(Ov);this.j=this.h=this.f=null}onPlayerCreated(){}onContentWillLoad(a){var b=a.getConfiguration();(this.a=!_.z(b.vimond)&&typeof b.vimond===_.De)?a.namespace()===_.jd&&(this.a=!1,this.g.info("Vimond does not report when casting.")):this.g.debug("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`);
|
|
7
|
+
a.onError(new _.G(1,9,9200));return}this.g.debug(_.qa);c=b.failIfUnreachable;typeof c!==_.Pc&&(c=!0);var d=b.failOnError;typeof d!==_.Pc&&(d=!0);this.f=new Uv(a);this.h=new Tv(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new Sv(b.playerEventRequest.eventInterval,c,d,a,this.h)}}onPlayerWillRelease(){if(this.a){if(this.f){var a=this.f;a.g.debug(_.Pb);_.ph(a.a)}this.j&&(a=this.j,a.g.debug(_.Pb),_.ph(a.a),a.h.stop());this.j=this.h=this.f=null}}onPlayerWillDestroy(){}id(){return"vimond"}Ne(a){this.a&&
|
|
8
|
+
this.h&&this.h.Ne(a)}};_.x(Ov,Vv);Vv.prototype.updateAuthToken=Vv.prototype.Ne;Vv.Id="vimond";_.Hq(new class{create(){return new Vv}});};f.call(g, window);
|