"use strict";(self.webpackChunkplex_web_client=self.webpackChunkplex_web_client||[]).push([[1906],{51906:(r,e,t)=>{t.r(e),t.d(e,{default:()=>p});var s=t(39473),a=t.n(s),E=t(96540),o=t(6055),i=t(46772),l=t(73697),R=Object.defineProperty,_=Object.defineProperties,c=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,h=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable,A=(r,e,t)=>e in r?R(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,D=(r,e,t)=>(A(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.A)("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.A)("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.A)("Media");case a().ErrorDetails.REMUX_ALLOC_ERROR:case a().ErrorDetails.LEVEL_SWITCH_ERROR:case a().ErrorDetails.INTERNAL_EXCEPTION:return(0,i.A)("Player")}}class T extends E.Component{constructor(r,e){super(r,e),D(this,"_hls"),D(this,"onElementChange",(r=>{this._hls=new(a())({maxMaxBufferLength:30,startLevel:-1}),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)})),D(this,"onHTMLError",(()=>{})),D(this,"onMediaAttached",(()=>{this._hls.loadSource(this.props.src)})),D(this,"onManifestParsed",(()=>{this.setState({isReadyToPlay:!0})})),D(this,"onError",((r,e)=>{const{type:t,details:s,fatal:E}=e,i=s;E&&t===a().ErrorTypes.NETWORK_ERROR?(o.A.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.A.warn(`[Player] A critical HLSjs media error occurred: ${i}; the player will attempt to recover`),this._hls.recoverMediaError()):E?(o.A.warn(`[Player] A critical HLSjs error occurred: ${i}; the player cannot recover`),this.props.onError&&this.props.onError({category:L(e)})):o.A.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.A,(r=((r,e)=>{for(var t in e||(e={}))h.call(e,t)&&A(r,t,e[t]);if(n)for(var t of n(e))O.call(e,t)&&A(r,t,e[t]);return r})({},this.props),e={isReadyToPlay:this.state.isReadyToPlay,onElementChange:this.onElementChange,onHTMLError:this.onHTMLError},_(r,c(e))));var r,e}}const p=T}}]);