1 line
25 KiB
JavaScript
Vendored
1 line
25 KiB
JavaScript
Vendored
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3126,6864,2513,2240],{61357:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/embed/video",function(){return n(7085)}])},82643:function(e,t,n){"use strict";n.d(t,{k:function(){return m}});var i=n(85893),s=n(93879),r=n(1461),a=n(20133),l=n(4116),o=n(56469),c=n(67294),u=n(84385),h=n.n(u),d=n(11);let m=e=>{let{handleClose:t}=e,[n,u]=(0,c.useState)(null),[m,f]=(0,c.useState)(!1),[p,g]=(0,c.useState)(!1),[y,b]=(0,c.useState)(null),v=e=>{u(e),(0,d.ME)(e)?f(!0):f(!1)},w=async()=>{if(m){g(!0);try{let e=n.replace(/^@+/,""),i=await fetch("/api/remotefollow",{method:"POST",body:JSON.stringify({account:e})}),s=await i.json();if(s.redirectUrl&&(window.open(s.redirectUrl,"_blank"),t()),!s.success){b(s.message),g(!1);return}if(!s.redirectUrl){b("Unable to follow."),g(!1);return}}catch(e){b(e.message)}g(!1)}};return(0,i.jsxs)(s.Z,{spinning:p,children:[y&&(0,i.jsx)(r.Z,{message:"Follow Error",description:y,type:"error",closable:!0,className:h().errorAlert}),(0,i.jsxs)("div",{className:h().inputContainer,children:[(0,i.jsx)("div",{className:h().instructions,children:"Enter your username @server to follow"}),(0,i.jsx)(a.default,{value:n,size:"large",onChange:e=>v(e.target.value),placeholder:"Your fediverse account @account@server",defaultValue:n}),(0,i.jsx)("div",{className:h().footer,children:"You'll be redirected to your Fediverse server and asked to confirm the action."})]}),(0,i.jsxs)(l.Z,{className:h().buttons,children:[(0,i.jsx)(o.Z,{onClick:()=>{window.open("https://owncast.online/join-fediverse","_blank")},type:"text",children:"Join the Fediverse"}),(0,i.jsx)(o.Z,{disabled:!m,type:"primary",onClick:w,children:"Follow"})]})]})}},4955:function(e,t,n){"use strict";n.r(t),n.d(t,{Modal:function(){return h}});var i=n(85893),s=n(77786),r=n(93879),a=n(67294),l=n(4511),o=n(69583),c=n(81820),u=n.n(c);let h=e=>{let{title:t,url:n,open:c,handleOk:h,handleCancel:d,afterClose:m,height:f,width:p,children:g}=e,[y,b]=(0,a.useState)(!!n),v="100%",w="520px";n&&(v="70vh",w="900px");let _={padding:"0px",minHeight:f,height:null!=f?f:v},T=n&&(0,i.jsx)("iframe",{title:t,src:n,width:"100%",height:"100%",sandbox:"allow-same-origin allow-scripts allow-popups allow-forms",frameBorder:"0",allowFullScreen:!0,style:{display:"block"},onLoad:()=>b(!1)}),k=y?"none":"inline";return(0,i.jsx)(s.default,{title:t,open:c,onOk:h,onCancel:d,afterClose:m,bodyStyle:_,width:null!=p?p:w,zIndex:999,footer:null,centered:!0,destroyOnClose:!0,className:u().modal,children:(0,i.jsx)(l.SV,{fallbackRender:e=>{let{error:t,resetErrorBoundary:n}=e;return(0,i.jsx)(o.A,{componentName:"Modal",message:t.message,retryFunction:n})},children:(0,i.jsxs)("div",{id:"modal-container",style:{height:"100%"},children:[T&&(0,i.jsx)("div",{style:{display:k},children:T}),g&&(0,i.jsx)("div",{className:u().content,children:g}),y&&(0,i.jsx)(r.Z,{className:u().spinner,spinning:y,size:"large",tip:t})]})})})}},84943:function(e,t,n){"use strict";n.d(t,{X:function(){return p}});var i=n(85893),s=n(36827),r=n(91710),a=n(61913),l=n(67294),o=n(5152),c=n.n(o),u=n(93967),h=n.n(u),d=n(20819),m=n.n(d);let f=c()(()=>Promise.all([n.e(3247),n.e(8586)]).then(n.t.bind(n,68586,23)),{loadableGenerated:{webpack:()=>[68586]},ssr:!1}),p=e=>{let t,{online:n,lastConnectTime:o,lastDisconnectTime:c,viewerCount:u,className:d}=e,[,p]=(0,l.useState)(new Date);(0,l.useEffect)(()=>{let e=setInterval(()=>p(new Date),1e3);return()=>{clearInterval(e)}},[]);let g="";if(n&&o){let e=function(e){let t=(0,s.y)({start:e,end:new Date});return t.days>=1?(0,r.L)({days:t.days,hours:t.hours>0?t.hours:0}):t.hours>=1?(0,r.L)({hours:t.hours,minutes:t.minutes>0?t.minutes:0}):(0,r.L)({minutes:t.minutes>0?t.minutes:0,seconds:t.seconds>0?t.seconds:0})}(new Date(o));g="Live for ".concat(e),t=u>0&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:m().viewerIcon,children:(0,i.jsx)(f,{})}),(0,i.jsx)("span",{children:" ".concat(u)})]})}else!n&&(g="Offline",c&&(t="Last live ".concat((0,a.Q)(new Date(c))," ago.")));return(0,i.jsxs)("div",{className:h()(m().statusbar,d),role:"status",children:[(0,i.jsx)("span",{"aria-live":"off",className:m().onlineMessage,children:g}),(0,i.jsx)("span",{className:m().viewerCount,children:t})]})};p.defaultProps={lastConnectTime:null,lastDisconnectTime:null}},6680:function(e,t,n){"use strict";n.r(t),n.d(t,{OwncastPlayer:function(){return O}});var i=n(85893),s=n(67294),r=n(4480),a=n(46977),l=n(93967),o=n.n(l),c=n(4511),u=n(85215),h=n(15505),d=n.n(h);n(78210);let m=e=>{let{options:t,onReady:n}=e,r=s.useRef(null),a=s.useRef(null);return s.useEffect(()=>{if(!a.current){let e=r.current,i=a.current=(0,u.Z)(e,t,()=>(console.debug("player is ready"),n&&n(i,u.Z)));i.autoplay(t.autoplay),i.src(t.sources)}},[t,r]),s.useEffect(()=>{u.Z.getPlayer(r.current).on("xhr-hooks-ready",()=>{var e;null===(e=u.Z.getPlayer(r.current).tech({IWillNotUseThisInPlugins:!0}))||void 0===e||e.vhs.xhr.onRequest(e=>{let{uri:t}=e,n=t;if(e.uri.match("m3u8")){let e=t.startsWith("http")?new URL(t):new URL(t,window.location.protocol+window.location.host),i=Math.random().toString(16).slice(2,8);e.searchParams.append("cachebust",i),n=e.toString()}return{...e,uri:n}})})},[]),(0,i.jsx)("div",{"data-vjs-player":!0,children:(0,i.jsx)("video",{ref:r,className:"video-js vjs-big-play-centered vjs-show-big-play-button-on-pause ".concat(d().player," vjs-owncast")})})};class f{start(){this.stop(),this.timer=setInterval(()=>{!function(){try{fetch("/api/ping")}catch(e){console.error(e)}}()},4e3)}stop(){clearInterval(this.timer)}}let p={position:"absolute",width:"100%",height:"100%"},g=e=>{let{src:t="",width:n,height:r,objectFit:a="fill",duration:l="1s",className:o}=e,c=(0,s.useMemo)(()=>({display:"inline-block",position:"relative",width:n,height:r}),[n,r]),u=(0,s.useMemo)(()=>[{...p,objectFit:a,opacity:0,transition:"opacity ".concat(l)},{...p,objectFit:a,opacity:1,transition:"opacity ".concat(l)},{...p,objectFit:a,opacity:0}],[a,l]),[h,d]=(0,s.useState)(0),[m,f]=(0,s.useState)(["",""]),g=t!==m[1]?t:"",y=()=>{d((h+1)%3),f([m[1],g])};return(0,i.jsx)("span",{style:c,className:o,children:[...m,g].map((e,t)=>""!==e&&(0,i.jsx)("img",{src:e,alt:"",style:u[t],onLoad:2===t?y:void 0},e))})};g.defaultProps={objectFit:"fill",duration:"3s"};var y=n(73593),b=n.n(y);let v=e=>{let t,{online:n,initialSrc:r,src:a}=e,[l,o]=(0,s.useState)(r),[c,u]=(0,s.useState)("0s");return(0,s.useEffect)(()=>{clearInterval(t),t=setInterval(()=>{"0s"===c&&u("3s"),o("".concat(a,"?").concat(Date.now()))},2e4)},[]),(0,i.jsxs)("div",{className:b().poster,children:[!n&&(0,i.jsx)("img",{src:r,alt:"logo"}),n&&(0,i.jsx)(g,{src:l,duration:c,objectFit:"contain",height:"auto",width:"100%",className:b().image})]})};var w=n(46445),_=n(28049);class T{stop(){clearInterval(this.sendMetricsTimer),this.player.off()}setClockSkew(e){this.clockSkewMs=e}videoJSReady(){let e=this.player.tech({IWillNotUseThisInPlugins:!0});this.supportsDetailedMetrics=!!e,null==e||e.on("usage",e=>{"vhs-unknown-waiting"===e.name&&this.setIsBuffering(!0),"vhs-rendition-change-abr"===e.name&&this.incrementQualityVariantChanges()}),this.player.textTracks().addEventListener("cuechange",()=>{this.incrementQualityVariantChanges()})}handlePlaying(){clearInterval(this.collectPlaybackMetricsTimer),this.collectPlaybackMetricsTimer=setInterval(()=>{this.collectPlaybackMetrics()},5e3)}handleEnded(){clearInterval(this.collectPlaybackMetricsTimer)}handleBuffering(){this.incrementErrorCount(1),this.setIsBuffering(!0)}handleNoLongerBuffering(){this.setIsBuffering(!1)}handleError(){this.incrementErrorCount(1)}incrementErrorCount(e){this.errors+=e}incrementQualityVariantChanges(){if(!this.hasPerformedInitialVariantChange){this.hasPerformedInitialVariantChange=!0;return}this.qualityVariantChanges++}setIsBuffering(e){if(this.isBuffering=e,!e){clearTimeout(this.bufferingDurationTimer);return}this.bufferingDurationTimer=setTimeout(()=>{this.incrementErrorCount(1)},500)}trackSegmentDownloadTime(e){this.segmentDownloadTime.push(e)}trackBandwidth(e){this.bandwidthTracking.push(e)}trackLatency(e){this.latencyTracking.push(e)}collectPlaybackMetrics(){let e=this.player.tech({IWillNotUseThisInPlugins:!0});if(!e||!e.vhs||this.player.paused()||2!==this.player.networkState())return;let t=e.vhs.systemBandwidth;this.trackBandwidth(t);try{let t=function(e){let t;let n=e.vhs.playlists.media(),i=e.currentTime();for(let e=0,s=n.segments.length;e<s;e++)if(i<n.segments[e].end){t=n.segments[e];break}return t||([t]=n.segments),t}(e);if(!t||!t.dateTimeObject)return;let n=t.dateTimeObject.getTime(),i=new Date().getTime()+this.clockSkewMs-n;if(i<0||i/1e3>=100)return;this.trackLatency(i)}catch(e){console.warn(e)}}async send(){let e;if(0===this.segmentDownloadTime.length||!this.player||this.player.paused())return;let t=this.errors;if(this.supportsDetailedMetrics){let n=e=>e.reduce((e,t)=>e+t,0)/e.length,i=n(this.segmentDownloadTime)/1e3;e={bandwidth:Math.round(n(this.bandwidthTracking)/1e3*1e3)/1e3,latency:Math.round(n(this.latencyTracking)/1e3*1e3)/1e3,downloadDuration:Math.round(1e3*i)/1e3,errors:t+(this.isBuffering?1:0),qualityVariantChanges:this.qualityVariantChanges}}else e={errors:t+(this.isBuffering?1:0)};this.errors=0,this.qualityVariantChanges=0,this.segmentDownloadTime=[],this.bandwidthTracking=[],this.latencyTracking=[];let n={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)};try{await fetch("/api/metrics/playback",n)}catch(e){console.error(e)}}constructor(e,t){var n=this;this.player=e,this.supportsDetailedMetrics=!1,this.hasPerformedInitialVariantChange=!1,this.clockSkewMs=0,this.segmentDownloadTime=[],this.bandwidthTracking=[],this.latencyTracking=[],this.errors=0,this.qualityVariantChanges=0,this.isBuffering=!1,this.bufferingDurationTimer=0,this.collectPlaybackMetricsTimer=0,this.videoJSReady=this.videoJSReady.bind(this),this.handlePlaying=this.handlePlaying.bind(this),this.handleBuffering=this.handleBuffering.bind(this),this.handleEnded=this.handleEnded.bind(this),this.handleError=this.handleError.bind(this),this.send=this.send.bind(this),this.collectPlaybackMetrics=this.collectPlaybackMetrics.bind(this),this.handleNoLongerBuffering=this.handleNoLongerBuffering.bind(this),this.sendMetricsTimer=0,this.player.on("canplaythrough",this.handleNoLongerBuffering),this.player.on("error",this.handleError),this.player.on("stalled",this.handleBuffering),this.player.on("waiting",this.handleBuffering),this.player.on("playing",this.handlePlaying),this.player.on("ended",this.handleEnded);let i=t.xhr;t.Vhs.xhr=function(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];if(t[0].uri.match(".ts")){let e=new Date,i=t[1];t[1]=(t,s,r)=>{let a=new Date().getTime()-e.getTime();n.trackSegmentDownloadTime(a),i(t,s,r)}}return i(...t)},this.videoJSReady(),this.sendMetricsTimer=setInterval(()=>{this.send()},1e4)}}class k{setClockSkew(e){this.clockSkewMs=e}check(){if(new Date().getTime()-this.startupTime.getTime()<1e4||this.player.paused()||this.player.seeking()||this.inTimeout||!this.enabled)return;let e=this.player.tech({IWillNotUseThisInPlugins:!0});if(!e||!e.vhs||2!==this.player.networkState())return;let t=0;try{if(0===e.vhs.stats.buffered.length){this.timeout();return}e.vhs.stats.buffered.forEach(e=>{t+=e.end-e.start})}catch(e){console.error(e)}let n=e.vhs.playlists.media().attributes.BANDWIDTH,i=e.vhs.systemBandwidth/n;try{let n=function(e){let t;let n=e.vhs.playlists.media(),i=e.currentTime();for(let e=0,s=n.segments.length;e<s;e++)if(i<n.segments[e].end){t=n.segments[e];break}return t||([t]=n.segments),t}(e);if(!n)return;if(i<1.8&&t<6*n.duration){this.timeout();return}let s=Math.max(4e3,1e3*n.duration*1.8),r=this.bufferedAtLatency.concat([s]),a=r.reduce((e,t)=>e+t,0)/r.length,l=Math.max(1.4*a,Math.min(1e3*n.duration*2.6,15e3));a>=l&&(l=a+3e3);let o=n.dateTimeObject.getTime(),c=new Date().getTime()+this.clockSkewMs-o;if(this.currentLatency=c,Math.abs(c)>8e4){this.timeout();return}if(c>l){if(this.shouldJumpToLive()&&c>l+5e3){let t=c/1e3-3*n.duration,i=this.player.currentTime()+t;console.info("latency",c/1e3,"jumping",t,"to live from ",this.player.currentTime()," to ",i);let s=e.vhs.stats.buffered[0].end,r=e.vhs.stats.buffered[0].start;if(i>r<s){this.jump(i);return}}let t=.33*i;(t=Math.max(Math.min(t,1.08),1))>this.playbackRate+.02&&(t=this.playbackRate+.02),t=Math.round(1e3*t)/1e3,this.start(t)}else c<=a&&this.stop();console.info("latency",c/1e3,"min",a/1e3,"max",l/1e3,"playback rate",this.playbackRate,"enabled:",this.enabled,"running: ",this.running,"skew: ",this.clockSkewMs,"rebuffer events: ",this.bufferingCounter)}catch(e){}}shouldJumpToLive(){return!(this.bufferingCounter>1)&&new Date().getTime()-this.lastJumpOccurred>2e4}jump(e){this.jumpingToLiveIgnoreBuffer=!0,this.performedInitialLiveJump=!0,this.lastJumpOccurred=new Date,console.info("current time",this.player.currentTime(),"seeking to",e),this.player.currentTime(e),setTimeout(()=>{this.jumpingToLiveIgnoreBuffer=!1},5e3)}setPlaybackRate(e){this.playbackRate=e,this.player.playbackRate(e)}start(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;!this.inTimeout&&this.enabled&&e!==this.playbackRate&&(this.running=!0,this.setPlaybackRate(e))}stop(){this.running&&console.log("stopping latency compensator..."),this.running=!1,this.setPlaybackRate(1)}enable(){this.enabled=!0,clearInterval(this.checkTimer),clearTimeout(this.bufferingTimer),this.checkTimer=setInterval(()=>{this.check()},3e3)}disable(){clearInterval(this.checkTimer),clearTimeout(this.timeoutTimer),this.stop(),this.enabled=!1}timeout(){this.jumpingToLiveIgnoreBuffer||(this.inTimeout=!0,this.stop(),clearTimeout(this.timeoutTimer),this.timeoutTimer=setTimeout(()=>{this.endTimeout()},3e4))}endTimeout(){clearTimeout(this.timeoutTimer),this.inTimeout=!1}handlePlaying(){let e=this.playing;this.playing=!0,clearTimeout(this.bufferingTimer),this.enabled&&this.shouldJumpToLive()&&(e||(this.jumpingToLiveIgnoreBuffer=!0,this.player.liveTracker.seekToLiveEdge(),this.lastJumpOccurred=new Date))}handlePause(){this.playing=!1}handleEnded(){this.enabled&&this.disable()}handleError(){this.enabled&&this.timeout()}countBufferingEvent(){if(this.bufferingCounter+=1,this.bufferingCounter>4){this.disable();return}this.bufferedAtLatency.push(this.currentLatency),console.log("latency compensation timeout due to buffering:",this.bufferingCounter,"buffering events of",4),setTimeout(()=>{this.bufferingCounter>0&&(this.bufferingCounter-=1)},18e4)}handleBuffering(){if(this.enabled&&!this.inTimeout){if(this.jumpingToLiveIgnoreBuffer){this.jumpingToLiveIgnoreBuffer=!1;return}this.timeout(),clearTimeout(this.bufferingTimer),this.bufferingTimer=setTimeout(()=>{this.countBufferingEvent()},200)}}constructor(e){this.player=e,this.playing=!1,this.enabled=!1,this.running=!1,this.inTimeout=!1,this.jumpingToLiveIgnoreBuffer=!1,this.timeoutTimer=0,this.checkTimer=0,this.bufferingCounter=0,this.bufferingTimer=0,this.playbackRate=1,this.lastJumpOccurred=null,this.startupTime=new Date,this.clockSkewMs=0,this.currentLatency=null,this.bufferedAtLatency=[],this.player.on("playing",this.handlePlaying.bind(this)),this.player.on("pause",this.handlePause.bind(this)),this.player.on("error",this.handleError.bind(this)),this.player.on("waiting",this.handleBuffering.bind(this)),this.player.on("stalled",this.handleBuffering.bind(this)),this.player.on("ended",this.handleEnded.bind(this)),this.player.on("canplaythrough",this.handlePlaying.bind(this)),this.player.on("canplay",this.handlePlaying.bind(this)),this.check=this.check.bind(this),this.start=this.start.bind(this),this.enable=this.enable.bind(this),this.countBufferingEvent=this.countBufferingEvent.bind(this)}}var x=n(52020),j=n.n(x);class C{static async getVideoQualities(){let e=[];try{let t=await fetch(C.VIDEO_CONFIG_URL);e=await t.json()}catch(e){console.error(e)}return e}}C.VIDEO_CONFIG_URL="/api/video/variants";let E=(0,s.createContext)(C);var M=n(69583);let I="owncast_volume",N="latencyCompensatorEnabled",P=new f,S=null,B=null,L=!1,O=e=>{let{source:t,online:n,initiallyMuted:l=!1,title:u,className:h}=e,d=(0,s.useContext)(E),f=s.useRef(null),[p,g]=(0,r.FV)(_.We),y=(0,r.sJ)(_.g8),b=()=>{try{f.current.volume((0,w.$o)(I)||1)}catch(e){console.warn(e)}},x=()=>{(0,w.qQ)(I,f.current.muted()?0:f.current.volume())},C=()=>{f.current.paused()?f.current.play():f.current.pause()},O=()=>{B&&B.stop(),L=!0,(B=new k(f.current)).setClockSkew(y),B.enable(),(0,w.qQ)(N,!0)},D=()=>{B&&B.disable(),B=null,L=!1,(0,w.qQ)(N,!1)},F=()=>(L?D():O(),L),R=e=>{let t=e.tech({IWillNotUseThisInPlugins:!0});t&&t.vhs&&("true"===(0,w.$o)(N)&&t&&t.vhs?O():D())},V=async(e,t)=>{let n=function(e,t,n,i){let s=t.getComponent("MenuItem"),r=t.getComponent("MenuItem"),a=t.getComponent("MenuButton");class l extends s{createEl(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"button",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=super.createEl(e,t,n);return i.innerHTML='<hr style="opacity: 0.3; margin-left: 10px; margin-right: 10px;" />',i}constructor(e,t){super(e,t)}}let o=new r(e,{selectable:!0,label:"minimize latency (experimental)"});o.on("click",()=>{let e=i();o.selected(e)});let c=new l(e,{selectable:!1});class u extends a{createItems(){let t;let i=e.tech({IWillNotUseThisInPlugins:!0}),s=new r(e,{selectable:!0,selected:!0,label:"Auto"}),a=Array(n.length);n.forEach(t=>{a[t.index]=new r(e,{selectable:!0,label:t.name})}),t="ontouchstart"in window?"touchend":"click";for(let e=0;e<a.length;e+=1)a[e].on(t,()=>{if(!i){console.warn("Invalid attempt to access null player tech");return}i.vhs.representations().forEach((t,n)=>{let i=n===e;t.enabled(i),a[n].selected(i)}),s.selected(!1)});s.on(t,()=>{i.vhs.representations().forEach(e=>{e.enabled(!0)}),a.forEach(e=>e.selected(!1)),s.selected(!0)});let l=!!i&&!!i.vhs;return n.length<2&&l?[o]:n.length>1&&l?[s,...a,c,o]:l||1!==n.length?[s,...a]:[]}constructor(){super(e)}}let h=new u;return h.el().setAttribute("aria-label","Settings"),h.addClass("vjs-quality-selector"),t.registerComponent("MenuButton",u),h}(e,t,await d.getVideoQualities(),F);e.controlBar.addChild(n,{},e.controlBar.children_.length-2),R(e)},J=(e,t)=>{if(window.hasOwnProperty("WebKitPlaybackTargetAvailabilityEvent")){let n=t.getComponent("Button");class i extends n{handleClick(){try{document.getElementsByTagName("video")[0].webkitShowPlaybackTargetPicker()}catch(e){console.error(e)}}constructor(){super(e)}}let s=new i;e.controlBar.addChild(s).addClass("vjs-airplay")}};return(0,a.y1)("space",e=>{e.preventDefault(),C()}),(0,a.y1)("f",()=>{f.current.isFullscreen()?f.current.exitFullscreen():f.current.requestFullscreen()},{enableOnContentEditable:!1}),(0,a.y1)("m",()=>{f.current.muted()||0===f.current.volume()?f.current.volume(.7):f.current.volume(0)},{enableOnContentEditable:!1}),(0,a.y1)("0",()=>f.current.volume(f.current.volume()+.1),{enableOnContentEditable:!1}),(0,a.y1)("9",()=>f.current.volume(f.current.volume()-.1),{enableOnContentEditable:!1}),(0,s.useEffect)(()=>{S&&S.setClockSkew(y)},[y]),(0,s.useEffect)(()=>()=>{D(),null==S||S.stop()},[]),(0,i.jsx)(c.SV,{fallbackRender:e=>{let{error:t,resetErrorBoundary:n}=e;return(0,i.jsx)(M.A,{componentName:"OwncastPlayer",message:t.message,retryFunction:n})},children:(0,i.jsxs)("div",{className:o()(j().container,h),id:"player",children:[n&&(0,i.jsx)("div",{className:j().player,children:(0,i.jsx)(m,{options:{autoplay:!1,controls:!0,responsive:!0,fluid:!1,fill:!0,playsinline:!0,liveui:!0,preload:"auto",muted:l,controlBar:{progressControl:{seekBar:!1}},html5:{vhs:{enableLowInitialPlaylist:!0,experimentalBufferBasedABR:!0,useNetworkInformationApi:!0,maxPlaylistRetries:30}},liveTracker:{trackingThreshold:0,liveTolerance:15},sources:[{src:t,type:"application/x-mpegURL"}]},onReady:(e,t)=>{f.current=e,b(),J(e,t),e.on("waiting",()=>{console.debug("player is waiting")}),e.on("dispose",()=>{console.debug("player will dispose"),P.stop()}),e.on("playing",()=>{console.debug("player is playing"),P.start(),g(!0)}),e.on("pause",()=>{console.debug("player is paused"),P.stop(),g(!1)}),e.on("ended",()=>{console.debug("player is ended"),P.stop(),g(!1)}),t.hookOnce(),e.on("volumechange",x),(S=new T(e,t)).setClockSkew(y),V(e,t)},"aria-label":u})}),(0,i.jsx)("div",{className:j().poster,children:!p&&(0,i.jsx)(v,{online:n,initialSrc:"/thumbnail.jpg",src:"/thumbnail.jpg"})})]})})}},7085:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return N}});var i,s,r=n(85893),a=n(6230),l=n.n(a),o=n(67294),c=n(4480),u=n(11163),h=n(62828),d=n(28049),m=n(84943),f=n(6680),p=n(83073),g=n(2643),y=n.n(g),b=n(93967),v=n.n(b),w=n(9008),_=n.n(w),T=n(23657),k=n(56469),x=n(26670),j=n.n(x),C=n(4955),E=n(82643);let{Title:M}=T.default;(i=s||(s={}))[i.CannotFollow=1]="CannotFollow",i[i.CanFollow=2]="CanFollow";let I=e=>{let{streamName:t,subtitle:n,image:i,supportsFollows:s}=e,[a,l]=(0,o.useState)(2),[c,u]=(0,o.useState)(!1);(0,o.useEffect)(()=>{s?1===a&&l(2):l(1)},[s]);let h=async()=>{u(!0)};return(0,r.jsxs)("div",{children:[(0,r.jsx)(_(),{children:(0,r.jsx)("title",{children:t})}),(0,r.jsx)("div",{className:v()(j().offlineContainer),children:(0,r.jsxs)("div",{className:j().content,children:[(0,r.jsxs)(M,{level:1,className:j().headerContainer,children:[(0,r.jsx)("div",{className:j().pageLogo,style:{backgroundImage:"url(".concat(i,")")}}),(0,r.jsx)("div",{className:j().streamName,children:t})]}),(0,r.jsxs)("div",{className:j().messageContainer,children:[(0,r.jsx)(M,{level:2,className:j().offlineTitle,children:"This stream is not currently live."}),(0,r.jsx)("div",{className:j().message,dangerouslySetInnerHTML:{__html:n}})]}),2===a&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(k.Z,{className:j().followButton,type:"primary",onClick:h,children:"Follow Server"}),(0,r.jsx)(C.Modal,{title:"Follow ".concat(t),open:c,handleCancel:()=>u(!1),children:(0,r.jsx)(E.k,{})})]})]})})]})};function N(){var e;let t=(0,c.sJ)(d.RI),n=(0,c.sJ)(d.g1),i=(0,c.sJ)(d.Q),{name:s,summary:a,offlineMessage:g,federation:b}=n,{viewerCount:v,lastConnectTime:w,lastDisconnectTime:_,streamTitle:T}=t,k=(0,c.sJ)(d.YW),{enabled:x}=b,j=(null!==(e=(0,u.useRouter)().asPath.split("?")[1])&&void 0!==e?e:"").split("&").reduce((e,t)=>{let[n,i]=t.split("=");return{...e,[n]:i}},{}),C="true"===j.initiallyMuted,E=x&&"false"!==j.supportsSocialFollow,M=(0,r.jsx)(h.Z,{active:!0,style:{padding:"10px"},paragraph:{rows:10}});(0,o.useEffect)(()=>{document.body.classList.add("body-background")},[]);let N=(0,r.jsx)(I,{streamName:s,subtitle:g||a,image:"/logo",supportsFollows:E}),P=(0,r.jsxs)("div",{className:"jsx-c9ad39c4496ab6bc "+(y().onlineContainer||""),children:[(0,r.jsx)(l(),{id:"c9ad39c4496ab6bc",children:".body-background{background:var(--theme-color-components-video-status-bar-background)}"}),(0,r.jsx)(f.OwncastPlayer,{source:"/hls/stream.m3u8",online:k,initiallyMuted:C,title:T||s}),(0,r.jsx)(m.X,{online:k,lastConnectTime:w,lastDisconnectTime:_,viewerCount:v})]});return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(d.me,{}),(0,r.jsx)(p.Q,{}),(0,r.jsx)("div",{className:"video-embed",children:i.appLoading?M:k?P:N})]})}},11:function(e,t,n){"use strict";n.d(t,{Kf:function(){return r},ME:function(){return a},ax:function(){return i},jv:function(){return s}});let i="https?://.*";function s(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["http:","https:"];try{let n=new URL(e);if(""===n.protocol||""===n.hostname||!t.includes(n.protocol))return!1}catch(e){return!1}return!0}function r(e,t){e.startsWith("@")&&(e=e.slice(1));let n=e.split(/:|@/),[i,s,r]=n;return i===t&&3===n.length&&!!i&&!!s&&!!r}function a(e){let t=e.replace(/^@+/,"");return/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(String(t).toLowerCase())}},84385:function(e){e.exports={header:"FollowModal_header__0tBbf",buttons:"FollowModal_buttons__Me7qJ",inputContainer:"FollowModal_inputContainer__Ie3e7",instructions:"FollowModal_instructions__JCqe7",footer:"FollowModal_footer__IBJi9",account:"FollowModal_account__OZ_ZG",logo:"FollowModal_logo__m4Z2e",username:"FollowModal_username__Voyzl",name:"FollowModal_name__fVdPj",errorAlert:"FollowModal_errorAlert__UneY4"}},81820:function(e){e.exports={spinner:"Modal_spinner__vORWo",content:"Modal_content__mZkaV",modal:"Modal_modal___vOcW"}},26670:function(e){e.exports={offlineContainer:"OfflineEmbed_offlineContainer__fdZ07",content:"OfflineEmbed_content__j10dd",headerContainer:"OfflineEmbed_headerContainer__4QoyJ",messageContainer:"OfflineEmbed_messageContainer__V4oKE",message:"OfflineEmbed_message__ZSzJ6",offlineTitle:"OfflineEmbed_offlineTitle__mYevK",pageLogo:"OfflineEmbed_pageLogo__cl5VS",streamName:"OfflineEmbed_streamName__lbS02",followButton:"OfflineEmbed_followButton__MAmeB"}},20819:function(e){e.exports={statusbar:"Statusbar_statusbar__b24qe",onlineMessage:"Statusbar_onlineMessage__FJnEa",viewerCount:"Statusbar_viewerCount__pfDDX",viewerIcon:"Statusbar_viewerIcon__U_j6P"}},52020:function(e){e.exports={container:"OwncastPlayer_container__CR5Ry",player:"OwncastPlayer_player__dCDjy",poster:"OwncastPlayer_poster__tbpwE"}},15505:function(e){e.exports={player:"VideoJS_player__GD36e"}},73593:function(e){e.exports={poster:"VideoPoster_poster__6rnLj",image:"VideoPoster_image__8kRcw"}},2643:function(e){e.exports={onlineContainer:"VideoEmbed_onlineContainer__5XevB"}},25893:function(){}},function(e){e.O(0,[2544,83,1287,3800,7786,3657,4065,1913,5888,1750,7244,6309,2657,2154,2888,9774,179],function(){return e(e.s=61357)}),_N_E=e.O()}]); |