Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not work with vite 2 #15

Open
hunteryun opened this issue Oct 24, 2021 · 7 comments
Open

Not work with vite 2 #15

hunteryun opened this issue Oct 24, 2021 · 7 comments

Comments

@hunteryun
Copy link

erro:

onMounted is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().

@Sebastix
Copy link

@hunteryun I encounter the same error using this package in a NuxtJS setup.

@hunteryun
Copy link
Author

hunteryun commented Nov 18, 2021

@Sebastix Wow, cool, A same Drupaler ! This is a special fate to meet here.

I have solved this problem, This library is just a simple package, so you can actually try to use howler.js directly, see https://github.com/goldfire/howler.js#quick-start

@Sebastix
Copy link

@hunteryun Fellow Drupaler ahoy! :-)

Your solution is also the solution I've worked out this morning, I'm using the Howler package now. This library is indeed a small wrapper. Thanks!

@invisispider
Copy link

invisispider commented Apr 12, 2022

I'm at the same issue trying to integrate into a vue app, but I'm not as astute as you guys. If you don't mind, I get that you are cloning howler into your project, but I don't get how you then integrate that into this particular project.

Update: Okay, I think I get it. They are saying, if you have this setup and encounter this problem, just use howler directly. It is just a JS file or two, and so I'm just using it in my assets/js like any little plugin library.

@invisispider
Copy link

invisispider commented Apr 13, 2022

<audio ref="playIt" src="@/sounds/sound.mp3" />

javascript (I'm using Vue):
const it = useJsToSelectElement("playIt")
const onSomeCondition = () => {
it.play()
}

So, just for adding sound effects to a simple app where users are interacting with the DOM, I seem to be getting the best results using vanilla functionality, and am unable to use howler or @vueuse/sound

@hunteryun
Copy link
Author

hunteryun commented Apr 13, 2022

I think the quick start docment is enough. Here is my code for your reference


import { Howl, Howler } from 'howler'
import sfx from './assets/test.mp3'

var sound = new Howl({
  src: [sfx],
  sprite: {
    aaa: [0, 1000],
    bbb: [1000, 1000],
  }
});

const play = () => {
  sound.play(‘aaa’);
}

I means only use howler, don't use @vueuse/sound, it not work

@Tahul
Copy link
Member

Tahul commented Nov 25, 2022

Hey here :)

Sorry for the late answer!

Could you let me know if v2 has fixed the issue for you?

Thanks a lot 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants