From 822927668381eab50e6c325d6e75703ebc30b42b Mon Sep 17 00:00:00 2001 From: Thomas Amland Date: Sun, 25 Apr 2021 11:26:06 +0200 Subject: [PATCH] ignore AbortError from audio.play() --- src/player/audio.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/player/audio.ts b/src/player/audio.ts index eeed78d..40404f7 100644 --- a/src/player/audio.ts +++ b/src/player/audio.ts @@ -69,7 +69,15 @@ export class AudioController { this.audio.volume = 0.0 if (options.paused !== true) { - await this.audio.play() + try { + await this.audio.play() + } catch (error) { + if (error.name === 'AbortError') { + console.warn(error) + return + } + throw error + } this.fadeIn() } }