From 319d09708ebe1937ef9f5adf20916b711d7239a4 Mon Sep 17 00:00:00 2001 From: Rudis Muiznieks Date: Sat, 29 Apr 2023 09:31:28 -0500 Subject: [PATCH] fixed race condition that could cause two episodes to play simultaneously --- site/radiostasis.js | 2 ++ src/Player.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/site/radiostasis.js b/site/radiostasis.js index 7f04322..fc567aa 100644 --- a/site/radiostasis.js +++ b/site/radiostasis.js @@ -120,6 +120,8 @@ var Player = /** @class */ (function () { return [4 /*yield*/, res.json()]; case 1: link = _a.sent(); + if (this.howl) + this.howl.unload(); this.howl = new Howl({ src: "".concat(link.url, "?Authorization=").concat(link.token), html5: true, diff --git a/src/Player.ts b/src/Player.ts index e7e8646..e4cc271 100644 --- a/src/Player.ts +++ b/src/Player.ts @@ -126,6 +126,7 @@ class Player { return; } const link = await res.json(); + if (this.howl) this.howl.unload(); this.howl = new Howl({ src: `${link.url}?Authorization=${link.token}`, html5: true,