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

Clean up of non-existing instances #18

Closed
rwolffgang opened this issue Sep 11, 2012 · 2 comments
Closed

Clean up of non-existing instances #18

rwolffgang opened this issue Sep 11, 2012 · 2 comments

Comments

@rwolffgang
Copy link

I called SoundJS.play with wrong parameters, such as an unknown id, so that the SoundInstance was not fully created. Still the function HTMLAudioPlugin.cleanUp was called which in turn called SoundJS.playFinished. Since instance was never pushed to the array, indexOfis -1 and splice removes the first array element.
Below is my fix, unfortunately I'm not yet familiar enough with GitHub to create a Pull Request.

Looking for your feedback and thanks for this great library!

s.playFinished = function(instance) {
    SoundChannel.remove(instance);

    var index = this.instances.indexOf(instance);
    if (index != -1)
        this.instances.splice(index, 1);
    // Note: Keep in instance hash.
}
@lannymcnie
Copy link
Member

I believe this fix is already pushed to Git in the NEXT build.

@rwolffgang
Copy link
Author

You're right, I should've looked before trying to fix it. Will do next time.

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

2 participants