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

Safari bails out on the script when calling .stop() on a sound that isn't playing #49

Closed
BenUniqcode opened this issue Aug 4, 2015 · 2 comments
Assignees

Comments

@BenUniqcode
Copy link

Hi, and thanks for your great plugin, which I'm using in my typewriter simulator, OverType: http://uniqcode.com/typewriter

I was having an issue with my application that uses it in Safari (8.0.7/Mac), that didn't happen in Firefox or Chrome. The root cause was that I was calling $.ionSound.stop('soundname') with the name of a sound that wasn't playing (had played before but already had .stop() called on it). But Firefox and Chrome don't complain about this, whereas in Safari it is treated as a fatal error and causes the script to stop altogether:

[Error] InvalidStateError: DOM Exception 11: An attempt was made to use an object that is not, or is no longer, usable.
    stop (ion.sound.min.js, line 14)
    stop (ion.sound.min.js, line 14)
    stop (ion.sound.min.js, line 11)
    _method (ion.sound.min.js, line 4)
    stop (ion.sound.min.js, line 5)
    (anonymous function) (typewriter, line 259)
    complete (jquery.min.js, line 3)
    j (jquery.min.js, line 2)
    add (jquery.min.js, line 2)
    Xb (jquery.min.js, line 3)
    g (jquery.min.js, line 3)
    dequeue (jquery.min.js, line 3)
    complete (jquery.min.js, line 3)
    j (jquery.min.js, line 2)
    fireWith (jquery.min.js, line 2)
    i (jquery.min.js, line 3)
    tick (jquery.min.js, line 3)

Although the fault was sloppiness on my part, it would be great if ion.sound could, for the sake of Safari, handle and ignore (maybe with a console warning) any attempt to stop an already-stopped sound :)

Cheers
Ben

@IonDen IonDen self-assigned this Aug 4, 2015
@IonDen
Copy link
Owner

IonDen commented Aug 4, 2015

Hi, thanks for finding this bug. Should be fixed in 3.0.6. Please check.

@IonDen IonDen closed this as completed Aug 4, 2015
@BenUniqcode
Copy link
Author

That was quick :) Yes, that fixes it - thanks!

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

No branches or pull requests

2 participants