"use strict";(self.webpackChunkplex_web_client=self.webpackChunkplex_web_client||[]).push([[4956],{74956:(r,e,t)=>{t.r(e),t.d(e,{default:()=>p});var s=t(8444),a=t.n(s),E=t(11504),o=t(38828),i=t(59396),l=t(95164),R=Object.defineProperty,c=Object.defineProperties,_=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,h=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable,D=(r,e,t)=>e in r?R(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,A=(r,e,t)=>(D(r,"symbol"!=typeof e?e+"":e,t),t);function L(r){switch(r.details){case a().ErrorDetails.MANIFEST_LOAD_ERROR:case a().ErrorDetails.MANIFEST_LOAD_TIMEOUT:case a().ErrorDetails.MANIFEST_PARSING_ERROR:return(0,i.c)("Manifest");case a().ErrorDetails.LEVEL_EMPTY_ERROR:case a().ErrorDetails.LEVEL_LOAD_ERROR:case a().ErrorDetails.LEVEL_LOAD_TIMEOUT:case a().ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case a().ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:case a().ErrorDetails.FRAG_LOAD_ERROR:case a().ErrorDetails.FRAG_LOAD_TIMEOUT:case a().ErrorDetails.KEY_LOAD_ERROR:case a().ErrorDetails.KEY_LOAD_TIMEOUT:return(0,i.c)("Network");case a().ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR:case a().ErrorDetails.FRAG_DECRYPT_ERROR:case a().ErrorDetails.FRAG_PARSING_ERROR:case a().ErrorDetails.BUFFER_ADD_CODEC_ERROR:case a().ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR:case a().ErrorDetails.BUFFER_APPEND_ERROR:case a().ErrorDetails.BUFFER_APPENDING_ERROR:case a().ErrorDetails.BUFFER_STALLED_ERROR:case a().ErrorDetails.BUFFER_FULL_ERROR:case a().ErrorDetails.BUFFER_SEEK_OVER_HOLE:case a().ErrorDetails.BUFFER_NUDGE_ON_STALL:return(0,i.c)("Media");case a().ErrorDetails.REMUX_ALLOC_ERROR:case a().ErrorDetails.LEVEL_SWITCH_ERROR:case a().ErrorDetails.INTERNAL_EXCEPTION:return(0,i.c)("Player")}}class T extends E.Component{constructor(r,e){super(r,e),A(this,"_hls"),A(this,"onElementChange",(r=>{this._hls=new(a())({maxMaxBufferLength:30}),this._hls.on(a().Events.MEDIA_ATTACHED,this.onMediaAttached),this._hls.on(a().Events.MANIFEST_PARSED,this.onManifestParsed),this._hls.on(a().Events.ERROR,this.onError),this._hls.attachMedia(r)})),A(this,"onHTMLError",(()=>{})),A(this,"onMediaAttached",(()=>{this._hls.loadSource(this.props.src)})),A(this,"onManifestParsed",(()=>{this.setState({isReadyToPlay:!0})})),A(this,"onError",((r,e)=>{const{type:t,details:s,fatal:E}=e,i=s;E&&t===a().ErrorTypes.NETWORK_ERROR?(o.c.warn(`[Player] A critical HLSjs network error occurred: ${i}; the player will restart the load`),this._hls.startLoad()):E&&t===a().ErrorTypes.MEDIA_ERROR?(o.c.warn(`[Player] A critical HLSjs media error occurred: ${i}; the player will attempt to recover`),this._hls.recoverMediaError()):E?(o.c.warn(`[Player] A critical HLSjs error occurred: ${i}; the player cannot recover`),this.props.onError&&this.props.onError({category:L(e)})):o.c.warn(`[Player] A non-critical HLSjs error occurred: ${i}`)})),this.state={isReadyToPlay:!1}}componentWillUnmount(){this._hls.detachMedia(),this._hls.destroy(),this._hls=null}render(){return E.createElement(l.c,(r=((r,e)=>{for(var t in e||(e={}))h.call(e,t)&&D(r,t,e[t]);if(n)for(var t of n(e))O.call(e,t)&&D(r,t,e[t]);return r})({},this.props),e={isReadyToPlay:this.state.isReadyToPlay,onElementChange:this.onElementChange,onHTMLError:this.onHTMLError},c(r,_(e))));var r,e}}const p=T}}]);