From 8422f931f13e865c4b8adcc24de18088fea02e12 Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Mon, 10 Dec 2018 15:25:21 -0800 Subject: [PATCH] Handle promise rejection for sound.play() in preload (#2162) --- core/workspace_audio.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/workspace_audio.js b/core/workspace_audio.js index fff9b3482..8b7089f91 100644 --- a/core/workspace_audio.js +++ b/core/workspace_audio.js @@ -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.