Initial Commit

This commit is contained in:
francop committed 2026-06-11 11:50:50 -04:00
commit d4a69c41be
2748 files changed
+80489

No files matched your search

@@ -0,0 +1,2 @@
export const ids=["9336"];export const modules={65744:function(e,t,r){var i=r(44249),s=r(72621),a=(r(75656),r(50100),r(18084),r(57243)),o=r(50778),n=r(11297),l=r(30137),d=(r(17949),r(530)),h=r(49672);(0,i.Z)([(0,o.Mo)("ha-hls-player")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,o.Cb)()],key:"entityid",value:void 0},{kind:"field",decorators:[(0,o.Cb)()],key:"url",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:"poster-url"})],key:"posterUrl",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Boolean,attribute:"controls"})],key:"controls",value:()=>!1},{kind:"field",decorators:[(0,o.Cb)({type:Boolean,attribute:"muted"})],key:"muted",value:()=>!1},{kind:"field",decorators:[(0,o.Cb)({type:Boolean,attribute:"autoplay"})],key:"autoPlay",value:()=>!1},{kind:"field",decorators:[(0,o.Cb)({type:Boolean,attribute:"playsinline"})],key:"playsInline",value:()=>!1},{kind:"field",decorators:[(0,o.Cb)({type:Boolean,attribute:"allow-exoplayer"})],key:"allowExoPlayer",value:()=>!1},{kind:"field",decorators:[(0,o.IO)("video")],key:"_videoEl",value:void 0},{kind:"field",decorators:[(0,o.SB)()],key:"_error",value:void 0},{kind:"field",decorators:[(0,o.SB)()],key:"_errorIsFatal",value:()=>!1},{kind:"field",decorators:[(0,o.SB)()],key:"_url",value:void 0},{kind:"field",key:"_hlsPolyfillInstance",value:void 0},{kind:"field",key:"_exoPlayer",value:()=>!1},{kind:"field",static:!0,key:"streamCount",value:()=>0},{kind:"method",key:"connectedCallback",value:function(){(0,s.Z)(i,"connectedCallback",this,3)([]),i.streamCount+=1,this.hasUpdated&&(this._resetError(),this._startHls())}},{kind:"method",key:"disconnectedCallback",value:function(){(0,s.Z)(i,"disconnectedCallback",this,3)([]),i.streamCount-=1,this._cleanUp()}},{kind:"method",key:"render",value:function(){return a.dy` ${this._error?a.dy`<ha-alert alert-type="error" class="${this._errorIsFatal?"fatal":"retry"}"> ${this._error} </ha-alert>`:""} ${this._errorIsFatal?"":a.dy`<video .poster="${this.posterUrl}" ?autoplay="${this.autoPlay}" .muted="${this.muted}" ?playsinline="${this.playsInline}" ?controls="${this.controls}" @loadeddata="${this._loadedData}"></video>`} `}},{kind:"method",key:"updated",value:function(e){(0,s.Z)(i,"updated",this,3)([e]);const t=e.has("entityid"),r=e.has("url");t?this._getStreamUrlFromEntityId():r&&this.url&&(this._cleanUp(),this._resetError(),this._url=this.url,this._startHls())}},{kind:"method",key:"_getStreamUrlFromEntityId",value:async function(){if(this._cleanUp(),this._resetError(),(0,h.p)(this.hass,"stream")){if(this.entityid)try{const{url:e}=await(0,d.Lr)(this.hass,this.entityid);this._url=e,this._cleanUp(),this._resetError(),this._startHls()}catch(e){console.error(e),(0,n.B)(this,"streams",{hasAudio:!1,hasVideo:!1})}}else this._setFatalError("Streaming component is not loaded.")}},{kind:"method",key:"_startHls",value:async function(){const e=fetch(this._url),t=(await Promise.all([r.e("3895"),r.e("4768")]).then(r.bind(r,17231))).default;if(!this.isConnected)return;let i=t.isSupported();if(i||(i=""!==this._videoEl.canPlayType("application/vnd.apple.mpegurl")),!i)return void this._setFatalError(this.hass.localize("ui.components.media-browser.video_not_supported"));const s=this.allowExoPlayer&&this.hass.auth.external?.config.hasExoPlayer,a=await(await e).text();if(!this.isConnected)return;const o=/#EXT-X-STREAM-INF:.*?(?:CODECS=".*?([^.]*)?\..*?,([^.]*)?\..*?".*?)?(?:\n|\r\n)(.+)/g,n=o.exec(a),l=o.exec(a);let d;if(null!==n&&null===l){let e;try{e=new URL(this._url).href}catch(t){e=new URL(this._url,window.location.href).href}d=new URL(n[3],e).href}else d=this._url;const h=n?`${n[1]},${n[2]}`:void 0;this._reportStreams(h),s&&(h?.includes("hevc")||h?.includes("hev1"))?this._renderHLSExoPlayer(d):t.isSupported()?this._renderHLSPolyfill(this._videoEl,t,d):this._renderHLSNative(this._videoEl,d)}},{kind:"method",key:"_renderHLSExoPlayer",value:async function(e){this._exoPlayer=!0,window.addEventListener("resize",this._resizeExoPlayer),this.updateComplete.then((()=>(0,l.y)())).then(this._resizeExoPlayer),this._videoEl.style.visibility="hidden",await this.hass.auth.external.fireMessage({type:"exoplayer/play_hls",payload:{url:new URL(e,window.location.href).toString(),muted:this.muted}})}},{kind:"field",key:"_resizeExoPlayer",value(){return()=>{if(!this._videoEl)return;const e=this._videoEl.getBoundingClientRect();this.hass.auth.external.fireMessage({type:"exoplayer/resize",payload:{left:e.left,top:e.top,right:e.right,bottom:e.bottom}})}}},{kind:"method",key:"_isLLHLSSupported",value:function(){if(i.streamCount<=2)return!0;if(!("performance"in window)||0===performance.getEntriesByType("resource").length)return!1;const e=performance.getEntriesByType("resource")[0];return"nextHopProtocol"in e&&"h2"===e.nextHopProtocol}},{kind:"method",key:"_renderHLSPolyfill",value:async function(e,t,r){const i=new Line truncated
//# sourceMappingURL=9336.8ae7f87f802d5630.js.map