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

Game resets when looping background music #310

Open
GotAnySnacks opened this issue Jan 12, 2015 · 0 comments
Open

Game resets when looping background music #310

GotAnySnacks opened this issue Jan 12, 2015 · 0 comments

Comments

@GotAnySnacks
Copy link

I'm currently loading background music into games using the following commands:

this.bgm = game.assets["mp3 file"];
this.bgm.play();

I've seen a few places online recommend the following as a workaround for enchant.js not having a built in looping function for sounds:
if (this.bgm.currentTime >= this.bgm.duration)
this.bgm.play();

This would be placed in the enterframe event of the scene where this.bgm was declared. However, once it calls, the entire game is reset along with the music. I've tried it on a few different programs & all desktop browsers as a test, although it could still be an error on my end. Is this something that's been reported before? Or am I just using a very out of date method?

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

1 participant