sound icon indicating copy to clipboard operation
sound copied to clipboard

Nuxt not working with sound

Open ThimoDEV opened this issue 2 years ago • 2 comments

Hi @Tahul ,

You asked for my experience with nuxt and this package. I tried to get it to work after the latest update, but it seems like it doesn't work. I have a sound in my public folder like this : public/sounds/back.wav

image

`

const { play, sound } = useSound('/sounds/back.wav')

`

This is my test component

modules: ['@vueuse/sound/nuxt'] sound: { sounds: { scan: true, }, },

Did I have something wrong or do I need to change something to get it to work?

Thanks in advance!

ThimoDEV avatar Feb 09 '23 00:02 ThimoDEV

Any news on this issue ? Still don't work @Tahul

louia avatar Jun 19 '23 10:06 louia

@louia @ThimoDEV Have you tried setting the config options like this?

defineNuxtConfig({
[...]
},
    sound: {
        scan: './src/public/sounds/',
    },
});

Maybe the readme is wrongly showing the scan: true option being in sound.sounds but needing to be directly in the sound module config at the "top level". In my case I had to use a string for the path as the module didn't pickup my sounds in a different src dir, but I haven't investigated further than that as it at least generates the types definitions with the config posted.

galexrt avatar Aug 31 '23 13:08 galexrt