Module 792348

958 characters · in no known chunk
Dependencies
Required by (2)
Lazily required by (0)none
Lazily requires (0)none
Source Raw
function(e,t,n){"use strict";n.d(t,{A:()=>E});var i=n(64700),r=n(17928),s=n(946261),a=n(536184),o=n(523006),l=n(885386),u=n(723702),c=n(209932),d=n(813564),_=n(102597),h=n(904054),f=n(257645);function E(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l.dG.getSetting()?.volume??100,E=arguments.length>3&&void 0!==arguments[3]?arguments[3]:f.a.DEFAULT,{audioRef:p}=i.useContext(o.A),[m,g]=i.useState(!1),A=(0,r.bG)([c.A],()=>c.A.isPlayingSound(e.soundId),[e]);return{playSoundboardSound:i.useCallback(n=>{null!=p.current&&p.current.pause(),null!=t&&(0,d.Ak)(e,t,n)},[e,p,t]),isPlayingSound:A,previewSound:i.useCallback(async()=>{let t=(0,_.A)(e.soundId),i=new(await (0,a.A)(t));i.src=t,null!=p.current&&p.current.pause(),u.isPlatformEmbedded&&E===f.a.VOICE&&i.setSinkId?.(s.voiceSinkId),p.current=i,i.currentTime=0,i.volume=(0,h.A)(e.volume,n),i.play(),g(!0),i.addEventListener("pause",()=>g(!1),{once:!0})},[e,n,p,E]),isPreviewingSound:m}}}