@castlabs/prestoplay 6.25.2 → 6.27.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 +38 -0
- package/README.md +5 -5
- 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 +32 -32
- package/cjs/cl.core.js +620 -620
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +89 -88
- package/cjs/cl.externs.js +89 -51
- package/cjs/cl.freewheel.js +25 -25
- package/cjs/cl.hls.js +79 -77
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +30 -30
- package/cjs/cl.ima.js +24 -24
- package/cjs/cl.mediatailor.js +3 -3
- package/cjs/cl.mse.js +351 -336
- package/cjs/cl.muxdata.js +15 -15
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +15 -15
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.sessions.js +16 -16
- package/cjs/cl.simid.js +17 -17
- package/cjs/cl.smooth.js +72 -72
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +73 -72
- package/cjs/cl.ttml.js +29 -29
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +12 -12
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.yospace.js +4 -4
- package/cjs/cl.youbora.js +39 -37
- package/cjs/polyfill.min.js +15 -3
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +92 -90
- package/cl.conviva.js +27 -27
- package/cl.core.js +496 -500
- package/cl.crypto.js +9 -9
- package/cl.dash.js +82 -82
- package/cl.externs.js +89 -51
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +80 -80
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +17 -17
- package/cl.mediatailor.js +3 -3
- package/cl.mse.js +305 -294
- 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 +14 -14
- package/cl.smooth.js +60 -60
- 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.yospace.js +3 -3
- package/cl.youbora.js +29 -28
- package/package.json +3 -3
- package/typings.d.ts +124 -3
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=_.mj([b.serverurl&&""!==b.serverurl?b.serverurl:c.
|
|
4
|
-
try{webapis.avplay.setDrm(
|
|
5
|
-
"Initialize",""),webapis.avplay.setDrm(
|
|
6
|
-
a.j=a.f;a.f=b;a.f===_.
|
|
7
|
-
_.
|
|
8
|
-
return new _.
|
|
9
|
-
a.g.debug("getting text streams");for(var d=0;d<c.length;d++)if(a.g.debug(c[d].startTime,a.m.getPosition()),c[d].startTime<=a.m.getPosition()){b=c[d].textStreams;break}a=b}else a=[];b=[];c=0;for(d=0;d<a.length;d++){const e=new _.
|
|
10
|
-
if(a.f){const b=_.
|
|
11
|
-
a.o=
|
|
12
|
-
[];for(let d=0;d<a.length;d++)for(let e=0;e<a[d].renditions.length;e++)_.
|
|
13
|
-
a.g.debug("Setting audio track with preferred language:",e);a.xa(c)}else a.g.debug("Preferred language(s) not available")}else a.g.debug("Could not set preferred audio language")},
|
|
14
|
-
(k=new _.
|
|
15
|
-
var d=null;b===_.
|
|
16
|
-
_.
|
|
17
|
-
b;c.kind=_.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
`AVPlay state: ${a.getState()}, `+`buffering: ${a.w}`,m),!1===l&&(a.j[h]={type:h,index:k,
|
|
21
|
-
a.A)},b=>{a.g.debug("Could not load DISPLAY property");throw b;})})},
|
|
22
|
-
c)}},
|
|
23
|
-
|
|
24
|
-
const b=new Promise(c=>{(new _.
|
|
25
|
-
b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case
|
|
26
|
-
new URL(g);h.searchParams.append("cl-ext",".mpd");g=h.toString()}webapis.avplay.open(g);e.nextBandwidth?(
|
|
27
|
-
h)});a.f||(b.volume&&a.setVolume(b.volume),b.muted&&
|
|
28
|
-
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())},
|
|
29
|
-
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=_.
|
|
30
|
-
yield
|
|
31
|
-
this.H);this.a.off(
|
|
32
|
-
|
|
33
|
-
yield b.j.start(a.url.replace(
|
|
34
|
-
a);this.w=!0;let b=_.
|
|
35
|
-
a);this.h&&this.h.getTextDisplayer().setTextVisibility(a)}release(){const a=this;return _.
|
|
36
|
-
b+" data: "+a)}}A(a){a.detail.currentState===_.
|
|
37
|
-
const b=this.f[_.
|
|
38
|
-
this.
|
|
39
|
-
this.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
attriCount:d,attributes:e}))}K(a,b){this.trigger(new _.
|
|
43
|
-
d)=>{webapis.avplay.prepareAsync(()=>{
|
|
44
|
-
this.F=a}catch(c){return this.g.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.F)}return!0}this.g.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1}getPlaybackRate(){return this.F}load(a,b){const c=this;return _.
|
|
45
|
-
1E3*a;return new Promise((c,d)=>{this.C=!0;this.m.trigger(new _.
|
|
46
|
-
this.h=null);webapis.avplay.stop();webapis.avplay.close();for(const c in this.j){const d=this.j[c];d&&d.
|
|
47
|
-
"The passed value value should be in the range of 0 to 1.");break;case
|
|
48
|
-
a}getSourceIndex(){return this.G}getLoadedSource(){return this.l&&this.l[this.getSourceIndex()]}},
|
|
49
|
-
{currentTime:a.currentTime/1E3}))}J(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
|
-
this;return _.
|
|
53
|
-
(this.configuration.startTime||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 eN="An unknown error occurred while trying to get volume",fN="Cannot get loading rendition due to platform limitations",gN="SecurityError",hN="The require privilege is: http://tizen.org/privilege/tv.audio",iN="|STARTBITRATE\x3d",jN=function(a,b,c){const d=e=>{c.call(a,e);a.removeEventListener(b,d)};a.addEventListener(b,d)},mN=function(a){return _.w(function*(){if(a.a!==_.ud&&a.a!==_.sd)throw new _.I(_.F,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.pd)throw new _.I(_.F,6,6012,`No license server given for ${a.a}`);try{a.a===_.ud?yield kN(a):yield lN(a,b),a.o={keySystem:a.a,licenseServerUri:b.pd,distinctiveIdentifierRequired:!1,persistentStateRequired:b.Le,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],keyIds:[],periodId:null}}catch(c){throw a.g.error(`Error while configuring CDM for ${a.a}`,c),new _.I(_.F,6,6005,{message:JSON.stringify(c)});}})},oN=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=_.mj([b.serverurl&&""!==b.serverurl?b.serverurl:c.pd],_.ij());c.type=3;c.body=e.buffer;c.method=_.db;try{var f=yield a.D.sb.fetch(c).U;if(a.j){var g=_.G(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(nN,"widevine_license_data",k)}catch(l){a.g.error("License response rejected by CDM");const m=new _.I(_.F,6,6008,{browserError:JSON.stringify(l)});a.D.onError(m)}}}catch(h){a.g.error("License request failed.",JSON.stringify(h)),g=new _.I(_.F,6,6007,{message:"Error while fetching license!",url:h.data.url,status:h.data.status||NaN,response:h.data.response||"",headers:h.data.headers||{}},h),a.D.onError(g)}})},kN=function(a){return _.w(function*(){try{webapis.avplay.setDrm(nN,
|
|
5
|
+
"Initialize",""),webapis.avplay.setDrm(nN,"widevine_app_session",a.l.id),webapis.avplay.setDrm(nN,"widevine_data_type",a.l.type)}catch(b){throw b;}})},lN=function(a,b){return _.w(function*(){var c={};c[pN]=!b.Le;c[qN]=b.pd;""!==b.customData&&(c[rN]=b.customData);c=JSON.stringify(c);a.g.debug("PlayReady properties: ",c);try{webapis.avplay.setDrm(sN,"SetProperties",c)}catch(d){throw d;}})},uN=function(a,b){if(a.f!==b)if(a.f===_.ip&&b!==_.pp)a.g.debug(_.rB+`${tN(b)}`);else{var c=(new Date).getTime();
|
|
6
|
+
a.j=a.f;a.f=b;a.f===_.lp?(a.o=(new Date).getTime(),a.m.trigger(new _.C(_.Oc,{detail:{bufferedTimeMS:-1,reason:a.h}}))):a.j===_.lp&&a.m.trigger(new _.C(_.Nc,{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(_.Nf,{detail:b}));a.g.debug("State changed:",tN(a.j),"-\x3e",tN(a.f))}},tN=function(a){return Object.keys(_.op)[a]},xN=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case vN:c=_.sp;break;case wN:c=
|
|
7
|
+
_.rp;break;default:a.m.isEnded()?c=_.hp:a.g.debug("Inconsistent AVPlay playback state:",b)}uN(a,c)}},yN=function(a){return _.w(function*(){const b=a.m.getConfiguration();let c;(c=yield _.qt(a.B.url,a.m.getNetworkEngine(),b.manifest.attemptParameters,a.B.type||null))&&c.configure(b.manifest);return c})},zN=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},AN=function(a){const b=document.createElement(_.t),c=new _.AI,d=new _.FH,e=a.m.getTextDisplayer();
|
|
8
|
+
return new _.BI(b,c,e,d,a.m.getConfiguration())},BN=function(a){const b={configuration:{},qb:()=>a.m.getPosition(),aa:a.h,sb:a.m.getNetworkEngine(),Ec:null,Ge:a.G.bind(a),fg:a.F.bind(a),onError:a.H.bind(a),gg:()=>{},onEvent:()=>{},kg:a.I.bind(a),ae:()=>{},$c:()=>new _.CJ,pe:()=>!1,Yc:null};return new _.XI(a.a,b)},CN=function(a){const b=a.m.getPosition();let c=null;for(const d of a.a.periods)d.startTime<=b&&(c=d);return c},DN=function(a){a.g.debug("getTextStreams()",a.a);if(a.a){var b=[],c=a.a.periods;
|
|
9
|
+
a.g.debug("getting text streams");for(var d=0;d<c.length;d++)if(a.g.debug(c[d].startTime,a.m.getPosition()),c[d].startTime<=a.m.getPosition()){b=c[d].textStreams;break}a=b}else a=[];b=[];c=0;for(d=0;d<a.length;d++){const e=new _.Xk(String(c++),_.K);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=a[d].kind||_.RB;const f=new _.al(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},EN=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;
|
|
10
|
+
if(a.f){const b=_.qG(a.f,_.H);let c=null;if(b){a=DN(a);for(let d=0;d<a.length;d++)if(a[d].renditions[0].id===String(b.id)){c=a[d].renditions[0];break}}return c}return null},FN=function(a,b){_.w(function*(){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);var c=CN(a);const d=b.renditions[0];(c=c.textStreams.find(e=>String(e.id)===d.id))?(a.w?(a.g.debug("Switching period defer text selection"),a.l=c):(yield _.HG(a.f,c),a.m.trigger(new _.C(_.Yf))),
|
|
11
|
+
a.o=c.language):a.g.error("No stream with id",d.id)}})},GN=function(a){const b=a.qa();b&&a.m.trigger(new _.C(_.Lc,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},HN=function(a,b){a.m.trigger(new _.C(_.yg,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,abrSelection:a.a.o}}))},IN=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},JN=function(a,b){a=a.f[_.M]||[];const c=
|
|
12
|
+
[];for(let d=0;d<a.length;d++)for(let e=0;e<a[d].renditions.length;e++)_.ih(a[d].renditions[e],b,Object.keys(b))&&c.push(a[d].renditions[e]);return c[0]||null},KN=function(a){const b=a.m.getConfiguration();var c=_.di(b.preferredAudioLanguage||[]);const d=a.f[_.L]||[];if(d.length){var e=null;c.some(g=>{e=_.mC(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]));
|
|
13
|
+
a.g.debug("Setting audio track with preferred language:",e);a.xa(c)}else a.g.debug("Preferred language(s) not available")}else a.g.debug("Could not set preferred audio language")},QN=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===LN),f=b.filter(l=>l.type===MN);const g=[];for(var h=0;h<f.length;h++){const l=IN(a,f[h].extra_info);if(l){var k=_.$i(l.language||_.hg);k=_.Tk(k);k=c(g,k);k||
|
|
14
|
+
(k=new _.Xk(String(a.h++),_.L),g.push(k));k.renditions.push(NN(f[h].index,l,k))}else a.g.warn("Skipping audio stream with no extra info")}c=new _.Xk(String(a.h++),_.M);for(f=0;f<e.length;f++)(h=IN(a,e[f].extra_info))?c.renditions.push(ON(e[f].index,h,c)):a.g.warn("Skipping video stream with no extra info");e=[];e=a.j?DN(a.j):PN(a,b);d[_.M]=[c];d[_.L]=g;d[_.K]=e;return d},TN=function(a,b){if(b===_.K&&a.j)return EN(a.j);var c=RN(a.a)||[];if(0===c.length)return null;c=c.filter(e=>e.type===b.toUpperCase())[0];
|
|
15
|
+
var d=null;b===_.M&&(d=IN(a,c.extra_info),d=JN(a,{width:d.Width,height:d.Height}));b===_.L&&(c?(d=SN(a,c,_.L),a.l=d):d=a.l);b===_.K&&(c?(d=SN(a,c,_.K),a.o=d):d=a.o);return d},WN=function(a,b){if(b){const c=b.track.type.toUpperCase();UN(a.a,c,Number(b.id)).then(()=>{c===MN&&(a.l=b,a.m.trigger(new _.C(_.Jc)));c===VN&&(a.o=b,a.m.trigger(new _.C(_.Yf)))}).catch(()=>{a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},NN=function(a,b,c){const d=_.$i(b.language||
|
|
16
|
+
_.hg);c.language=_.Tk(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.Gc;a=new _.al(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=b.bit_rate||null;return a},ON=function(a,b,c){c.mimeType=_.tg;a=new _.al(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},XN=function(a,b,c){b=_.$i(b.track_lang||_.hg);c.mimeType="text/ttml";c.language=_.Tk(b);c.originalLanguage=
|
|
17
|
+
b;c.kind=_.RB;return new _.al(String(a),c)},PN=function(a,b){b=b.filter(d=>d.type===VN);const c=[];for(let d=0;d<b.length;d++){const e=IN(a,b[d].extra_info);if(!e){a.g.warn("Skipping text stream with no extra info");continue}const f=new _.Xk(String(a.h++),_.K);f.renditions.push(XN(b[d].index,e,f));c.push(f)}return c},SN=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},
|
|
18
|
+
YN=function(a){return a.f&&a.a?a.a.Bi:webapis.avplay.getTotalTrackInfo()},$N=function(a,b,c){a.g.debug("switchVideoTrack()");try{const d={estimatedBandwidth:parseInt(webapis.avplay.getStreamingProperty("CURRENT_BANDWITH"),10),currentBandwidth:b,nextBandwidth:c,currentPosition:a.getPosition()};a.a=ZN(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(()=>{const e=a.a.xf;a.f=!1;a.a=null;return e===wN?a.pause():a.play()})}catch(d){return Promise.reject(d)}},
|
|
19
|
+
aO=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)}},UN=function(a,b,c){b=b.toUpperCase();b===VN&&aO(a,!0);const d=a.j[b];d&&(d.he.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...`+
|
|
20
|
+
`AVPlay state: ${a.getState()}, `+`buffering: ${a.w}`,m),!1===l&&(a.j[h]={type:h,index:k,tf:0,he:new _.Mj(()=>g(h,c,!0))}),(k=a.j[h])&&3>k.tf?(!a.w&&++k.tf,k.he.la(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),k&&k.he.stop(),a.j[h]=null,f())}};g(b,c)})},RN=function(a){return a.f&&a.a?a.a.bh:webapis.avplay.getCurrentStreamInfo()},bO=function(a){return _.w(function*(){tizen.systeminfo.getPropertyValue("DISPLAY",b=>{a.A=b.resolutionWidth/1920;a.g.debug("Display resolution ratio: ",
|
|
21
|
+
a.A)},b=>{a.g.debug("Could not load DISPLAY property");throw b;})})},dO=function(a){try{webapis.avplay.setListener({onbufferingstart:a.J.bind(a),onbufferingprogress:a.I.bind(a),onbufferingcomplete:a.H.bind(a),onstreamcompleted:a.M.bind(a),oncurrentplaytime:b=>{a.trigger(new _.C(cO,{currentTime:b}))},onevent:a.L.bind(a),onsubtitlechange:a.P.bind(a),ondrmevent:a.K.bind(a),onerror:a.B.bind(a)})}catch(b){a.g.error(b)}},eO=function(a){const b=!!a.m.getTrackManager().Pa();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",
|
|
22
|
+
c)}},fO=function(a,b){try{const c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,Ri:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",iN+d)}catch(c){a.g.debug(c)}},gO=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+iN+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",c),c;}},hO=function(a){let b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case gN:a.g.warn("The application doesn't have the privilege to get the mute state.",
|
|
23
|
+
hN);break;default:a.g.warn(eN,c)}}return!!b},ZN=function(a){return{position:a.getPosition(),state:a.m.getState(),xf:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:hO(a),volume:a.getVolume(),Bi:YN(a),bh:RN(a)}},iO=function(){return new Promise((a,b)=>{if(window.webapis)a();else{const c=document.createElement("script");jN(c,_.ne,d=>a(d));jN(c,_.Ud,d=>b(d));c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},jO=function(a){return _.w(function*(){yield iO();
|
|
24
|
+
const b=new Promise(c=>{(new _.Mj(c)).la(5)});if(!(yield Promise.race([bO(a).then(()=>!0),b.then(()=>!1)])))return a.g.debug("Took to long for the SDK to be ready"),Promise.reject("SDK Timeout")})},kO=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!");eO(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)}})})},lO=function(a,
|
|
25
|
+
b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case gN:a.g.warn("The application does not have the privilege to set mute.",hN);break;default:a.g.warn(eN,c)}}},qO=function(a,b,c){return _.w(function*(){a.l=_.vp(b);const d=a.G,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(mO)),f=c.currentPosition);try{let g=a.l[d].url;if(a.l[d].type===_.uc&&!g.includes(".mpd")){const h=
|
|
26
|
+
new URL(g);h.searchParams.append("cl-ext",".mpd");g=h.toString()}webapis.avplay.open(g);e.nextBandwidth?(gO(a,e.nextBandwidth),a.o=!1):(a.o||fO(a,e),a.o=!0);dO(a);if(b.drm&&b.drm.env){const h={onError:k=>a.m.onError(k),sb:a.m.getNetworkEngine()};a.h=new nO(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(oO));yield kO(a);a.f||a.trigger(new _.C(pO));f&&typeof f===_.r&&0<f&&a.seek(f).catch(h=>{a.g.debug("Couldn't set start position",
|
|
27
|
+
h)});a.f||(b.volume&&a.setVolume(b.volume),b.muted&&lO(a,b.muted),b.autoplay&&a.m.play().catch(h=>{a.g.debug("Autoplay failed",h)}))}catch(g){throw a.g.debug("Error while attempting to load source."),g;}})},rO=function(a){if("NONE"!==a.a.getState()){var b=a.j.getBoundingClientRect();{a=a.a;const c=Math.floor(b.left*a.A),d=Math.floor(b.top*a.A),e=Math.floor(b.width*a.A);b=Math.floor(b.height*a.A);a.g.debug("Setting display area to","x:",c,"y:",d,"width:",e,"height:",b);webapis.avplay.setDisplayRect(c,
|
|
28
|
+
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())},nO=class{constructor(a,b){this.h=a;this.o=null;this.a=_.Ee;this.l=null;this.j=!1;this.f=new Map;this.D=b;this.g=new _.S("clpp.tizen.DrmEngine")}init(){const a=this;return _.w(function*(){var b=_.om[a.h.env]||null;if(!b)throw a.g.debug(_.wa,_.ib+a.h.env+_.aa),new _.I(_.F,6,6015,`DRM environment '${a.h.env}' is missing.`);
|
|
29
|
+
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=_.qm(b,a.h.customData);const d=b[_.sd];d&&a.f.set(_.sd,{pd:d.licenseUrl||"",customData:c,Le:!1});(b=b[_.ud])&&a.f.set(_.ud,{pd:b.licenseUrl||"",customData:c,Le:!1});if(0===a.f.size)throw new _.I(_.F,6,6E3);if((c=a.h.preferredDrmSystem)&&a.f.get(c))a.a=c;else if(a.f.get(_.sd))a.a=_.sd;else if(a.f.get(_.ud))a.a=_.ud;else throw new _.I(_.F,6,6001,"Configuration for the target system is missing.");
|
|
30
|
+
yield mN(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}},pN="DeleteLicenseAfterUse",qN="LicenseServer",rN="CustomData";var xO=class{constructor(a){this.m=a;this.a=this.m.a;this.f=_.pp;this.j=_.bv;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.h=2;this.g=new _.S("clpp.tizen.StateManager")}initialize(){this.a.on(mO,this.C,this);this.a.on(sO,this.B,this);this.a.on(tO,this.A,this);this.a.on(oO,this.H,this);this.a.on(pO,this.G,this);this.a.on(uO,this.F,this)}release(){uN(this,_.pp);this.l=!1;this.o=-1;this.h=2}destroy(){this.release();this.a.off(mO,this.C);this.a.off(sO,this.B);this.a.off(tO,this.A);this.a.off(oO,
|
|
31
|
+
this.H);this.a.off(pO,this.G);this.a.off(uO,this.F);this.m=this.a=null}C(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.C?1:2;uN(this,_.lp)}B(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",tN(this.f))}A(){this.g.debug("Buffering complete. Player state: ",this.a.getState());if(!this.l){this.l=!0;var a=this.m.getConfiguration().autoplay;const b=this.a.getState()===vO;if(!a&&b){uN(this,_.rp);return}}if(a=this.f!==_.qp)a=this.a.getState(),a=a===
|
|
32
|
+
vN||a===wN;a&&xN(this)}H(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===wO?uN(this,_.qp):this.g.error("AVPlay prepares while state is not IDLE")}G(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())}F(){uN(this,_.hp)}getState(){return this.f}};var yO=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 _.S("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 yN(b),b.j){var c={configurationId:"",networkingEngine:b.m.getNetworkEngine(),onContentSteeringInfoFound:()=>null,filterNewPeriod:()=>{},filterAllPeriods:()=>{},onEvent:()=>{},onError:()=>{}};try{b.a=yield b.j.start(a.url,c)}catch(d){b.g.warn(d);try{b.a=
|
|
33
|
+
yield b.j.start(a.url.replace(_.de,"http://"),c)}catch(e){b.g.error(e),b.a=null}}if(b.a&&zN(b.a)){b.h=AN(b);try{yield b.h.open();b.f=BN(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(_.KB,
|
|
34
|
+
a.id);this.w=!0;let b=_.BF(a.textStreams,this.o||"",this.A||"",this.C)[0]||null;this.l&&(a.textStreams.includes(this.l)&&(b=this.l),this.l=null);return{video:null,audio:null,text:b,Wa:null}}F(){const a=this;return _.w(function*(){a.g.debug("canSwitch_");a.w=!1;a.l&&(yield _.HG(a.f,a.l),a.l=null)})}H(){this.g.debug("onError_")}I(){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 CO=class extends _.T{constructor(){super();this.j=this.a=this.m=null;this.f={};this.g=new _.S("clpp.tizen.TrackManager");this.w=this.o=this.l=null;this.B=!1;this.h=1}C(a){var b=a.eventid;a=a.data;switch(b){case zO:0<Object.keys(this.f).length||(this.g.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+IN(this,b[0].extra_info).Bit_rate,b=JN(this,{bandwidth:b}))&&(this.w=b,HN(this,b));break;case AO:GN(this);break;default:this.g.debug("Event type: "+
|
|
36
|
+
b+" data: "+a)}}A(a){a.detail.currentState===_.sp&&this.m.off(_.Nf,this.A)}initialize(a){this.m=a;this.a=this.m.a;this.m.on(_.Nf,b=>{this.B||(b=b.detail,b.currentState===_.sp&&(this.g.debug("Current state",b.currentState),this.B=!0,KN(this)))});this.a.on(BO,this.C,this)}release(){this.f={};this.j=this.w=this.o=this.l=null;this.B=!1;this.h=1}load(){if(this.a&&!(0<Object.keys(this.f).length)){this.j=this.m.h;this.m.off(_.Nf,this.A);this.m.on(_.Nf,this.A,this);try{const a=YN(this.a);this.f=QN(this,a);
|
|
37
|
+
const b=this.f[_.L]||[];b.length&&(this.l=b[0].renditions[0]||null);GN(this)}catch(a){this.g.debug("Could not load track manager")}}}destroy(){this.a.off(BO,this.C);this.a=this.m=null}getVideoTracks(){return this.f[_.M]||[]}getAudioTracks(){return this.f[_.L]||[]}pa(){return this.f[_.K]||[]}qa(){return TN(this,_.M)}La(){return TN(this,_.L)}Pa(){return TN(this,_.K)}ob(){return this.w}Cb(){this.g.info(fN);return null}Db(){this.g.info(fN);return null}Ea(){const a=this.qa();return a?a.track:null}oa(){const a=
|
|
38
|
+
this.La();return a?a.track:null}ta(){const a=this.Pa();return a?a.track:null}xb(a){null===a?(a=this.qa(),$N(this.a,a.bandwidth,null).then(()=>{GN(this)})):0<a.renditions.length&&this.gb(a.renditions[0])}xa(a){a?WN(this,a.renditions[0]):this.g.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")}Ra(a){a?(a=a.renditions[0],this.j?FN(this.j,a.track):WN(this,a)):(this.g.debug("Disabling text tracks"),this.o=null,aO(this.a,!1),this.m.trigger(new _.C(_.Yf)))}gb(a){const b=
|
|
39
|
+
this.qa();this.a.o||a.width!==b.width||a.height!==b.height||a.bandwidth!==b.bandwidth?(this.w=a,HN(this,a),$N(this.a,b.bandwidth,a.bandwidth).then(()=>{GN(this)}).catch(c=>{const d=new _.I(_.F,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...")}vb(a){WN(this,a)}wb(a){this.j?FN(this.j,a.track):WN(this,a)}addTextTrack(){}ua(){return this.a.o}};CO.prototype.isAbrEnabled=CO.prototype.ua;
|
|
40
|
+
CO.prototype.addTextTrack=CO.prototype.addTextTrack;CO.prototype.setTextRendition=CO.prototype.wb;CO.prototype.setAudioRendition=CO.prototype.vb;CO.prototype.setVideoRendition=CO.prototype.gb;CO.prototype.setTextTrack=CO.prototype.Ra;CO.prototype.setAudioTrack=CO.prototype.xa;CO.prototype.setVideoTrack=CO.prototype.xb;CO.prototype.getTextTrack=CO.prototype.ta;CO.prototype.getAudioTrack=CO.prototype.oa;CO.prototype.getVideoTrack=CO.prototype.Ea;CO.prototype.getLoadingTextRendition=CO.prototype.Db;
|
|
41
|
+
CO.prototype.getLoadingAudioRendition=CO.prototype.Cb;CO.prototype.getLoadingVideoRendition=CO.prototype.ob;CO.prototype.getTextRendition=CO.prototype.Pa;CO.prototype.getAudioRendition=CO.prototype.La;CO.prototype.getVideoRendition=CO.prototype.qa;CO.prototype.getTextTracks=CO.prototype.pa;CO.prototype.getAudioTracks=CO.prototype.getAudioTracks;CO.prototype.getVideoTracks=CO.prototype.getVideoTracks;var GO=class extends _.nu{constructor(a){super();this.m=a;this.h=null;this.g=new _.S("clpp.tizen.Middleware");this.F=1;this.C=!1;this.l=null;this.G=0;this.o=!0;this.f=!1;this.a=null;this.A=1;this.w=!1;this.j={}}J(){this.w=!0;this.f||this.trigger(new _.C(mO))}I(a){this.w=!0;this.trigger(new _.C(sO,{percent:a}))}H(){this.w=!1;this.trigger(new _.C(tO))}M(){this.trigger(new _.C(uO))}L(a,b){this.trigger(new _.C(BO,{eventid:a,data:b}))}P(a,b,c,d,e){this.trigger(new _.C(DO,{duration:a,text:b,subtitleType:c,
|
|
42
|
+
attriCount:d,attributes:e}))}K(a,b){this.trigger(new _.C(EO,{drmType:a,drmData:b}));this.h&&(a=this.h,a.j&&(a.a===_.ud&&"Challenge"===b.name?oN(a,b):"DrmError"===b.name&&(a.g.debug("DrmError event",b),b=new _.I(_.F,6,6005,{message:JSON.stringify(b)}),a.D.onError(b))))}B(a){this.trigger(new _.C(FO,{eventType:a}))}play(){const a=this.getState(),b=()=>new Promise((c,d)=>{let e=null;const f=()=>{c();clearTimeout(e)};this.one(cO,f,this);e=setTimeout(()=>{this.off(cO,f);d("Timeout")},3E4)});if(a===wO)return(new Promise((c,
|
|
43
|
+
d)=>{webapis.avplay.prepareAsync(()=>{eO(this);c(webapis.avplay.play())},e=>{this.trigger(new _.C(FO));d(e)})})).then(()=>b());if(a===wN||a===vO)try{return webapis.avplay.play(),b()}catch(c){return Promise.reject(c)}return a===vN?Promise.resolve():Promise.reject("Player is in invalid state")}pause(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===wN?Promise.resolve():Promise.reject()}setPlaybackRate(a){const b=this.getState();if(b===vO||b===vN||b===wN){try{webapis.avplay.setSpeed(a),
|
|
44
|
+
this.F=a}catch(c){return this.g.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.F)}return!0}this.g.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1}getPlaybackRate(){return this.F}load(a,b){const c=this;return _.w(function*(){c.g.debug("configure()",b||"");try{yield jO(c),yield qO(c,a,b)}catch(d){throw new _.I(_.F,7,7003,null,d);}})}getState(){if(this.f&&this.a)return this.a.xf;try{return webapis.avplay.getState()}catch(a){this.B(JSON.stringify(a))}}seek(a){const b=
|
|
45
|
+
1E3*a;return new Promise((c,d)=>{this.C=!0;this.m.trigger(new _.C(_.ng));webapis.avplay.seekTo(b,()=>{this.C=!1;this.m.trigger(new _.C(_.mg));c()},()=>{this.C=!1;d()})})}getPosition(){if(this.f&&this.a)return this.a.position;try{return webapis.avplay.getCurrentTime()/1E3}catch(a){this.B(JSON.stringify(a))}}getDuration(){if(this.f&&this.a)return this.a.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.B(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.he.stop()}this.j={};this.F=1;this.C=!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 gN:this.g.debug("The application does not have the privilege to get the volume.",hN);break;default:this.g.debug(eN,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 gN:this.g.warn("The application does not have the privilege to set the volume.",hN);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.B(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.G=
|
|
48
|
+
a}getSourceIndex(){return this.G}getLoadedSource(){return this.l&&this.l[this.getSourceIndex()]}},wO="IDLE",vO="READY",vN="PLAYING",wN="PAUSED",LN=_.Cb,MN=_.kB,VN="TEXT",AO="PLAYER_MSG_RESOLUTION_CHANGED",zO="PLAYER_MSG_BITRATE_CHANGE",sN="PLAYREADY",nN="WIDEVINE_CDM";var KO=class extends _.nu{constructor(){super();this.a=new GO(this);this.f=new xO(this);this.configuration=this.B=_.Xl();this.w=null;this.g=new _.S("clpp.tizen.Player");this.j=null;this.l=new CO;this.C=new _.Xr;this.o=this.h=null;this.A=!1}I(){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(_.cg,
|
|
49
|
+
{currentTime:a.currentTime/1E3}))}J(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=_.Oi(d))&&this.o.append([new _.St(b,c,d)],[])}G(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)}K(){this.A||(this.g.debug("Initial buffering completed..."),this.A=!0)}H(a){this.g.debug(`Error: TYPE: ${a.eventType}`);uN(this.f,_.ip);a=new _.I(_.F,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(uO,this.I,this);this.a.on(cO,this.F,this);this.a.on(DO,this.J,this);this.a.on(EO,this.G,this);this.a.on(FO,this.H,this);this.a.on(tO,this.K,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();a=HO;HO+=1;a="__clpp_tizen_player_"+a;this.j=_.Lp(_.Fe,{id:a,type:"application/avplayer"});this.w.addElementToContainer(this.j,!0);var c=this.w.getMedia();if(c){a=this.j;{b=[_.Jg,_.ae,"position",
|
|
51
|
+
_.he,"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}_.Np(a,d);rO(this)}}getSurface(){return this.w}getConfiguration(){return this.configuration}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.$a)}appendLoad(){return Promise.reject(_.$a)}seekWith(){return Promise.reject(_.$a)}setSeekInterceptor(){}setPlaybackSessionId(){}getBandwidthEstimate(){return null}destroy(){const a=
|
|
52
|
+
this;return _.w(function*(){yield a.release();a.a.off(uO,a.I);a.a.off(cO,a.F);a.a.off(DO,a.J);a.a.off(EO,a.G);a.a.off(FO,a.H);a.a.off(tO,a.K);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 IO}getPlaybackRate(){return this.a.getPlaybackRate()}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}setPlaybackRate(a){this.a.setPlaybackRate(a)}getPosition(){return this.getMediaPosition()}getMediaPosition(){return 0<
|
|
53
|
+
(this.configuration.startTime||0)&&!this.A?0:this.f.getState()===_.hp?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 _.mu}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=_.Zl(b.B,a);var c=_.$o(b.configuration,[_.ce,"native"]);b.o=c.create(b);c=_.vp(b.configuration)[0];if(b.configuration.tizen&&b.configuration.tizen.sideStreamText){b.h=
|
|
55
|
+
new yO;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(_.Ue));rO(this);return this.a.play().then(()=>{xN(this.f)})}pause(){return this.a.pause().then(()=>{xN(this.f)})}getState(){return this.f.getState()}getPeriods(){return[]}onError(a){const b=new _.C(_.Ud,{detail:a});a.severity===_.F&&(uN(this.f,_.ip),this.a.release());this.trigger(b);b.defaultPrevented&&(b.a=!0)}getDrmInfo(){return this.a.getDrmInfo()}isEnded(){return this.f.getState()===
|
|
56
|
+
_.hp}isPaused(){return this.a.getState()===wN}isMuted(){return hO(this.a)}setMuted(a){lO(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 JO).canPlay(a,b)}getTimelineCues(){return[]}getCueTimeline(){return null}getTextDisplayer(){return this.o}resetAbr(){}},
|
|
57
|
+
IO="clpp.tizen",HO=0,JO=class{a(){return IO}canPlay(a){a=a.type;const b=!!window.webapis;if((a===_.uc||a===_.Ql||a===_.Bc)&&b){if(_.Qj(2))return 2;if(_.Qj(3)||_.Qj(4)||_.Qj(5)||_.Qj(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 KO}};_.x("clpp.tizen.TizenComponent",class extends _.uv{f(){_.yh(new JO)}a(){var a=IO;a&&_.wh[a]&&(delete _.wh[a],_.xh.info("Removed Player factory: '"+a+"'"))}id(){return"tizen"}});var mO="onbufferingstart",sO="onbufferingprogress",tO="onbufferingcomplete",uO="onstreamcompleted",cO="oncurrentplaytime",BO="onevent",DO="onsubtitlechange",EO="ondrmevent",FO="onerror",oO="preparingstart",pO="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
|
-
let e=Number(a[3]),f=Number(a[4]);f+=(Number(a[5])||0)/b.f;e+=f/b.frameRate;c=e+60*d+3600*c}}else
|
|
3
|
-
"$1em")},
|
|
4
|
-
e);for(const e of a.j)d.appendChild(
|
|
5
|
-
|
|
6
|
-
-1===[_.da,"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
|
-
"lineHeight","opacity","padding",
|
|
9
|
-
f.get(this.o))){g.region=f.build(a,e);g.textAlign=
|
|
10
|
-
a.getAttribute("imagetype"),a=a.j.trim(),d="PNG"===e&&"Base64"===d&&0<a.length?`data:image/png;base64,${a}`:null,g.backgroundImage=d||"");return g}};var
|
|
11
|
-
d,1,100);c.widthUnits=
|
|
12
|
-
this.a){d=this.a.textOutline.split(" ");e="black";let g=".4em";const h=d[0]&&d[0].trim(),k=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!
|
|
13
|
-
"monospace").replace("monospaceSerif","monospace").replace("proportionalSansSerif","sans-serif").replace("proportionalSerif","sans-serif").replace("sansSerif","sans-serif").replace("default","sans-serif")};`:"");a:{if(
|
|
14
|
-
|
|
15
|
-
["color","color"],[
|
|
16
|
-
_.
|
|
17
|
-
new
|
|
18
|
-
g=new
|
|
19
|
-
c.getId()),c=d,g=a,
|
|
20
|
-
c.f.set(b,g),c.o.push(g),c=g):c=null,c&&a.l.push(c.getId());e=
|
|
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 tx='application/mp4; codecs\x3d"stpp.ttml"',ux='application/mp4; codecs\x3d"stpp.ttml.im1i"',vx='application/mp4; codecs\x3d"stpp.ttml.im1t"',wx="backgroundColor",xx="direction",yx="displayAlign",zx="region",Ax="textAlign",Bx="textDecoration",Cx="writingMode",Dx=function(a,b,c){a=a.f;for(let d=a.length-1;0<=d;d--){const e=b.get(a[d]);if(e.hasAttribute(c))return e.getAttribute(c)}return null},Lx=function(a,b){var c=null;if(Ex.test(a)){{a=Ex.exec(a);c=Number(a[1]);const d=Number(a[2]);
|
|
2
|
+
let e=Number(a[3]),f=Number(a[4]);f+=(Number(a[5])||0)/b.f;e+=f/b.frameRate;c=e+60*d+3600*c}}else Fx.test(a)?c=Gx(Fx,a):Hx.test(a)?c=Gx(Hx,a):Ix.test(a)?(a=Ix.exec(a),c=Number(a[1])/b.frameRate):Jx.test(a)?(a=Jx.exec(a),c=Number(a[1])/b.a):Kx.test(a)&&(c=Gx(Kx,a));return c},Gx=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)},Mx=function(a){return a.split(":").pop()},Nx=function(a){return a.replace(/(\d*\.?\d+)c/g,
|
|
3
|
+
"$1em")},Px=function(a,b){for(;Ox.test(a);){const c=Ox.exec(a)[0];a=a.replace(c,`${parseInt(c,10)/b}em`)}return a},Qx=function(a){return a?a.replace(/(\d*\.?\d+)%/g,(b,c)=>`${c/100}em`):""},Rx=function(a,b,c){a=Dx(a,b,Ax);if(!a&&c&&(a=Dx(c,b,Ax),!a&&"rltb"===Dx(c,b,Cx)))return _.Sd;switch(a){case _.Vc:return _.Nt;case _.zf:case _.Sd:return _.Sd;default:return _.Mf}},Sx=function(a,b,c){if(_.Ki(a.w))return document.createTextNode(_.Oi(a.w||""));if(a.A)return _.Lp("br");const d=_.Lp("span");for(const e of a.f)_.Mp(d,
|
|
4
|
+
e);for(const e of a.j)d.appendChild(Sx(c.get(e),b,c));return d},Vx=function(a,b,c,d){const e=Tx.exec(a);a=Ux.exec(a);return typeof b===_.r&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},Wx=function(a,b){return typeof b===_.r&&0<b?_.Vt:Ux.test(a)?0:_.Vt},Xx=function(a,b,c){return typeof a===_.r?a:typeof b===_.r?b:c},Yx=function(a,b){a=a.getAttribute("extent");return(a=Ux.exec(a))?Number(a[b]):null},$x=function(a){a=a.getAttribute("cellResolution");return(a=Zx.exec(a))?Number(a[2]):null},
|
|
5
|
+
by=function(){return`${"inline-"}${ay++}`},dy=function(a){return cy.some(b=>b in a.attributes)},ey=function(a,b){if(0===b.length)return[];const c=[];for(const d of b)a.a.has(d)&&c.push(...ey(a,a.a.get(d).f),d);return c},fy=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)},gy=function(a){return Mx(a.h.nodeName)},jy=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===[_.da,"span","br"].indexOf(b.nodeName)&&(c=k.a,d=k.j,f=[...k.f],g={},hy.forEach(l=>{l in k.attributes&&(g[l]=k.attributes[l])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(zx)&&(c=b.getAttribute(zx));b.hasAttribute(_.Sf)&&f.push(...b.getAttribute(_.Sf).split(" "));d=Array.from(b.attributes).map(k=>k.name);for(const k of d)d=Mx(k),g[d]=b.getAttribute(k);d=g.backgroundImage}c=new iy(b,c,d,e,f,g);a.a.set(b,c);return c},ky=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")}`},ly=class{constructor(a,b,c){this.h=a;this.f=b;this.a=c}getId(){return this.h}hasAttribute(a){return a in this.a}getAttribute(a){return this.a[a]}};var my=class extends ly{constructor(a,b,c){super(a,[],c);this.j=b||""}};var ny=class extends ly{constructor(a,b,c){super(a,b,c)}};var Ex=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Fx=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,Hx=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,Ix=/^(\d*(?:\.\d*)?)f$/,Jx=/^(\d*(?:\.\d*)?)t$/,Kx=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,Tx=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,Ux=/^(\d+)px (\d+)px$/,Zx=/^(\d+) (\d+)$/,Ox=/(\d+)px/,oy=/^(\d+px|\d+em|\d*\.?\d+c)$/,cy=[wx,"color",xx,yx,"fontFamily","fontSize","fontStyle","fontWeight",
|
|
8
|
+
"lineHeight","opacity","padding",Ax,Bx,"textOutline",Cx,"zIndex"],hy=["begin",_.Sd];var py=class extends ny{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=Lx(this.a.begin,b);b=Lx(this.a.end,b);if(null===h||null===b)return null;h+=c;b+=c;c=_.Lp(_.Dd);for(const k of this.j)c.appendChild(Sx(g.get(k),e,g));g=new _.St(h,b,c.innerHTML.trim(),_.fg);g.cssClassList=[...this.f];g.textAlign=Rx(this,e,null);g.writingMode=_.Ot;g.line=-1;g.lineInterpretation=_.Pt;g.lineAlign=_.Qt;g.containerRows=Xx(null,$x(a),15);if(this.o&&(f=
|
|
9
|
+
f.get(this.o))){g.region=f.build(a,e);g.textAlign=Rx(this,e,f);a:switch(Dx(f,e,Cx)){case "tb":case "tblr":a=_.qg;break a;case "tbrl":a=_.rg;break a;default:a=_.Ot}g.writingMode=a;a:switch(Dx(f,e,yx)){case _.Vc:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(Dx(f,e,yx)){case _.Vc:a=1;break a;default:a=_.Pt}g.lineInterpretation=a;a:switch(Dx(f,e,yx)){case _.Vc:e=_.Vc;break a;default:e=_.Qt}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 qy=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 ry=class extends ny{constructor(a,b,c){super(a,b,c)}build(a,b){const c=new _.Xt;c.id=this.getId();const d=Xx(a.j.containerWidth,Yx(a,1),720);a=Xx(a.j.containerHeight,Yx(a,2),480);a:switch(Dx(this,b,yx)){case "after":var e="flex-start";break a;case _.Vc:e=_.Vc;break a;default:e="flex-end"}c.displayAlign=e;a:switch(Dx(this,b,Cx)){case "tb":case "tblr":e="row-reverse";break a;case "tbrl":e="row";break a;default:e=_.od}c.writingMode=e;e=this.getAttribute("extent")||Dx(this,b,"extent");c.width=Vx(e,
|
|
11
|
+
d,1,100);c.widthUnits=Wx(e,d);c.height=Vx(e,a,2,100);c.heightUnits=Wx(e,a);b=this.getAttribute("origin")||Dx(this,b,"origin");c.viewportAnchorX=Vx(b,d,1,0);c.viewportAnchorY=Vx(b,a,2,0);c.viewportAnchorUnits=Wx(b,d);c.cssClassList=[...this.f];return c}};var sy=class extends ly{constructor(a,b){super("root-container",[],b);this.j=a}};var uy=class extends ly{constructor(a,b,c){super(a,b,c)}build(a){var b=null;var c=$x(a);c&&(b=Xx(a.j.containerHeight,Yx(a,2),480)/c);b=Xx(a.j.fontSizeRadix,b,16);a=[];c=`::ttml .${this.h}, ::ttml .${this.h} * {`;for(const [g,h]of ty.entries())g in this.a&&(c+=`${h}:${Nx(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&&!oy.test(h)&&oy.test(k)&&oy.test(l)?(e=h,g=k):2===d.length&&!oy.test(h)&&oy.test(k)?(e=h,g=k):2===d.length&&oy.test(h)&&oy.test(k)&&(g=h);if(""!==g){g=Nx(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=Qx(this.a.textShadow),d=Nx(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(Bx 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
|
+
Nx(this.a.padding),d+=";"):d="";f=c=c+f+d;"lineHeight"in this.a?(c="",d=this.a.lineHeight,d=Nx(d),d=Px(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=Nx(c);c=Px(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}},ty=new Map([[wx,"background-color"],
|
|
15
|
+
["color","color"],[xx,xx],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var vy=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=[]}},ay=0;var yy=class{constructor(a){this.a=a.firstChild;this.f=new Set}hd(){return!!this.a}next(){if(!this.a)return null;let a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!wy.has(Mx(a.nodeName))||xy.has(Mx(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&&!wy.has(Mx(a.nodeName))));const b=this.a;this.a=a;return b}},wy=new Set(["tt","head","layout",_.ye,_.ee,zx,"styling",_.Sf,"body",
|
|
16
|
+
_.Dd,"p","span","br"]),xy=new Set([_.Sf,_.ee]);var iy=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 zy=class{constructor(){this.a=new Map}};var Ay=class{constructor(a){this.a=a;this.f=new DOMParser}parseInit(){}parseMedia(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.ah(this.a.ttml||{}),e=_.G(a,0,c[0]);e=_.Bi(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.Xf)}catch(m){throw new _.I(_.F,2,2005,"Failed to parse TTML.");}d=new vy(d);e=new zy;f=new yy(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=_.G(a,b,h);k=_.zk(k);const m=`urn:mpeg:14496-30:subs:${g}`;d.h.set(m,
|
|
17
|
+
new my(m,k,{imageType:"PNG",encoding:"Base64"}));b+=h}for(;f.hd();)a=f.next(),a=jy(e,a),c=d,b=a,"tt"===gy(b)&&(c.l=new sy(c.B,Object.assign({},b.attributes))),c=d,b=a,"tt"===gy(b)&&(c.w=new qy(b.attributes.frameRate,b.attributes.subFrameRate,b.attributes.frameRateMultiplier,b.attributes.tickRate)),c=d,b=a,gy(b)!==_.ee||b.attributes.begin||b.attributes.end||(g=`#${b.getId()}`,c.h.set(g,new my(g,b.h.textContent,b.attributes))),c=d,g=a,gy(g)===_.ee&&g.attributes.begin&&g.attributes.end?(b=`#${by()}`,
|
|
18
|
+
g=new my(b,g.h.textContent,g.attributes),c.h.set(b,g),c=g):c=null,c&&(a.j=c.getId()),c=d,b=a,gy(b)===_.Sf&&(g=b.getId()||by(),h=new uy(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,gy(g)!==_.Sf&&dy(g)?(b=by(),g=new uy(b,[],Object.assign({},g.attributes)),c.a.set(b,g),c=g):c=null,c&&a.f.push(c.getId()),c=d,g=a,gy(g)!==_.Dd||!g.attributes.extent&&!g.attributes.origin?c=null:(b=by(),g=new ry(b,ey(c,g.f),Object.assign({},g.attributes)),c.j.set(b,g),c=g),c&&(a.a=
|
|
19
|
+
c.getId()),c=d,g=a,gy(g)!==zx?c=null:(b=g.getId(),g=new ry(b,ey(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===[_.da,"span","br"].indexOf(gy(g))||0===b.length?c=null:(h=b[b.length-1],c.f.has(h)?(b=by(),g=new py(b,g.h.nodeName===_.da?g.h.textContent:null,"br"===gy(g),g.a,g.j,ey(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"===gy(g)||g.j?(b=by(),g=new py(b,null,!1,g.a,g.j,ey(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=fy(d);f=[];for(l of d.a.values())f.push(...l.build(d.l));var l=f;return{cues:e,styles:l}}};var By=class{constructor(a){this.f=a}a(a){var b=new Ay(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=ky(d.startTime)+" --\x3e "+ky(d.endTime);{var c=d;const e=[];switch(c.textAlign){case _.he:e.push("align:left");break;case _.zf:e.push("align:right");break;case _.Nt:e.push("align:middle");break;case _.Mf:e.push("align:start");break;case _.Sd:e.push("align:end")}switch(c.writingMode){case _.qg:e.push("vertical:lr");break;case _.rg:e.push("vertical:rl")}c=
|
|
21
|
+
e.length?" "+e.join(" "):""}b=a+(b+c+"\n");b+=d.payload+"\n\n"}return _.Fi(b)}},Cy=class{probe(a,b){return a===_.yc&&b===_.Wf}create(a){return new By(a)}};var Dy=class{constructor(a){this.a=new Ay(a);this.g=new _.S("clpp.ttml.Mp4TtmlParser")}parseInit(a){let b=!1;(new _.Nm).N(_.Be,_.Gm).N(_.eg,_.Gm).N(_.te,_.Gm).N(_.Ae,_.Gm).N(_.Pf,_.Gm).fa(_.Rf,_.Hm).N("stpp",c=>{b=!0;c.parser.stop()}).parse(a);if(!b)throw new _.I(_.F,2,2007);}parseMedia(a,b){let c=!1,d=[],e=[];const f=[];(new _.Nm).N("moof",_.Gm).N("traf",_.Gm).fa("subs",g=>{const h=_.O(g.reader);for(let k=0;k<h;++k){g.reader.skip(4);const l=_.zm(g.reader);for(let m=0;m<l;++m){const n=1===g.version?
|
|
22
|
+
_.O(g.reader):_.zm(g.reader);f.push(n);g.reader.skip(6)}}}).N(_.se,_.Im(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 _.uv{constructor(){super();this.j=new Cy}f(){_.vt(_.yc,Ay);_.vt(_.wc,Dy);_.vt(tx,Dy);_.vt(vx,Dy);_.vt(ux,Dy);_.xl.push(this.j)}a(){_.xt(_.yc);_.xt(_.wc);_.xt(tx);_.xt(vx);_.xt(ux);_.zl(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 ix="VerimatrixVCAS",jx="clpp.verimatrix.Vcas",kx="clpp.verimatrix.VcasComponent",mx=function(a,b){return a.C===lx?(a=Object.assign({},{deviceId:_.Ak(_.Hi(a.A))},a.a&&{authenticator:_.Ak(_.Hi(a.a))}),b+_.Ri(a)):b},sx=class extends _.su{constructor(a){super(ix);const b={};b[nx]=nx;b[ox]=ox;const {deviceId:c,authenticator:d,licenseRequestVuidLocation:e=lx,httpHeaderNames:f=b,widevineLicenseUrl:g,playReadyLicenseUrl:h,fairPlayLicenseUrl:k,fairPlayCertificateUrl:l,fairPlaySiteId:m,fairPlayAssetIdStrategy:n=
|
|
2
|
+
px}=a;this.A=c;this.a=d;this.C=e;this.B=f;this.w=mx(this,g);this.o=mx(this,h);this.l=mx(this,k);this.j=l;this.G=m;this.F=n;this.g=new _.S(jx);_.Li(this.w)?this.g.warn(_.Hb):this.Xa(_.ud,{licenseUrl:this.w,videoRobustness:[_.ob,void 0],audioRobustness:[_.nb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.Li(this.o)?this.g.warn(_.eb):this.Xa(_.sd,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],
|
|
3
|
+
modifiers:{licenseRequest:this.h.bind(this)}});_.Li(this.l)?this.g.warn(_.Ea):_.Li(this.j)?this.g.warn(_.Da):this.Xa(_.qd,{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===qx){a=this.B[ox];const c={};c[this.B[nx]]=this.A;this.a&&(c[a]=this.a);Object.keys(c).forEach(d=>{b.headers[d]=c[d]})}}H(a,b){a=_.Mm(b);switch(this.F){case rx:a=_.Ri({r:a,cj:this.G},!0)}return a}J(a,b){this.h(a,
|
|
4
|
+
b);_.Um(b)}K(a,b){_.Vm(b)}};_.x(jx,sx);sx.prototype.constructor=sx.prototype.constructor;sx.NAME=ix;var lx="query-string",qx="http-header";sx.LicenseRequestVuidLocation={QUERY_STRING:lx,HTTP_HEADER:qx};var nx="DeviceId",ox="Authenticator";sx.LicenseRequestHttpHeader={DEVICE_ID_HEADER:nx,AUTHENTICATOR_HEADER:ox};var px="keyid",rx="contentid-siteid";sx.FairPlayAssetIdStrategy={KEYID:px,CONTENTID_SITEID:rx};_.x(kx,class extends _.uv{constructor(){super();this.g=new _.S(kx)}a(){delete _.om.VerimatrixVCAS}h(a){a=a.getConfiguration();if(a.drm&&a.drm.env===ix){({customData:a}=a.drm);if(!a)throw new _.I(_.F,7,7100,_.vd);a=new sx(a);this.g.info("Registering the Verimatrix VCAS Ultra environment");_.pm(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.h=!1}H(a){const b=this;return _.
|
|
4
|
-
a.l} seconds ago`);a.l=b;a.f.stop();a.f.
|
|
5
|
-
c=((new _.
|
|
6
|
-
!0)}a.progress.eventNumber=this.f;a.timestamp=(new Date).toISOString();this.g.debug("Fire an event");b=_.mj(this.l);b.method=_.
|
|
7
|
-
a.onError(new _.I(1,9,9200));return}this.g.debug(_.
|
|
8
|
-
this.h&&this.h.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var $w="Registering listeners",ax="clpp.vimond.VimondPlugin",bx=function(a,b){a.m.trigger(new _.C(_.zg,{detail:b}))},cx=function(a,b,c){b&&(a.A=!0,a.f.stop());a.m.onError(new _.I(b?_.F:1,9,9201,c))},dx=function(a,b){const c=a.m.getState();if(1===b)return["str-start",_.ef];if(a.h)return[_.Sd,_.Qe];if(c===_.hp)return[_.Sd,null];if(c===_.ip)return[_.Ud,_.Qe];b=_.Qe;if(c===_.lp||c===_.sp||a.f)b=_.ef;return["period",b]},ex=class{constructor(a,b,c,d,e){this.J=a;this.K=b;this.L=c;this.m=d;this.C=
|
|
2
|
+
e;this.a=new _.Kt;this.j=!0;this.Y=this.h=this.A=!1;this.B=null;this.f=new _.Mj(this.w.bind(this));this.g=new _.S("clpp.vimond.VimondDispatcher");this.l=this.o=0;this.m&&this.a&&(this.g.debug($w),this.a.on(this.m,_.Nf,this.H.bind(this)),this.a.on(this.m,_.cg,this.I.bind(this)),this.a.on(this.m,_.Sb,this.F.bind(this)),this.a.on(this.m,_.Tb,this.G.bind(this)))}I(){this.Y||(this.Y=1<Math.abs(this.o-this.m.getPosition()));this.o=this.m.getPosition()}F(){this.g.debug("Ad break started");this.h=!0}G(){this.g.debug("Ad break stopped");
|
|
3
|
+
this.h=!1}H(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.A||b.h||(d!==b.B||b.Y?b.j&&d!==_.sp||(b.Y&&[_.rp,_.lp].includes(d)?b.g.debug("Seeking"):(b.Y&&d===_.sp&&(b.g.debug("Seeked"),b.Y=!1),[_.sp,_.rp,_.ip,_.hp].includes(d)&&(b.B=d,yield b.w(),d===_.hp&&b.f.stop()))):b.g.debug("Ignore transition"))})}w(){const a=this;return _.w(function*(){var b=Math.floor(Date.now()/1E3);0<a.l&&a.g.debug(`Last event was ${b-
|
|
4
|
+
a.l} seconds ago`);a.l=b;a.f.stop();a.f.la(a.j?10:a.J);a.j=!1;try{var c=yield a.C.fireEvent();bx(a,c)}catch(d){b=d.code,c=d.data,[1002,1003].includes(b)?(a.g.debug("Unreachable service"),bx(a,c),cx(a,a.K,c)):1001===b?(a.g.debug("Generic service error"),bx(a,c),cx(a,a.L,c)):a.g.error(d.toString())}})}};var fx=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 _.S("clpp.vimond.VimondService");this.f=0}fireEvent(){this.f++;const a=_.$g(this.o);a.client.buildName=_.ra;a.client.buildVersion=_.ea;var b=a.client;var c=(c=this.a.m.getDrmInfo())?c.keySystem:"";b.drm=c;a.client.pageUrl=document.location.href;a.client.streamUrl=this.a.m.getLoadedSource().url;a.client.userAgent=navigator.userAgent;a.client.videoFormat=this.a.m.getLoadedSource().type||"";b=a.client;c=this.a.m.getLoadedSource();
|
|
5
|
+
c=((new _.Lm(c.url)).scheme||"").replace(":","");b.videoProtocol=c;b=dx(this.a,this.f);a.client.playerEvent=b[0]||"";a.client.playerState=b[1]||"";a.progress.vod&&(a.progress.vod.position=this.a.getPosition());if(b=a.progress.live){c=this.a;var d=c.m.getPresentationStartTime()||0;c=Math.floor(d+c.m.getPosition());c=(new Date(1E3*c)).toISOString();b.position=c;d=this.a;c=d.m.getPosition();d=d.m.getSeekRange().end;c=30>Math.abs(d-c);b.onLiveEdge=c;typeof b.liveResumePossible!==_.Mc&&(b.liveResumePossible=
|
|
6
|
+
!0)}a.progress.eventNumber=this.f;a.timestamp=(new Date).toISOString();this.g.debug("Fire an event");b=_.mj(this.l);b.method=_.db;b.contentType="application/json";b.headers.Authorization=`Bearer ${this.h}`;b.body=_.Hi(JSON.stringify(a));return this.j.fetch(b).U}gf(a){this.h=a}};var gx=class{constructor(a){this.m=a;this.a=new _.Kt;this.g=new _.S("clpp.vimond.VimondAdapter");this.f=this.h=!1;this.m&&this.a&&(this.g.debug($w),this.a.on(this.m,_.vf,this.o.bind(this)),this.a.on(this.m,_.Sb,this.j.bind(this)),this.a.on(this.m,_.Tb,this.l.bind(this)))}getPosition(){return Math.floor(this.m.getPosition())}o(){this.h=!0}j(){this.f=!0}l(){this.f=!1}};var hx=class extends _.Iv{constructor(){super();this.a=!1;this.g=new _.S(ax);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()===_.ed&&(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 _.I(1,9,9200));return}this.g.debug(_.sa);c=b.failIfUnreachable;typeof c!==_.Mc&&(c=!0);var d=b.failOnError;typeof d!==_.Mc&&(d=!0);this.f=new gx(a);this.h=new fx(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new ex(b.playerEventRequest.eventInterval,c,d,a,this.h)}}onPlayerWillRelease(){if(this.a){if(this.f){var a=this.f;a.g.debug(_.xb);_.Hh(a.a)}this.j&&(a=this.j,a.g.debug(_.xb),_.Hh(a.a),a.f.stop());this.j=this.h=this.f=null}}onPlayerWillDestroy(){}id(){return"vimond"}gf(a){this.a&&
|
|
8
|
+
this.h&&this.h.gf(a)}};_.x(ax,hx);hx.prototype.updateAuthToken=hx.prototype.gf;hx.Id="vimond";_.fs(new class{create(){return new hx}});};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 _.I(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
|
|
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
|
|
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.P=new
|
|
8
|
-
if(void 0!==d&&_.
|
|
9
|
-
|
|
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&&(
|
|
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.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.
|
|
13
|
-
0,a.h);a=this.o;a.a.bindTexture(a.a.TEXTURE_2D,null);this.C.a.useProgram(null)}}}}
|
|
14
|
-
this.B,!1)}ia(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 Gw="touchmove",Hw="touchstart",Jw=function(a,b,c){c*=.5;const d=Math.sqrt(a*a+b*b),e=Math.sin(c);return new Iw(a/d*e,b/d*e,0/d*e,Math.cos(c))},Kw=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)},Lw=function(a,b){isFinite(b)?(a.x*=b,a.y*=b,a.a*=b):(a.x=0,a.y=0,a.a=0)},Mw=function(a,b){return a.x*b.x+a.y*b.y+a.a*b.a},Nw=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},Ow=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},Qw=function(a){var b=new Pw(0,0,0),c=new Pw(0,0,1);const d=new Pw,e=new Pw,f=new Pw;a=a.a;var g=
|
|
3
|
+
new Pw(0,1,0);f.x=b.x-g.x;f.y=b.y-g.y;f.a=b.a-g.a;g=f.length();Lw(f,1/g);c=Nw(d,c,f);g=c.length();Lw(c,1/g);Nw(e,f,d);a[0]=d.x;a[1]=d.y;a[2]=d.a;a[3]=-Mw(d,b);a[4]=e.x;a[5]=e.y;a[6]=e.a;a[7]=-Mw(e,b);a[8]=f.x;a[9]=f.y;a[10]=f.a;a[11]=-Mw(f,b);a[12]=0;a[13]=0;a[14]=0;a[15]=1},Rw=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 _.I(1,9,9004,"Unable to compile GL shader: "+
|
|
4
|
+
a.a.getShaderInfoLog(b));return b},Sw=function(a){a.a&&(a.a.removeEventListener("mousemove",a.A,!1),a.a.removeEventListener(Gw,a.A,!1),a.a.removeEventListener("mouseup",a.B,!1),a.a.removeEventListener("touchend",a.B,!1))},Tw=function(a){const b=Jw(1,0,a.l*Math.PI/180);Kw(Jw(0,1,a.j*Math.PI/180),a.P);Kw(b,a.R);Qw(a.ca);Ow(a.ea,a.P,a.ca);Ow(a.G,a.R,a.ea)},Iw=class{constructor(a,b,c,d){this.x=a||0;this.y=b||0;this.a=c||0;this.f=d||1}};var Pw=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 Uw=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,p,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]=p;A[7]=u;A[11]=v;A[15]=y;return this}};var Vw=class{constructor(a){this.a=a;this.f=a.createProgram();this.l=Rw(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=Rw(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 _.I(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 Ww=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 Xw=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 Yw={alpha:!1,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!1,devicePixelRatio:1},Zw=class extends _.Iv{constructor(){super();this.o=this.w=this.K=this.I=this.C=this.Z=this.G=this.f=this.a=this.m=null;this.g=new _.S("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.P=new Uw;this.R=new Uw;this.ca=new Uw;this.ea=new Uw;this.A=this.ia.bind(this);this.B=this.ya.bind(this);this.J=this.ha.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&&_.hh(d))this.H=d;else throw new _.I(1,7,7100,"fieldOfView configuration must be a number");if(void 0!==e&&_.hh(e)&&0<e)this.V=e;else throw new _.I(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",Yw)||this.a.getContext("experimental-webgl",
|
|
9
|
+
Yw);if(!this.f)throw new _.I(1,9,9003,"Unable to create GL context");this.G=new Uw;Qw(this.G);this.Z=new Ww(this.f);this.C=new Vw(this.f);this.I=new Uw;this.K=new Uw;this.o=this.w=null;this.a.addEventListener(_.yf,this.F)}a.addElementToContainer(this.a,!0,!0);a.hideMediaElement();b.vr.attachMouseListener&&(this.a.addEventListener("mousedown",this.J,!1),this.a.addEventListener(Hw,this.J,!1));this.F();this.T()}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&&(Sw(this),this.a.removeEventListener(_.yf,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"}T(){if(this.m&&this.f){var a=this.m.getSurface();if(a&&(a=a.getMedia())&&a.tagName.toLowerCase()===_.t){this.w=requestAnimationFrame(this.T.bind(this));
|
|
11
|
+
var b=this.f;this.o||a.readyState!==a.HAVE_ENOUGH_DATA||(this.o=new Xw(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=Ow(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.Z;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)}}}}ha(a){this.g.debug("Mouse Down. Enable VR mouse interaction");a.preventDefault();if(0===a.button||a.type===Hw)a.type===Hw?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(Gw,this.A,!1),this.a.addEventListener("mouseup",this.B,!1),this.a.addEventListener("touchend",
|
|
14
|
+
this.B,!1)}ia(a){a.preventDefault();var b=a.clientX;let c=a.clientY;a.type===Gw&&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 {Vg:e,Wg:f}={Vg:a*b*(this.L?-1:1),Wg:d*b*(this.M?-1:1)};this.j+=e;this.l+=f;Tw(this)}ya(a){this.g.debug("Mouse Up. Removing mouse interaction listeners");a.preventDefault();Sw(this)}Oh(a,b){this.l=b;this.j=a;Tw(this)}qh(){return{x:this.j,y:this.l}}ki(a){this.H=a;this.F()}};
|
|
15
|
+
_.x("clpp.vr.VrPlugin",Zw);Zw.prototype.setCameraFieldOfView=Zw.prototype.ki;Zw.prototype.getCameraCoordinates=Zw.prototype.qh;Zw.prototype.moveCamera=Zw.prototype.Oh;Zw.Id="vr";_.fs(new class{create(){return new Zw}});};f.call(g, window);
|