From ae8063a0af9b5827d6a72c36637240a30c66333b Mon Sep 17 00:00:00 2001 From: SondreB Date: Thu, 19 Jan 2023 00:57:05 +0100 Subject: [PATCH] Improve the exit action for media player --- src/app/services/media.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/app/services/media.ts b/src/app/services/media.ts index f2f9d1c..b3f52cf 100644 --- a/src/app/services/media.ts +++ b/src/app/services/media.ts @@ -62,17 +62,14 @@ export class MediaService { } exit() { - if (!this.audio) { - return; + if (this.audio) { + this.audio.pause(); + this.audio.currentTime = 0; + this.audio = undefined; } - this.audio.pause(); - this.audio.currentTime = 0; - this.index = -1; - this.audio = undefined; this.current = undefined; - this.options.options.showMediaPlayer = false; this.media = []; }