pupunzi/jquery.mb.audio

Repeats beginning of audio file in iOS

Opened this issue · 5 comments

I'm using this as a kind of piano playing mobile site with each note assigned in the sprite, but in iOS it will randomly play the very first one instead of it's intended note. When the note is repeatedly pressed it will eventually play the correct one, but this happens on every note and seems to happen randomly.

Has anyone else had this problem?

I've found a workaround that uses individual files for each note instead of sections of a larger file. This isn't ideal though because each note has to load on click now. Is there a way to silently preload/preplay the sounds without user interaction?

Update: I reverted back to using one audio file that has all the notes in it - except I used "mbAudio.pause()" instead of "mbAudio.stop()" and that solved the repeating problem. I guess stop makes the "playhead" move back to zero and that was causing the repeat.

bump! I'm trying to do something pretty similar and co-incidentally experiencing the exact same problem...how did you "pause()" it?

I used the sprite method and "mbAudio.pause()" on onMouseUp / touchEnd events. Example:

 <div id="soundButton" ontouchstart="$.mbAudio.play('soundSprite', 'sound1');" ontouchend="$.mbAudio.pause('soundSprite', 'sound1');"></div>

Wow...well that sucks for me!

Hmm. Not working for you? I did that a year ago, a lot's changed about iOS since then. iOS/Safari was(is?) notoriously weird about playing sounds in-browser, latency issues, etc.

Nope. I'm however trying to pause it in the play function