@castlabs/prestoplay 6.17.1 → 6.19.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 +55 -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 +575 -565
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +77 -74
- package/cjs/cl.externs.js +175 -293
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +70 -69
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +29 -29
- package/cjs/cl.ima.js +24 -24
- package/cjs/cl.mse.js +315 -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 +72 -72
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +71 -71
- package/cjs/cl.ttml.js +29 -28
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +13 -13
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.youbora.js +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 +473 -466
- package/cl.crypto.js +9 -9
- package/cl.dash.js +72 -70
- 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 +26 -26
- package/cl.ima.js +17 -17
- package/cl.mse.js +276 -273
- 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 +8 -8
- package/cl.vr.js +15 -15
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +15 -15
- package/clpp.styles.css +14 -0
- package/package.json +2 -2
- package/typings.d.ts +406 -377
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.
|
|
4
|
-
|
|
5
|
-
"widevine_app_session",a.l.id),webapis.avplay.setDrm(
|
|
6
|
-
a.m.trigger(new _.
|
|
7
|
-
b)}
|
|
8
|
-
{configuration:{},
|
|
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 _.
|
|
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},
|
|
11
|
-
a.ma();b&&a.m.trigger(new _.
|
|
12
|
-
b,Object.keys(b))&&c.push(a[d].renditions[e]);return c[0]||null},
|
|
13
|
-
|
|
14
|
-
e.length;f++)(h=
|
|
15
|
-
|
|
16
|
-
b.bit_rate||null;return a},
|
|
17
|
-
continue}const f=new _.
|
|
18
|
-
10),currentBandwidth:b,nextBandwidth:c,currentPosition:a.getPosition()};a.a=
|
|
19
|
-
b===
|
|
20
|
-
k&&k.
|
|
21
|
-
oncurrentplaytime:b=>{a.trigger(new _.
|
|
22
|
-
|
|
23
|
-
isLive:a.isLive(),duration:a.getDuration(),isMuted:
|
|
24
|
-
Promise.reject("SDK Timeout")})},
|
|
25
|
-
c)}}},
|
|
26
|
-
a.o=!0)
|
|
27
|
-
g;}})},
|
|
28
|
-
b){this.
|
|
29
|
-
{
|
|
30
|
-
|
|
31
|
-
this.H);this.a.off(
|
|
32
|
-
|
|
33
|
-
"http://"),c)}catch(e){b.
|
|
34
|
-
a);this.w=!0;let b=_
|
|
35
|
-
a);this.
|
|
36
|
-
b+" data: "+a)}}A(a){a.detail.currentState===_.
|
|
37
|
-
const b=this.f[_.
|
|
38
|
-
this.
|
|
39
|
-
this.ma();this.a.o||a.width!==b.width||a.height!==b.height||a.bandwidth!==b.bandwidth?(this.w=a,
|
|
40
|
-
W.prototype.addTextTrack=W.prototype.addTextTrack;W.prototype.setTextRendition=W.prototype.
|
|
41
|
-
W.prototype.getLoadingAudioRendition=W.prototype.
|
|
42
|
-
attriCount:d,attributes:e}))}J(a,b){this.trigger(new _.
|
|
43
|
-
d)=>{webapis.avplay.prepareAsync(()=>{
|
|
44
|
-
this.C=a}catch(c){return this.
|
|
45
|
-
1E3*a;return new Promise((c,d)=>{this.B=!0;this.m.trigger(new _.
|
|
46
|
-
this.
|
|
47
|
-
"The passed value value should be in the range of 0 to 1.");break;case
|
|
48
|
-
a}getSourceIndex(){return this.F}getLoadedSource(){return this.l&&this.l[this.getSourceIndex()]}},
|
|
49
|
-
{currentTime:a.currentTime/1E3}))}I(a){const b=this.a.getPosition(),c=b+a.duration/1E3;let d=a.text||"";this.
|
|
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 aN="An unknown error occurred while trying to get volume",bN="Cannot get loading rendition due to platform limitations",cN="SecurityError",dN="The require privilege is: http://tizen.org/privilege/tv.audio",eN="|STARTBITRATE\x3d",fN=function(a,b,c){const d=e=>{c.call(a,e);a.removeEventListener(b,d)};a.addEventListener(b,d)},iN=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 gN(a):yield hN(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)});}})},kN=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=_.Wi([b.serverurl&&""!==b.serverurl?b.serverurl:c.dd],_.Ti());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(jN,"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)}})},gN=function(a){return _.w(function*(){try{webapis.avplay.setDrm(jN,"Initialize",""),webapis.avplay.setDrm(jN,
|
|
5
|
+
"widevine_app_session",a.l.id),webapis.avplay.setDrm(jN,"widevine_data_type",a.l.type)}catch(b){throw b;}})},hN=function(a,b){return _.w(function*(){var c={};c[lN]=!b.te;c[mN]=b.dd;""!==b.customData&&(c[nN]=b.customData);c=JSON.stringify(c);a.g.debug("PlayReady properties: ",c);try{webapis.avplay.setDrm(oN,"SetProperties",c)}catch(d){throw d;}})},qN=function(a,b){if(a.f!==b)if(a.f===_.Yn&&b!==_.Zn)a.g.debug(_.iA+`${pN(b)}`);else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.Un?(a.o=(new Date).getTime(),
|
|
6
|
+
a.m.trigger(new _.C(_.Wc,{detail:{bufferedTimeMS:-1,reason:a.h}}))):a.j===_.Un&&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:",pN(a.j),"-\x3e",pN(a.f))}},pN=function(a){return Object.keys(_.Xn)[a]},tN=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case rN:c=_.bo;break;case sN:c=_.ao;break;default:a.m.isEnded()?c=_.Rn:a.g.debug("Inconsistent AVPlay playback state:",
|
|
7
|
+
b)}qN(a,c)}},uN=function(a){return _.w(function*(){const b=a.m.getConfiguration();let c;(c=yield _.Kr(a.B.url,a.m.getNetworkEngine(),b.manifest.attemptParameters,a.B.type||null))&&c.configure(b.manifest);return c})},vN=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},wN=function(a){const b=document.createElement(_.t),c=new _.HG,d=new _.OF,e=a.m.getTextDisplayer();return new _.JG(b,c,e,d,a.m.getConfiguration())},xN=function(a){const b=
|
|
8
|
+
{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 _.AH,Rd:()=>!1,Rc:null};return new _.aH(a.a,b)},yN=function(a){const b=a.m.getPosition();let c=null;for(const d of a.a.periods)d.startTime<=b&&(c=d);return c},zN=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 _.kj(String(c++),_.J);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=a[d].kind||_.QA;const f=new _.uj(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},AN=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.f){const b=_.FE(a.f,_.F);let c=null;if(b){a=zN(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},BN=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=yN(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):(_.XE(a.f,b,!0,0),a.m.trigger(new _.C(_.Nk))),a.o=b.language):a.g.error(_.hA,d.id)}},CN=function(a){const b=
|
|
11
|
+
a.ma();b&&a.m.trigger(new _.C(_.Pc,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},DN=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}}))},EN=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},FN=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],
|
|
12
|
+
b,Object.keys(b))&&c.push(a[d].renditions[e]);return c[0]||null},GN=function(a){const b=a.m.getConfiguration();var c=_.Ch(b.preferredAudioLanguage||[]);const d=a.f[_.K]||[];if(d.length){var e=null;c.some(g=>{e=_.jB(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
|
+
MN=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===HN),f=b.filter(l=>l.type===IN);const g=[];for(var h=0;h<f.length;h++){const l=EN(a,f[h].extra_info);if(l){var k=_.ei(l.language||_.ag);k=_.gj(k);k=c(g,k);k||(k=new _.kj(String(a.o++),_.K),g.push(k));k.renditions.push(JN(f[h].index,l,k))}else a.g.warn("Skipping audio stream with no extra info")}c=new _.kj(String(a.o++),_.L);for(f=0;f<
|
|
14
|
+
e.length;f++)(h=EN(a,e[f].extra_info))?c.renditions.push(KN(e[f].index,h,c)):a.g.warn("Skipping video stream with no extra info");e=[];e=a.h?zN(a.h):LN(a,b);d[_.L]=[c];d[_.K]=g;d[_.J]=e;return d},PN=function(a,b){if(b===_.J&&a.h)return AN(a.h);var c=NN(a.a)||[];if(0===c.length)return null;c=c.filter(e=>e.type===b.toUpperCase())[0];var d=null;b===_.L&&(d=EN(a,c.extra_info),d=FN(a,{width:d.Width,height:d.Height}));b===_.K&&(c?(d=ON(a,c,_.K),a.j=d):d=a.j);b===_.J&&(c?(d=ON(a,c,_.J),a.l=d):d=a.l);return d},
|
|
15
|
+
SN=function(a,b){if(b){const c=b.track.type.toUpperCase();QN(a.a,c,Number(b.id)).then(()=>{c===IN&&(a.j=b,a.m.trigger(new _.C(_.Mk)));c===RN&&(a.l=b,a.m.trigger(new _.C(_.Nk)))}).catch(()=>{a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},JN=function(a,b,c){const d=_.ei(b.language||_.ag);c.language=_.gj(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.Lc;a=new _.uj(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=
|
|
16
|
+
b.bit_rate||null;return a},KN=function(a,b,c){c.mimeType=_.qg;a=new _.uj(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},TN=function(a,b,c){b=_.ei(b.track_lang||_.ag);c.mimeType="text/ttml";c.language=_.gj(b);c.originalLanguage=b;c.kind=_.QA;return new _.uj(String(a),c)},LN=function(a,b){b=b.filter(d=>d.type===RN);const c=[];for(let d=0;d<b.length;d++){const e=EN(a,b[d].extra_info);if(!e){a.g.warn("Skipping text stream with no extra info");
|
|
17
|
+
continue}const f=new _.kj(String(a.o++),_.J);f.renditions.push(TN(b[d].index,e,f));c.push(f)}return c},ON=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},UN=function(a){return a.f&&a.a?a.a.Dh:webapis.avplay.getTotalTrackInfo()},WN=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=VN(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===sN?a.pause():a.play()})}catch(d){return Promise.reject(d)}},XN=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)}},QN=function(a,b,c){b=b.toUpperCase();
|
|
19
|
+
b===RN&&XN(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..."),
|
|
20
|
+
k&&k.Ld.stop(),a.j[h]=null,f())}};g(b,c)})},NN=function(a){return a.f&&a.a?a.a.qg:webapis.avplay.getCurrentStreamInfo()},YN=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;})})},$N=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(ZN,{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)}},aO=function(a){const b=!!a.m.getTrackManager().Ka();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",c)}},bO=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",
|
|
22
|
+
eN+d)}catch(c){a.g.debug(c)}},cO=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+eN+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",c),c;}},dO=function(a){let b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case cN:a.g.warn("The application doesn't have the privilege to get the mute state.",dN);break;default:a.g.warn(aN,c)}}return!!b},VN=function(a){return{position:a.getPosition(),state:a.m.getState(),Xe:a.getState(),playbackRate:a.getPlaybackRate(),
|
|
23
|
+
isLive:a.isLive(),duration:a.getDuration(),isMuted:dO(a),volume:a.getVolume(),Dh:UN(a),qg:NN(a)}},eO=function(){return new Promise((a,b)=>{if(window.webapis)a();else{const c=document.createElement("script");fN(c,_.qe,d=>a(d));fN(c,_.Vd,d=>b(d));c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},fO=function(a){return _.w(function*(){yield eO();const b=new Promise(c=>{(new _.Wj(c)).fa(5)});if(!(yield Promise.race([YN(a).then(()=>!0),b.then(()=>!1)])))return a.g.debug("Took to long for the SDK to be ready"),
|
|
24
|
+
Promise.reject("SDK Timeout")})},gO=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!");aO(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)}})})},hO=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case cN:a.g.warn("The application does not have the privilege to set mute.",dN);break;default:a.g.warn(aN,
|
|
25
|
+
c)}}},mO=function(a,b,c){return _.w(function*(){a.l=_.fo(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(iO)),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?(cO(a,e.nextBandwidth),a.o=!1):(a.o||bO(a,e),
|
|
26
|
+
a.o=!0);$N(a);if(b.drm&&b.drm.env){const h={onError:k=>a.m.onError(k),Hb:a.m.getNetworkEngine()};a.h=new jO(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(kO));yield gO(a);a.f||a.trigger(new _.C(lO));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&&hO(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;}})},nO=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())},jO=class{constructor(a,
|
|
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 _.w(function*(){var b=_.ql[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=_.sl(b,a.h.customData);const d=b[_.wd];d&&a.f.set(_.wd,
|
|
29
|
+
{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 iN(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}},lN="DeleteLicenseAfterUse",
|
|
30
|
+
mN="LicenseServer",nN="CustomData";var tO=class{constructor(a){this.m=a;this.a=this.m.a;this.f=_.Zn;this.j=_.It;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(iO,this.C,this);this.a.on(oO,this.B,this);this.a.on(pO,this.A,this);this.a.on(kO,this.H,this);this.a.on(lO,this.G,this);this.a.on(qO,this.F,this)}release(){qN(this,_.Zn);this.l=!1;this.o=-1;this.h=2}destroy(){this.release();this.a.off(iO,this.C);this.a.off(oO,this.B);this.a.off(pO,this.A);this.a.off(kO,
|
|
31
|
+
this.H);this.a.off(lO,this.G);this.a.off(qO,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;qN(this,_.Un)}B(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",pN(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()===rO;if(!a&&b){qN(this,_.ao);return}}if(a=this.f!==_.$n)a=this.a.getState(),a=a===
|
|
32
|
+
rN||a===sN;a&&tN(this)}H(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===sO?qN(this,_.$n):this.g.error("AVPlay prepares while state is not IDLE")}G(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())}F(){qN(this,_.Rn)}getState(){return this.f}};var uO=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 uN(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&&vN(b.a)){b.h=wN(b);try{yield b.h.open();b.f=xN(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(_.HA,
|
|
34
|
+
a);this.w=!0;let b=_.jD(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&&(_.XE(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 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 vO:0<Object.keys(this.f).length||(this.g.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+EN(this,b[0].extra_info).Bit_rate,b=FN(this,{bandwidth:b}))&&(this.w=b,DN(this,b));break;case wO:CN(this);break;default:this.g.debug("Event type: "+
|
|
36
|
+
b+" data: "+a)}}A(a){a.detail.currentState===_.bo&&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===_.bo&&(this.g.debug("Current state",b.currentState),this.B=!0,GN(this)))});this.a.on(xO,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=UN(this.a);this.f=MN(this,a);
|
|
37
|
+
const b=this.f[_.K]||[];b.length&&(this.j=b[0].renditions[0]||null);CN(this)}catch(a){this.g.debug("Could not load track manager")}}}destroy(){this.a.off(xO,this.C);this.a=this.m=null}getVideoTracks(){return this.f[_.L]||[]}getAudioTracks(){return this.f[_.K]||[]}ha(){return this.f[_.J]||[]}ma(){return PN(this,_.L)}Ta(){return PN(this,_.K)}Ka(){return PN(this,_.J)}jb(){return this.w}zb(){this.g.info(bN);return null}Ab(){this.g.info(bN);return null}La(){const a=this.ma();return a?a.track:null}la(){const a=
|
|
38
|
+
this.Ta();return a?a.track:null}ta(){const a=this.Ka();return a?a.track:null}ub(a){null===a?(a=this.ma(),WN(this.a,a.bandwidth,null).then(()=>{CN(this)})):0<a.renditions.length&&this.ab(a.renditions[0])}va(a){a?SN(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?BN(this.h,a.track):SN(this,a)):(this.g.debug("Disabling text tracks"),this.l=null,XN(this.a,!1),this.m.trigger(new _.C(_.Nk)))}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,DN(this,a),WN(this.a,b.bandwidth,a.bandwidth).then(()=>{CN(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){SN(this,a)}tb(a){this.h?BN(this.h,a.track):SN(this,a)}addTextTrack(){}pa(){return this.a.o}};W.prototype.isAbrEnabled=W.prototype.pa;
|
|
40
|
+
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;W.prototype.getLoadingTextRendition=W.prototype.Ab;
|
|
41
|
+
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 BO=class extends _.nt{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(iO))}H(a){this.w=!0;this.trigger(new _.C(oO,{percent:a}))}G(){this.w=!1;this.trigger(new _.C(pO))}L(){this.trigger(new _.C(qO))}K(a,b){this.trigger(new _.C(xO,{eventid:a,data:b}))}M(a,b,c,d,e){this.trigger(new _.C(yO,{duration:a,text:b,subtitleType:c,
|
|
42
|
+
attriCount:d,attributes:e}))}J(a,b){this.trigger(new _.C(zO,{drmType:a,drmData:b}));this.h&&(a=this.h,a.j&&(a.a===_.yd&&"Challenge"===b.name?kN(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(AO,{eventType:a}))}play(){const a=this.getState(),b=()=>new Promise((c,d)=>{let e=null;const f=()=>{c();clearTimeout(e)};this.one(ZN,f,this);e=setTimeout(()=>{this.off(ZN,f);d("Timeout")},3E4)});if(a===sO)return(new Promise((c,
|
|
43
|
+
d)=>{webapis.avplay.prepareAsync(()=>{aO(this);c(webapis.avplay.play())},e=>{this.trigger(new _.C(AO));d(e)})})).then(()=>b());if(a===sN||a===rO)try{return webapis.avplay.play(),b()}catch(c){return Promise.reject(c)}return a===rN?Promise.resolve():Promise.reject("Player is in invalid state")}pause(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===sN?Promise.resolve():Promise.reject()}setPlaybackRate(a){const b=this.getState();if(b===rO||b===rN||b===sN){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 fO(c),yield mO(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=
|
|
45
|
+
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(),
|
|
46
|
+
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 cN:this.g.debug("The application does not have the privilege to get the volume.",dN);break;default:this.g.debug(aN,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 cN:this.g.warn("The application does not have the privilege to set the volume.",dN);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()]}},sO="IDLE",rO="READY",rN="PLAYING",sN="PAUSED",HN=_.Tb,IN="AUDIO",RN="TEXT",wO="PLAYER_MSG_RESOLUTION_CHANGED",vO="PLAYER_MSG_BITRATE_CHANGE",oN="PLAYREADY",jN="WIDEVINE_CDM";var FO=class extends _.nt{constructor(){super();this.a=new BO(this);this.f=new tO(this);this.configuration=this.B=_.Xk();this.w=null;this.g=new _.R("clpp.tizen.Player");this.j=null;this.l=new W;this.C=new _.iq;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=_.Fi(d))&&this.o.append([new _.Js(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}`);qN(this.f,_.Yn);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(qO,this.H,this);this.a.on(ZN,this.F,this);this.a.on(yO,this.I,this);this.a.on(zO,this.G,this);this.a.on(AO,this.T,this);this.a.on(pO,this.J,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();a=CO;CO+=1;a="__clpp_tizen_player_"+a;this.j=_.wo(_.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}_.yo(a,d);nO(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(qO,a.H);a.a.off(ZN,a.F);a.a.off(yO,a.I);a.a.off(zO,a.G);a.a.off(AO,a.T);a.a.off(pO,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 DO}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()===_.Rn?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 _.mt}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=_.Zk(b.B,a);var c=_.Hn(b.configuration,[_.ce,"native"]);b.o=c.create(b);c=_.fo(b.configuration)[0];if(b.configuration.tizen&&b.configuration.tizen.sideStreamText){b.h=
|
|
55
|
+
new uO;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));nO(this);return this.a.play().then(()=>{tN(this.f)})}pause(){return this.a.pause().then(()=>{tN(this.f)})}getState(){return this.f.getState()}getPeriods(){return[]}onError(a){const b=new _.C(_.Vd,{detail:a});a.severity===_.E&&(qN(this.f,_.Yn),this.a.release());this.trigger(b);b.defaultPrevented&&(b.a=!0)}getDrmInfo(){return this.a.getDrmInfo()}isEnded(){return this.f.getState()===
|
|
56
|
+
_.Rn}isPaused(){return this.a.getState()===sN}isMuted(){return dO(this.a)}setMuted(a){hO(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 EO).canPlay(a,b)}getTimelineCues(){return[]}getCueTimeline(){return null}getTextDisplayer(){return this.o}resetAbr(){}};
|
|
57
|
+
FO.prototype.getTextDisplayer=FO.prototype.getTextDisplayer;FO.prototype.setNetworkEngine=FO.prototype.setNetworkEngine;FO.prototype.getNetworkEngine=FO.prototype.getNetworkEngine;var DO="clpp.tizen",CO=0,EO=class{a(){return DO}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 FO}};_.x("clpp.tizen.TizenComponent",class extends _.au{f(){_.oh(new EO)}a(){var a=DO;a&&_.mh[a]&&(delete _.mh[a],_.nh.info("Removed Player factory: '"+a+"'"))}id(){return"tizen"}});var iO="onbufferingstart",oO="onbufferingprogress",pO="onbufferingcomplete",qO="onstreamcompleted",ZN="oncurrentplaytime",xO="onevent",yO="onsubtitlechange",zO="ondrmevent",AO="onerror",kO="preparingstart",lO="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
|
-
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
|
|
3
|
-
"$1em")},
|
|
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
|
-
a%1E3)).padStart(3,"0")}`},
|
|
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
|
-
_.Fd,"p","span","br"]),
|
|
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
|
-
e.length?" "+e.join(" "):""}b=a+(b+c+"\n");b+=d.payload+"\n\n"}return _.
|
|
22
|
-
_.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Rv='application/mp4; codecs\x3d"stpp.ttml"',Sv='application/mp4; codecs\x3d"stpp.ttml.im1i"',Tv='application/mp4; codecs\x3d"stpp.ttml.im1t"',Uv="backgroundColor",Vv="direction",Wv="displayAlign",Xv="region",Yv="textAlign",Zv="textDecoration",$v="writingMode",aw=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},iw=function(a,b){var c=null;if(bw.test(a)){{a=bw.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 cw.test(a)?c=dw(cw,a):ew.test(a)?c=dw(ew,a):fw.test(a)?(a=fw.exec(a),c=Number(a[1])/b.frameRate):gw.test(a)?(a=gw.exec(a),c=Number(a[1])/b.a):hw.test(a)&&(c=dw(hw,a));return c},dw=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)},jw=function(a){return a.split(":").pop()},kw=function(a){return a.replace(/(\d*\.?\d+)c/g,
|
|
3
|
+
"$1em")},mw=function(a,b){for(;lw.test(a);){const c=lw.exec(a)[0];a=a.replace(c,`${parseInt(c,10)/b}em`)}return a},nw=function(a){return a?a.replace(/(\d*\.?\d+)%/g,(b,c)=>`${c/100}em`):""},ow=function(a,b,c){a=aw(a,b,Yv);if(!a&&c&&(a=aw(c,b,Yv),!a&&"rltb"===aw(c,b,$v)))return _.yf;switch(a){case _.cd:return _.Es;case _.yf:case _.Td:return _.yf;default:return _.ge}},pw=function(a,b,c){if(_.Bi(a.w))return document.createTextNode(_.Fi(a.w||""));if(a.A)return _.wo("br");const d=_.wo("span");for(const e of a.f)_.xo(d,
|
|
4
|
+
e);for(const e of a.j)d.appendChild(pw(c.get(e),b,c));return d},sw=function(a,b,c,d){const e=qw.exec(a);a=rw.exec(a);return typeof b===_.r&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},tw=function(a,b){return typeof b===_.r&&0<b?_.Ms:rw.test(a)?0:_.Ms},uw=function(a,b,c){return typeof a===_.r?a:typeof b===_.r?b:c},vw=function(a,b){a=a.getAttribute("extent");return(a=rw.exec(a))?Number(a[b]):null},xw=function(a){a=a.getAttribute("cellResolution");return(a=ww.exec(a))?Number(a[2]):null},
|
|
5
|
+
zw=function(){return`${"inline-"}${yw++}`},Bw=function(a){return Aw.some(b=>b in a.attributes)},Cw=function(a,b){if(0===b.length)return[];const c=[];for(const d of b)a.a.has(d)&&c.push(...Cw(a,a.a.get(d).f),d);return c},Dw=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)},Ew=function(a){return jw(a.h.nodeName)},Hw=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={},Fw.forEach(l=>{l in k.attributes&&(g[l]=k.attributes[l])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(Xv)&&(c=b.getAttribute(Xv));b.hasAttribute(_.Rf)&&f.push(...b.getAttribute(_.Rf).split(" "));d=Array.from(b.attributes).map(k=>k.name);for(const k of d)d=jw(k),g[d]=b.getAttribute(k);d=g.backgroundImage}c=new Gw(b,c,d,e,f,g);a.a.set(b,c);return c},Iw=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")}`},Jw=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 Kw=class extends Jw{constructor(a,b,c){super(a,[],c);this.j=b||""}};var Lw=class extends Jw{constructor(a,b,c){super(a,b,c)}};var bw=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,cw=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,ew=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,fw=/^(\d*(?:\.\d*)?)f$/,gw=/^(\d*(?:\.\d*)?)t$/,hw=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,qw=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,rw=/^(\d+)px (\d+)px$/,ww=/^(\d+) (\d+)$/,lw=/(\d+)px/,Mw=/^(\d+px|\d+em|\d*\.?\d+c)$/,Aw=[Uv,"color",Vv,Wv,"fontFamily","fontSize","fontStyle","fontWeight",
|
|
8
|
+
"lineHeight","opacity","padding",Yv,Zv,"textOutline",$v,"zIndex"],Fw=["begin",_.Td];var Nw=class extends Lw{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=iw(this.a.begin,b);b=iw(this.a.end,b);if(null===h||null===b)return null;h+=c;b+=c;c=_.wo(_.Fd);for(const k of this.j)c.appendChild(pw(g.get(k),e,g));g=new _.Js(h,b,c.innerHTML.trim(),_.Zf);g.cssClassList=[...this.f];g.textAlign=ow(this,e,null);g.writingMode=_.Fs;g.line=-1;g.lineInterpretation=_.Gs;g.lineAlign=_.Hs;g.containerRows=uw(null,xw(a),15);if(this.o&&(f=
|
|
9
|
+
f.get(this.o))){g.region=f.build(a,e);g.textAlign=ow(this,e,f);a:switch(aw(f,e,$v)){case "tb":case "tblr":a=_.kg;break a;case "tbrl":a=_.lg;break a;default:a=_.Fs}g.writingMode=a;a:switch(aw(f,e,Wv)){case _.cd:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(aw(f,e,Wv)){case _.cd:a=1;break a;default:a=_.Gs}g.lineInterpretation=a;a:switch(aw(f,e,Wv)){case _.cd:e=_.cd;break a;default:e=_.Hs}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 Ow=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 Pw=class extends Lw{constructor(a,b,c){super(a,b,c)}build(a,b){const c=new _.Os;c.id=this.getId();const d=uw(a.j.containerWidth,vw(a,1),720);a=uw(a.j.containerHeight,vw(a,2),480);a:switch(aw(this,b,Wv)){case "after":var e="flex-start";break a;case _.cd:e=_.cd;break a;default:e="flex-end"}c.displayAlign=e;a:switch(aw(this,b,$v)){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")||aw(this,b,"extent");c.width=sw(e,
|
|
11
|
+
d,1,100);c.widthUnits=tw(e,d);c.height=sw(e,a,2,100);c.heightUnits=tw(e,a);b=this.getAttribute("origin")||aw(this,b,"origin");c.viewportAnchorX=sw(b,d,1,0);c.viewportAnchorY=sw(b,a,2,0);c.viewportAnchorUnits=tw(b,d);c.cssClassList=[...this.f];return c}};var Qw=class extends Jw{constructor(a,b){super("root-container",[],b);this.j=a}};var Sw=class extends Jw{constructor(a,b,c){super(a,b,c)}build(a){var b=null;var c=xw(a);c&&(b=uw(a.j.containerHeight,vw(a,2),480)/c);b=uw(a.j.fontSizeRadix,b,16);a=[];c=`::ttml .${this.h}, ::ttml .${this.h} * {`;for(const [g,h]of Rw.entries())g in this.a&&(c+=`${h}:${kw(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&&!Mw.test(h)&&Mw.test(k)&&Mw.test(l)?(e=h,g=k):2===d.length&&!Mw.test(h)&&Mw.test(k)?(e=h,g=k):2===d.length&&Mw.test(h)&&Mw.test(k)&&(g=h);if(""!==g){g=kw(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=nw(this.a.textShadow),d=kw(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(Zv 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
|
+
kw(this.a.padding),d+=";"):d="";f=c=c+f+d;"lineHeight"in this.a?(c="",d=this.a.lineHeight,d=kw(d),d=mw(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=kw(c);c=mw(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}},Rw=new Map([[Uv,"background-color"],
|
|
15
|
+
["color","color"],[Vv,Vv],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var Tw=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=[]}},yw=0;var Ww=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&&!Uw.has(jw(a.nodeName))||Vw.has(jw(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&&!Uw.has(jw(a.nodeName))));const b=this.a;this.a=a;return b}},Uw=new Set(["tt","head","layout",_.ye,_.de,Xv,"styling",_.Rf,"body",
|
|
16
|
+
_.Fd,"p","span","br"]),Vw=new Set([_.Rf,_.de]);var Gw=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 Xw=class{constructor(){this.a=new Map}};var Yw=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=_.si(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 Tw(d);e=new Xw;f=new Ww(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=_.Gi(k);const m=`urn:mpeg:14496-30:subs:${g}`;d.h.set(m,
|
|
17
|
+
new Kw(m,k,{imageType:"PNG",encoding:"Base64"}));b+=h}for(;f.Wc();)a=f.next(),a=Hw(e,a),c=d,b=a,"tt"===Ew(b)&&(c.l=new Qw(c.B,Object.assign({},b.attributes))),c=d,b=a,"tt"===Ew(b)&&(c.w=new Ow(b.attributes.frameRate,b.attributes.subFrameRate,b.attributes.frameRateMultiplier,b.attributes.tickRate)),c=d,b=a,Ew(b)!==_.de||b.attributes.begin||b.attributes.end||(g=`#${b.getId()}`,c.h.set(g,new Kw(g,b.h.textContent,b.attributes))),c=d,g=a,Ew(g)===_.de&&g.attributes.begin&&g.attributes.end?(b=`#${zw()}`,
|
|
18
|
+
g=new Kw(b,g.h.textContent,g.attributes),c.h.set(b,g),c=g):c=null,c&&(a.j=c.getId()),c=d,b=a,Ew(b)===_.Rf&&(g=b.getId()||zw(),h=new Sw(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,Ew(g)!==_.Rf&&Bw(g)?(b=zw(),g=new Sw(b,[],Object.assign({},g.attributes)),c.a.set(b,g),c=g):c=null,c&&a.f.push(c.getId()),c=d,g=a,Ew(g)!==_.Fd||!g.attributes.extent&&!g.attributes.origin?c=null:(b=zw(),g=new Pw(b,Cw(c,g.f),Object.assign({},g.attributes)),c.j.set(b,g),c=g),c&&(a.a=
|
|
19
|
+
c.getId()),c=d,g=a,Ew(g)!==Xv?c=null:(b=g.getId(),g=new Pw(b,Cw(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(Ew(g))||0===b.length?c=null:(h=b[b.length-1],c.f.has(h)?(b=zw(),g=new Nw(b,"#text"===g.h.nodeName?g.h.textContent:null,"br"===Ew(g),g.a,g.j,Cw(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"===Ew(g)||g.j?(b=zw(),g=new Nw(b,null,!1,g.a,g.j,Cw(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=Dw(d);f=[];for(l of d.a.values())f.push(...l.build(d.l));var l=f;return{cues:e,styles:l}}};var Zw=class{constructor(a){this.f=a}a(a){var b=new Yw(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=Iw(d.startTime)+" --\x3e "+Iw(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 _.Es: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=
|
|
21
|
+
e.length?" "+e.join(" "):""}b=a+(b+c+"\n");b+=d.payload+"\n\n"}return _.wi(b)}},$w=class{probe(a,b){return a===_.Fc&&b===_.Uf}create(a){return new Zw(a)}};var ax=class{constructor(a){this.a=new Yw(a);this.g=new _.R("clpp.ttml.Mp4TtmlParser")}parseInit(a){let b=!1;(new _.Pl).N(_.Be,_.Il).N(_.Yf,_.Il).N(_.we,_.Il).N(_.Ae,_.Il).N(_.Of,_.Il).ca(_.Qf,_.Jl).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 _.Pl).N("moof",_.Il).N("traf",_.Il).ca("subs",g=>{const h=_.O(g.reader);for(let k=0;k<h;++k){g.reader.skip(4);const l=_.Bl(g.reader);for(let m=0;m<l;++m){const n=1===g.version?
|
|
22
|
+
_.O(g.reader):_.Bl(g.reader);f.push(n);g.reader.skip(6)}}}).N(_.ve,_.Kl(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 _.au{constructor(){super();this.j=new $w}f(){_.os(_.Fc,Yw);_.os(_.Dc,ax);_.os(Rv,ax);_.os(Tv,ax);_.os(Sv,ax);_.Gj.push(this.j)}a(){_.qs(_.Fc);_.qs(_.Dc);_.qs(Rv);_.qs(Tv);_.qs(Sv);_.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.
|
|
4
|
-
b);_.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Gv="VerimatrixVCAS",Hv="clpp.verimatrix.Vcas",Iv="clpp.verimatrix.VcasComponent",Kv=function(a,b){return a.C===Jv?(a=Object.assign({},{deviceId:_.Hi(_.yi(a.A))},a.a&&{authenticator:_.Hi(_.yi(a.a))}),b+_.nj(a)):b},Qv=class extends _.st{constructor(a){super(Gv);const b={};b[Lv]=Lv;b[Mv]=Mv;const {deviceId:c,authenticator:d,licenseRequestVuidLocation:e=Jv,httpHeaderNames:f=b,widevineLicenseUrl:g,playReadyLicenseUrl:h,fairPlayLicenseUrl:k,fairPlayCertificateUrl:l,fairPlaySiteId:m,fairPlayAssetIdStrategy:n=
|
|
2
|
+
Nv}=a;this.A=c;this.a=d;this.C=e;this.B=f;this.w=Kv(this,g);this.o=Kv(this,h);this.l=Kv(this,k);this.j=l;this.G=m;this.F=n;this.g=new _.R(Hv);_.Ci(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)}});_.Ci(this.o)?this.g.warn(_.wb):this.Wa(_.wd,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],
|
|
3
|
+
modifiers:{licenseRequest:this.h.bind(this)}});_.Ci(this.l)?this.g.warn(_.Va):_.Ci(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===Ov){a=this.B[Mv];const c={};c[this.B[Lv]]=this.A;this.a&&(c[a]=this.a);Object.keys(c).forEach(d=>{b.headers[d]=c[d]})}}H(a,b){a=_.Ol(b);switch(this.F){case Pv:a=_.nj({r:a,ci:this.G},!0)}return a}J(a,b){this.h(a,
|
|
4
|
+
b);_.Tl(b)}K(a,b){_.Ul(b)}};_.x(Hv,Qv);Qv.prototype.constructor=Qv.prototype.constructor;Qv.NAME=Gv;var Jv="query-string",Ov="http-header";Qv.LicenseRequestVuidLocation={QUERY_STRING:Jv,HTTP_HEADER:Ov};var Lv="DeviceId",Mv="Authenticator";Qv.LicenseRequestHttpHeader={DEVICE_ID_HEADER:Lv,AUTHENTICATOR_HEADER:Mv};var Nv="keyid",Pv="contentid-siteid";Qv.FairPlayAssetIdStrategy={KEYID:Nv,CONTENTID_SITEID:Pv};_.x(Iv,class extends _.au{constructor(){super();this.g=new _.R(Iv)}a(){delete _.ql.VerimatrixVCAS}h(a){a=a.getConfiguration();if(a.drm&&a.drm.env===Gv){({customData:a}=a.drm);if(!a)throw new _.G(_.E,7,7100,_.zd);a=new Qv(a);this.g.info("Registering the Verimatrix VCAS Ultra environment");_.rl(a)}}id(){return"verimatrix-vcas"}});};f.call(g, window);
|
package/cl.vimond.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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.
|
|
5
|
-
"")}e.videoProtocol=f;const u=
|
|
6
|
-
b.f;q.timestamp=(new Date).toISOString();b.
|
|
7
|
-
a.onError(new _.
|
|
8
|
-
this.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var xv="Registering listeners",yv="clpp.vimond.VimondPlugin",zv=function(a,b){a.m.trigger(new _.C(_.tg,{detail:b}))},Av=function(a,b,c){b&&(a.B=!0,a.h.stop());a.m.onError(new _.G(b?_.E:1,9,9201,c))},Bv=function(a,b){const c=a.m.getState();if(1===b)return["str-start",_.df];if(a.h)return[_.Td,_.Pe];if(c===_.Rn)return[_.Td,null];if(c===_.Yn)return[_.Vd,_.Pe];b=_.Pe;if(c===_.Un||c===_.bo||a.f)b=_.df;return["period",b]},Cv=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 _.Bs;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(xv),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()));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!==_.bo||(b.f&&[_.ao,_.Un].includes(d)?b.g.debug("Seeking"):(b.f&&d===_.bo&&(b.g.debug("Seeked"),b.f=!1),[_.bo,_.ao,_.Yn,_.Rn].includes(d)&&(b.C=d,yield b.A(),d===_.Rn&&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=_.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||"";var e=q.client;{const A=b.a.m.getLoadedSource();var f=((new _.Nl(A.url)).scheme||"").replace(":",
|
|
5
|
+
"")}e.videoProtocol=f;const u=Bv(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!==_.Rc&&(v.liveResumePossible=!0)}q.progress.eventNumber=
|
|
6
|
+
b.f;q.timestamp=(new Date).toISOString();b.g.debug("Fire an event");const y=_.Wi(b.l);y.method=_.vb;y.contentType="application/json";y.headers.Authorization=`Bearer ${b.h}`;y.body=_.yi(JSON.stringify(q));var m=b.j.fetch(y).W}const n=yield m;zv(a,n)}catch(n){m=n.code,b=n.data,[1002,1003].includes(m)?(a.g.debug("Unreachable service"),zv(a,b),Av(a,a.L,b)):1001===m?(a.g.debug("Generic service error"),zv(a,b),Av(a,a.M,b)):a.g.error(n.toString())}})}};var Dv=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 Ev=class{constructor(a){this.m=a;this.a=new _.Bs;this.g=new _.R("clpp.vimond.VimondAdapter");this.f=this.h=!1;this.m&&this.a&&(this.g.debug(xv),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 Fv=class extends _.Bu{constructor(){super();this.a=!1;this.g=new _.R(yv);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`);
|
|
7
|
+
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 Ev(a);this.h=new Dv(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new Cv(b.playerEventRequest.eventInterval,c,d,a,this.h)}}onPlayerWillRelease(){if(this.a){if(this.f){var a=this.f;a.g.debug(_.Pb);_.rh(a.a)}this.j&&(a=this.j,a.g.debug(_.Pb),_.rh(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(yv,Fv);Fv.prototype.updateAuthToken=Fv.prototype.Ne;Fv.Id="vimond";_.rq(new class{create(){return new Fv}});};f.call(g, window);
|
package/cl.vr.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
b=b.a;const f=c.x,g=c.y;c=c.a;a.x=e*c-b*g;a.y=b*f-d*c;a.a=d*g-e*f;return a},
|
|
3
|
-
new
|
|
4
|
-
a.a.getShaderInfoLog(b));return b},
|
|
5
|
-
a.attachShader(this.f,this.l);a.attachShader(this.f,this.j);a.bindAttribLocation(this.f,0,"aPosition");a.bindAttribLocation(this.f,1,"aTexCoord");a.linkProgram(this.f);if(!a.getProgramParameter(this.f,a.LINK_STATUS))throw new _.
|
|
6
|
-
4]),f=5*(129*d+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*d+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]);this.
|
|
7
|
-
b;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=2E3/-1999.9;a[11]=200/-1999.9;a[12]=0;a[13]=0;a[14]=-1;a[15]=1}}};this.l=this.j=0;this.
|
|
8
|
-
if(void 0!==d&&_.
|
|
9
|
-
|
|
10
|
-
this.w&&cancelAnimationFrame(this.w);this.
|
|
11
|
-
var b=this.f;this.o||a.readyState!==a.HAVE_ENOUGH_DATA||(this.o=new
|
|
12
|
-
c[8];c[8]=d;d=c[6];c[6]=c[9];c[9]=d;d=c[3];c[3]=c[12];c[12]=d;d=c[7];c[7]=c[13];c[13]=d;d=c[11];c[11]=c[14];c[14]=d}b.uniformMatrix4fv(this.C.
|
|
13
|
-
0,a.
|
|
14
|
-
this.B,!1)}da(a){a.preventDefault();var b=a.clientX;let c=a.clientY;a.type===
|
|
15
|
-
_.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var cv="touchmove",dv="touchstart",fv=function(a,b,c){c*=.5;const d=Math.sqrt(a*a+b*b),e=Math.sin(c);return new ev(a/d*e,b/d*e,0/d*e,Math.cos(c))},gv=function(a,b){const c=a.x,d=a.y,e=a.a;a=a.f;b.set(1-2*(d*d+e*e),2*(c*d-e*a),2*(c*e+d*a),0,2*(c*d+e*a),1-2*(c*c+e*e),2*(d*e-c*a),0,2*(c*e-d*a),2*(d*e+c*a),1-2*(c*c+d*d),0,0,0,0,1)},hv=function(a,b){isFinite(b)?(a.x*=b,a.y*=b,a.a*=b):(a.x=0,a.y=0,a.a=0)},iv=function(a,b){return a.x*b.x+a.y*b.y+a.a*b.a},jv=function(a,b,c){const d=b.x,e=b.y;
|
|
2
|
+
b=b.a;const f=c.x,g=c.y;c=c.a;a.x=e*c-b*g;a.y=b*f-d*c;a.a=d*g-e*f;return a},kv=function(a,b,c){b=b.a;c=c.a;const d=a.a;let e=0;do d[4*e]=b[4*e]*c[0]+b[4*e+1]*c[4]+b[4*e+2]*c[8]+b[4*e+3]*c[12],d[4*e+1]=b[4*e]*c[1]+b[4*e+1]*c[5]+b[4*e+2]*c[9]+b[4*e+3]*c[13],d[4*e+2]=b[4*e]*c[2]+b[4*e+1]*c[6]+b[4*e+2]*c[10]+b[4*e+3]*c[14],d[4*e+3]=b[4*e]*c[3]+b[4*e+1]*c[7]+b[4*e+2]*c[11]+b[4*e+3]*c[15];while(4>++e);return a},mv=function(a){var b=new lv(0,0,0),c=new lv(0,0,1);const d=new lv,e=new lv,f=new lv;a=a.a;var g=
|
|
3
|
+
new lv(0,1,0);f.x=b.x-g.x;f.y=b.y-g.y;f.a=b.a-g.a;g=f.length();hv(f,1/g);c=jv(d,c,f);g=c.length();hv(c,1/g);jv(e,f,d);a[0]=d.x;a[1]=d.y;a[2]=d.a;a[3]=-iv(d,b);a[4]=e.x;a[5]=e.y;a[6]=e.a;a[7]=-iv(e,b);a[8]=f.x;a[9]=f.y;a[10]=f.a;a[11]=-iv(f,b);a[12]=0;a[13]=0;a[14]=0;a[15]=1},nv=function(a,b,c){b=a.a.createShader(b?a.a.FRAGMENT_SHADER:a.a.VERTEX_SHADER);a.a.shaderSource(b,c);a.a.compileShader(b);if(!a.a.getShaderParameter(b,a.a.COMPILE_STATUS))throw new _.G(1,9,9004,"Unable to compile GL shader: "+
|
|
4
|
+
a.a.getShaderInfoLog(b));return b},ov=function(a){a.a&&(a.a.removeEventListener("mousemove",a.A,!1),a.a.removeEventListener(cv,a.A,!1),a.a.removeEventListener("mouseup",a.B,!1),a.a.removeEventListener("touchend",a.B,!1))},pv=function(a){const b=fv(1,0,a.l*Math.PI/180);gv(fv(0,1,a.j*Math.PI/180),a.O);gv(b,a.R);mv(a.Y);kv(a.Z,a.O,a.Y);kv(a.G,a.R,a.Z)},ev=class{constructor(a,b,c,d){this.x=a||0;this.y=b||0;this.a=c||0;this.f=d||1}};var lv=class{constructor(a,b,c){this.x=a||0;this.y=b||0;this.a=c||0}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.a*this.a)}};var qv=class{constructor(){this.a=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}set(a,b,c,d,e,f,g,h,k,l,m,n,q,u,v,y){const A=this.a;A[0]=a;A[4]=b;A[8]=c;A[12]=d;A[1]=e;A[5]=f;A[9]=g;A[13]=h;A[2]=k;A[6]=l;A[10]=m;A[14]=n;A[3]=q;A[7]=u;A[11]=v;A[15]=y;return this}};var rv=class{constructor(a){this.a=a;this.f=a.createProgram();this.l=nv(this,!1,"uniform highp mat4 Mvpm;\nattribute highp vec4 aPosition;\nattribute highp vec2 aTexCoord;\nvarying highp vec2 oTexCoord;\nvoid main()\n{\n gl_Position \x3d Mvpm * aPosition;\n oTexCoord \x3d aTexCoord;\n}\n");this.j=nv(this,!0,"precision highp float;\nuniform sampler2D Texture0;\nvarying highp vec2 oTexCoord;\nvoid main()\n{\n gl_FragColor \x3d texture2D(Texture0, oTexCoord);\n gl_FragColor.w \x3d 1.0;\n}\n");
|
|
5
|
+
a.attachShader(this.f,this.l);a.attachShader(this.f,this.j);a.bindAttribLocation(this.f,0,"aPosition");a.bindAttribLocation(this.f,1,"aTexCoord");a.linkProgram(this.f);if(!a.getProgramParameter(this.f,a.LINK_STATUS))throw new _.G(1,9,9004,"Unable to initialize shader");a.useProgram(this.f);this.h=a.getUniformLocation(this.f,"Mvpm");a.uniform1i(a.getUniformLocation(this.f,"Texture0"),0);a.useProgram(null)}};var sv=class{constructor(a){this.a=a;var b=[];let c,d;for(d=0;70>=d;d++){var e=3>=d?d/4/64:67<=d?(63+(d-66)/4)/64:(d-3)/64;var f=(e-.5)*Math.PI;const g=Math.cos(f);for(c=0;128>=c;c++){const h=c/128,k=(.5+h)*Math.PI*2;128===c?(b.push(b[645*d]),b.push(b[645*d+1]),b.push(b[645*d+2])):(b.push(100*Math.cos(k)*g),b.push(100*Math.sin(k)*g),b.push(100*Math.sin(f)));0===d||70===d?b.push(.5):b.push(1-h);b.push(1-e)}}e=[];for(c=0;128>c;c++)for(d=0;70>d;d++)f=5*(129*d+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+
|
|
6
|
+
4]),f=5*(129*d+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*d+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]);this.h=e.length/5;this.f=a.createBuffer();b=new Float32Array(e);a.bindBuffer(a.ARRAY_BUFFER,this.f);a.bufferData(a.ARRAY_BUFFER,b,a.STATIC_DRAW)}};var uv=class{constructor(a,b){this.a=b;this.f=this.a.createTexture();b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,this.f);b.texImage2D(b.TEXTURE_2D,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,a);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.bindTexture(b.TEXTURE_2D,null)}};var vv={alpha:!1,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!1,devicePixelRatio:1},wv=class extends _.Bu{constructor(){super();this.o=this.w=this.K=this.I=this.C=this.X=this.G=this.f=this.a=this.m=null;this.g=new _.R("clpp.vr");this.H=70;this.V=1;this.M=this.L=!1;this.F=()=>{if(this.a&&this.f){this.f.viewport(0,0,this.a.width,this.a.height);{const a=this.K.a,b=Math.tan(.5*this.H*Math.PI/180);a[0]=1/(this.a.width/this.a.height*b);a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1/
|
|
7
|
+
b;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=2E3/-1999.9;a[11]=200/-1999.9;a[12]=0;a[13]=0;a[14]=-1;a[15]=1}}};this.l=this.j=0;this.h={x:0,y:0};this.O=new qv;this.R=new qv;this.Y=new qv;this.Z=new qv;this.A=this.da.bind(this);this.B=this.ia.bind(this);this.J=this.ba.bind(this)}onPlayerCreated(a){this.g.info("Player created");this.m=a}onContentWillLoad(a){const b=a.getConfiguration();if(b.vr&&b.vr.enable){{var c=b.vr,d=c.fieldOfView;const e=c.sensitivity,f=c.invertHorizontalControl;c=c.invertVerticalControl;
|
|
8
|
+
if(void 0!==d&&_.Yg(d))this.H=d;else throw new _.G(1,7,7100,"fieldOfView configuration must be a number");if(void 0!==e&&_.Yg(e)&&0<e)this.V=e;else throw new _.G(1,7,7100,"sensitivity configuration must be a positive number");this.L=!!f;this.M=!!c}if(a=a.getSurface())if((d=a.getMedia())&&d.tagName.toLowerCase()===_.t){this.g.info("Initialize VR Surface");if(!this.a){this.a=document.createElement("canvas");this.a.style.width="100%";this.f=this.a.getContext("webgl",vv)||this.a.getContext("experimental-webgl",
|
|
9
|
+
vv);if(!this.f)throw new _.G(1,9,9003,"Unable to create GL context");this.G=new qv;mv(this.G);this.X=new sv(this.f);this.C=new rv(this.f);this.I=new qv;this.K=new qv;this.o=this.w=null;this.a.addEventListener(_.xf,this.F)}a.addElementToContainer(this.a,!0,!0);a.hideMediaElement();b.vr.attachMouseListener&&(this.a.addEventListener("mousedown",this.J,!1),this.a.addEventListener(dv,this.J,!1));this.F();this.S()}else this.g.info("No video element found, can not initialize VR plugin");else this.g.info("No surface found, can not initialize VR plugin")}}onPlayerWillRelease(){this.g.info("Releasing VR plugin resources");
|
|
10
|
+
this.w&&cancelAnimationFrame(this.w);this.h.x=0;this.l=this.j=this.h.y=0;this.f&&(delete this.f,this.f=null);this.a&&(ov(this),this.a.removeEventListener(_.xf,this.F),this.a.parentElement.removeChild(this.a),this.a.removeEventListener("mousedown",this.J,!1),delete this.a,this.a=null)}onPlayerWillDestroy(){const a=this;return _.w(function*(){a.m=null})}id(){return"vr"}S(){if(this.m&&this.f){var a=this.m.getSurface();if(a&&(a=a.getMedia())&&a.tagName.toLowerCase()===_.t){this.w=requestAnimationFrame(this.S.bind(this));
|
|
11
|
+
var b=this.f;this.o||a.readyState!==a.HAVE_ENOUGH_DATA||(this.o=new uv(a,b));b.clearColor(0,0,0,1);b.clearDepth(1);b.clearStencil(0);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);b.depthMask(!0);b.clearColor(0,0,0,1);b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);if(this.o){var c=this.C;c.a.useProgram(c.f);{c=kv(this.I,this.K,this.G).a;let d;d=c[1];c[1]=c[4];c[4]=d;d=c[2];c[2]=
|
|
12
|
+
c[8];c[8]=d;d=c[6];c[6]=c[9];c[9]=d;d=c[3];c[3]=c[12];c[12]=d;d=c[7];c[7]=c[13];c[13]=d;d=c[11];c[11]=c[14];c[14]=d}b.uniformMatrix4fv(this.C.h,!1,this.I.a);c=this.o;c.a.activeTexture(c.a.TEXTURE0);c.a.bindTexture(c.a.TEXTURE_2D,c.f);b.texImage2D(b.TEXTURE_2D,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,a);a=this.X;a.a.bindBuffer(a.a.ARRAY_BUFFER,a.f);a.a.vertexAttribPointer(0,3,a.a.FLOAT,!1,20,0);a.a.vertexAttribPointer(1,2,a.a.FLOAT,!1,20,12);a.a.enableVertexAttribArray(0);a.a.enableVertexAttribArray(1);a.a.drawArrays(a.a.TRIANGLES,
|
|
13
|
+
0,a.h);a=this.o;a.a.bindTexture(a.a.TEXTURE_2D,null);this.C.a.useProgram(null)}}}}ba(a){this.g.debug("Mouse Down. Enable VR mouse interaction");a.preventDefault();if(0===a.button||a.type===dv)a.type===dv?a.touches[0]&&(this.h.x=a.touches[0].clientX,this.h.y=a.touches[0].clientY):(this.h.x=a.clientX,this.h.y=a.clientY),this.g.debug("Mouse Start coordinates:",this.h,a),this.a.addEventListener("mousemove",this.A,!1),this.a.addEventListener(cv,this.A,!1),this.a.addEventListener("mouseup",this.B,!1),this.a.addEventListener("touchend",
|
|
14
|
+
this.B,!1)}da(a){a.preventDefault();var b=a.clientX;let c=a.clientY;a.type===cv&&a.touches[0]&&(b=a.touches[0].clientX,c=a.touches[0].clientY);a=this.h.x-b;const d=this.h.y-c;this.h.x=b;this.h.y=c;b=this.V;const {jg:e,kg:f}={jg:a*b*(this.L?-1:1),kg:d*b*(this.M?-1:1)};this.j+=e;this.l+=f;pv(this)}ia(a){this.g.debug("Mouse Up. Removing mouse interaction listeners");a.preventDefault();ov(this)}Zg(a,b){this.l=b;this.j=a;pv(this)}Dg(){return{x:this.j,y:this.l}}rh(a){this.H=a;this.F()}};
|
|
15
|
+
_.x("clpp.vr.VrPlugin",wv);wv.prototype.setCameraFieldOfView=wv.prototype.rh;wv.prototype.getCameraCoordinates=wv.prototype.Dg;wv.prototype.moveCamera=wv.prototype.Zg;wv.Id="vr";_.rq(new class{create(){return new wv}});};f.call(g, window);
|