project-totopia/w-demo.com_capture/html_sources/유저1/user_메인페이지_files/heartbeat.js.다운로드
2019-07-21 06:39:16 +09:00

45 lines
11 KiB
Plaintext

(function(g){var window=this;var q5=function(a){g.W.call(this,{C:"button",W:["ytp-offline-slate-button","ytp-button"],J:[{C:"div",G:"ytp-offline-slate-button-icon",V:"{{icon}}"},{C:"div",G:"ytp-offline-slate-button-text",V:"{{text}}"}]});this.A=a;this.o=this.l=null;this.hide();this.da("click",this.B,this)},s5=function(a,b){!a.l&&b&&b.toggleButtonRenderer?a.l=b.toggleButtonRenderer:b&&b.toggleButtonRenderer||(a.l=null);
r5(a)},r5=function(a){if(a.l){if(a.l.isToggled){var b=a.l.toggledText?g.yB(a.l.toggledText):"";
a.update({text:b,icon:t5(a.l.toggledIcon)})}else b=a.l.defaultText?g.yB(a.l.defaultText):"",a.update({text:b,icon:t5(a.l.defaultIcon)});a.show()}else a.hide()},t5=function(a){if(!a)return null;
switch(a.iconType){case "NOTIFICATIONS_NONE":return g.UP?{C:"div",W:["ytp-icon","ytp-icon-notifications-none"]}:{C:"svg",L:{fill:"#fff",height:"24px",viewBox:"0 0 24 24",width:"24px"},J:[{C:"path",L:{d:"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.9 2 2 2zm6-6v-5c0-3.07-1.63-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.64 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2zm-2 1H8v-6c0-2.48 1.51-4.5 4-4.5s4 2.02 4 4.5v6z"}}]};case "NOTIFICATIONS_ACTIVE":return g.jQ();default:return null}},u5=function(a){g.W.call(this,
{C:"div",
G:"ytp-offline-slate",J:[{C:"div",G:"ytp-offline-slate-bar",J:[{C:"span",G:"ytp-offline-slate-icon",J:[g.UP?{C:"div",W:["ytp-icon","ytp-icon-live-icon"]}:{C:"svg",L:{fill:"#fff",height:"100%",viewBox:"0 0 24 24",width:"100%"},J:[{C:"path",L:{d:"M16.94 6.91l-1.41 1.45c.9.94 1.46 2.22 1.46 3.64s-.56 2.71-1.46 3.64l1.41 1.45c1.27-1.31 2.05-3.11 2.05-5.09s-.78-3.79-2.05-5.09zM19.77 4l-1.41 1.45C19.98 7.13 21 9.44 21 12.01c0 2.57-1.01 4.88-2.64 6.54l1.4 1.45c2.01-2.04 3.24-4.87 3.24-7.99 0-3.13-1.23-5.96-3.23-8.01zM7.06 6.91c-1.27 1.3-2.05 3.1-2.05 5.09s.78 3.79 2.05 5.09l1.41-1.45c-.9-.94-1.46-2.22-1.46-3.64s.56-2.71 1.46-3.64L7.06 6.91zM5.64 5.45L4.24 4C2.23 6.04 1 8.87 1 11.99c0 3.13 1.23 5.96 3.23 8.01l1.41-1.45C4.02 16.87 3 14.56 3 11.99s1.01-4.88 2.64-6.54z"}},
{C:"circle",L:{cx:"12",cy:"12",r:"3"}}]}]},{C:"span",G:"ytp-offline-slate-buttons"},{C:"span",G:"ytp-offline-slate-messages",J:[{C:"div",G:"ytp-offline-slate-main-text",V:"{{maintext}}"},{C:"div",G:"ytp-offline-slate-subtitle-text",V:"{{subtitletext}}"}]}]}]});this.o=a;this.u=this.l=null;this.D=!1;this.A=new g.J(this.F,1E3,this);this.K(a,"presentingplayerstatechange",this.H);this.K(a,"livestatedata",this.B);this.hide();a=this.o.getVideoData();a.getPlayerResponse()&&(a=a.getPlayerResponse().playabilityStatus)&&
this.B(a)},v5=function(a,b,c){if(b){var d=void 0!=b.subtitleText?g.yB(b.subtitleText):"";
b=c?c:void 0!=b.mainText?g.yB(b.mainText):"";a.update({maintext:b,subtitletext:d});g.I(a.element,"ytp-offline-slate-single-text-line",!d)}},z5=function(a){g.mL.call(this,a);
this.B=!1;this.D=0;this.A=!1;this.g=NaN;this.i=this.l=null;this.u=!1;this.F=new g.Wo(1E3,6E4,1);this.H=0;this.o=null;this.I=-(new g.Zh).getTimezoneOffset();this.ca=new g.Us(this);g.B(this,this.ca);var b=this.player.getVideoData(),c=g.X(this.player);if(!b.sa)!g.O(c.experiments,"html5_release_post_live_heartbeat_killswitch")&&g.$a(b.Fc,"heartbeat")&&g.UK(this.player,"heartbeat");else if(!g.fy(c.o))g.aJ(this.player.app.l,"html5.unsupportedlive","HTML5_NO_AVAILABLE_FORMATS_FALLBACK","nolive.1",void 0);
else if(g.O(c.experiments,"live_fresca_v2")){this.B=this.u=!0;if(!g.uz(c)||g.Ez(c))this.o=new u5(this.player),g.B(this,this.o),g.XK(this.player,this.o.element,4);(b=b.getPlayerResponse())&&b.playabilityStatus&&(this.i=b.playabilityStatus);this.i?(b=w5(this.i.liveStreamability&&this.i.liveStreamability.liveStreamabilityRenderer))?x5(this,b):x5(this,7500):x5(this,1E3)}this.ca.K(a,"heartbeatparams",this.qF);this.ca.K(a,"presentingplayerstatechange",this.rF);this.ca.K(a,"videoplayerreset",this.VL);this.ca.K(a,
g.tE("heartbeat"),this.pF);this.u&&this.i&&y5(this,this.i);b=new g.qE(1E3,0x7ffffffffffff,{priority:0,namespace:"heartbeat"});g.QK(a,[b])},A5=function(a){var b=a.player.getVideoData();
return!!g.ZB(a.player.getVideoData())&&!b.Wq},B5=function(a){var b=a.player.getVideoData();
return A5(a)?!!a.l:!!b.heartbeatToken},x5=function(a,b){if(!a.g&&a.B){var c=a.player.getVideoData();
if(B5(a)||c.sa)void 0==b&&(b=a.A?a.u?7500:a.l?1E3*a.l.interval:a.player.getVideoData().Nw||6E4:1E3),a.g=g.eq((0,g.x)(a.LM,a),b)}},y5=function(a,b){var c=b.liveStreamability&&b.liveStreamability.liveStreamabilityRenderer,d=!(!c||!c.switchStreamsImmediately),e=w5(c),f=a.player.getVideoData();
if(g.WC(g.IK(a.player))&&!g.lC(f)&&!a.player.isAtLiveHead()&&!d)return e;var k=(d=c&&c.streamTransitionEndpoint&&c.streamTransitionEndpoint.watchEndpoint)&&d.videoId;if(k)return g.IY(a.player.app,k,void 0,void 0,!0,d),e;if("OK"==b.status.toUpperCase()){d=c&&c.broadcastId;k=a.i&&a.i.liveStreamability&&a.i.liveStreamability.liveStreamabilityRenderer&&a.i.liveStreamability.liveStreamabilityRenderer.broadcastId;if(!f.hlsvp&&!f.Nd||d!=k)return c={video_id:f.videoId},f.Om&&(c.is_live_destination="1"),c.autonav_state=
f.autonavState,a.player.loadVideoByPlayerVars(c),e;g.UK(a.player,"heartbeat")}c&&c.displayEndscreen&&a.o&&(f=a.o,f.D=!0,f.Fa()&&g.MK(f.o));return e},w5=function(a){var b=0;
a&&a.pollDelayMs&&(a=parseInt(a.pollDelayMs,10))&&(b=a);return b},C5=function(a,b,c){if(a.g){a.g=NaN;
a.D++;var d=a.player.getVideoData();(d.Pw||b&&!g.ZB(a.player.getVideoData())&&!B5(a)&&d.sa?0:a.D>=(a.l?a.l.g:d.Ow||5))?(b=b?"heartbeat.net":"heartbeat.servererror",(d=a.player.getVideoData())&&d.sa?g.aJ(a.player.app.l,b,"\ub3d9\uc601\uc0c1 \uc7ac\uc0dd\uc774 \uc911\ub2e8\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \ub2e4\uc2dc \uc2dc\ub3c4\ud574 \uc8fc\uc138\uc694.",c,void 0):g.aJ(a.player.app.l,b,"\ub3d9\uc601\uc0c1\uc5d0 \ub77c\uc774\uc120\uc2a4\ub97c \ubd80\uc5ec\ud558\ub294 \uc911\uc5d0 \uc624\ub958\uac00 \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4.",
c,void 0)):(x5(a,a.F.getValue()),g.Xo(a.F))}},D5=function(a){a.D=0;
a.g&&(g.gq(a.g),a.g=NaN);a.A=!1;a.H=0},E5=function(a){try{var b=JSON.parse(a);
return null!=b?b:null}catch(c){return null}};
g.t(q5,g.W);
q5.prototype.B=function(){this.o||(this.o=new g.Ms(g.X(this.A).Wb));var a={context:g.Yr(this.o.g)};g.Ct()&&(a.context.clientScreenNonce=g.Ct());var b;if(this.l.isToggled){if(b=(b=this.l.toggledServiceEndpoint)&&b.removeUpcomingEventReminderEndpoint&&b.removeUpcomingEventReminderEndpoint.params)a.params=b;b="notification/remove_upcoming_event_reminder"}else{if(b=(b=this.l.defaultServiceEndpoint)&&b.addUpcomingEventReminderEndpoint&&b.addUpcomingEventReminderEndpoint.params)a.params=b;b="notification/add_upcoming_event_reminder"}var c=
{timeout:5E3};c.onError=(0,g.x)(this.u,this);c.ne=(0,g.x)(this.u,this);g.bs(this.o,b,a,c);this.l.isToggled=!this.l.isToggled;r5(this)};
q5.prototype.u=function(){this.l&&(this.l.isToggled=!this.l.isToggled,r5(this))};g.t(u5,g.W);
u5.prototype.B=function(a){var b=a&&a.liveStreamability&&a.liveStreamability.liveStreamabilityRenderer.offlineSlate;if(b){this.l=a;b=b.liveStreamOfflineSlateRenderer;b.canShowCountdown?this.F():v5(this,b);var c=a&&a.liveStreamability&&a.liveStreamability.liveStreamabilityRenderer&&a.liveStreamability.liveStreamabilityRenderer.offlineSlate&&a.liveStreamability.liveStreamabilityRenderer.offlineSlate.liveStreamOfflineSlateRenderer&&a.liveStreamability.liveStreamabilityRenderer.offlineSlate.liveStreamOfflineSlateRenderer.thumbnail;if(c){for(var d=
0,e=null,f=0;f<c.thumbnails.length;f++)c.thumbnails[f].width>d&&(d=c.thumbnails[f].width,e=c.thumbnails[f].url);e&&(this.element.style.backgroundImage="url("+e+")")}else this.element.style.backgroundImage="";b.actionButtons?(this.u||(this.u=new q5(this.o),this.u.g(this.i["ytp-offline-slate-buttons"]),g.B(this,this.u)),s5(this.u,b.actionButtons[0])):this.u&&s5(this.u,null);this.l=a}else this.l=null;this.H()};
u5.prototype.H=function(){var a=g.IK(this.o),b=this.o.getVideoData(),c=b.sa&&(g.YC(a)||g.T(a,2)||g.T(a,64)),d=2==b.autonavState&&g.T(a,2);a=g.WC(a)&&!g.lC(b)&&!this.o.isAtLiveHead(!0);c&&!a&&!d&&this.l&&"LIVE_STREAM_OFFLINE"==this.l.status.toUpperCase()?this.Fa()||(this.show(),this.o.N("offlineslatestatechange"),this.D&&g.MK(this.o)):this.Fa()&&(this.hide(),this.o.N("offlineslatestatechange"))};
u5.prototype.F=function(){var a=this.l&&this.l.liveStreamability&&this.l.liveStreamability.liveStreamabilityRenderer&&this.l.liveStreamability.liveStreamabilityRenderer.offlineSlate&&this.l.liveStreamability.liveStreamabilityRenderer.offlineSlate.liveStreamOfflineSlateRenderer;if(a){var b=Math.floor((0,g.D)()/1E3),c=a.canShowCountdown&&parseInt(a.scheduledStartTime,10);!c||c<=b?(v5(this,a),this.A.stop()):(b=g.oR(c-b),v5(this,a,b),g.Do(this.A))}};
u5.prototype.U=function(){this.A.dispose();this.A=null;g.W.prototype.U.call(this)};g.t(z5,g.mL);g.h=z5.prototype;g.h.U=function(){D5(this);g.TK(this.player,"heartbeat");g.mL.prototype.U.call(this)};
g.h.pF=function(){this.B=!0;x5(this,2E3)};
g.h.qF=function(a){this.l=a;x5(this,2E3)};
g.h.rF=function(a){g.T(a.state,2)||g.T(a.state,64)?(D5(this),this.u&&(this.B=!0,x5(this,1E3))):(g.T(a.state,1)||g.T(a.state,8))&&x5(this,2E3)};
g.h.VL=function(){3!==this.player.getPresentingPlayerType()&&x5(this,2E3)};
g.h.LM=function(){var a=g.X(this.player),b=this.player.getVideoData();var c=a.B;if(3==this.player.getPresentingPlayerType())this.g=NaN;else if(g.T(g.IK(this.player),4))this.g=NaN;else if(B5(this)||b.sa){if(!A5(this)||b.sa){var d="GET";var e=a.deviceParams;a={video_id:b.videoId,heartbeat_token:b.heartbeatToken,c:e.c,cver:e.cver,cbrand:e.cbrand,cmodel:e.cmodel,vvt:b.gf,mdx_environment:b.mdxEnvironment,access_token:b.oauthToken,forced_experiments:a.xa,utc_offset_minutes:this.I,upg_content_filter_mode:b.Io,
sequence_number:this.H};e=g.X(this.player);void 0!=e.homeGroupInfo?a.home_group_info=e.homeGroupInfo:void 0!=b.homeGroupInfo&&(a.home_group_info=b.homeGroupInfo);void 0!=e.livingRoomAppMode&&(a.living_room_app_mode=e.livingRoomAppMode);(e="undefined"!=typeof Intl?(new Intl.DateTimeFormat).resolvedOptions().timeZone:null)&&(a.time_zone=e);(e=g.VB(b))&&(a.uloc=e);(e=this.player.getProgressState().ingestionTime)&&isFinite(e)&&(a.ingestion_time=e);c=g.bh(c+"heartbeat",a)}else d="GET",c=g.bh(this.l.url,
{request_id:g.wt()}),b.gf&&(c=g.bh(c,{vvt:b.gf}),b.mdxEnvironment&&(c=g.bh(c,{mdx_environment:b.mdxEnvironment}))),b.oauthToken&&(c=g.bh(c,{access_token:b.oauthToken}));b.Zj&&(c=g.bh(c,{internalipoverride:b.Zj}));c=g.bh(c,{cpn:b.clientPlaybackNonce});g.br(c,{format:"RAW",method:d,timeout:3E4,onSuccess:(0,g.x)(this.EE,this),onError:(0,g.x)(this.DE,this),ne:(0,g.x)(this.FE,this),withCredentials:!0})}else D5(this)};
g.h.EE=function(a){if(this.g){this.F.reset();this.H++;a=a.responseText;var b=E5(a);if(b){this.player.la("onHeartbeat",b);var c="ok"==b.status?b.stop_heartbeat?2:0:"stop"==b.status?1:"live_stream_offline"==b.status?0:-1}else c=(c=a.match(F5))?"0"==c[1]?0:1:-1;if(-1==c)b="decode",window.btoa&&(b+=" "+window.btoa(a)),C5(this,!1,b);else if(2!=c||B5(this))if(this.D=0,this.g=NaN,1==c){this.A=!1;b=this.player;c="LICENSE";var d=E5(a);d?a=d.reason||g.OJ[c]||"":((a=a.match(F5))&&(a=parseInt(a[1],10))&&(c=g.MC(a)),
a=g.OJ[c]||"");g.aJ(b.app.l,"heartbeat.stop",a,void 0,void 0)}else this.A=!0,a=0,this.u&&b&&(a=y5(this,b),this.player.N("livestatedata",b)),a?x5(this,a):x5(this);else D5(this),this.A=!0}};
g.h.DE=function(a){C5(this,!0,"net-"+a.status)};
g.h.FE=function(){C5(this,!0,"timeout")};
g.h.dk=function(){return!!this.o&&this.o.Fa()};
var F5=/^GLS\/1.0 (\d+) (\w+).*?\r\n\r\n([\S\s]*)$/;g.IV.heartbeat=z5;})(_yt_player);