async function s(e){if(e instanceof HTMLVideoElement)return i(e);const n=URL.createObjectURL(e),t=document.createElement("video");t.src=n,t.muted=!0,t.playsInline=!0,t.preload="auto";try{return await new Promise((d,o)=>{const a=()=>{t.removeEventListener("loadedmetadata",r),t.removeEventListener("error",u)},r=()=>{a(),d()},u=()=>{a(),o(new Error("Failed to load video for sound detection"))};t.addEventListener("loadedmetadata",r),t.addEventListener("error",u)}),await i(t)}finally{t.removeAttribute("src"),t.load(),URL.revokeObjectURL(n)}}async function i(e){const n=e.audioTracks;if(n&&typeof n.length=="number")return n.length>0;if(typeof e.mozHasAudio=="boolean")return e.mozHasAudio;if("webkitAudioDecodedByteCount"in e){const t=e.paused,d=e.muted;e.muted=!0;try{await e.play().catch(()=>{}),await new Promise(a=>{const r=()=>{e.removeEventListener("timeupdate",r),a()};e.addEventListener("timeupdate",r),setTimeout(()=>{e.removeEventListener("timeupdate",r),a()},400)})}finally{t&&e.pause(),e.muted=d}const o=e.webkitAudioDecodedByteCount;if(typeof o=="number")return o>0}return!0}export{s as d};
//# sourceMappingURL=detectVideoHasSound-C6FwY-mT.js.map
