Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/howler.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,9 @@

// Calling resume() on a stack initiated by user gesture is what actually unlocks the audio on Android Chrome >= 55.
if (typeof self.ctx.resume === 'function') {
self.ctx.resume();
self.ctx.resume().catch(function(err) {
console.warn('AudioContext resume failed during unlock:', err.name + ':', err.message);
});
}

// Setup a timeout to check that we are unlocked on the next event loop.
Expand Down Expand Up @@ -529,6 +531,14 @@
for (var i=0; i<self._howls.length; i++) {
self._howls[i]._emit('resume');
}
}).catch(function(err) {
console.warn('AudioContext resume failed:', err.name + ':', err.message);
self.state = 'suspended';

// Emit resume error event to all Howls so they can handle it appropriately.
for (var i=0; i<self._howls.length; i++) {
self._howls[i]._emit('resumeerror', null, err);
}
});

if (self._suspendTimer) {
Expand Down