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

Can svelte-sound be used manually? #25

Closed
iguesspaul opened this issue Aug 3, 2023 · 4 comments
Closed

Can svelte-sound be used manually? #25

iguesspaul opened this issue Aug 3, 2023 · 4 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@iguesspaul
Copy link

Title.

I would like to use it for both some button interactions but also for some game events (clearing a level for example)

Is this possible

@Rajaniraiyn
Copy link
Owner

Currently it is not possible in svelte-sound but you can directly use Howler.js for this.

It is bit harder to implement as most of the browsers don't allow audio without user interaction (but there are workarounds for games kinda apps)

@Rajaniraiyn
Copy link
Owner

@iguesspaul Can you suggest an example API that you would like to use for svelte-sound manually. Like below

import { SyntheticSound } from "svelte-sound"
import success_sound from "./success.mp4"

const options = {
// options for svelte-sound
}

const levelClearedEffect = new SyntheticSound(success_sound, options);

levelClearedEffect.play()

will this kind of API will be easier to use or you would like something else?

@Rajaniraiyn Rajaniraiyn pinned this issue Aug 6, 2023
@Rajaniraiyn Rajaniraiyn changed the title Can svelte-sound be used without a button? Can svelte-sound be used manually? Aug 6, 2023
@Rajaniraiyn Rajaniraiyn self-assigned this Aug 6, 2023
@Rajaniraiyn Rajaniraiyn added the good first issue Good for newcomers label Aug 6, 2023
@iguesspaul
Copy link
Author

The example api you had shown would be suited perfectly for me. However, the only extra thing I would perhaps like to see is the ability to reuse sounds (play them more than once, which in howler involves a whole reloading process). For the rest, this has been great library to use

@Rajaniraiyn
Copy link
Owner

@iguesspaul You're most welcome for the feedback. I'd like to inform you that the most recent release of svelte-sound (v0.6.0) now includes a feature that allows manual sound playback without the need for DOM elements. For further insights, please refer to the details provided in the README.md.

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

No branches or pull requests

2 participants