Bug 1551879 Comment 11 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Didn't find anything suspicions, and since it's only reproducible sometimes, I think changing the code to eliminate the possibility of the race condition would be a good idea.

As a quick workaround the site could also try wrapping putting `initAudioPlayer()` inside another `soundManager.onready`
```
$(window).on('load', function () {
    soundManager.onready(function () {
        initAudioPlayer();
    });
```
I've tried it and it fixes the issue for me.

From the [docs](http://www.schillmania.com/projects/soundmanager2/demo/api/): SoundManager processes the onready and ontimeout queue in the order items were added. You can also add callbacks via soundManager.onready() and soundManager.ontimeout(), respectively. If you add listeners for these events after SM2 has loaded, your callback will be fired immediately.
Didn't find anything suspicions, and since it's only reproducible sometimes, I think changing the code to eliminate the possibility of the race condition would be a good idea.

As a quick workaround the site could also try putting `initAudioPlayer()` inside another `soundManager.onready`
```
$(window).on('load', function () {
    soundManager.onready(function () {
        initAudioPlayer();
    });
```
I've tried it and it fixes the issue for me.

From the [docs](http://www.schillmania.com/projects/soundmanager2/demo/api/): SoundManager processes the onready and ontimeout queue in the order items were added. You can also add callbacks via soundManager.onready() and soundManager.ontimeout(), respectively. If you add listeners for these events after SM2 has loaded, your callback will be fired immediately.

Back to Bug 1551879 Comment 11