Sound is not playing on Next.js. No bugs, but just sound doesn't play. Please help!
iamalaziz opened this issue · comments
Abdulaziz commented
import useSound from 'use-sound'
import switchOn from '../assets/switch-on.mp3'
const [playSwitchOn] = useSound(switchOn)
const switchTheme = () => {
setTheme(theme === 'dark' || resolvedTheme === 'dark' ? 'light' : 'dark')
playSwitchOn()
}
<button
aria-label="Toggle Dark Mode"
type="button"
className="flex h-8 w-8 items-center justify-center p-2"
onClick={switchTheme}
>