Handle promise rejection for sound.play() in preload (#2162)

This commit is contained in:
Ashwin Ramaswami
2018-12-10 15:25:21 -08:00
committed by RoboErikG
parent c9411dfa33
commit 8422f931f1

View File

@@ -111,7 +111,7 @@ Blockly.WorkspaceAudio.prototype.preload = function() {
for (var name in this.SOUNDS_) {
var sound = this.SOUNDS_[name];
sound.volume = 0.01;
sound.play();
sound.play().catch(function() {});
sound.pause();
// iOS can only process one sound at a time. Trying to load more than one
// corrupts the earlier ones. Just load one and leave the others uncached.