Files
haos_config/www/community/advanced-camera-card/audio-13475a81.js
2026-01-30 23:31:00 -06:00

2 lines
2.5 KiB
JavaScript

import{dC as t,f5 as e}from"./card-b98d578d.js";const a=2,s=(t,e)=>{t._controlsHideTimer&&(t._controlsHideTimer.stop(),delete t._controlsHideTimer,delete t._controlsOriginalValue),t.controls=e},o=(e,a=1)=>{const o=e._controlsOriginalValue??e.controls;s(e,!1),e._controlsHideTimer??=new t,e._controlsOriginalValue=o;const i=()=>{s(e,o),e.removeEventListener("loadstart",i)};e.addEventListener("loadstart",i),e._controlsHideTimer.start(a,(()=>{s(e,o)}))};class i{constructor(t,e,a){this._host=t,this._getVideoCallback=e,this._getControlsDefaultCallback=a??null}async play(){await this._host.updateComplete;const t=this._getVideoCallback();if(t?.play)try{await t.play()}catch(e){if("NotAllowedError"===e.name&&!this.isMuted()){await this.mute();try{await t.play()}catch(t){}}}}async pause(){await this._host.updateComplete,this._getVideoCallback()?.pause()}async mute(){await this._host.updateComplete;const t=this._getVideoCallback();t&&(t.muted=!0)}async unmute(){await this._host.updateComplete;const t=this._getVideoCallback();t&&(t.muted=!1)}isMuted(){return this._getVideoCallback()?.muted??!0}async seek(t){await this._host.updateComplete;const e=this._getVideoCallback();e&&(o(e),e.currentTime=t)}async setControls(t){await this._host.updateComplete;const e=this._getVideoCallback(),a=t??this._getControlsDefaultCallback?.();e&&void 0!==a&&s(e,a)}isPaused(){return this._getVideoCallback()?.paused??!0}async getScreenshotURL(){await this._host.updateComplete;const t=this._getVideoCallback();return t?e(t):null}getFullscreenElement(){return this._getVideoCallback()??null}}const n=t=>void 0!==t.mozHasAudio?t.mozHasAudio:void 0!==t.audioTracks?Boolean(t.audioTracks?.length):!("undefined"!=typeof MediaStream&&t.srcObject instanceof MediaStream)||t.srcObject.getAudioTracks().length>0,l=(t,e,a)=>{if(e){const t=e.getReceivers();if(t.length>0)return t.some((t=>"audio"===t.track?.kind&&!t.track?.muted))}return a?a.includes("mp4a")||a.includes("opus")||a.includes("flac"):n(t)},r=t=>!!t?.getTransceivers().some((t=>"audio"===t.sender.track?.kind&&("sendonly"===t.direction||"sendrecv"===t.direction))),c=(t,e)=>{if(!t)return null;const a=t.getReceivers().map((t=>t.track)).filter((t=>"audio"===t?.kind));if(0===a.length)return null;const s=()=>a.some((t=>!t.muted));let o=s();const i=()=>{const t=s();t!==o&&(o=t,e(t))};return a.forEach((t=>{t.addEventListener("unmute",i),t.addEventListener("mute",i)})),()=>a.forEach((t=>{t.removeEventListener("unmute",i),t.removeEventListener("mute",i)}))};export{a as M,i as V,l as a,c as b,r as c,o as h,n as m,s};