@castlabs/prestoplay 6.14.1 → 6.16.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 +28 -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 +114 -112
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +553 -538
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +74 -73
- package/cjs/cl.externs.js +193 -58
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +69 -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 +368 -264
- 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.simid.js +15 -15
- package/cjs/cl.smooth.js +72 -71
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +71 -71
- package/cjs/cl.ttml.js +28 -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 +20 -20
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +89 -88
- package/cl.conviva.js +27 -27
- package/cl.core.js +455 -443
- package/cl.crypto.js +9 -9
- package/cl.dash.js +70 -68
- package/cl.externs.js +189 -58
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +71 -71
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +17 -17
- package/cl.mse.js +318 -236
- 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.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/package.json +1 -1
- package/typings.d.ts +393 -57
package/cjs/cl.tizen.js
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
c,d;return _.
|
|
4
|
-
keyIds:[],periodId:null},_.
|
|
5
|
-
"Initialize",""),webapis.avplay.setDrm(b.
|
|
6
|
-
"POST";_.A
|
|
7
|
-
6,6007,{message:_
|
|
8
|
-
reason:a.h}}))):a.j===_
|
|
9
|
-
c)}},
|
|
10
|
-
|
|
11
|
-
c=null;a=_.
|
|
12
|
-
a[d].kind||_.
|
|
13
|
-
var c=
|
|
14
|
-
|
|
15
|
-
0<f.length&&(c=f[0]));a.g.debug("Setting audio track with preferred language:",e);a.
|
|
16
|
-
function(a,b,c){var d=_.
|
|
17
|
-
c.language=_.
|
|
18
|
-
_.
|
|
19
|
-
c.length;e++){var f=
|
|
20
|
-
b){c=a[d].renditions[e];break}return c},
|
|
21
|
-
0;this.o=!0;this.f=!1;this.a=null;this.A=1;this.w=!1;this.j={}},
|
|
22
|
-
{currentTime:b}))},onevent:a.
|
|
23
|
-
|
|
24
|
-
_.
|
|
25
|
-
_.
|
|
26
|
-
_.
|
|
27
|
-
|
|
28
|
-
null;return e===
|
|
29
|
-
h+" track. Trying again...AVPlay state: "+(a.getState()+", buffering: ")+a.w,n),!1===m&&(a.j[h]={type:h,index:l,
|
|
30
|
-
d)}},
|
|
31
|
-
|
|
32
|
-
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())},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var
|
|
36
|
-
_.
|
|
37
|
-
_.
|
|
38
|
-
_.
|
|
39
|
-
onError:function(){}};_.
|
|
40
|
-
0);break;case 10:_.
|
|
41
|
-
_.
|
|
42
|
-
_.
|
|
43
|
-
_.
|
|
44
|
-
_.
|
|
45
|
-
_.
|
|
46
|
-
_.
|
|
47
|
-
_.
|
|
48
|
-
_.
|
|
49
|
-
|
|
50
|
-
_.
|
|
51
|
-
_.
|
|
52
|
-
Promise.resolve():Promise.reject("Player is in invalid state")};_.
|
|
53
|
-
_.
|
|
54
|
-
_.
|
|
55
|
-
_.
|
|
56
|
-
_.
|
|
57
|
-
_.
|
|
58
|
-
_.
|
|
59
|
-
var
|
|
60
|
-
_.
|
|
61
|
-
_.
|
|
62
|
-
_.
|
|
63
|
-
var e=[_.
|
|
64
|
-
_.
|
|
65
|
-
_.
|
|
66
|
-
_.
|
|
67
|
-
_.
|
|
68
|
-
_.
|
|
69
|
-
_.
|
|
70
|
-
_.
|
|
71
|
-
_.
|
|
72
|
-
|
|
2
|
+
var f=function(window){var pP="An unknown error occurred while trying to get volume",qP="Cannot get loading rendition due to platform limitations",rP="PARAM_START_POSITION",sP="SecurityError",tP="The require privilege is: http://tizen.org/privilege/tv.audio",uP="|STARTBITRATE\x3d",vP=function(a,b,c){function d(e){c.call(a,e);a.removeEventListener(b,d)}a.addEventListener(b,d)},wP=function(a,b){this.h=a;this.o=null;this.a=_.Xe;this.l=null;this.j=!1;this.f=new Map;this.B=b;this.g=new _.K("clpp.tizen.DrmEngine")},zP=function(a){var b,
|
|
3
|
+
c,d;return _.I(function(e){if(1==e.a){b=a.a===_.Ud||a.a===_.Sd;if(!b)throw new _.P(_.Q,6,6001,"The key system "+a.a+" is not supported by the player or the platform");c=a.f.get(a.a);if(!c.fe)throw new _.P(_.Q,6,6012,"No license server given for "+a.a);_.D(e,2);return a.a===_.Ud?_.y(e,xP(a),5):_.y(e,yP(a,c),5)}if(2!=e.a)return a.o={keySystem:a.a,licenseServerUri:c.fe,distinctiveIdentifierRequired:!1,persistentStateRequired:c.kg,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],
|
|
4
|
+
keyIds:[],periodId:null},_.qh(e,0);d=_.E(e);a.g.error("Error while configuring CDM for "+a.a,d);throw new _.P(_.Q,6,6005,{message:JSON.stringify(d)});})},yP=function(a,b){var c,d,e,f;return _.I(function(g){c=AP;d=BP;e={};e[d.Xi]=!b.kg;e[d.Zi]=b.fe;""!==b.customData&&(e[d.Wi]=b.customData);f=JSON.stringify(e);a.g.debug("PlayReady properties: ",f);try{webapis.avplay.setDrm(c.PLAYREADY,"SetProperties",f)}catch(h){throw h;}_.C(g)})},xP=function(a){var b;return _.I(function(c){b=AP;try{webapis.avplay.setDrm(b.xe,
|
|
5
|
+
"Initialize",""),webapis.avplay.setDrm(b.xe,"widevine_app_session",a.l.id),webapis.avplay.setDrm(b.xe,"widevine_data_type",a.l.type)}catch(d){throw d;}_.C(c)})},CP=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,v,z,B,F,G;_.I(function(A){if(1==A.a){c=AP;d=a.f.get(a.a);a.g.debug("DRM Challenge data: ",b.challenge);e=atob(b.challenge);f=new Uint8Array(e.length);for(g=0;g<e.length;++g)f[g]=e.charCodeAt(g);h=b.serverurl&&""!==b.serverurl?b.serverurl:d.fe;l=_.Lj([h],_.Ij());l.type=3;l.body=f.buffer;l.method=
|
|
6
|
+
"POST";_.D(A,2);return _.y(A,a.B.bb.fetch(l).N,4)}if(2!=A.a){m=A.f;if(a.j){n=_.nj(m.data);p=n.byteLength;q="";for(t=0;t<p;t++)q+=String.fromCharCode(n[t]);v=btoa(q);z=b.session_id+rP+(v+rP);a.g.debug("Widevine license params",z);try{webapis.avplay.setDrm(c.xe,"widevine_license_data",z)}catch(H){a.g.error("License response rejected by CDM"),B=new _.P(_.Q,6,6008,{browserError:JSON.stringify(H)}),a.B.onError(B)}}return _.qh(A,0)}F=_.E(A);a.g.error("License request failed.",JSON.stringify(F));G=new _.P(_.Q,
|
|
7
|
+
6,6007,{message:_.bb,url:F.data.url,status:F.data.status||NaN,response:F.data.response||"",headers:F.data.headers||{}},F);a.B.onError(G);_.C(A)})},DP=function(a){this.m=a;this.a=this.m.a;this.f=_.np;this.j=_.op;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.h=2;this.g=new _.K("clpp.tizen.StateManager")},FP=function(a,b){if(a.f!==b)if(a.f===_.yp&&b!==_.np)a.g.debug(_.YA+EP(b));else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.sp?(a.o=(new Date).getTime(),a.m.trigger(new _.L(_.nd,{detail:{bufferedTimeMS:-1,
|
|
8
|
+
reason:a.h}}))):a.j===_.sp&&a.m.trigger(new _.L(_.md,{detail:{bufferedTimeMS:c-a.o,reason:a.h}}));var d={currentState:a.f,previousState:a.j,timeSinceLastStateChangeMS:c-a.w};a.w=c;a.m.trigger(new _.L(_.hg,{detail:d}));a.g.debug("State changed:",EP(a.j),"-\x3e",EP(a.f))}},EP=function(a){return Object.keys(_.wp)[a]},IP=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case GP:c=_.Bp;break;case HP:c=_.Ap;break;default:a.m.isEnded()?c=_.up:a.g.debug("Inconsistent AVPlay playback state:",b)}FP(a,
|
|
9
|
+
c)}},JP=function(){this.o=this.A=this.f=this.h=this.C=this.m=this.j=this.a=null;this.D=!1;this.w=!0;this.l=null;this.g=new _.K("clpp.tizen.TextStreamer")},KP=function(a){if(!a)return!1;a=a.periods;for(var b=!1,c=0;c<a.length;c++)b=b||0<a[c].textStreams.length;return b},LP=function(a){var b,c;return _.I(function(d){if(1==d.a)return b=a.m.getConfiguration(),c=null,_.y(d,_.Ct(a.C.url,a.m.getNetworkEngine(),b.manifest.attemptParameters,a.C.type||null),2);(c=d.f)&&c.configure(b.manifest);return d["return"](c)})},
|
|
10
|
+
MP=function(a){var b=document.createElement(_.r),c=new _.hF,d=new _.GD(function(){return null}),e=a.m.getTextDisplayer();return new _.jF(b,c,e,d,a.m.getConfiguration())},NP=function(a){var b={configuration:{},va:function(){return a.m.getPosition()},O:a.h,bb:a.m.getNetworkEngine(),sd:a.vk.bind(a),rd:a.uk.bind(a),onError:a.V.bind(a),Xe:function(){},onEvent:function(){},Ze:a.wk.bind(a),td:function(){},jd:function(){return new _.tG},Zc:function(){return!1},zb:null};return new _.vH(a.a,b)},OP=function(a){var b=
|
|
11
|
+
a.m.getPosition(),c=null;a=_.w(a.a.periods);for(var d=a.next();!d.done;d=a.next())d=d.value,d.startTime<=b&&(c=d);return c},PP=function(a){a.g.debug("getTextStreams()",a.a);if(a.a){var b=[],c=a.a.periods;a.g.debug("getting text streams");for(var d=0;d<c.length;d++)if(a.g.debug(c[d].startTime,a.m.getPosition()),c[d].startTime<=a.m.getPosition()){b=c[d].textStreams;break}a=b}else a=[];b=[];for(d=c=0;d<a.length;d++){var e=new _.gk(String(c++),_.T);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=
|
|
12
|
+
a[d].roles;e.kind=a[d].kind||_.TC;var f=new _.rk(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},QP=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.f){var b=a.f.Je(),c=null;if(b){a=PP(a);for(var 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},RP=function(a,b){a.g.debug("Set active track",b);if(b&&(a.o=b.language,a.A=b.roles[0]||"",a.D=b.kind===_.te,a.a&&a.f)){a.setTextVisibility(!0);
|
|
13
|
+
var c=OP(a),d=b.renditions[0];(c=c.textStreams.find(function(e){return String(e.id)===d.id}))?(a.w?(a.g.debug("Switching period defer text selection"),a.l=c):(a.f.pe(c),a.m.trigger(new _.L(_.Sl))),a.o=c.language):a.g.error(_.WA,d.id)}},SP=function(){this.h=this.a=this.m=null;this.f={};this.g=new _.K("clpp.tizen.TrackManager");this.w=this.l=this.j=null;this.A=!1;this.o=1},TP=function(a,b){a.m.trigger(new _.L(_.Ig,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,abrSelection:a.a.o}}))},
|
|
14
|
+
UP=function(a){var b=a.qa();b&&a.m.trigger(new _.L(_.kd,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},VP=function(a){var b=a.m.getConfiguration(),c=_.ji(b.preferredAudioLanguage||[]),d=a.f[_.ik]||[];if(d.length){var e=null;c.some(function(g){e=_.xD(g,d.map(function(h){return h.language}));return!!e});if(e){var f=d.filter(function(g){return g.language===e});c=f[0];1<f.length&&b.preferredAudioRole&&(f=f.filter(function(g){return 0<=g.roles.indexOf(b.preferredAudioRole)}),
|
|
15
|
+
0<f.length&&(c=f[0]));a.g.debug("Setting audio track with preferred language:",e);a.Ia(c)}else a.g.debug("Preferred language(s) not available")}else a.g.debug("Could not set preferred audio language")},ZP=function(a,b){if(b){var c=b.track.type.toUpperCase();WP(a.a,c,Number(b.id)).then(function(){c===XP&&(a.j=b,a.m.trigger(new _.L(_.Rl)));c===YP&&(a.l=b,a.m.trigger(new _.L(_.Sl)))})["catch"](function(){a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},$P=
|
|
16
|
+
function(a,b,c){var d=_.fj(b.language||_.vg);c.language=_.hk(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.gd;a=new _.rk(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=b.bit_rate||null;return a},aQ=function(a,b,c){c.mimeType=_.Gg;a=new _.rk(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},bQ=function(a,b,c){b=_.fj(b.track_lang||_.vg);c.mimeType="text/ttml";
|
|
17
|
+
c.language=_.hk(b);c.originalLanguage=b;c.kind=_.TC;return new _.rk(String(a),c)},cQ=function(a,b){var c=null;try{c=JSON.parse(b)}catch(d){a.g.warn("Couldn't retrieve extra infos from stream."),c=null}return c},fQ=function(a,b){function c(n,p){for(var q=0;q<n.length;q++)if(n[q].language===p)return n[q];return null}var d={};if(0>=b.length)return d;for(var e=b.filter(function(n){return n.type===dQ}),f=b.filter(function(n){return n.type===XP}),g=[],h=0;h<f.length;h++){var l=cQ(a,f[h].extra_info);if(l){var m=
|
|
18
|
+
_.fj(l.language||_.vg);m=_.hk(m);m=c(g,m);m||(m=new _.gk(String(a.o++),_.ik),g.push(m));m.renditions.push($P(f[h].index,l,m))}else a.g.warn("Skipping audio stream with no extra info")}f=new _.gk(String(a.o++),_.jk);for(h=0;h<e.length;h++)(l=cQ(a,e[h].extra_info))?f.renditions.push(aQ(e[h].index,l,f)):a.g.warn("Skipping video stream with no extra info");e=[];e=a.h?PP(a.h):eQ(a,b);d[_.jk]=[f];d[_.ik]=g;d[_.T]=e;return d},eQ=function(a,b){for(var c=b.filter(function(h){return h.type===YP}),d=[],e=0;e<
|
|
19
|
+
c.length;e++){var f=cQ(a,c[e].extra_info);if(f){var g=new _.gk(String(a.o++),_.T);g.renditions.push(bQ(c[e].index,f,g));d.push(g)}else a.g.warn("Skipping text stream with no extra info")}return d},gQ=function(a,b){for(var c=a.f[_.jk]||[],d=[],e=0;e<c.length;e++)for(var f=0;f<c[e].renditions.length;f++)_.O.oa(c[e].renditions[f],b,Object.keys(b))&&d.push(c[e].renditions[f]);return d[0]||null},hQ=function(a,b,c){a=a.f[c]||[];b=String(b.index);c=null;for(var d=0;d<a.length;d++)for(var e=0;e<a[d].renditions.length;e++)if(a[d].renditions[e].id===
|
|
20
|
+
b){c=a[d].renditions[e];break}return c},jQ=function(a,b){if(b===_.T&&a.h)return QP(a.h);var c=iQ(a.a)||[];if(0===c.length)return null;c=c.filter(function(e){return e.type===b.toUpperCase()})[0];var d=null;b===_.jk&&(d=cQ(a,c.extra_info),d=gQ(a,{width:d.Width,height:d.Height}));b===_.ik&&(c?(d=hQ(a,c,_.ik),a.j=d):d=a.j);b===_.T&&(c?(d=hQ(a,c,_.T),a.l=d):d=a.l);return d},kQ=function(a){_.Yl.call(this);this.m=a;this.h=null;this.g=new _.K("clpp.tizen.Middleware");this.D=1;this.C=!1;this.l=null;this.G=
|
|
21
|
+
0;this.o=!0;this.f=!1;this.a=null;this.A=1;this.w=!1;this.j={}},lQ=function(a){return _.I(function(b){tizen.systeminfo.getPropertyValue("DISPLAY",function(c){a.A=c.resolutionWidth/1920;a.g.debug("Display resolution ratio: ",a.A)},function(c){a.g.debug("Could not load DISPLAY property");throw c;});_.C(b)})},nQ=function(a){try{webapis.avplay.setListener({onbufferingstart:a.pk.bind(a),onbufferingprogress:a.nk.bind(a),onbufferingcomplete:a.mk.bind(a),onstreamcompleted:a.sk.bind(a),oncurrentplaytime:function(b){a.trigger(new _.L(mQ,
|
|
22
|
+
{currentTime:b}))},onevent:a.rk.bind(a),onsubtitlechange:a.tk.bind(a),ondrmevent:a.qk.bind(a),onerror:a.V.bind(a)})}catch(b){a.g.error(b)}},oQ=function(a){var b=!!a.m.getTrackManager().Ra();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",c)}},pQ=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,Wn:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",uP+d)}catch(e){a.g.debug(e)}},
|
|
23
|
+
qQ=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+uP+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",c),c;}},tQ=function(a){return{position:a.getPosition(),state:a.m.getState(),Pg:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:rQ(a),volume:a.getVolume(),vn:sQ(a),Kk:iQ(a)}},vQ=function(a){var b,c;return _.I(function(d){if(1==d.a)return _.y(d,uQ(),2);if(3!=d.a)return b=new Promise(function(e){(new _.Zk(e)).fa(5)}),
|
|
24
|
+
_.y(d,Promise.race([lQ(a).then(function(){return!0}),b.then(function(){return!1})]),3);c=d.f;if(!c)return a.g.debug("Took to long for the SDK to be ready"),d["return"](Promise.reject("SDK Timeout"));_.C(d)})},BQ=function(a,b,c){var d,e,f,g,h,l,m,n;return _.I(function(p){switch(p.a){case 1:a.l=_.Fp(b);d=a.G;e=c||{estimatedBandwidth:0,currentBandwidth:0,nextBandwidth:null,currentPosition:0};a.g.debug("Loading manifest URL: "+a.l[d].url);f=b.startTime||void 0;a.f&&(a.trigger(new _.L(wQ)),f=c.currentPosition);
|
|
25
|
+
_.D(p,2);g=a.l[d].url;h=a.l[d].type;h!==_.Vc||g.includes(".mpd")||(l=new URL(g),l.searchParams.append("cl-ext",".mpd"),g=l.toString());webapis.avplay.open(g);e.nextBandwidth?(qQ(a,e.nextBandwidth),a.o=!1):(a.o||pQ(a,e),a.o=!0);nQ(a);if(!b.drm||!b.drm.env){a.g.debug("No DRM configuration was provided. Assuming clear content");p.F(4);break}m={onError:function(q){return a.m.onError(q)},bb:a.m.getNetworkEngine()};a.h=new wP(b.drm,m);return _.y(p,a.h.init(),4);case 4:return a.f||a.trigger(new _.L(xQ)),
|
|
26
|
+
_.y(p,yQ(a),6);case 6:a.f||a.trigger(new _.L(zQ));f&&typeof f===_.k&&0<f&&a.seek(f)["catch"](function(q){a.g.debug("Couldn't set start position",q)});a.f||(b.volume&&a.setVolume(b.volume),b.muted&&AQ(a,b.muted),b.autoplay&&a.m.play()["catch"](function(q){a.g.debug("Autoplay failed",q)}));_.qh(p,0);break;case 2:throw n=_.E(p),a.g.debug("Error while attempting to load source."),n;}})},yQ=function(a){return _.I(function(b){a.g.debug("avplay.prepare()");return b["return"](new Promise(function(c,d){try{webapis.avplay.prepareAsync(function(){a.g.debug("AVPlay is ready!");
|
|
27
|
+
oQ(a);c()},function(e){a.g.debug("prepareAsync failed",e);d(e)})}catch(e){a.g.debug("Failed to prepare media player for playback"),d(e)}}))})},CQ=function(a,b,c){a.g.debug("switchVideoTrack()");try{var d={estimatedBandwidth:parseInt(webapis.avplay.getStreamingProperty("CURRENT_BANDWITH"),10),currentBandwidth:b,nextBandwidth:c,currentPosition:a.getPosition()};a.a=tQ(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(function(){var e=a.a.Pg;a.f=!1;a.a=
|
|
28
|
+
null;return e===HP?a.pause():a.play()})}catch(e){return Promise.reject(e)}},sQ=function(a){return a.f&&a.a?a.a.vn:webapis.avplay.getTotalTrackInfo()},iQ=function(a){return a.f&&a.a?a.a.Kk:webapis.avplay.getCurrentStreamInfo()},WP=function(a,b,c){b=b.toUpperCase();b===YP&&DQ(a,!0);var d=a.j[b];d&&(d.ff.stop(),a.j[b]=null,a.g.debug("Cancelled pending track switch for "+b));return new Promise(function(e,f){function g(h,l,m){m=void 0===m?!1:m;try{webapis.avplay.setSelectTrack(h,l),a.j[h]=null,e()}catch(n){a.g.debug("Could not set "+
|
|
29
|
+
h+" track. Trying again...AVPlay state: "+(a.getState()+", buffering: ")+a.w,n),!1===m&&(a.j[h]={type:h,index:l,Mg:0,ff:new _.Zk(function(){return g(h,c,!0)})}),(l=a.j[h])&&3>l.Mg?(!a.w&&++l.Mg,l.ff.fa(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),l&&l.ff.stop(),a.j[h]=null,f())}}g(b,c)})},DQ=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",
|
|
30
|
+
d)}},AQ=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case sP:a.g.warn("The application does not have the privilege to set mute.",tP);break;default:a.g.warn(pP,c)}}},rQ=function(a){var b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case sP:a.g.warn("The application doesn't have the privilege to get the mute state.",tP);break;default:a.g.warn(pP,c)}}return!!b},uQ=function(){return new Promise(function(a,b){if(window.webapis)a();else{var c=document.createElement("script");
|
|
31
|
+
vP(c,"load",function(d){return a(d)});vP(c,_.se,function(d){return b(d)});c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},EQ=function(){_.Yl.call(this);this.a=new kQ(this);this.f=new DP(this);this.configuration=this.C=_.dm();this.w=null;this.g=new _.K("clpp.tizen.Player");this.j=null;this.l=new SP;this.D=new _.ck;this.o=this.h=null;this.A=!1},FQ=function(a){if("NONE"!==a.a.getState()){var b=a.j.getBoundingClientRect();a=a.a;var c=Math.floor(b.left*a.A),d=Math.floor(b.top*
|
|
32
|
+
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())},GQ=function(){},HQ=function(){};
|
|
33
|
+
wP.prototype.init=function(){var a=this,b,c,d,e,f,g;return _.I(function(h){if(1==h.a){b=_.ym[a.h.env]||null;if(!b)throw a.g.debug(_.za,_.Qb+a.h.env+_.ca),new _.P(_.Q,6,6015,_.Aa+a.h.env+"' is missing.");a.l={id:String(Math.floor(1E4*Math.random())),type:"MPEG-DASH"};c=Object.keys(a.h.customData||{}).length?btoa(JSON.stringify(a.h.customData)):"";d=_.Am(b,a.h.customData);(e=d[_.Sd])&&a.f.set(_.Sd,{fe:e.licenseUrl||"",customData:c,kg:!1});(f=d[_.Ud])&&a.f.set(_.Ud,{fe:f.licenseUrl||"",customData:c,
|
|
34
|
+
kg:!1});if(0===a.f.size)throw new _.P(_.Q,6,6E3);if((g=a.h.preferredDrmSystem)&&a.f.get(g))a.a=g;else if(a.f.get(_.Sd))a.a=_.Sd;else if(a.f.get(_.Ud))a.a=_.Ud;else throw new _.P(_.Q,6,6001,"Configuration for the target system is missing.");return _.y(h,zP(a),2)}a.j=!0;_.C(h)})};wP.prototype.release=function(){var a=this;return _.I(function(b){a.j=!1;a.o=null;a.a=_.Xe;a.l=null;a.f=new Map;_.C(b)})};wP.prototype.getDrmInfo=function(){return this.o};
|
|
35
|
+
var BP={Xi:"DeleteLicenseAfterUse",Zi:"LicenseServer",In:"GetChallenge",Jn:"HttpHeader",Ln:"UserAgent",En:"Cookie",Wi:"CustomData"};_.u=DP.prototype;_.u.initialize=function(){this.a.on(wQ,this.mh,this);this.a.on(IQ,this.lh,this);this.a.on(JQ,this.kh,this);this.a.on(xQ,this.ni,this);this.a.on(zQ,this.mi,this);this.a.on(KQ,this.nh,this)};_.u.release=function(){FP(this,_.np);this.l=!1;this.o=-1;this.h=2};_.u.destroy=function(){this.release();this.a.off(wQ,this.mh);this.a.off(IQ,this.lh);this.a.off(JQ,this.kh);this.a.off(xQ,this.ni);this.a.off(zQ,this.mi);this.a.off(KQ,this.nh);this.m=this.a=null};
|
|
36
|
+
_.u.mh=function(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.C?1:2;FP(this,_.sp)};_.u.lh=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",EP(this.f))};_.u.kh=function(){this.g.debug("Buffering complete. Player state: ",this.a.getState());if(!this.l){this.l=!0;var a=this.m.getConfiguration().autoplay,b=this.a.getState()===LQ;if(!a&&b){FP(this,_.Ap);return}}if(a=this.f!==_.zp)a=this.a.getState(),a=a===GP||a===HP;a&&IP(this)};
|
|
37
|
+
_.u.ni=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===MQ?FP(this,_.zp):this.g.error("AVPlay prepares while state is not IDLE")};_.u.mi=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.u.nh=function(){FP(this,_.up)};_.u.getState=function(){return this.f};_.u=JP.prototype;_.u.initialize=function(a){this.m=a};
|
|
38
|
+
_.u.load=function(a){var b=this,c,d,e,f,g,h,l;return _.I(function(m){switch(m.a){case 1:if(!b.m)return b.g.debug("Text streamer is not initialized. Will not load()"),m["return"]();b.C=a;c=b;return _.y(m,LP(b),2);case 2:c.j=m.f;if(!b.j)return b.g.debug("Could not find manifest parser for source. Make sure parsers are registered."),m["return"]();d={configurationId:"",networkingEngine:b.m.getNetworkEngine(),filterNewPeriod:function(){},filterAllPeriods:function(){},onTimelineCueAdded:function(){},onEvent:function(){},
|
|
39
|
+
onError:function(){}};_.D(m,3);e=b;return _.y(m,b.j.start(a.url,d),5);case 5:e.a=m.f;_.qh(m,4);break;case 3:return f=_.E(m),b.g.warn(f),_.D(m,6),g=b,_.y(m,b.j.start(a.url.replace("https://","http://"),d),8);case 8:g.a=m.f;_.qh(m,4);break;case 6:h=_.E(m),b.g.error(h),b.a=null;case 4:if(!b.a||!KP(b.a)){m.F(0);break}b.h=MP(b);_.D(m,10);return _.y(m,b.h.open(),12);case 12:b.f=NP(b);l=b.m.getConfiguration();b.f.Gf(l.streaming);b.o=l.preferredTextLanguage;b.A=l.preferredTextRole;b.D=l.preferForcedSubtitles;
|
|
40
|
+
_.qh(m,0);break;case 10:_.E(m),b.g.debug("Could not setup media source..."),b.h=null,b.f=null,b.j=null,b.a=null,_.C(m)}})};_.u.vk=function(a){this.g.debug(_.yC,a);this.w=!0;var b=_.SF(a.textStreams,this.o||"",this.A||"",this.D)[0]||null;this.l&&(a.textStreams.includes(this.l)&&(b=this.l),this.l=null);return{variant:null,text:b}};_.u.uk=function(){this.g.debug("canSwitch_");this.w=!1;this.l&&(this.f.pe(this.l),this.l=null)};_.u.V=function(){this.g.debug("onError_")};
|
|
41
|
+
_.u.wk=function(){this.j&&this.j.update&&this.j.update()};_.u.start=function(){var a=this;return _.I(function(b){if(!a.f)return b["return"]();try{a.f.start()}catch(c){a.g.error("Error while starting streaming engine",c)}_.C(b)})};_.u.setTextVisibility=function(a){this.g.debug("Set text visibility",a);this.h&&this.h.getTextDisplayer().setTextVisibility(a)};_.u.release=function(){var a=this;return _.I(function(b){a.m=null;a.a=null;a.C=null;a.A=null;a.o=null;a.w=!0;a.l=null;_.C(b)})};
|
|
42
|
+
_.u.destroy=function(){var a=this;return _.I(function(b){switch(b.a){case 1:if(!a.j){b.F(2);break}return _.y(b,a.j.stop(),3);case 3:a.j=null;case 2:if(!a.f){b.F(4);break}return _.y(b,a.f.destroy(),5);case 5:a.f=null,a.w=!0;case 4:if(!a.h){b.F(0);break}return _.y(b,a.h.destroy(),7);case 7:a.h=null,_.C(b)}})};_.x(SP,_.Mk);_.u=SP.prototype;_.u.di=function(a){var b=a.eventid;a=a.data;switch(b){case NQ:0<Object.keys(this.f).length||(this.g.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+cQ(this,b[0].extra_info).Bit_rate,b=gQ(this,{bandwidth:b}))&&(this.w=b,TP(this,b));break;case OQ:UP(this);break;default:this.g.debug("Event type: "+b+" data: "+a)}};_.u.eg=function(a){a.detail.currentState===_.Bp&&this.m.off(_.hg,this.eg)};
|
|
43
|
+
_.u.initialize=function(a){var b=this;this.m=a;this.a=this.m.a;this.m.on(_.hg,function(c){b.A||(c=c.detail,c.currentState===_.Bp&&(b.g.debug("Current state",c.currentState),b.A=!0,VP(b)))});this.a.on(PQ,this.di,this)};_.u.release=function(){this.f={};this.h=this.w=this.l=this.j=null;this.A=!1;this.o=1};
|
|
44
|
+
_.u.load=function(){if(this.a&&!(0<Object.keys(this.f).length)){this.h=this.m.h;this.m.off(_.hg,this.eg);this.m.on(_.hg,this.eg,this);try{var a=sQ(this.a);this.f=fQ(this,a);var b=this.f[_.ik]||[];b.length&&(this.j=b[0].renditions[0]||null);UP(this)}catch(c){this.g.debug("Could not load track manager")}}};_.u.destroy=function(){this.a.off(PQ,this.di);this.a=this.m=null};_.u.getVideoTracks=function(){return this.f[_.jk]||[]};_.u.getAudioTracks=function(){return this.f[_.ik]||[]};
|
|
45
|
+
_.u.ma=function(){return this.f[_.T]||[]};_.u.qa=function(){return jQ(this,_.jk)};_.u.Za=function(){return jQ(this,_.ik)};_.u.Ra=function(){return jQ(this,_.T)};_.u.pb=function(){return this.w};_.u.Bb=function(){this.g.info(qP);return null};_.u.Cb=function(){this.g.info(qP);return null};_.u.Ta=function(){var a=this.qa();return a?a.track:null};_.u.pa=function(){var a=this.Za();return a?a.track:null};_.u.Ea=function(){var a=this.Ra();return a?a.track:null};
|
|
46
|
+
_.u.xb=function(a){var b=this;null===a?(a=this.qa(),CQ(this.a,a.bandwidth,null).then(function(){UP(b)})):0<a.renditions.length&&this.lb(a.renditions[0])};_.u.Ia=function(a){a?ZP(this,a.renditions[0]):this.g.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")};_.u.Va=function(a){a?(a=a.renditions[0],this.h?RP(this.h,a.track):ZP(this,a)):(this.g.debug("Disabling text tracks"),this.l=null,DQ(this.a,!1),this.m.trigger(new _.L(_.Sl)))};
|
|
47
|
+
_.u.lb=function(a){var b=this,c=this.qa();this.a.o||a.width!==c.width||a.height!==c.height||a.bandwidth!==c.bandwidth?(this.w=a,TP(this,a),CQ(this.a,c.bandwidth,a.bandwidth).then(function(){UP(b)})["catch"](function(d){var e=new _.P(_.Q,7,7200,{tizenerror:d});b.g.debug("Error while switching video track",d);b.m.onError(e)})):this.g.debug("Trying to switch to already active rendition. Doing nothing...")};_.u.vb=function(a){ZP(this,a)};_.u.wb=function(a){this.h?RP(this.h,a.track):ZP(this,a)};
|
|
48
|
+
_.u.addTextTrack=function(){};_.u.xa=function(){return this.a.o};SP.prototype.isAbrEnabled=SP.prototype.xa;SP.prototype.addTextTrack=SP.prototype.addTextTrack;SP.prototype.setTextRendition=SP.prototype.wb;SP.prototype.setAudioRendition=SP.prototype.vb;SP.prototype.setVideoRendition=SP.prototype.lb;SP.prototype.setTextTrack=SP.prototype.Va;SP.prototype.setAudioTrack=SP.prototype.Ia;SP.prototype.setVideoTrack=SP.prototype.xb;SP.prototype.getTextTrack=SP.prototype.Ea;SP.prototype.getAudioTrack=SP.prototype.pa;
|
|
49
|
+
SP.prototype.getVideoTrack=SP.prototype.Ta;SP.prototype.getLoadingTextRendition=SP.prototype.Cb;SP.prototype.getLoadingAudioRendition=SP.prototype.Bb;SP.prototype.getLoadingVideoRendition=SP.prototype.pb;SP.prototype.getTextRendition=SP.prototype.Ra;SP.prototype.getAudioRendition=SP.prototype.Za;SP.prototype.getVideoRendition=SP.prototype.qa;SP.prototype.getTextTracks=SP.prototype.ma;SP.prototype.getAudioTracks=SP.prototype.getAudioTracks;SP.prototype.getVideoTracks=SP.prototype.getVideoTracks;_.x(kQ,_.Yl);_.u=kQ.prototype;_.u.pk=function(){this.w=!0;this.f||this.trigger(new _.L(wQ))};_.u.nk=function(a){this.w=!0;this.trigger(new _.L(IQ,{percent:a}))};_.u.mk=function(){this.w=!1;this.trigger(new _.L(JQ))};_.u.sk=function(){this.trigger(new _.L(KQ))};_.u.rk=function(a,b){this.trigger(new _.L(PQ,{eventid:a,data:b}))};_.u.tk=function(a,b,c,d,e){this.trigger(new _.L(QQ,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
|
|
50
|
+
_.u.qk=function(a,b){this.trigger(new _.L(RQ,{drmType:a,drmData:b}));if(this.h){var c=this.h;if(c.j)if(c.a===_.Ud&&"Challenge"===b.name)CP(c,b);else if("DrmError"===b.name){c.g.debug("DrmError event",b);var d=new _.P(_.Q,6,6005,{message:JSON.stringify(b)});c.B.onError(d)}}};_.u.V=function(a){this.trigger(new _.L(SQ,{eventType:a}))};
|
|
51
|
+
_.u.play=function(){function a(){return new Promise(function(d,e){function f(){d();clearTimeout(g)}var g=null;b.one(mQ,f,b);g=setTimeout(function(){b.off(mQ,f);e("Timeout")},3E4)})}var b=this,c=this.getState();if(c===MQ)return(new Promise(function(d,e){webapis.avplay.prepareAsync(function(){oQ(b);d(webapis.avplay.play())},function(f){b.trigger(new _.L(SQ));e(f)})})).then(function(){return a()});if(c===HP||c===LQ)try{return webapis.avplay.play(),a()}catch(d){return Promise.reject(d)}return c===GP?
|
|
52
|
+
Promise.resolve():Promise.reject("Player is in invalid state")};_.u.pause=function(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===HP?Promise.resolve():Promise.reject()};
|
|
53
|
+
_.u.setPlaybackRate=function(a){var b=this.getState();if(b===LQ||b===GP||b===HP){try{webapis.avplay.setSpeed(a),this.D=a}catch(c){return this.g.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.D)}return!0}this.g.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1};_.u.getPlaybackRate=function(){return this.D};
|
|
54
|
+
_.u.load=function(a,b){var c=this,d;return _.I(function(e){switch(e.a){case 1:return c.g.debug("configure()",b||""),_.D(e,2),_.y(e,vQ(c),4);case 4:return _.y(e,BQ(c,a,b),5);case 5:_.qh(e,0);break;case 2:throw d=_.E(e),new _.P(_.Q,7,7003,null,d);}})};_.u.getState=function(){if(this.f&&this.a)return this.a.Pg;try{return webapis.avplay.getState()}catch(a){this.V(JSON.stringify(a))}};
|
|
55
|
+
_.u.seek=function(a){var b=this,c=1E3*a;return new Promise(function(d,e){b.C=!0;b.m.trigger(new _.L(_.Bg));webapis.avplay.seekTo(c,function(){b.C=!1;b.m.trigger(new _.L(_.Ag));d()},function(){b.C=!1;e()})})};_.u.getPosition=function(){if(this.f&&this.a)return this.a.position;try{return webapis.avplay.getCurrentTime()/1E3}catch(a){this.V(JSON.stringify(a))}};_.u.getDuration=function(){if(this.f&&this.a)return this.a.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.V(JSON.stringify(a))}};
|
|
56
|
+
_.u.release=function(){var a=this;return new Promise(function(b,c){try{a.h&&(a.h.release(),a.h=null);webapis.avplay.stop();webapis.avplay.close();for(var d in a.j){var e=a.j[d];e&&e.ff.stop()}a.j={};a.D=1;a.C=!1;a.l=null;a.a=null;return b()}catch(f){return c(f)}})};_.u.getVolume=function(){var a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case sP:this.g.debug("The application does not have the privilege to get the volume.",tP);break;default:this.g.debug(pP,b)}}return a};
|
|
57
|
+
_.u.setVolume=function(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.","The passed value value should be in the range of 0 to 1.");break;case sP:this.g.warn("The application does not have the privilege to set the volume.",tP);break;default:this.g.warn("An unknown error occurred while trying to set volume",b)}}};
|
|
58
|
+
_.u.isLive=function(){if(this.f&&this.a)return this.a.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.V(JSON.stringify(a))}};_.u.stop=function(){try{webapis.avplay.stop()}catch(a){this.g.debug(a)}};_.u.getDrmInfo=function(){this.h&&this.h.getDrmInfo();return null};_.u.setSourceIndex=function(a){this.G=a};_.u.getSourceIndex=function(){return this.G};_.u.getLoadedSource=function(){return this.l&&this.l[this.getSourceIndex()]};
|
|
59
|
+
var MQ="IDLE",LQ="READY",GP="PLAYING",HP="PAUSED",dQ=_.mc,XP="AUDIO",YP="TEXT",OQ="PLAYER_MSG_RESOLUTION_CHANGED",NQ="PLAYER_MSG_BITRATE_CHANGE",AP={PLAYREADY:"PLAYREADY",Fn:"EME_PLAYREADY",Mn:"VERIMATRIX",xe:"WIDEVINE_CDM",Gn:"EME_WIDEVINE_CDM",On:"WIDEVINE_CLASSIC"};_.x(EQ,_.Yl);_.u=EQ.prototype;_.u.ih=function(){var a=this;this.g.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.L(_.re));this.configuration.loop?this.seek(this.configuration.startTime||0)["catch"](function(){a.g.debug("Could not loop playback")}):this.a.stop()};_.u.gh=function(a){this.trigger(new _.L(_.sg,{currentTime:a.currentTime/1E3}))};
|
|
60
|
+
_.u.jh=function(a){var b=this.a.getPosition(),c=b+a.duration/1E3,d=a.text||"";this.g.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.S.vg(d))&&this.o.append([new _.ui(b,c,d)],[])};_.u.hh=function(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.u.fi=function(){this.A||(this.g.debug("Initial buffering completed..."),this.A=!0)};
|
|
61
|
+
_.u.V=function(a){this.g.debug("Error: TYPE: "+a.eventType);FP(this.f,_.yp);a=new _.P(_.Q,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.L(_.se,{detail:a}))};
|
|
62
|
+
_.u.init=function(a,b){this.configuration=this.C=b;this.w=a;this.a.on(KQ,this.ih,this);this.a.on(mQ,this.gh,this);this.a.on(QQ,this.jh,this);this.a.on(RQ,this.hh,this);this.a.on(SQ,this.V,this);this.a.on(JQ,this.fi,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();var c=TQ;TQ+=1;this.j=_.Yp(_.Ye,{id:"__clpp_tizen_player_"+c,type:"application/avplayer"});this.w.addElementToContainer(this.j,!0);var d=this.w.getMedia();if(d){c=this.j;
|
|
63
|
+
var e=[_.Wg,_.we,"position",_.De,"top"],f={};d=null!==d.parentElement?window.getComputedStyle(d,null):d.style;if(!e||0===e.length){e||(e=[]);for(var g in d)e.push(g)}g=_.w(e);for(e=g.next();!e.done;e=g.next())e=e.value,f[e]=d[e];_.$p(c,f);FQ(this)}};_.u.getSurface=function(){return this.w};_.u.getConfiguration=function(){return this.configuration};_.u.getTimeline=function(){return null};_.u.setupPlaylist=function(){return Promise.reject(_.Hb)};_.u.appendLoad=function(){return Promise.reject(_.Hb)};
|
|
64
|
+
_.u.seekWith=function(){return Promise.reject(_.Hb)};_.u.destroy=function(){var a=this;return _.I(function(b){switch(b.a){case 1:return _.y(b,a.release(),2);case 2:a.a.off(KQ,a.ih);a.a.off(mQ,a.gh);a.a.off(QQ,a.jh);a.a.off(RQ,a.hh);a.a.off(SQ,a.V);a.a.off(JQ,a.fi);if(!a.h){b.F(3);break}return _.y(b,a.h.destroy(),4);case 4:a.h=null;case 3:a.j&&(a.j.parentElement.removeChild(a.j),a.j=null),a.l.destroy(),a.f.destroy(),a.l=null,a.f=null,_.C(b)}})};_.u.namespace=function(){return UQ};
|
|
65
|
+
_.u.getPlaybackRate=function(){return this.a.getPlaybackRate()};_.u.setDrmCustomDataModifier=function(){};_.u.setCdnErrorCallback=function(){};_.u.detach=function(){};_.u.setPlaybackRate=function(a){this.a.setPlaybackRate(a)};_.u.getPosition=function(){return this.getMediaPosition()};_.u.getMediaPosition=function(){return 0<(this.configuration.startTime||0)&&!this.A?0:this.f.getState()===_.up?this.getDuration():this.a.getPosition()||0};
|
|
66
|
+
_.u.seek=function(a){return typeof a===_.k&&0<=a?(this.isLive()||(a=Math.min(a,this.getDuration())),this.a.seek(a)):Promise.reject()};_.u.getPresentationStartTime=function(){return null};_.u.getSeekRange=function(){return{start:0,end:0}};_.u.getVolume=function(){var a=this.a.getVolume();return typeof a===_.k?a/100:null};_.u.setVolume=function(a){this.a.setVolume(a)};_.u.getDuration=function(){return this.getMediaDuration()};_.u.getMediaDuration=function(){return this.a.getDuration()};
|
|
67
|
+
_.u.getBufferInfo=function(){this.g.warn(_.va);return new _.Xl};_.u.getTrackManager=function(){return this.l};_.u.unload=function(){var a=this;return this.a.release().then(function(){a.l.release()})};_.u.release=function(){var a=this;return _.I(function(b){switch(b.a){case 1:if(!a.h){b.F(2);break}return _.y(b,a.h.release(),2);case 2:if(!a.o){b.F(4);break}return _.y(b,a.o.destroy(),5);case 5:a.o=null;case 4:return _.y(b,a.a.release(),6);case 6:a.l.release(),a.f.release(),a.A=!1,_.C(b)}})};
|
|
68
|
+
_.u.load=function(a){var b=this,c,d,e,f,g;return _.I(function(h){switch(h.a){case 1:b.configuration=_.fm(b.C,a);c=_.bp(b.configuration,[_.ye,"native"]);b.o=c.create(b);d=_.Fp(b.configuration)[0];e=!!b.configuration.tizen&&b.configuration.tizen.sideStreamText;if(!e){h.F(2);break}b.h=new JP;b.h.initialize(b);_.D(h,3);return _.y(h,b.h.load(d),5);case 5:b.h.start();_.qh(h,2);break;case 3:f=_.E(h),b.g.error(f);case 2:return _.D(h,6),_.y(h,b.a.load(b.configuration),8);case 8:_.qh(h,7);break;case 6:throw g=
|
|
69
|
+
_.E(h),b.onError(g),g;case 7:b.l.load(),_.C(h)}})};_.u.play=function(){var a=this;this.trigger(new _.L(_.mf));FQ(this);return this.a.play().then(function(){IP(a.f)})};_.u.pause=function(){var a=this;return this.a.pause().then(function(){IP(a.f)})};_.u.getState=function(){return this.f.getState()};_.u.getPeriods=function(){return[]};_.u.onError=function(a){var b=new _.L(_.se,{detail:a});a.severity===_.Q&&(FP(this.f,_.yp),this.a.release());this.trigger(b);b.defaultPrevented&&(b.a=!0)};
|
|
70
|
+
_.u.getDrmInfo=function(){return this.a.getDrmInfo()};_.u.isEnded=function(){return this.f.getState()===_.up};_.u.isPaused=function(){return this.a.getState()===HP};_.u.isMuted=function(){return rQ(this.a)};_.u.setMuted=function(a){AQ(this.a,a)};_.u.getNetworkEngine=function(){return this.D};_.u.setNetworkEngine=function(a){this.D=a};_.u.isLive=function(){return this.a.isLive()};_.u.getStats=function(){return null};_.u.setSourceIndex=function(a){this.a.setSourceIndex(a)};_.u.getSourceIndex=function(){return this.a.getSourceIndex()};
|
|
71
|
+
_.u.getLoadedSource=function(){return this.a.getLoadedSource()};_.u.canPlay=function(a,b){return(new GQ).canPlay(a,b)};_.u.getTimelineCues=function(){return[]};_.u.getTextDisplayer=function(){return this.o};_.u.resetAbr=function(){};EQ.prototype.getTextDisplayer=EQ.prototype.getTextDisplayer;EQ.prototype.setNetworkEngine=EQ.prototype.setNetworkEngine;EQ.prototype.getNetworkEngine=EQ.prototype.getNetworkEngine;var UQ="clpp.tizen",TQ=0;GQ.prototype.a=function(){return UQ};
|
|
72
|
+
GQ.prototype.canPlay=function(a){a=a.type;var b=!!window.webapis;if((a===_.Vc||a===_.Il||a===_.$c)&&b){if(_.Xj(2))return 2;if(_.Xj(3)||_.Xj(4)||_.Xj(5)||_.Xj(6))return _.Fh("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0};GQ.prototype.f=function(a){return a===_.qa};GQ.prototype.create=function(){return new EQ};_.x(HQ,_.Gs);HQ.prototype.f=function(){_.Ph(new GQ)};HQ.prototype.a=function(){var a=UQ;a&&_.Nh[a]&&(delete _.Nh[a],_.Oh.info("Removed Player factory: '"+a+"'"))};HQ.prototype.id=function(){return"tizen"};_.J("clpp.tizen.TizenComponent",HQ);var wQ="onbufferingstart",IQ="onbufferingprogress",JQ="onbufferingcomplete",KQ="onstreamcompleted",mQ="oncurrentplaytime",PQ="onevent",QQ="onsubtitlechange",RQ="ondrmevent",SQ="onerror",xQ="preparingstart",zQ="preparingend";};
|
|
73
73
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
74
74
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
75
75
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.ttml.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
e.a)return e.getAttribute(c)}return null},
|
|
4
|
-
0)+60*(Number(c[2])||0)+3600*(Number(c[1])||0)},
|
|
5
|
-
b,
|
|
6
|
-
this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=Number(a[1])/Number(a[2]))},
|
|
7
|
-
return(c=
|
|
8
|
-
a.a.get(e).f)).concat([e]));return c},
|
|
9
|
-
g={},
|
|
10
|
-
a},
|
|
11
|
-
"lineHeight","opacity","padding",
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
g.backgroundImage=("PNG"===e&&"Base64"===d&&0<a.length?"data:image/png;base64,"+a:null)||"");return g};_.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
e+";";break a}}d=""}c+=d;a:{if("textOutline"in this.a){d=this.a.textOutline.split(" ");e="black";f=".4em";var g=d[0]&&d[0].trim(),h=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!
|
|
19
|
-
d+";"):d="";c=c+d+("fontFamily"in this.a?"font-family:"+this.a.fontFamily.replace("monospaceSansSerif","monospace").replace("monospaceSerif","monospace").replace("proportionalSansSerif",
|
|
20
|
-
"text-decoration:"+d.join(" ")+";";break a}}d=""}e="padding"in this.a?"border: solid transparent;border-width:"+
|
|
21
|
-
c="::ttml .clpp-text-wrapper__"+this.h+" {",a.push(c+b+"}"));return a};var
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
b+=h}for(;f.
|
|
25
|
-
|
|
26
|
-
c=b),c&&(a.a=c.getId()),c=a.l,-1===["#text","span","br"].indexOf(
|
|
27
|
-
a.next())f.push.apply(f,_.
|
|
28
|
-
case _.
|
|
29
|
-
|
|
2
|
+
var f=function(window){var Uw='application/mp4; codecs\x3d"stpp.ttml"',Vw='application/mp4; codecs\x3d"stpp.ttml.im1i"',Ww='application/mp4; codecs\x3d"stpp.ttml.im1t"',Xw="backgroundColor",Yw="direction",Zw="displayAlign",$w="region",ax="sans-serif",bx="textAlign",cx="textDecoration",dx="writingMode",ex=function(a,b,c){this.h=a;this.f=b;this.a=c},fx=function(a,b,c){ex.call(this,a,[],c);this.j=b||""},gx=function(a,b,c){ex.call(this,a,b,c)},hx=function(a,b,c){a=a.f;for(var d=a.length-1;0<=d;d--){var e=b.get(a[d]);if(c in
|
|
3
|
+
e.a)return e.getAttribute(c)}return null},px=function(a,b){var c=null;if(ix.test(a)){c=ix.exec(a);var d=Number(c[1]),e=Number(c[2]),f=Number(c[3]),g=Number(c[4]);g+=(Number(c[5])||0)/b.f;f+=g/b.frameRate;c=f+60*e+3600*d}else jx.test(a)?c=kx(jx,a):lx.test(a)?c=kx(lx,a):mx.test(a)?(c=mx.exec(a),c=Number(c[1])/b.frameRate):nx.test(a)?(c=nx.exec(a),c=Number(c[1])/b.a):ox.test(a)&&(c=kx(ox,a));return c},kx=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:(Number(c[4])||0)/1E3+(Number(c[3])||
|
|
4
|
+
0)+60*(Number(c[2])||0)+3600*(Number(c[1])||0)},qx=function(a){return a.split(":").pop()},rx=function(a){return a.replace(/(\d*\.?\d+)c/g,"$1em")},tx=function(a,b){for(;sx.test(a);){var c=sx.exec(a)[0];a=a.replace(c,parseInt(c,10)/b+"em")}return a},ux=function(a){return a?a.replace(/(\d*\.?\d+)%/g,function(b,c){return c/100+"em"}):""},vx=function(a,b,c,d,e,f,g){ex.call(this,a,f,g);this.w=b;this.A=c;this.o=d;this.l=e;this.j=[]},wx=function(a,b,c){a=hx(a,b,bx);if(!a&&c&&(a=hx(c,b,bx),!a&&"rltb"===hx(c,
|
|
5
|
+
b,dx)))return _.Uf;switch(a){case _.vd:return _.pi;case _.Uf:case _.qe:return _.Uf;default:return _.De}},xx=function(a,b,c){if(_.S.Ue(a.w))return document.createTextNode(_.S.vg(a.w||""));if(a.A)return _.Yp("br");for(var d=_.Yp("span"),e=_.w(a.f),f=e.next();!f.done;f=e.next())_.Zp(d,f.value);a=_.w(a.j);for(e=a.next();!e.done;e=a.next())d.appendChild(xx(c.get(e.value),b,c));return d},yx=function(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*
|
|
6
|
+
this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=Number(a[1])/Number(a[2]))},zx=function(a,b,c){ex.call(this,a,b,c)},Cx=function(a,b,c,d){var e=Ax.exec(a);a=Bx.exec(a);return typeof b===_.k&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},Dx=function(a,b){return typeof b===_.k&&0<b?_.vi:Bx.test(a)?0:_.vi},Ex=function(a,b){ex.call(this,"root-container",[],b);this.j=a},Fx=function(a,b,c){return typeof a===_.k?a:typeof b===_.k?b:c},Gx=function(a,b){var c=a.getAttribute("extent");
|
|
7
|
+
return(c=Bx.exec(c))?Number(c[b]):null},Ix=function(a){a=a.getAttribute("cellResolution");return(a=Hx.exec(a))?Number(a[2]):null},Jx=function(a,b,c){ex.call(this,a,b,c)},Kx=function(a){this.C=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=[]},Mx=function(a){return Lx.some(function(b){return b in a.attributes})},Nx=function(a,b){if(0===b.length)return[];for(var c=[],d=_.w(b),e=d.next();!e.done;e=d.next())e=e.value,a.a.has(e)&&c.push.apply(c,_.ch(Nx(a,
|
|
8
|
+
a.a.get(e).f)).concat([e]));return c},Px=function(){return"inline-"+Ox++},Qx=function(a){this.a=a.firstChild;this.f=new Set},Rx=function(a,b,c,d,e,f){this.h=a;this.a=b;this.j=c;this.l=d;this.f=e;this.attributes=f},Sx=function(a){return qx(a.h.nodeName)},Tx=function(){this.a=new Map},Vx=function(a,b){if(a.a.has(b))return a.a.get(b);var c=null,d=null,e=[],f=[],g={},h=b.parentNode;if(h&&a.a.has(h)){var l=a.a.get(h);e=_.ch(l.l).concat();-1===["#text","span","br"].indexOf(b.nodeName)&&(c=l.a,d=l.j,f=_.ch(l.f).concat(),
|
|
9
|
+
g={},Ux.forEach(function(n){n in l.attributes&&(g[n]=l.attributes[n])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute($w)&&(c=b.getAttribute($w));b.hasAttribute(_.mg)&&f.push.apply(f,_.ch(b.getAttribute(_.mg).split(" ")));d=Array.from(b.attributes).map(function(n){return n.name});d=_.w(d);for(h=d.next();!h.done;h=d.next()){h=h.value;var m=qx(h);g[m]=b.getAttribute(h)}d=g.backgroundImage}c=new Rx(b,c,d,e,f,g);a.a.set(b,c);return c},Wx=function(a){this.a=a;this.f=new DOMParser},Xx=function(a){this.f=
|
|
10
|
+
a},Yx=function(a){return String(Math.floor(a/3600)).padStart(2,"0")+":"+String(Math.floor(a/60%60)).padStart(2,"0")+":"+String(Math.floor(a%60)).padStart(2,"0")+"."+String(Math.floor(1E3*a%1E3)).padStart(3,"0")},Zx=function(){},$x=function(a){this.a=new Wx(a);this.g=new _.K("clpp.ttml.Mp4TtmlParser")},ay=function(){this.j=new Zx};ex.prototype.getId=function(){return this.h};ex.prototype.getAttribute=function(a){return this.a[a]};_.x(fx,ex);_.x(gx,ex);var ix=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,jx=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,lx=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,mx=/^(\d*(?:\.\d*)?)f$/,nx=/^(\d*(?:\.\d*)?)t$/,ox=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,Ax=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,Bx=/^(\d+)px (\d+)px$/,Hx=/^(\d+) (\d+)$/,sx=/(\d+)px/,by=/^(\d+px|\d+em|\d*\.?\d+c)$/,Lx=[Xw,"color",Yw,Zw,"fontFamily","fontSize","fontStyle","fontWeight",
|
|
11
|
+
"lineHeight","opacity","padding",bx,cx,"textOutline",dx,"zIndex"],Ux=["begin",_.qe];_.x(vx,gx);
|
|
12
|
+
vx.prototype.build=function(a,b,c,d,e,f,g){var h=px(this.a.begin,b);b=px(this.a.end,b);if(null===h||null===b)return null;h+=c;b+=c;c=_.Yp(_.ae);for(var l=_.w(this.j),m=l.next();!m.done;m=l.next())c.appendChild(xx(g.get(m.value),e,g));g=new _.ui(h,b,c.innerHTML.trim(),_.ug);g.cssClassList=_.ch(this.f).concat();g.textAlign=wx(this,e,null);g.writingMode=_.qi;g.line=-1;g.lineInterpretation=_.ri;g.lineAlign=_.si;g.containerRows=Fx(null,Ix(a),15);if(this.o&&(f=f.get(this.o))){g.region=f.build(a,e);g.textAlign=
|
|
13
|
+
wx(this,e,f);a:switch(hx(f,e,dx)){case "tb":case "tblr":a=_.Dg;break a;case "tbrl":a=_.Eg;break a;default:a=_.qi}g.writingMode=a;a:switch(hx(f,e,Zw)){case _.vd:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(hx(f,e,Zw)){case _.vd:a=1;break a;default:a=_.ri}g.lineInterpretation=a;a:switch(hx(f,e,Zw)){case _.vd:e=_.vd;break a;default:e=_.si}g.lineAlign=e}this.l&&(a=d.get(this.l))&&(d=a.getAttribute("encoding"),e=a.getAttribute("imageType")||a.getAttribute("imagetype"),a=a.j.trim(),
|
|
14
|
+
g.backgroundImage=("PNG"===e&&"Base64"===d&&0<a.length?"data:image/png;base64,"+a:null)||"");return g};_.x(zx,gx);
|
|
15
|
+
zx.prototype.build=function(a,b){var c=new _.xi;c.id=this.getId();var d=Fx(a.j.containerWidth,Gx(a,1),720),e=Fx(a.j.containerHeight,Gx(a,2),480);a:switch(hx(this,b,Zw)){case "after":var f="flex-start";break a;case _.vd:f=_.vd;break a;default:f="flex-end"}c.displayAlign=f;a:switch(hx(this,b,dx)){case "tb":case "tblr":f="row-reverse";break a;case "tbrl":f="row";break a;default:f=_.Od}c.writingMode=f;f=this.getAttribute("extent")||hx(this,b,"extent");c.width=Cx(f,d,1,100);c.widthUnits=Dx(f,d);c.height=
|
|
16
|
+
Cx(f,e,2,100);c.heightUnits=Dx(f,e);f=this.getAttribute("origin")||hx(this,b,"origin");c.viewportAnchorX=Cx(f,d,1,0);c.viewportAnchorY=Cx(f,e,2,0);c.viewportAnchorUnits=Dx(f,d);c.cssClassList=_.ch(this.f).concat();return c};_.x(Ex,ex);_.x(Jx,ex);
|
|
17
|
+
Jx.prototype.build=function(a){var b=null;var c=Ix(a);c&&(b=Fx(a.j.containerHeight,Gx(a,2),480)/c);b=Fx(a.j.fontSizeRadix,b,16);a=[];c="::ttml ."+this.h+", ::ttml ."+this.h+" * {";for(var d=_.w(cy.entries()),e=d.next();!e.done;e=d.next()){var f=_.w(e.value);e=f.next().value;f=f.next().value;e in this.a&&(c+=f+":"+rx(this.a[e])+";")}a:{if("unicodeBidi"in this.a){d=this.a.unicodeBidi;e="";switch(d){case "normal":case "embed":e=d;break;case "bidiOverride":e="bidi-override"}if(0<e.length){d="unicode-bidi:"+
|
|
18
|
+
e+";";break a}}d=""}c+=d;a:{if("textOutline"in this.a){d=this.a.textOutline.split(" ");e="black";f=".4em";var g=d[0]&&d[0].trim(),h=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!by.test(g)&&by.test(h)&&by.test(l)?(e=g,f=h):2===d.length&&!by.test(g)&&by.test(h)?(e=g,f=h):2===d.length&&by.test(g)&&by.test(h)&&(f=g);if(""!==f){f=rx(f);d="text-shadow:0 0 "+(f+" "+e+",0 0 ")+(f+" "+e+",0 0 ")+(f+" "+e+";");break a}}d=""}c+=d;"textShadow"in this.a?(d=ux(this.a.textShadow),d=rx(d),d="text-shadow:"+
|
|
19
|
+
d+";"):d="";c=c+d+("fontFamily"in this.a?"font-family:"+this.a.fontFamily.replace("monospaceSansSerif","monospace").replace("monospaceSerif","monospace").replace("proportionalSansSerif",ax).replace("proportionalSerif",ax).replace("sansSerif",ax).replace("default",ax)+";":"");a:{if(cx in this.a){d=[];e=_.w(this.a.textDecoration.split(" "));for(f=e.next();!f.done;f=e.next())switch(f=f.value,f){case "underline":case "overline":d.push(f);break;case "lineThrough":d.push("line-through")}if(0<d.length){d=
|
|
20
|
+
"text-decoration:"+d.join(" ")+";";break a}}d=""}e="padding"in this.a?"border: solid transparent;border-width:"+rx(this.a.padding)+";":"";c=c+d+e;"lineHeight"in this.a?(d="",e=this.a.lineHeight,e=rx(e),e=tx(e,b),d=d+"line-height:"+e+";"):d="";a.push(c+d+"}");a:{if("fontSize"in this.a&&(c=this.a.fontSize.split(" "),d=null,1===c.length&&(d=c[0]),2===c.length&&(d=c[1]),d)){d=d.trim();d=rx(d);d=tx(d,b);b="font-size:"+d+";";break a}b=null}b&&(c="::ttml ."+this.h+" .clpp-text-wrapper {",a.push(c+b+"}"),
|
|
21
|
+
c="::ttml .clpp-text-wrapper__"+this.h+" {",a.push(c+b+"}"));return a};var cy=new Map([[Xw,"background-color"],["color","color"],[Yw,Yw],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);Kx.prototype.Rd=function(){var a=this;return this.o.map(function(b){return b.build(a.l,a.w,a.A,a.h,a.a,a.j,a.f)}).filter(function(b){return null!=b})};var Ox=0;Qx.prototype.md=function(){return!!this.a};Qx.prototype.next=function(){if(!this.a)return null;var a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!dy.has(qx(a.nodeName))||ey.has(qx(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&&!dy.has(qx(a.nodeName))));var b=this.a;this.a=a;return b};
|
|
22
|
+
var dy=new Set(["tt","head","layout",_.Re,_.ze,$w,"styling",_.mg,"body",_.ae,"p","span","br"]),ey=new Set([_.mg,_.ze]);Rx.prototype.getId=function(){return this.attributes.id};Wx.prototype.parseInit=function(){};
|
|
23
|
+
Wx.prototype.parseMedia=function(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.O.Xa(this.a.ttml||{}),e=_.nj(a,0,c[0]);e=_.S.ea(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.rg)}catch(n){throw new _.P(_.Q,2,2005,"Failed to parse TTML.");}d=new Kx(d);e=new Tx;f=new Qx(f);b=b.periodStart;typeof b===_.k&&(d.A=b);b=c[0];for(var g=1;g<c.length;++g){var h=c[g],l=_.nj(a,b,h);l=_.xj(l);var m="urn:mpeg:14496-30:subs:"+g;d.h.set(m,new fx(m,l,{imageType:"PNG",encoding:"Base64"}));
|
|
24
|
+
b+=h}for(;f.md();)a=f.next(),a=Vx(e,a),"tt"===Sx(a)&&(d.l=new Ex(d.C,Object.assign({},a.attributes))),"tt"===Sx(a)&&(d.w=new yx(a.attributes.frameRate,a.attributes.subFrameRate,a.attributes.frameRateMultiplier,a.attributes.tickRate)),Sx(a)!==_.ze||a.attributes.begin||a.attributes.end||(c="#"+a.getId(),d.h.set(c,new fx(c,a.h.textContent,a.attributes))),Sx(a)===_.ze&&a.attributes.begin&&a.attributes.end?(c="#"+Px(),b=new fx(c,a.h.textContent,a.attributes),d.h.set(c,b),c=b):c=null,c&&(a.j=c.getId()),
|
|
25
|
+
Sx(a)===_.mg&&(c=a.getId()||Px(),b=new Jx(c,a.f,Object.assign({},a.attributes)),d.a.set(c,b),a.a&&d.j.get(a.a).f.push(c)),Sx(a)!==_.mg&&Mx(a)?(c=Px(),b=new Jx(c,[],Object.assign({},a.attributes)),d.a.set(c,b),c=b):c=null,c&&a.f.push(c.getId()),Sx(a)!==_.ae||!a.attributes.extent&&!a.attributes.origin?c=null:(c=Px(),b=new zx(c,Nx(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),c=b),c&&(a.a=c.getId()),Sx(a)!==$w?c=null:(c=a.getId(),b=new zx(c,Nx(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),
|
|
26
|
+
c=b),c&&(a.a=c.getId()),c=a.l,-1===["#text","span","br"].indexOf(Sx(a))||0===c.length?c=null:(g=c[c.length-1],d.f.has(g)?(c=Px(),b=new vx(c,"#text"===a.h.nodeName?a.h.textContent:null,"br"===Sx(a),a.a,a.j,Nx(d,a.f),a.attributes),d.f.set(c,b),(g=d.f.get(g))&&g.j.push(c),c=b):c=null),c&&a.l.push(c.getId()),"p"===Sx(a)||a.j?(c=Px(),b=new vx(c,null,!1,a.a,a.j,Nx(d,a.f),a.attributes),d.f.set(c,b),d.o.push(b),c=b):c=null,c&&a.l.push(c.getId());e=d.Rd();f=[];a=_.w(d.a.values());for(c=a.next();!c.done;c=
|
|
27
|
+
a.next())f.push.apply(f,_.ch(c.value.build(d.l)));return{cues:e,styles:f}};Xx.prototype.a=function(a){a=(new Wx(this.f)).parseMedia(a,{periodStart:0,segmentStart:null,segmentEnd:0}).cues;var b="WEBVTT\n\n";a=_.w(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=Yx(c.startTime)+" --\x3e "+Yx(c.endTime),e=[];switch(c.textAlign){case _.De:e.push("align:left");break;case _.Uf:e.push("align:right");break;case _.pi:e.push("align:middle");break;case _.De:e.push("align:start");break;case _.Uf:e.push("align:end")}switch(c.writingMode){case _.Dg:e.push("vertical:lr");break;
|
|
28
|
+
case _.Eg:e.push("vertical:rl")}b+=d+(e.length?" "+e.join(" "):"")+"\n";b+=c.payload+"\n\n"}return _.S.hb(b)};Zx.prototype.probe=function(a,b){return a===_.Zc&&b===_.qg};Zx.prototype.create=function(a){return new Xx(a)};$x.prototype.parseInit=function(a){var b=!1;(new _.Rm).K(_.Ue,_.Sm).K(_.tg,_.Sm).K(_.Oe,_.Sm).K(_.Te,_.Sm).K(_.jg,_.Sm).Y(_.lg,_.Tm).K("stpp",function(c){b=!0;c.parser.stop()}).parse(a);if(!b)throw new _.P(_.Q,2,2007);};
|
|
29
|
+
$x.prototype.parseMedia=function(a,b){var c=this,d=!1,e=[],f=[],g=[];(new _.Rm).K("moof",_.Sm).K("traf",_.Sm).Y("subs",function(h){for(var l=_.V(h.reader),m=0;m<l;++m){h.reader.skip(4);for(var n=_.Mm(h.reader),p=0;p<n;++p){var q=1===h.version?_.V(h.reader):_.Mm(h.reader);g.push(q);h.reader.skip(6)}}}).K(_.Ne,_.Um(function(h){d=!0;h=c.a.parseMedia(h,b,g);e=e.concat(h.cues);f=f.concat(h.styles)})).parse(a);d||this.g.warn("Couldn't find the mdat box");return{cues:e,styles:f}};_.x(ay,_.Gs);ay.prototype.f=function(){_.fu(_.Zc,Wx);_.fu(_.Xc,$x);_.fu(Uw,$x);_.fu(Ww,$x);_.fu(Vw,$x);_.Jk.push(this.j)};ay.prototype.a=function(){_.iu(_.Zc);_.iu(_.Xc);_.iu(Uw);_.iu(Ww);_.iu(Vw);_.Lk(this.j)};ay.prototype.id=function(){return"subtitles-ttml"};_.J("clpp.ttml.TtmlComponent",ay);};
|
|
30
30
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
31
31
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
32
32
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.verimatrix.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
this.D=d;this.
|
|
4
|
-
_.
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
var f=function(window){var Iw="VerimatrixVCAS",Jw="clpp.verimatrix.Vcas",Kw="clpp.verimatrix.VcasComponent",Qw=function(a){_.Em.call(this,Iw);var b={};b[Lw]=Lw;b[Mw]=Mw;var c=a.authenticator,d=void 0===a.licenseRequestVuidLocation?Nw:a.licenseRequestVuidLocation;b=void 0===a.httpHeaderNames?b:a.httpHeaderNames;var e=a.widevineLicenseUrl,f=a.playReadyLicenseUrl,g=a.fairPlayLicenseUrl,h=a.fairPlayCertificateUrl,l=a.fairPlaySiteId,m=void 0===a.fairPlayAssetIdStrategy?Ow:a.fairPlayAssetIdStrategy;this.A=a.deviceId;this.a=c;
|
|
3
|
+
this.D=d;this.C=b;this.w=Pw(this,e);this.o=Pw(this,f);this.l=Pw(this,g);this.j=h;this.H=l;this.G=m;this.g=new _.K(Jw);_.S.empty(this.w)?this.g.warn(_.rc):this.fb(_.Ud,{licenseUrl:this.w,videoRobustness:[_.Yb,void 0],audioRobustness:[_.Xb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.S.empty(this.o)?this.g.warn(_.Lb):this.fb(_.Sd,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],modifiers:{licenseRequest:this.h.bind(this)}});
|
|
4
|
+
_.S.empty(this.l)?this.g.warn(_.db):_.S.empty(this.j)?this.g.warn(_.cb):this.fb(_.Qd,{licenseUrl:this.l,certificateUrl:this.j,modifiers:{licenseRequest:this.L.bind(this),licenseResponse:this.M.bind(this),extractContentId:this.I.bind(this)}})},Pw=function(a,b){if(a.D===Nw){var c=Object.assign({},{deviceId:_.yj(_.S.wd(a.A))},a.a&&{authenticator:_.yj(_.S.wd(a.a))});return b+_.uk(c)}return b},Rw=function(){this.g=new _.K(Kw)};_.x(Qw,_.Em);
|
|
5
|
+
Qw.prototype.h=function(a,b){if(this.D===Sw){var c=this.C[Mw],d={};d[this.C[Lw]]=this.A;this.a&&(d[c]=this.a);Object.keys(d).forEach(function(e){b.headers[e]=d[e]})}};Qw.prototype.I=function(a,b){var c=_.$m(b);switch(this.G){case Tw:c=_.uk({r:c,lo:this.H},!0)}return c};Qw.prototype.L=function(a,b){this.h(a,b);_.cn(b)};Qw.prototype.M=function(a,b){_.dn(b)};_.J(Jw,Qw);Qw.prototype.constructor=Qw.prototype.constructor;Qw.NAME=Iw;var Nw="query-string",Sw="http-header";
|
|
6
|
+
Qw.LicenseRequestVuidLocation={QUERY_STRING:Nw,HTTP_HEADER:Sw};var Lw="DeviceId",Mw="Authenticator";Qw.LicenseRequestHttpHeader={DEVICE_ID_HEADER:Lw,AUTHENTICATOR_HEADER:Mw};var Ow="keyid",Tw="contentid-siteid";Qw.FairPlayAssetIdStrategy={KEYID:Ow,CONTENTID_SITEID:Tw};_.x(Rw,_.Gs);Rw.prototype.a=function(){delete _.ym.VerimatrixVCAS};Rw.prototype.h=function(a){a=a.getConfiguration();if(a.drm&&a.drm.env===Iw){a=a.drm.customData;if(!a)throw new _.P(_.Q,7,7100,_.Vd);a=new Qw(a);this.g.info("Registering the Verimatrix VCAS Ultra environment");_.zm(a)}};Rw.prototype.id=function(){return"verimatrix-vcas"};_.J(Kw,Rw);};
|
|
7
7
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
8
8
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
9
9
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.vimond.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
b){a.m.trigger(new _.L(_.
|
|
4
|
-
|
|
5
|
-
_.
|
|
6
|
-
_.
|
|
7
|
-
b.
|
|
8
|
-
_.
|
|
9
|
-
l.a.m.getLoadedSource().type||"";n=m.client;p=l.a.m.getLoadedSource();p=((new _.
|
|
10
|
-
typeof n.liveResumePossible!==_.
|
|
11
|
-
|
|
12
|
-
_.
|
|
13
|
-
c=b.failIfUnreachable;typeof c!==_.
|
|
14
|
-
_.
|
|
2
|
+
var f=function(window){var yw="Registering listeners",zw="clpp.vimond.VimondPlugin",Aw=function(a,b,c,d,e){this.G=a;this.H=b;this.I=c;this.m=d;this.D=e;this.a=new _.Uh;this.l=!0;this.f=this.j=this.A=!1;this.C=null;this.h=new _.Zk(this.xh.bind(this));this.g=new _.K("clpp.vimond.VimondDispatcher");this.o=this.w=0;this.m&&this.a&&(this.g.debug(yw),this.a.on(this.m,_.hg,this.Bk.bind(this)),this.a.on(this.m,_.sg,this.Ck.bind(this)),this.a.on(this.m,_.yc,this.zk.bind(this)),this.a.on(this.m,_.zc,this.Ak.bind(this)))},Bw=function(a,
|
|
3
|
+
b){a.m.trigger(new _.L(_.Jg,{detail:b}))},Cw=function(a,b,c){b&&(a.A=!0,a.h.stop());a.m.onError(new _.P(b?_.Q:1,9,9201,c))},Dw=function(a,b,c,d,e){this.l=a;this.o=c;this.h=b;this.a=d;this.j=e;this.g=new _.K("clpp.vimond.VimondService");this.f=0},Ew=function(a){this.m=a;this.a=new _.Uh;this.g=new _.K("clpp.vimond.VimondAdapter");this.f=this.h=!1;this.m&&this.a&&(this.g.debug(yw),this.a.on(this.m,_.Nf,this.zm.bind(this)),this.a.on(this.m,_.yc,this.xk.bind(this)),this.a.on(this.m,_.zc,this.yk.bind(this)))},
|
|
4
|
+
Fw=function(a,b){var c=a.m.getState();if(1===b)return["str-start",_.xf];if(a.h)return[_.qe,_.hf];if(c===_.up)return[_.qe,null];if(c===_.yp)return[_.se,_.hf];var d=_.hf;if(c===_.sp||c===_.Bp||a.f)d=_.xf;return["period",d]},Gw=function(){this.a=!1;this.g=new _.K(zw);this.j=this.h=this.f=null},Hw=function(){};_.u=Aw.prototype;_.u.Ck=function(){this.f||(this.f=1<Math.abs(this.w-this.m.getPosition()));this.w=this.m.getPosition()};_.u.zk=function(){this.g.debug("Ad break started");this.j=!0};
|
|
5
|
+
_.u.Ak=function(){this.g.debug("Ad break stopped");this.j=!1};
|
|
6
|
+
_.u.Bk=function(a){var b=this,c,d,e,f,g;return _.I(function(h){if(1==h.a){c=a.detail;d=_.wp;e=c.currentState;f=c.previousState;b.g.debug("State changed, prev: "+f+" curr: "+e);if(b.A||b.j)return h["return"]();if(e===b.C&&!b.f)return b.g.debug("Ignore transition"),h["return"]();if(b.l&&e!==d.PLAYING)return h["return"]();if(b.f&&[d.PAUSED,d.BUFFERING].includes(e))return b.g.debug("Seeking"),h["return"]();b.f&&e===d.PLAYING&&(b.g.debug("Seeked"),b.f=!1);g=[d.PLAYING,d.PAUSED,d.ERROR,d.ENDED];if(!g.includes(e))return h.F(0);
|
|
7
|
+
b.C=e;return _.y(h,b.xh(),3)}e===d.ENDED&&b.h.stop();_.C(h)})};
|
|
8
|
+
_.u.xh=function(){var a=this,b,c,d,e,f,g;return _.I(function(h){if(1==h.a){var l=Math.floor(Date.now()/1E3);0<a.o&&a.g.debug("Last event was "+(l-a.o)+" seconds ago");a.o=l;a.h.stop();a.h.fa(a.l?10:a.G);a.l=!1;_.D(h,2);l=a.D;l.f++;var m=_.O.ra(l.o);m.client.buildName=_.wa;m.client.buildVersion=_.ja;var n=m.client,p=l.a.m.getDrmInfo();n.drm=p?p.keySystem:"";m.client.pageUrl=document.location.href;m.client.streamUrl=l.a.m.getLoadedSource().url;m.client.userAgent=navigator.userAgent;m.client.videoFormat=
|
|
9
|
+
l.a.m.getLoadedSource().type||"";n=m.client;p=l.a.m.getLoadedSource();p=((new _.sk(p.url)).scheme||"").replace(":","");n.videoProtocol=p;n=Fw(l.a,l.f);m.client.playerEvent=n[0]||"";m.client.playerState=n[1]||"";m.progress.vod&&(m.progress.vod.position=l.a.getPosition());if(n=m.progress.live){p=l.a;var q=p.m.getPresentationStartTime()||0;p=Math.floor(q+p.m.getPosition());p=(new Date(1E3*p)).toISOString();n.position=p;q=l.a;p=q.m.getPosition();q=q.m.getSeekRange().end;n.onLiveEdge=30>Math.abs(q-p);
|
|
10
|
+
typeof n.liveResumePossible!==_.ld&&(n.liveResumePossible=!0)}m.progress.eventNumber=l.f;m.timestamp=(new Date).toISOString();l.g.debug("Fire an event");n=_.Lj(l.l);n.method="POST";n.contentType="application/json";n.headers.Authorization="Bearer "+l.h;n.body=_.S.wd(JSON.stringify(m));l=l.j.fetch(n).N;return _.y(h,l,4)}if(2!=h.a)return b=h.f,Bw(a,b),_.qh(h,0);d=c=_.E(h);e=d.code;f=d.data;g=[1002,1003];g.includes(e)?(a.g.debug("Unreachable service"),Bw(a,f),Cw(a,a.H,f)):1001===e?(a.g.debug("Generic service error"),
|
|
11
|
+
Bw(a,f),Cw(a,a.I,f)):a.g.error(c.toString());_.C(h)})};_.u.dispose=function(){this.g.debug(_.jc);_.Xh(this.a);this.h.stop()};Dw.prototype.Dg=function(a){this.h=a};_.u=Ew.prototype;_.u.getPosition=function(){return Math.floor(this.m.getPosition())};_.u.zm=function(){this.h=!0};_.u.xk=function(){this.f=!0};_.u.yk=function(){this.f=!1};_.u.dispose=function(){this.g.debug(_.jc);_.Xh(this.a)};_.x(Gw,_.tu);_.u=Gw.prototype;_.u.onPlayerCreated=function(){};
|
|
12
|
+
_.u.onContentWillLoad=function(a){var b=a.getConfiguration();(this.a=!_.O.S(b.vimond)&&typeof b.vimond===_.Ye)?a.namespace()===_.Fd&&(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=_.w(["authToken","playerEventRequest"]),d=c.next();!d.done;d=c.next())if(d=d.value,!b[d]){this.g.warn(d+" key is missing");a.onError(new _.P(1,9,9200));return}this.g.debug("Configuration is valid");
|
|
13
|
+
c=b.failIfUnreachable;typeof c!==_.ld&&(c=!0);d=b.failOnError;typeof d!==_.ld&&(d=!0);this.f=new Ew(a);this.h=new Dw(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new Aw(b.playerEventRequest.eventInterval,c,d,a,this.h)}};_.u.onPlayerWillRelease=function(){this.a&&(this.f&&this.f.dispose(),this.j&&this.j.dispose(),this.j=this.h=this.f=null)};_.u.onPlayerWillDestroy=function(){};_.u.id=function(){return"vimond"};
|
|
14
|
+
_.u.Dg=function(a){this.a&&this.h&&this.h.Dg(a)};_.J(zw,Gw);Gw.prototype.updateAuthToken=Gw.prototype.Dg;Gw.Id="vimond";Hw.prototype.create=function(){return new Gw};_.Zq(new Hw);};
|
|
15
15
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
16
16
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
17
17
|
else{_=this.clpp._;(f.call(g,this));}
|