- added framework for playing uploaded music files. need to permanently store and retreive files
This commit is contained in:
@@ -43,12 +43,20 @@ export default function SightingHistoryWidget({ className, title }: SightingHist
|
||||
const { state } = useSoundContext();
|
||||
|
||||
const soundSrcNped = useMemo(() => {
|
||||
if (state?.NPEDsound?.includes(".mp3") || state.NPEDsound?.includes(".wav")) {
|
||||
const file = state.soundOptions?.find((item) => item.name === state.NPEDsound);
|
||||
return file?.soundUrl ?? popup;
|
||||
}
|
||||
return getSoundFileURL(state.NPEDsound) ?? popup;
|
||||
}, [state.NPEDsound]);
|
||||
}, [state.NPEDsound, state.soundOptions]);
|
||||
|
||||
const soundSrcHotlist = useMemo(() => {
|
||||
if (state?.hotlistSound?.includes(".mp3") || state.hotlistSound?.includes(".wav")) {
|
||||
const file = state.soundOptions?.find((item) => item.name === state.hotlistSound);
|
||||
return file?.soundUrl ?? notification;
|
||||
}
|
||||
return getSoundFileURL(state?.hotlistSound) ?? notification;
|
||||
}, [state?.hotlistSound]);
|
||||
}, [state.hotlistSound, state.soundOptions]);
|
||||
|
||||
const { play: npedSound } = useSound(soundSrcNped, { volume: state.NPEDsoundVolume });
|
||||
const { play: hotlistsound } = useSound(soundSrcHotlist, { volume: state.hotlistSoundVolume });
|
||||
|
||||
Reference in New Issue
Block a user