Possible bug in reboot?

  • 1
  • Problem
  • Updated 4 years ago
  • Solved
I see strange TypeException errors when I try to play sounds after soundManager.reboot(). Debugging these errors, I noticed that _s.sounds has become an Array object rather than a simple Object. Sure enough, in soundmanager2.js, _s.sounds gets init'd to {} but during reboot, gets init'd to []. (I'm using the 12-20 release.)

This is probably what you meant to do, but when I change this line:

_s.soundIDs = _s.sounds = [];


_s.soundIDs = [];
_s.sounds = {};

my strange bugs go away.

Am I totally off track here?

Incidentally, the reason I'm playing with reboot is that I have found that for a certain percentage of Chrome users on windows (all flavors), sm2 init (with preferFlash=true) times out. It's not a flashblock problem (I'm trapping that separately). My plan is to set preferFlash=false and useHTML5Audio=true and reboot in the hopes that I can get audio working for these folks.

It may be relevant that to force this error condition (ie., initial timeout) I enable flashblock in chrome and temporarily bypass the flashblock handler.
Photo of Phil Mitchell

Phil Mitchell

  • 16 Posts
  • 0 Reply Likes

Posted 4 years ago

  • 1
Photo of Phil Mitchell

Phil Mitchell

  • 16 Posts
  • 0 Reply Likes
Hi Scott,

Would still love to get your thoughts on this. My code does seem to be working, but I'd feel much better if you approved the bugfix and incorporated it into official sm2.


Photo of Scott

Scott, Official Rep

  • 3854 Posts
  • 251 Reply Likes
Thanks for the reminder, missed this bug with my last round of responses.

Your code looks to be correct, and soundManager.soundIDs should be reset to {} and not an array on reboot.

This is now checked in on the current dev branch, and will be included in the next release.

if you're able to troubleshoot the Chrome + Flash issue, let me know. Occasionally I'd hear of JS/Flash issues with IE on Windows related to wmode=transparent, so wmode is typically reset to the default for those special cases.