Skip to content

Commit c44bd39

Browse files
committed
Add autoplay to start of load queue
Fixes goldfire#659
1 parent 7989731 commit c44bd39

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/howler.core.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,16 @@
496496
// Keep track of this Howl group in the global controller.
497497
Howler._howls.push(self);
498498

499+
// If they selected autoplay, add a play event to the load queue.
500+
if (self._autoplay) {
501+
self._queue.push({
502+
event: 'play',
503+
action: function() {
504+
self.play();
505+
}
506+
});
507+
}
508+
499509
// Load the source file unless otherwise specified.
500510
if (self._preload) {
501511
self.load();
@@ -1989,10 +1999,6 @@
19891999
parent._loadQueue();
19902000
}
19912001

1992-
if (parent._autoplay) {
1993-
parent.play();
1994-
}
1995-
19962002
// Clear the event listener.
19972003
self._node.removeEventListener(Howler._canPlayEvent, self._loadFn, false);
19982004
}
@@ -2110,11 +2116,6 @@
21102116
self._emit('load');
21112117
self._loadQueue();
21122118
}
2113-
2114-
// Begin playback if specified.
2115-
if (self._autoplay) {
2116-
self.play();
2117-
}
21182119
};
21192120

21202121
/**

0 commit comments

Comments
 (0)