<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">"use strict";(self.webpackChunkPeerTube=self.webpackChunkPeerTube||[]).push([[5028],{85028:(v,h,i)=&gt;{i.r(h),i.d(h,{P2pMediaLoaderPlugin:()=&gt;P});var E=i(99525),p=i.n(E),u=i(1296),l=i.n(u),o=i(98888),a=i(16136),r=i(84820),_=i(84872);const g=l().getPlugin("plugin");class P extends g{constructor(t,s){if(super(t),this.statsP2PBytes={pendingDownload:[],pendingUpload:[],peersWithWebSeed:0,peersP2POnly:0,totalDownload:0,totalUpload:0},this.statsHTTPBytes={pendingDownload:[],totalDownload:0},this.options=s,l().Html5Hlsjs)l().Html5Hlsjs.addHook("beforeinitialize",(e,n)=&gt;{this.hlsjs=n}),(0,a.initVideoJsContribHlsJsPlayer)(t),t.src({type:s.type,src:s.src}),t.ready(()=&gt;{this.initializePlugin()});else{if(t.canPlayType("application/vnd.apple.mpegurl"))return void this.fallbackToBuiltInIOS();const e="HLS.js does not seem to be supported. Cannot fallback to built-in HLS";r.Q.warn(e);const n={code:MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED,message:e,MEDIA_ERR_ABORTED:MediaError.MEDIA_ERR_ABORTED,MEDIA_ERR_DECODE:MediaError.MEDIA_ERR_DECODE,MEDIA_ERR_NETWORK:MediaError.MEDIA_ERR_NETWORK,MEDIA_ERR_SRC_NOT_SUPPORTED:MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED};t.ready(()=&gt;t.error(n))}}dispose(){var t,s,e,n,d;null===(t=this.p2pEngine)||void 0===t||t.removeAllListeners(),null===(s=this.p2pEngine)||void 0===s||s.destroy(),null===(e=this.hlsjs)||void 0===e||e.destroy(),null===(n=this.options.segmentValidator)||void 0===n||n.destroy(),null===(d=l().Html5Hlsjs)||void 0===d||d.removeAllHooks(),clearInterval(this.networkInfoInterval),super.dispose()}getCurrentLevel(){if(this.hlsjs)return this.hlsjs.levels[this.hlsjs.currentLevel]}getLiveLatency(){return Math.round(this.hlsjs.latency)}getLiveLatencyFromEdge(){return Math.round(this.hlsjs.latency-this.hlsjs.targetLatency)}getHLSJS(){return this.hlsjs}initializePlugin(){(0,a.initHlsJsPlayer)(this.hlsjs),this.p2pEngine=this.options.loader.getEngine(),this.p2pEngine.on(o.Events.SegmentError,(s,e)=&gt;{!1!==navigator.onLine&amp;&amp;(r.Q.error(`Segment ${s.id} error.`,e),this.options.redundancyUrlManager.removeBySegmentUrl(s.requestUrl))}),this.statsP2PBytes.peersWithWebSeed=1+this.options.redundancyUrlManager.countBaseUrls(),this.runStats();let t=!0;this.hlsjs.on(p().Events.LEVEL_SWITCHED,()=&gt;{const s=this.getCurrentLevel(),e=Math.min((null==s?void 0:s.height)||0,(null==s?void 0:s.width)||0);this.player.trigger("resolution-change",{resolution:e,initResolutionChange:t}),t=!1}),this.hlsjs.on(p().Events.MANIFEST_PARSED,(s,e)=&gt;{if(Array.isArray(e.levels)&amp;&amp;e.levels.length&gt;=1){const n=e.levels[0];this.player.trigger("video-ratio-changed",{ratio:n.width/n.height})}})}runStats(){this.p2pEngine.on(o.Events.PieceBytesDownloaded,(t,s,e)=&gt;{const n="p2p"===t?this.statsP2PBytes:this.statsHTTPBytes;n.pendingDownload.push(e),n.totalDownload+=e}),this.p2pEngine.on(o.Events.PieceBytesUploaded,(t,s,e)=&gt;{"p2p"===t?(this.statsP2PBytes.pendingUpload.push(e),this.statsP2PBytes.totalUpload+=e):r.Q.error(`Received upload from unknown method ${t}`)}),this.p2pEngine.on(o.Events.PeerConnect,()=&gt;{this.statsP2PBytes.peersWithWebSeed++,this.statsP2PBytes.peersP2POnly++}),this.p2pEngine.on(o.Events.PeerClose,()=&gt;{this.statsP2PBytes.peersWithWebSeed--,this.statsP2PBytes.peersP2POnly--}),this.networkInfoInterval=setInterval(()=&gt;{const t=this.arraySum(this.statsP2PBytes.pendingDownload),s=this.arraySum(this.statsP2PBytes.pendingUpload),e=this.arraySum(this.statsHTTPBytes.pendingDownload);return this.statsP2PBytes.pendingDownload=[],this.statsP2PBytes.pendingUpload=[],this.statsHTTPBytes.pendingDownload=[],this.player.trigger("network-info",{source:"p2p-media-loader",bandwidthEstimate:this.hlsjs.bandwidthEstimate/8,http:{downloadSpeed:e,downloaded:this.statsHTTPBytes.totalDownload},p2p:this.options.p2pEnabled?{downloadSpeed:t,uploadSpeed:s,peersWithWebSeed:this.statsP2PBytes.peersWithWebSeed,peersP2POnly:this.statsP2PBytes.peersP2POnly,downloaded:this.statsP2PBytes.totalDownload,uploaded:this.statsP2PBytes.totalUpload}:void 0})},1e3)}arraySum(t){return t.reduce((s,e)=&gt;s+e,0)}fallbackToBuiltInIOS(){r.Q.info("HLS.js does not seem to be supported. Fallback to built-in HLS."),this.player.src({type:this.options.type,src:(0,_.qS)(this.options.src,{videoFileToken:this.options.videoFileToken(),reinjectVideoFileToken:"true"})}),this.getResolutionButton().hide()}getResolutionButton(){return this.player.controlBar.getDescendant(["settingsButton"]).menu.getChild("resolutionMenuButton")}}l().registerPlugin("p2pMediaLoader",P)}}]);
//# sourceMappingURL=5028.0a407929918445cb.js.map</pre></body></html>