@castlabs/prestoplay 6.18.0 → 6.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +7 -7
- package/cjs/cl.cast.js +115 -114
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +581 -577
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +77 -75
- package/cjs/cl.externs.js +175 -293
- package/cjs/cl.freewheel.js +23 -24
- package/cjs/cl.hls.js +70 -71
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +28 -29
- package/cjs/cl.ima.js +24 -24
- package/cjs/cl.mse.js +313 -314
- package/cjs/cl.muxdata.js +15 -15
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.sessions.js +16 -15
- package/cjs/cl.simid.js +15 -15
- package/cjs/cl.smooth.js +71 -72
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +71 -71
- package/cjs/cl.ttml.js +27 -27
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +12 -13
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.youbora.js +18 -18
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +90 -89
- package/cl.conviva.js +27 -27
- package/cl.core.js +475 -474
- package/cl.crypto.js +9 -9
- package/cl.dash.js +72 -71
- package/cl.externs.js +172 -294
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +74 -72
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +25 -26
- package/cl.ima.js +17 -17
- package/cl.mse.js +277 -274
- package/cl.muxdata.js +13 -13
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +11 -11
- package/cl.playlist.js +5 -5
- package/cl.sessions.js +10 -10
- package/cl.simid.js +13 -13
- package/cl.smooth.js +59 -59
- package/cl.thumbnails.js +19 -19
- package/cl.tizen.js +57 -57
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +9 -8
- package/cl.vr.js +14 -14
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +15 -15
- package/clpp.styles.css +14 -0
- package/package.json +1 -1
- package/typings.d.ts +379 -384
package/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 _.I(function(e){if(1==e.a){b=a.a===_.
|
|
4
|
-
keyIds:[],periodId:null},_.
|
|
5
|
-
"Initialize",""),webapis.avplay.setDrm(b.
|
|
6
|
-
_.
|
|
7
|
-
6,6007,{message:_.
|
|
8
|
-
|
|
9
|
-
c)}},
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
b
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
h
|
|
30
|
-
d
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var
|
|
36
|
-
_.
|
|
37
|
-
_.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
_.
|
|
41
|
-
_.
|
|
42
|
-
_.
|
|
43
|
-
_.
|
|
44
|
-
_.
|
|
45
|
-
_.
|
|
46
|
-
_.
|
|
47
|
-
_.
|
|
48
|
-
_.
|
|
49
|
-
|
|
50
|
-
_.
|
|
51
|
-
_.
|
|
52
|
-
|
|
53
|
-
_.
|
|
54
|
-
_.
|
|
55
|
-
_.
|
|
56
|
-
_.
|
|
57
|
-
_.
|
|
58
|
-
_.
|
|
59
|
-
|
|
60
|
-
_.
|
|
61
|
-
_.
|
|
62
|
-
_.
|
|
63
|
-
var e=[_.
|
|
64
|
-
_.
|
|
65
|
-
_.
|
|
66
|
-
_.
|
|
67
|
-
_.
|
|
68
|
-
_.
|
|
69
|
-
_.
|
|
70
|
-
_.
|
|
71
|
-
_.
|
|
72
|
-
|
|
2
|
+
var f=function(window){var bO="An unknown error occurred while trying to get volume",cO="Cannot get loading rendition due to platform limitations",dO="PARAM_START_POSITION",eO="SecurityError",fO="The require privilege is: http://tizen.org/privilege/tv.audio",gO="|STARTBITRATE\x3d",hO=function(a,b,c){function d(e){c.call(a,e);a.removeEventListener(b,d)}a.addEventListener(b,d)},iO=function(a,b){this.h=a;this.o=null;this.a=_.Ue;this.l=null;this.j=!1;this.f=new Map;this.D=b;this.g=new _.K("clpp.tizen.DrmEngine")},lO=function(a){var b,
|
|
3
|
+
c,d;return _.I(function(e){if(1==e.a){b=a.a===_.Qd||a.a===_.Od;if(!b)throw new _.N(_.O,6,6001,"The key system "+a.a+" is not supported by the player or the platform");c=a.f.get(a.a);if(!c.Zd)throw new _.N(_.O,6,6012,"No license server given for "+a.a);_.D(e,2);return a.a===_.Qd?_.y(e,jO(a),5):_.y(e,kO(a,c),5)}if(2!=e.a)return a.o={keySystem:a.a,licenseServerUri:c.Zd,distinctiveIdentifierRequired:!1,persistentStateRequired:c.eg,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],
|
|
4
|
+
keyIds:[],periodId:null},_.ph(e,0);d=_.F(e);a.g.error("Error while configuring CDM for "+a.a,d);throw new _.N(_.O,6,6005,{message:JSON.stringify(d)});})},kO=function(a,b){var c,d,e,f;return _.I(function(g){c=mO;d=nO;e={};e[d.Si]=!b.eg;e[d.Ui]=b.Zd;""!==b.customData&&(e[d.Ri]=b.customData);f=JSON.stringify(e);a.g.debug("PlayReady properties: ",f);try{webapis.avplay.setDrm(c.PLAYREADY,"SetProperties",f)}catch(h){throw h;}_.A(g)})},jO=function(a){var b;return _.I(function(c){b=mO;try{webapis.avplay.setDrm(b.ne,
|
|
5
|
+
"Initialize",""),webapis.avplay.setDrm(b.ne,"widevine_app_session",a.l.id),webapis.avplay.setDrm(b.ne,"widevine_data_type",a.l.type)}catch(d){throw d;}_.A(c)})},oO=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,v,z,C,H,E;_.I(function(B){if(1==B.a){c=mO;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.Zd;l=_.uj([h],_.qj());l.type=3;l.body=f.buffer;l.method=
|
|
6
|
+
_.Jb;_.D(B,2);return _.y(B,a.D.Jb.fetch(l).U,4)}if(2!=B.a){m=B.f;if(a.j){n=_.Wi(m.data);p=n.byteLength;q="";for(t=0;t<p;t++)q+=String.fromCharCode(n[t]);v=btoa(q);z=b.session_id+dO+(v+dO);a.g.debug("Widevine license params",z);try{webapis.avplay.setDrm(c.ne,"widevine_license_data",z)}catch(G){a.g.error("License response rejected by CDM"),C=new _.N(_.O,6,6008,{browserError:JSON.stringify(G)}),a.D.onError(C)}}return _.ph(B,0)}H=_.F(B);a.g.error("License request failed.",JSON.stringify(H));E=new _.N(_.O,
|
|
7
|
+
6,6007,{message:_.ab,url:H.data.url,status:H.data.status||NaN,response:H.data.response||"",headers:H.data.headers||{}},H);a.D.onError(E);_.A(B)})},pO=function(a){_.Ul.call(this);this.m=a;this.h=null;this.g=new _.K("clpp.tizen.Middleware");this.C=1;this.B=!1;this.l=null;this.G=0;this.o=!0;this.f=!1;this.a=null;this.A=1;this.w=!1;this.j={}},qO=function(a){return _.I(function(b){tizen.systeminfo.getPropertyValue("DISPLAY",function(c){a.A=c.resolutionWidth/1920;a.g.debug("Display resolution ratio: ",
|
|
8
|
+
a.A)},function(c){a.g.debug("Could not load DISPLAY property");throw c;});_.A(b)})},sO=function(a){try{webapis.avplay.setListener({onbufferingstart:a.mk.bind(a),onbufferingprogress:a.lk.bind(a),onbufferingcomplete:a.kk.bind(a),onstreamcompleted:a.qk.bind(a),oncurrentplaytime:function(b){a.trigger(new _.L(rO,{currentTime:b}))},onevent:a.pk.bind(a),onsubtitlechange:a.rk.bind(a),ondrmevent:a.nk.bind(a),onerror:a.S.bind(a)})}catch(b){a.g.error(b)}},tO=function(a){var b=!!a.m.getTrackManager().Na();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",
|
|
9
|
+
c)}},uO=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,ho:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",gO+d)}catch(e){a.g.debug(e)}},vO=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+gO+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",c),c;}},zO=function(a){return{position:a.getPosition(),state:a.m.getState(),Kg:a.getState(),playbackRate:a.getPlaybackRate(),
|
|
10
|
+
isLive:a.isLive(),duration:a.getDuration(),isMuted:wO(a),volume:a.getVolume(),Dn:xO(a),Gk:yO(a)}},BO=function(a){var b,c;return _.I(function(d){if(1==d.a)return _.y(d,AO(),2);if(3!=d.a)return b=new Promise(function(e){(new _.Vk(e)).ea(5)}),_.y(d,Promise.race([qO(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"));_.A(d)})},HO=function(a,b,c){var d,e,f,g,h,l,m,n;return _.I(function(p){switch(p.a){case 1:a.l=
|
|
11
|
+
_.Gp(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(CO)),f=c.currentPosition);_.D(p,2);g=a.l[d].url;h=a.l[d].type;h!==_.Uc||g.includes(".mpd")||(l=new URL(g),l.searchParams.append("cl-ext",".mpd"),g=l.toString());webapis.avplay.open(g);e.nextBandwidth?(vO(a,e.nextBandwidth),a.o=!1):(a.o||uO(a,e),a.o=!0);sO(a);if(!b.drm||!b.drm.env){a.g.debug("No DRM configuration was provided. Assuming clear content");
|
|
12
|
+
p.F(4);break}m={onError:function(q){return a.m.onError(q)},Jb:a.m.getNetworkEngine()};a.h=new iO(b.drm,m);return _.y(p,a.h.init(),4);case 4:return a.f||a.trigger(new _.L(DO)),_.y(p,EO(a),6);case 6:a.f||a.trigger(new _.L(FO));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&&GO(a,b.muted),b.autoplay&&a.m.play()["catch"](function(q){a.g.debug("Autoplay failed",q)}));_.ph(p,0);break;case 2:throw n=_.F(p),
|
|
13
|
+
a.g.debug("Error while attempting to load source."),n;}})},EO=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!");tO(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)}}))})},JO=function(a,b,c){a.g.debug("switchVideoTrack()");try{var d={estimatedBandwidth:parseInt(webapis.avplay.getStreamingProperty("CURRENT_BANDWITH"),
|
|
14
|
+
10),currentBandwidth:b,nextBandwidth:c,currentPosition:a.getPosition()};a.a=zO(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(function(){var e=a.a.Kg;a.f=!1;a.a=null;return e===IO?a.pause():a.play()})}catch(e){return Promise.reject(e)}},xO=function(a){return a.f&&a.a?a.a.Dn:webapis.avplay.getTotalTrackInfo()},yO=function(a){return a.f&&a.a?a.a.Gk:webapis.avplay.getCurrentStreamInfo()},MO=function(a,b,c){b=b.toUpperCase();b===KO&&LO(a,!0);var d=
|
|
15
|
+
a.j[b];d&&(d.Ve.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 "+h+" track. Trying again...AVPlay state: "+(a.getState()+", buffering: ")+a.w,n),!1===m&&(a.j[h]={type:h,index:l,Hg:0,Ve:new _.Vk(function(){return g(h,c,!0)})}),(l=a.j[h])&&3>l.Hg?(!a.w&&++l.Hg,l.Ve.ea(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),
|
|
16
|
+
l&&l.Ve.stop(),a.j[h]=null,f())}}g(b,c)})},LO=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)}},GO=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case eO:a.g.warn("The application does not have the privilege to set mute.",fO);break;default:a.g.warn(bO,c)}}},wO=function(a){var b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case eO:a.g.warn("The application doesn't have the privilege to get the mute state.",
|
|
17
|
+
fO);break;default:a.g.warn(bO,c)}}return!!b},AO=function(){return new Promise(function(a,b){if(window.webapis)a();else{var c=document.createElement("script");hO(c,_.Fe,function(d){return a(d)});hO(c,_.oe,function(d){return b(d)});c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},NO=function(a){this.m=a;this.a=this.m.a;this.f=_.op;this.j=_.pp;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.h=2;this.g=new _.K("clpp.tizen.StateManager")},PO=function(a,b){if(a.f!==
|
|
18
|
+
b)if(a.f===_.zp&&b!==_.op)a.g.debug(_.RB+OO(b));else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.tp?(a.o=(new Date).getTime(),a.m.trigger(new _.L(_.md,{detail:{bufferedTimeMS:-1,reason:a.h}}))):a.j===_.tp&&a.m.trigger(new _.L(_.ld,{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(_.dg,{detail:d}));a.g.debug("State changed:",OO(a.j),"-\x3e",OO(a.f))}},OO=function(a){return Object.keys(_.xp)[a]},RO=
|
|
19
|
+
function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case QO:c=_.Cp;break;case IO:c=_.Bp;break;default:a.m.isEnded()?c=_.vp:a.g.debug("Inconsistent AVPlay playback state:",b)}PO(a,c)}},SO=function(){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 _.K("clpp.tizen.TextStreamer")},TO=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},UO=function(a){var b,c;return _.I(function(d){if(1==
|
|
20
|
+
d.a)return b=a.m.getConfiguration(),c=null,_.y(d,_.Qq(a.B.url,a.m.getNetworkEngine(),b.manifest.attemptParameters,a.B.type||null),2);(c=d.f)&&c.configure(b.manifest);return d["return"](c)})},VO=function(a){var b=document.createElement(_.r),c=new _.BE,d=new _.tE,e=a.m.getTextDisplayer();return new _.DE(b,c,e,d,a.m.getConfiguration())},WO=function(a){var b={configuration:{},Pb:function(){return a.m.getPosition()},W:a.h,Jb:a.m.getNetworkEngine(),Uf:a.tk.bind(a),Tf:a.sk.bind(a),onError:a.S.bind(a),di:function(){},
|
|
21
|
+
onEvent:function(){},ii:a.uk.bind(a),Qe:function(){},ze:function(){return new _.LH},rf:function(){return!1},Gd:null};return new _.SF(a.a,b)},XO=function(a){var b=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},YO=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=
|
|
22
|
+
c[d].textStreams;break}a=b}else a=[];b=[];for(d=c=0;d<a.length;d++){var e=new _.Rj(String(c++),_.T);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=a[d].kind||_.wC;var f=new _.ak(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},ZO=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.f){var b=_.VF(a.f,_.Q),c=null;if(b){a=YO(a);for(var d=0;d<a.length;d++)if(a[d].renditions[0].id===String(b.id)){c=a[d].renditions[0];
|
|
23
|
+
break}}return c}return null},$O=function(a,b){a.g.debug("Set active track",b);if(b&&(a.o=b.language,a.A=b.roles[0]||"",a.C=b.kind===_.qe,a.a&&a.f)){a.setTextVisibility(!0);var c=XO(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):(_.fG(a.f,c,!0,0),a.m.trigger(new _.L(_.Ol))),a.o=c.language):a.g.error(_.QB,d.id)}},aP=function(){this.h=this.a=this.m=null;this.f={};this.g=new _.K("clpp.tizen.TrackManager");
|
|
24
|
+
this.w=this.l=this.j=null;this.A=!1;this.o=1},bP=function(a,b){a.m.trigger(new _.L(_.Kg,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,abrSelection:a.a.o}}))},cP=function(a){var b=a.na();b&&a.m.trigger(new _.L(_.jd,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},dP=function(a){var b=a.m.getConfiguration(),c=_.di(b.preferredAudioLanguage||[]),d=a.f[_.Tj]||[];if(d.length){var e=null;c.some(function(g){e=_.TC(g,d.map(function(h){return h.language}));
|
|
25
|
+
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)}),0<f.length&&(c=f[0]));a.g.debug("Setting audio track with preferred language:",e);a.Da(c)}else a.g.debug("Preferred language(s) not available")}else a.g.debug("Could not set preferred audio language")},eP=function(a,b){if(b){var c=b.track.type.toUpperCase();MO(a.a,c,Number(b.id)).then(function(){c===_.ka&&(a.j=b,a.m.trigger(new _.L(_.Nl)));
|
|
26
|
+
c===KO&&(a.l=b,a.m.trigger(new _.L(_.Ol)))})["catch"](function(){a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},fP=function(a,b,c){var d=_.Ni(b.language||_.tg);c.language=_.Sj(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.ed;a=new _.ak(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=b.bit_rate||null;return a},gP=function(a,b,c){c.mimeType=_.Ig;a=new _.ak(String(a),c);a.track=c;a.width=b.Width||null;a.height=
|
|
27
|
+
b.Height||null;a.bandwidth=b.Bit_rate?Number(b.Bit_rate):null;a.codec=b.fourCC||null;return a},hP=function(a,b,c){b=_.Ni(b.track_lang||_.tg);c.mimeType="text/ttml";c.language=_.Sj(b);c.originalLanguage=b;c.kind=_.wC;return new _.ak(String(a),c)},iP=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},kP=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;
|
|
28
|
+
for(var e=b.filter(function(n){return n.type===_.jc}),f=b.filter(function(n){return n.type===_.ka}),g=[],h=0;h<f.length;h++){var l=iP(a,f[h].extra_info);if(l){var m=_.Ni(l.language||_.tg);m=_.Sj(m);m=c(g,m);m||(m=new _.Rj(String(a.o++),_.Tj),g.push(m));m.renditions.push(fP(f[h].index,l,m))}else a.g.warn("Skipping audio stream with no extra info")}f=new _.Rj(String(a.o++),_.Uj);for(h=0;h<e.length;h++)(l=iP(a,e[h].extra_info))?f.renditions.push(gP(e[h].index,l,f)):a.g.warn("Skipping video stream with no extra info");
|
|
29
|
+
e=[];e=a.h?YO(a.h):jP(a,b);d[_.Uj]=[f];d[_.Tj]=g;d[_.T]=e;return d},jP=function(a,b){for(var c=b.filter(function(h){return h.type===KO}),d=[],e=0;e<c.length;e++){var f=iP(a,c[e].extra_info);if(f){var g=new _.Rj(String(a.o++),_.T);g.renditions.push(hP(c[e].index,f,g));d.push(g)}else a.g.warn("Skipping text stream with no extra info")}return d},lP=function(a,b){for(var c=a.f[_.Uj]||[],d=[],e=0;e<c.length;e++)for(var f=0;f<c[e].renditions.length;f++)_.M.la(c[e].renditions[f],b,Object.keys(b))&&d.push(c[e].renditions[f]);
|
|
30
|
+
return d[0]||null},mP=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===b){c=a[d].renditions[e];break}return c},nP=function(a,b){if(b===_.T&&a.h)return ZO(a.h);var c=yO(a.a)||[];if(0===c.length)return null;c=c.filter(function(e){return e.type===b.toUpperCase()})[0];var d=null;b===_.Uj&&(d=iP(a,c.extra_info),d=lP(a,{width:d.Width,height:d.Height}));b===_.Tj&&(c?(d=mP(a,c,_.Tj),a.j=d):d=a.j);b===_.T&&
|
|
31
|
+
(c?(d=mP(a,c,_.T),a.l=d):d=a.l);return d},oP=function(){_.Ul.call(this);this.a=new pO(this);this.f=new NO(this);this.configuration=this.B=_.em();this.w=null;this.g=new _.K("clpp.tizen.Player");this.j=null;this.l=new aP;this.C=new _.Nj;this.o=this.h=null;this.A=!1},pP=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*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:",
|
|
32
|
+
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())},qP=function(){},rP=function(){};
|
|
33
|
+
iO.prototype.init=function(){var a=this,b,c,d,e,f,g;return _.I(function(h){if(1==h.a){b=_.zm[a.h.env]||null;if(!b)throw a.g.debug(_.Aa,_.Ob+a.h.env+_.aa),new _.N(_.O,6,6015,_.Ba+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=_.Bm(b,a.h.customData);(e=d[_.Od])&&a.f.set(_.Od,{Zd:e.licenseUrl||"",customData:c,eg:!1});(f=d[_.Qd])&&a.f.set(_.Qd,{Zd:f.licenseUrl||"",customData:c,
|
|
34
|
+
eg:!1});if(0===a.f.size)throw new _.N(_.O,6,6E3);if((g=a.h.preferredDrmSystem)&&a.f.get(g))a.a=g;else if(a.f.get(_.Od))a.a=_.Od;else if(a.f.get(_.Qd))a.a=_.Qd;else throw new _.N(_.O,6,6001,"Configuration for the target system is missing.");return _.y(h,lO(a),2)}a.j=!0;_.A(h)})};iO.prototype.release=function(){var a=this;return _.I(function(b){a.j=!1;a.o=null;a.a=_.Ue;a.l=null;a.f=new Map;_.A(b)})};iO.prototype.getDrmInfo=function(){return this.o};
|
|
35
|
+
var nO={Si:"DeleteLicenseAfterUse",Ui:"LicenseServer",Sn:"GetChallenge",Tn:"HttpHeader",Vn:"UserAgent",On:"Cookie",Ri:"CustomData"};_.x(pO,_.Ul);_.u=pO.prototype;_.u.mk=function(){this.w=!0;this.f||this.trigger(new _.L(CO))};_.u.lk=function(a){this.w=!0;this.trigger(new _.L(sP,{percent:a}))};_.u.kk=function(){this.w=!1;this.trigger(new _.L(tP))};_.u.qk=function(){this.trigger(new _.L(uP))};_.u.pk=function(a,b){this.trigger(new _.L(vP,{eventid:a,data:b}))};_.u.rk=function(a,b,c,d,e){this.trigger(new _.L(wP,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
|
|
36
|
+
_.u.nk=function(a,b){this.trigger(new _.L(xP,{drmType:a,drmData:b}));if(this.h){var c=this.h;if(c.j)if(c.a===_.Qd&&"Challenge"===b.name)oO(c,b);else if("DrmError"===b.name){c.g.debug("DrmError event",b);var d=new _.N(_.O,6,6005,{message:JSON.stringify(b)});c.D.onError(d)}}};_.u.S=function(a){this.trigger(new _.L(yP,{eventType:a}))};
|
|
37
|
+
_.u.play=function(){function a(){return new Promise(function(d,e){function f(){d();clearTimeout(g)}var g=null;b.one(rO,f,b);g=setTimeout(function(){b.off(rO,f);e("Timeout")},3E4)})}var b=this,c=this.getState();if(c===zP)return(new Promise(function(d,e){webapis.avplay.prepareAsync(function(){tO(b);d(webapis.avplay.play())},function(f){b.trigger(new _.L(yP));e(f)})})).then(function(){return a()});if(c===IO||c===AP)try{return webapis.avplay.play(),a()}catch(d){return Promise.reject(d)}return c===QO?
|
|
38
|
+
Promise.resolve():Promise.reject("Player is in invalid state")};_.u.pause=function(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===IO?Promise.resolve():Promise.reject()};
|
|
39
|
+
_.u.setPlaybackRate=function(a){var b=this.getState();if(b===AP||b===QO||b===IO){try{webapis.avplay.setSpeed(a),this.C=a}catch(c){return this.g.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.C)}return!0}this.g.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1};_.u.getPlaybackRate=function(){return this.C};
|
|
40
|
+
_.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,BO(c),4);case 4:return _.y(e,HO(c,a,b),5);case 5:_.ph(e,0);break;case 2:throw d=_.F(e),new _.N(_.O,7,7003,null,d);}})};_.u.getState=function(){if(this.f&&this.a)return this.a.Kg;try{return webapis.avplay.getState()}catch(a){this.S(JSON.stringify(a))}};
|
|
41
|
+
_.u.seek=function(a){var b=this,c=1E3*a;return new Promise(function(d,e){b.B=!0;b.m.trigger(new _.L(_.zg));webapis.avplay.seekTo(c,function(){b.B=!1;b.m.trigger(new _.L(_.yg));d()},function(){b.B=!1;e()})})};_.u.getPosition=function(){if(this.f&&this.a)return this.a.position;try{return webapis.avplay.getCurrentTime()/1E3}catch(a){this.S(JSON.stringify(a))}};_.u.getDuration=function(){if(this.f&&this.a)return this.a.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.S(JSON.stringify(a))}};
|
|
42
|
+
_.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.Ve.stop()}a.j={};a.C=1;a.B=!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 eO:this.g.debug("The application does not have the privilege to get the volume.",fO);break;default:this.g.debug(bO,b)}}return a};
|
|
43
|
+
_.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 eO:this.g.warn("The application does not have the privilege to set the volume.",fO);break;default:this.g.warn("An unknown error occurred while trying to set volume",b)}}};
|
|
44
|
+
_.u.isLive=function(){if(this.f&&this.a)return this.a.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.S(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()]};
|
|
45
|
+
var zP="IDLE",AP="READY",QO="PLAYING",IO="PAUSED",KO="TEXT",mO={PLAYREADY:"PLAYREADY",Qn:"EME_PLAYREADY",Wn:"VERIMATRIX",ne:"WIDEVINE_CDM",Rn:"EME_WIDEVINE_CDM",Yn:"WIDEVINE_CLASSIC"};_.u=NO.prototype;_.u.initialize=function(){this.a.on(CO,this.fh,this);this.a.on(sP,this.eh,this);this.a.on(tP,this.dh,this);this.a.on(DO,this.ki,this);this.a.on(FO,this.ji,this);this.a.on(uP,this.gh,this)};_.u.release=function(){PO(this,_.op);this.l=!1;this.o=-1;this.h=2};_.u.destroy=function(){this.release();this.a.off(CO,this.fh);this.a.off(sP,this.eh);this.a.off(tP,this.dh);this.a.off(DO,this.ki);this.a.off(FO,this.ji);this.a.off(uP,this.gh);this.m=this.a=null};
|
|
46
|
+
_.u.fh=function(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;PO(this,_.tp)};_.u.eh=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",OO(this.f))};_.u.dh=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()===AP;if(!a&&b){PO(this,_.Bp);return}}if(a=this.f!==_.Ap)a=this.a.getState(),a=a===QO||a===IO;a&&RO(this)};
|
|
47
|
+
_.u.ki=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===zP?PO(this,_.Ap):this.g.error("AVPlay prepares while state is not IDLE")};_.u.ji=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.u.gh=function(){PO(this,_.vp)};_.u.getState=function(){return this.f};var CO="onbufferingstart",sP="onbufferingprogress",tP="onbufferingcomplete",uP="onstreamcompleted",rO="oncurrentplaytime",vP="onevent",wP="onsubtitlechange",xP="ondrmevent",yP="onerror",DO="preparingstart",FO="preparingend";_.u=SO.prototype;_.u.initialize=function(a){this.m=a};
|
|
48
|
+
_.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.B=a;c=b;return _.y(m,UO(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(){},onEvent:function(){},onError:function(){}};
|
|
49
|
+
_.D(m,3);e=b;return _.y(m,b.j.start(a.url,d),5);case 5:e.a=m.f;_.ph(m,4);break;case 3:return f=_.F(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;_.ph(m,4);break;case 6:h=_.F(m),b.g.error(h),b.a=null;case 4:if(!b.a||!TO(b.a)){m.F(0);break}b.h=VO(b);_.D(m,10);return _.y(m,b.h.open(),12);case 12:b.f=WO(b);l=b.m.getConfiguration();b.f.h=l.streaming;b.o=l.preferredTextLanguage;b.A=l.preferredTextRole;b.C=l.preferForcedSubtitles;_.ph(m,0);break;case 10:_.F(m),
|
|
50
|
+
b.g.debug("Could not setup media source..."),b.h=null,b.f=null,b.j=null,b.a=null,_.A(m)}})};_.u.tk=function(a){this.g.debug(_.oC,a);this.w=!0;var b=_.dF(a.textStreams,this.o||"",this.A||"",this.C)[0]||null;this.l&&(a.textStreams.includes(this.l)&&(b=this.l),this.l=null);return{variant:null,text:b}};_.u.sk=function(){this.g.debug("canSwitch_");this.w=!1;this.l&&(_.fG(this.f,this.l,!0,0),this.l=null)};_.u.S=function(){this.g.debug("onError_")};_.u.uk=function(){this.j&&this.j.update&&this.j.update()};
|
|
51
|
+
_.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)}_.A(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.B=null;a.A=null;a.o=null;a.w=!0;a.l=null;_.A(b)})};
|
|
52
|
+
_.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,_.A(b)}})};_.x(aP,_.U);_.u=aP.prototype;_.u.ai=function(a){var b=a.eventid;a=a.data;switch(b){case "PLAYER_MSG_BITRATE_CHANGE":0<Object.keys(this.f).length||(this.g.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+iP(this,b[0].extra_info).Bit_rate,b=lP(this,{bandwidth:b}))&&(this.w=b,bP(this,b));break;case "PLAYER_MSG_RESOLUTION_CHANGED":cP(this);break;default:this.g.debug("Event type: "+b+" data: "+a)}};
|
|
53
|
+
_.u.Zf=function(a){a.detail.currentState===_.Cp&&this.m.off(_.dg,this.Zf)};_.u.initialize=function(a){var b=this;this.m=a;this.a=this.m.a;this.m.on(_.dg,function(c){b.A||(c=c.detail,c.currentState===_.Cp&&(b.g.debug("Current state",c.currentState),b.A=!0,dP(b)))});this.a.on(vP,this.ai,this)};_.u.release=function(){this.f={};this.h=this.w=this.l=this.j=null;this.A=!1;this.o=1};
|
|
54
|
+
_.u.load=function(){if(this.a&&!(0<Object.keys(this.f).length)){this.h=this.m.h;this.m.off(_.dg,this.Zf);this.m.on(_.dg,this.Zf,this);try{var a=xO(this.a);this.f=kP(this,a);var b=this.f[_.Tj]||[];b.length&&(this.j=b[0].renditions[0]||null);cP(this)}catch(c){this.g.debug("Could not load track manager")}}};_.u.destroy=function(){this.a.off(vP,this.ai);this.a=this.m=null};_.u.getVideoTracks=function(){return this.f[_.Uj]||[]};_.u.getAudioTracks=function(){return this.f[_.Tj]||[]};
|
|
55
|
+
_.u.ia=function(){return this.f[_.T]||[]};_.u.na=function(){return nP(this,_.Uj)};_.u.Sa=function(){return nP(this,_.Tj)};_.u.Na=function(){return nP(this,_.T)};_.u.lb=function(){return this.w};_.u.Ab=function(){this.g.info(cO);return null};_.u.Bb=function(){this.g.info(cO);return null};_.u.Oa=function(){var a=this.na();return a?a.track:null};_.u.ma=function(){var a=this.Sa();return a?a.track:null};_.u.xa=function(){var a=this.Na();return a?a.track:null};
|
|
56
|
+
_.u.wb=function(a){var b=this;null===a?(a=this.na(),JO(this.a,a.bandwidth,null).then(function(){cP(b)})):0<a.renditions.length&&this.cb(a.renditions[0])};_.u.Da=function(a){a?eP(this,a.renditions[0]):this.g.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")};_.u.Qa=function(a){a?(a=a.renditions[0],this.h?$O(this.h,a.track):eP(this,a)):(this.g.debug("Disabling text tracks"),this.l=null,LO(this.a,!1),this.m.trigger(new _.L(_.Ol)))};
|
|
57
|
+
_.u.cb=function(a){var b=this,c=this.na();this.a.o||a.width!==c.width||a.height!==c.height||a.bandwidth!==c.bandwidth?(this.w=a,bP(this,a),JO(this.a,c.bandwidth,a.bandwidth).then(function(){cP(b)})["catch"](function(d){var e=new _.N(_.O,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.ub=function(a){eP(this,a)};_.u.vb=function(a){this.h?$O(this.h,a.track):eP(this,a)};
|
|
58
|
+
_.u.addTextTrack=function(){};_.u.qa=function(){return this.a.o};aP.prototype.isAbrEnabled=aP.prototype.qa;aP.prototype.addTextTrack=aP.prototype.addTextTrack;aP.prototype.setTextRendition=aP.prototype.vb;aP.prototype.setAudioRendition=aP.prototype.ub;aP.prototype.setVideoRendition=aP.prototype.cb;aP.prototype.setTextTrack=aP.prototype.Qa;aP.prototype.setAudioTrack=aP.prototype.Da;aP.prototype.setVideoTrack=aP.prototype.wb;aP.prototype.getTextTrack=aP.prototype.xa;aP.prototype.getAudioTrack=aP.prototype.ma;
|
|
59
|
+
aP.prototype.getVideoTrack=aP.prototype.Oa;aP.prototype.getLoadingTextRendition=aP.prototype.Bb;aP.prototype.getLoadingAudioRendition=aP.prototype.Ab;aP.prototype.getLoadingVideoRendition=aP.prototype.lb;aP.prototype.getTextRendition=aP.prototype.Na;aP.prototype.getAudioRendition=aP.prototype.Sa;aP.prototype.getVideoRendition=aP.prototype.na;aP.prototype.getTextTracks=aP.prototype.ia;aP.prototype.getAudioTracks=aP.prototype.getAudioTracks;aP.prototype.getVideoTracks=aP.prototype.getVideoTracks;_.x(oP,_.Ul);_.u=oP.prototype;_.u.ah=function(){var a=this;this.g.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.L(_.ne));this.configuration.loop?this.seek(this.configuration.startTime||0)["catch"](function(){a.g.debug("Could not loop playback")}):this.a.stop()};_.u.Zg=function(a){this.trigger(new _.L(_.pg,{currentTime:a.currentTime/1E3}))};
|
|
60
|
+
_.u.bh=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.sg(d))&&this.o.append([new _.Ak(b,c,d)],[])};_.u.$g=function(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.u.ci=function(){this.A||(this.g.debug("Initial buffering completed..."),this.A=!0)};
|
|
61
|
+
_.u.S=function(a){this.g.debug("Error: TYPE: "+a.eventType);PO(this.f,_.zp);a=new _.N(_.O,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.L(_.oe,{detail:a}))};
|
|
62
|
+
_.u.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on(uP,this.ah,this);this.a.on(rO,this.Zg,this);this.a.on(wP,this.bh,this);this.a.on(xP,this.$g,this);this.a.on(yP,this.S,this);this.a.on(tP,this.ci,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();var c=BP;BP+=1;this.j=_.ir(_.Ve,{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=[_.Vg,_.te,"position",_.ze,"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];_.kr(c,f);pP(this)}};_.u.getSurface=function(){return this.w};_.u.getConfiguration=function(){return this.configuration};_.u.getTimeline=function(){return null};_.u.setupPlaylist=function(){return Promise.reject(_.Fb)};_.u.appendLoad=function(){return Promise.reject(_.Fb)};
|
|
64
|
+
_.u.seekWith=function(){return Promise.reject(_.Fb)};_.u.setSeekInterceptor=function(){};_.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(uP,a.ah);a.a.off(rO,a.Zg);a.a.off(wP,a.bh);a.a.off(xP,a.$g);a.a.off(yP,a.S);a.a.off(tP,a.ci);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,_.A(b)}})};_.u.namespace=function(){return CP};
|
|
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()===_.vp?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 _.Tl};_.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,_.A(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=_.gm(b.B,a);c=_.cp(b.configuration,[_.ve,"native"]);b.o=c.create(b);d=_.Gp(b.configuration)[0];e=!!b.configuration.tizen&&b.configuration.tizen.sideStreamText;if(!e){h.F(2);break}b.h=new SO;b.h.initialize(b);_.D(h,3);return _.y(h,b.h.load(d),5);case 5:b.h.start();_.ph(h,2);break;case 3:f=_.F(h),b.g.error(f);case 2:return _.D(h,6),_.y(h,b.a.load(b.configuration),8);case 8:_.ph(h,7);break;case 6:throw g=
|
|
69
|
+
_.F(h),b.onError(g),g;case 7:b.l.load(),_.A(h)}})};_.u.play=function(){var a=this;this.trigger(new _.L(_.jf));pP(this);return this.a.play().then(function(){RO(a.f)})};_.u.pause=function(){var a=this;return this.a.pause().then(function(){RO(a.f)})};_.u.getState=function(){return this.f.getState()};_.u.getPeriods=function(){return[]};_.u.onError=function(a){var b=new _.L(_.oe,{detail:a});a.severity===_.O&&(PO(this.f,_.zp),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()===_.vp};_.u.isPaused=function(){return this.a.getState()===IO};_.u.isMuted=function(){return wO(this.a)};_.u.setMuted=function(a){GO(this.a,a)};_.u.getNetworkEngine=function(){return this.C};_.u.setNetworkEngine=function(a){this.C=a};_.u.setCmsdManager=function(){};_.u.isLive=function(){return this.a.isLive()};_.u.getStats=function(){return null};_.u.setSourceIndex=function(a){this.a.setSourceIndex(a)};
|
|
71
|
+
_.u.getSourceIndex=function(){return this.a.getSourceIndex()};_.u.getLoadedSource=function(){return this.a.getLoadedSource()};_.u.canPlay=function(a,b){return(new qP).canPlay(a,b)};_.u.getTimelineCues=function(){return[]};_.u.getCueTimeline=function(){return null};_.u.getTextDisplayer=function(){return this.o};_.u.resetAbr=function(){};oP.prototype.getTextDisplayer=oP.prototype.getTextDisplayer;oP.prototype.setNetworkEngine=oP.prototype.setNetworkEngine;oP.prototype.getNetworkEngine=oP.prototype.getNetworkEngine;
|
|
72
|
+
var CP="clpp.tizen",BP=0;qP.prototype.a=function(){return CP};qP.prototype.canPlay=function(a){a=a.type;var b=!!window.webapis;if((a===_.Uc||a===_.El||a===_.Zc)&&b){if(_.Ij(2))return 2;if(_.Ij(3)||_.Ij(4)||_.Ij(5)||_.Ij(6))return _.Eh("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0};qP.prototype.f=function(a){return a===_.qa};qP.prototype.create=function(){return new oP};_.x(rP,_.Lt);rP.prototype.f=function(){_.Yl(new qP)};rP.prototype.a=function(){var a=CP;a&&_.Wl[a]&&(delete _.Wl[a],_.Xl.info("Removed Player factory: '"+a+"'"))};rP.prototype.id=function(){return"tizen"};_.J("clpp.tizen.TizenComponent",rP);};
|
|
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 fx='application/mp4; codecs\x3d"stpp.ttml"',gx='application/mp4; codecs\x3d"stpp.ttml.im1i"',hx='application/mp4; codecs\x3d"stpp.ttml.im1t"',ix="backgroundColor",jx="direction",kx="displayAlign",lx="region",mx="sans-serif",nx="textAlign",ox="textDecoration",px="writingMode",
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
a
|
|
9
|
-
g={},
|
|
10
|
-
a},jy=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")},
|
|
11
|
-
"lineHeight","opacity","padding",nx,ox,"textOutline",px,"zIndex"],
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
g.backgroundImage=("PNG"===e&&"Base64"===d&&0<a.length?"data:image/png;base64,"+a:null)||"");return g};_.x(Lx,
|
|
15
|
-
Lx.prototype.build=function(a,b){var c=new _.
|
|
16
|
-
Ox(f,e,2,100);c.heightUnits=Px(f,e);f=this.getAttribute("origin")||
|
|
17
|
-
Vx.prototype.build=function(a){var b=null;var c=Ux(a);c&&(b=Rx(a.j.containerHeight,Sx(a,2),480)/c);b=Rx(a.j.fontSizeRadix,b,16);a=[];c="::ttml ."+this.h+", ::ttml ."+this.h+" * {";for(var d=_.w(
|
|
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&&!
|
|
2
|
+
var f=function(window){var fx='application/mp4; codecs\x3d"stpp.ttml"',gx='application/mp4; codecs\x3d"stpp.ttml.im1i"',hx='application/mp4; codecs\x3d"stpp.ttml.im1t"',ix="backgroundColor",jx="direction",kx="displayAlign",lx="region",mx="sans-serif",nx="textAlign",ox="textDecoration",px="writingMode",xx=function(a,b){var c=null;if(qx.test(a)){c=qx.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 rx.test(a)?c=sx(rx,a):tx.test(a)?c=sx(tx,
|
|
3
|
+
a):ux.test(a)?(c=ux.exec(a),c=Number(c[1])/b.frameRate):vx.test(a)?(c=vx.exec(a),c=Number(c[1])/b.a):wx.test(a)&&(c=sx(wx,a));return c},sx=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:(Number(c[4])||0)/1E3+(Number(c[3])||0)+60*(Number(c[2])||0)+3600*(Number(c[1])||0)},yx=function(a){return a.split(":").pop()},zx=function(a){return a.replace(/(\d*\.?\d+)c/g,"$1em")},Bx=function(a,b){for(;Ax.test(a);){var c=Ax.exec(a)[0];a=a.replace(c,parseInt(c,10)/b+"em")}return a},Cx=function(a){return a?
|
|
4
|
+
a.replace(/(\d*\.?\d+)%/g,function(b,c){return c/100+"em"}):""},Dx=function(a,b,c){this.h=a;this.f=b;this.a=c},Ex=function(a,b,c){Dx.call(this,a,b,c)},Fx=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 e.a)return e.getAttribute(c)}return null},Gx=function(a,b,c,d,e,f,g){Dx.call(this,a,f,g);this.w=b;this.A=c;this.o=d;this.l=e;this.j=[]},Hx=function(a,b,c){a=Fx(a,b,nx);if(!a&&c&&(a=Fx(c,b,nx),!a&&"rltb"===Fx(c,b,px)))return _.Qf;switch(a){case _.ud:return _.vk;case _.Qf:case _.me:return _.Qf;
|
|
5
|
+
default:return _.ze}},Ix=function(a,b,c){if(_.S.Me(a.w))return document.createTextNode(_.S.sg(a.w||""));if(a.A)return _.ir("br");for(var d=_.ir("span"),e=_.w(a.f),f=e.next();!f.done;f=e.next())_.jr(d,f.value);a=_.w(a.j);for(e=a.next();!e.done;e=a.next())d.appendChild(Ix(c.get(e.value),b,c));return d},Jx=function(a,b,c){Dx.call(this,a,[],c);this.j=b||""},Kx=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*this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&
|
|
6
|
+
(this.frameRate*=Number(a[1])/Number(a[2]))},Lx=function(a,b,c){Dx.call(this,a,b,c)},Ox=function(a,b,c,d){var e=Mx.exec(a);a=Nx.exec(a);return typeof b===_.k&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},Px=function(a,b){return typeof b===_.k&&0<b?_.Bk:Nx.test(a)?0:_.Bk},Qx=function(a,b){Dx.call(this,"root-container",[],b);this.j=a},Rx=function(a,b,c){return typeof a===_.k?a:typeof b===_.k?b:c},Sx=function(a,b){var c=a.getAttribute("extent");return(c=Nx.exec(c))?Number(c[b]):null},Ux=
|
|
7
|
+
function(a){a=a.getAttribute("cellResolution");return(a=Tx.exec(a))?Number(a[2]):null},Vx=function(a,b,c){Dx.call(this,a,b,c)},Wx=function(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=[]},Yx=function(a){return Xx.some(function(b){return b in a.attributes})},Zx=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,_.bh(Zx(a,a.a.get(e).f)).concat([e]));return c},ay=
|
|
8
|
+
function(){return"inline-"+$x++},by=function(a){return a.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})},cy=function(a){this.a=a.firstChild;this.f=new Set},dy=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},ey=function(a){return yx(a.h.nodeName)},fy=function(){this.a=new Map},hy=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=
|
|
9
|
+
_.bh(l.l).concat();-1===["#text","span","br"].indexOf(b.nodeName)&&(c=l.a,d=l.j,f=_.bh(l.f).concat(),g={},gy.forEach(function(n){n in l.attributes&&(g[n]=l.attributes[n])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(lx)&&(c=b.getAttribute(lx));b.hasAttribute(_.ig)&&f.push.apply(f,_.bh(b.getAttribute(_.ig).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=yx(h);g[m]=b.getAttribute(h)}d=g.backgroundImage}c=new dy(b,
|
|
10
|
+
c,d,e,f,g);a.a.set(b,c);return c},iy=function(a){this.a=a;this.f=new DOMParser},jy=function(a){this.a=new iy(a);this.g=new _.K("clpp.ttml.Mp4TtmlParser")},ky=function(a){this.f=a},ly=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")},my=function(){},ny=function(){this.j=new my},qx=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,rx=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,
|
|
11
|
+
tx=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,ux=/^(\d*(?:\.\d*)?)f$/,vx=/^(\d*(?:\.\d*)?)t$/,wx=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,Mx=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,Nx=/^(\d+)px (\d+)px$/,Tx=/^(\d+) (\d+)$/,Ax=/(\d+)px/,oy=/^(\d+px|\d+em|\d*\.?\d+c)$/,Xx=[ix,"color",jx,kx,"fontFamily","fontSize","fontStyle","fontWeight","lineHeight","opacity","padding",nx,ox,"textOutline",px,"zIndex"],gy=["begin",_.me];Dx.prototype.getId=function(){return this.h};Dx.prototype.getAttribute=function(a){return this.a[a]};_.x(Ex,Dx);_.x(Gx,Ex);
|
|
12
|
+
Gx.prototype.build=function(a,b,c,d,e,f,g){var h=xx(this.a.begin,b);b=xx(this.a.end,b);if(null===h||null===b)return null;h+=c;b+=c;c=_.ir(_.Xd);for(var l=_.w(this.j),m=l.next();!m.done;m=l.next())c.appendChild(Ix(g.get(m.value),e,g));g=new _.Ak(h,b,c.innerHTML.trim(),_.rg);g.cssClassList=_.bh(this.f).concat();g.textAlign=Hx(this,e,null);g.writingMode=_.wk;g.line=-1;g.lineInterpretation=_.xk;g.lineAlign=_.yk;g.containerRows=Rx(null,Ux(a),15);if(this.o&&(f=f.get(this.o))){g.region=f.build(a,e);g.textAlign=
|
|
13
|
+
Hx(this,e,f);a:switch(Fx(f,e,px)){case "tb":case "tblr":a=_.Fg;break a;case "tbrl":a=_.Gg;break a;default:a=_.wk}g.writingMode=a;a:switch(Fx(f,e,kx)){case _.ud:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(Fx(f,e,kx)){case _.ud:a=1;break a;default:a=_.xk}g.lineInterpretation=a;a:switch(Fx(f,e,kx)){case _.ud:e=_.ud;break a;default:e=_.yk}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(Jx,Dx);_.x(Lx,Ex);
|
|
15
|
+
Lx.prototype.build=function(a,b){var c=new _.Dk;c.id=this.getId();var d=Rx(a.j.containerWidth,Sx(a,1),720),e=Rx(a.j.containerHeight,Sx(a,2),480);a:switch(Fx(this,b,kx)){case "after":var f="flex-start";break a;case _.ud:f=_.ud;break a;default:f="flex-end"}c.displayAlign=f;a:switch(Fx(this,b,px)){case "tb":case "tblr":f="row-reverse";break a;case "tbrl":f="row";break a;default:f=_.Kd}c.writingMode=f;f=this.getAttribute("extent")||Fx(this,b,"extent");c.width=Ox(f,d,1,100);c.widthUnits=Px(f,d);c.height=
|
|
16
|
+
Ox(f,e,2,100);c.heightUnits=Px(f,e);f=this.getAttribute("origin")||Fx(this,b,"origin");c.viewportAnchorX=Ox(f,d,1,0);c.viewportAnchorY=Ox(f,e,2,0);c.viewportAnchorUnits=Px(f,d);c.cssClassList=_.bh(this.f).concat();return c};_.x(Qx,Dx);_.x(Vx,Dx);
|
|
17
|
+
Vx.prototype.build=function(a){var b=null;var c=Ux(a);c&&(b=Rx(a.j.containerHeight,Sx(a,2),480)/c);b=Rx(a.j.fontSizeRadix,b,16);a=[];c="::ttml ."+this.h+", ::ttml ."+this.h+" * {";for(var d=_.w(py.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+":"+zx(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&&!oy.test(g)&&oy.test(h)&&oy.test(l)?(e=g,f=h):2===d.length&&!oy.test(g)&&oy.test(h)?(e=g,f=h):2===d.length&&oy.test(g)&&oy.test(h)&&(f=g);if(""!==f){f=zx(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=Cx(this.a.textShadow),d=zx(d),d="text-shadow:"+
|
|
19
19
|
d+";"):d="";c=c+d+("fontFamily"in this.a?"font-family:"+this.a.fontFamily.replace("monospaceSansSerif","monospace").replace("monospaceSerif","monospace").replace("proportionalSansSerif",mx).replace("proportionalSerif",mx).replace("sansSerif",mx).replace("default",mx)+";":"");a:{if(ox 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:"+
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
"text-decoration:"+d.join(" ")+";";break a}}d=""}e="padding"in this.a?"border: solid transparent;border-width:"+zx(this.a.padding)+";":"";c=c+d+e;"lineHeight"in this.a?(d="",e=this.a.lineHeight,e=zx(e),e=Bx(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=zx(d);d=Bx(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 py=new Map([[ix,"background-color"],["color","color"],[jx,jx],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var $x=0;cy.prototype.Rd=function(){return!!this.a};cy.prototype.next=function(){if(!this.a)return null;var a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!qy.has(yx(a.nodeName))||ry.has(yx(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&&!qy.has(yx(a.nodeName))));var b=this.a;this.a=a;return b};
|
|
22
|
+
var qy=new Set(["tt","head","layout",_.Oe,_.we,lx,"styling",_.ig,"body",_.Xd,"p","span","br"]),ry=new Set([_.ig,_.we]);dy.prototype.getId=function(){return this.attributes.id};iy.prototype.parseInit=function(){};
|
|
23
|
+
iy.prototype.parseMedia=function(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.M.$a(this.a.ttml||{}),e=_.Wi(a,0,c[0]);e=_.S.aa(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.ng)}catch(n){throw new _.N(_.O,2,2005,"Failed to parse TTML.");}d=new Wx(d);e=new fy;f=new cy(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=_.Wi(a,b,h);l=_.fj(l);var m="urn:mpeg:14496-30:subs:"+g;d.h.set(m,new Jx(m,l,{imageType:"PNG",encoding:"Base64"}));
|
|
24
|
+
b+=h}for(;f.Rd();)a=f.next(),a=hy(e,a),"tt"===ey(a)&&(d.l=new Qx(d.B,Object.assign({},a.attributes))),"tt"===ey(a)&&(d.w=new Kx(a.attributes.frameRate,a.attributes.subFrameRate,a.attributes.frameRateMultiplier,a.attributes.tickRate)),ey(a)!==_.we||a.attributes.begin||a.attributes.end||(c="#"+a.getId(),d.h.set(c,new Jx(c,a.h.textContent,a.attributes))),ey(a)===_.we&&a.attributes.begin&&a.attributes.end?(c="#"+ay(),b=new Jx(c,a.h.textContent,a.attributes),d.h.set(c,b),c=b):c=null,c&&(a.j=c.getId()),
|
|
25
|
+
ey(a)===_.ig&&(c=a.getId()||ay(),b=new Vx(c,a.f,Object.assign({},a.attributes)),d.a.set(c,b),a.a&&d.j.get(a.a).f.push(c)),ey(a)!==_.ig&&Yx(a)?(c=ay(),b=new Vx(c,[],Object.assign({},a.attributes)),d.a.set(c,b),c=b):c=null,c&&a.f.push(c.getId()),ey(a)!==_.Xd||!a.attributes.extent&&!a.attributes.origin?c=null:(c=ay(),b=new Lx(c,Zx(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),c=b),c&&(a.a=c.getId()),ey(a)!==lx?c=null:(c=a.getId(),b=new Lx(c,Zx(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(ey(a))||0===c.length?c=null:(g=c[c.length-1],d.f.has(g)?(c=ay(),b=new Gx(c,"#text"===a.h.nodeName?a.h.textContent:null,"br"===ey(a),a.a,a.j,Zx(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"===ey(a)||a.j?(c=ay(),b=new Gx(c,null,!1,a.a,a.j,Zx(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=by(d);f=[];a=_.w(d.a.values());for(c=a.next();!c.done;c=a.next())f.push.apply(f,
|
|
27
|
+
_.bh(c.value.build(d.l)));return{cues:e,styles:f}};jy.prototype.parseInit=function(a){var b=!1;(new _.Sm).M(_.Re,_.Tm).M(_.qg,_.Tm).M(_.Me,_.Tm).M(_.Qe,_.Tm).M(_.fg,_.Tm).Y(_.hg,_.Um).M("stpp",function(c){b=!0;c.parser.stop()}).parse(a);if(!b)throw new _.N(_.O,2,2007);};
|
|
28
|
+
jy.prototype.parseMedia=function(a,b){var c=this,d=!1,e=[],f=[],g=[];(new _.Sm).M("moof",_.Tm).M("traf",_.Tm).Y("subs",function(h){for(var l=_.W(h.reader),m=0;m<l;++m){h.reader.skip(4);for(var n=_.Nm(h.reader),p=0;p<n;++p){var q=1===h.version?_.W(h.reader):_.Nm(h.reader);g.push(q);h.reader.skip(6)}}}).M(_.Le,_.Vm(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}};ky.prototype.a=function(a){a=(new iy(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=ly(c.startTime)+" --\x3e "+ly(c.endTime),e=[];switch(c.textAlign){case _.ze:e.push("align:left");break;case _.Qf:e.push("align:right");break;case _.vk:e.push("align:middle");break;case _.ze:e.push("align:start");break;case _.Qf:e.push("align:end")}switch(c.writingMode){case _.Fg:e.push("vertical:lr");break;
|
|
29
|
+
case _.Gg:e.push("vertical:rl")}b+=d+(e.length?" "+e.join(" "):"")+"\n";b+=c.payload+"\n\n"}return _.S.Ya(b)};my.prototype.probe=function(a,b){return a===_.Yc&&b===_.mg};my.prototype.create=function(a){return new ky(a)};_.x(ny,_.Lt);ny.prototype.f=function(){_.eu(_.Yc,iy);_.eu(_.Wc,jy);_.eu(fx,jy);_.eu(hx,jy);_.eu(gx,jy);_.Gk.push(this.j)};ny.prototype.a=function(){_.gu(_.Yc);_.gu(_.Wc);_.gu(fx);_.gu(hx);_.gu(gx);_.Ik(this.j)};ny.prototype.id=function(){return"subtitles-ttml"};_.J("clpp.ttml.TtmlComponent",ny);};
|
|
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));}
|