From 738a9b710b5bda29abe08f93551e17990e0fc944 Mon Sep 17 00:00:00 2001 From: Yuzu Date: Sun, 18 Aug 2024 15:48:12 +0700 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20Save=20previous=20audio=20i?= =?UTF-8?q?nformation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/player/index.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/player/index.ts b/src/player/index.ts index 3ad1f42..2a541a5 100644 --- a/src/player/index.ts +++ b/src/player/index.ts @@ -16,6 +16,7 @@ export class Player { private paused: boolean = false; private currentAudioInformation: AudioInformation | null = null; private loopMode: LoopMode = LoopMode.None; + private previousAudioInformation: AudioInformation | null = null; public _stream: SeekableStream | null = null; private _skipFlag: boolean = false; @@ -67,6 +68,8 @@ export class Player { this._stream.destroy(); } + this.previousAudioInformation = this.currentAudioInformation; + if (this.loopMode === LoopMode.Current) { this._createStream( this.currentAudioInformation as AudioInformation, @@ -116,6 +119,10 @@ export class Player { return await this.currentProvider.getInformation(url); } + public getPreviousAudioInformation() { + return this.previousAudioInformation; + } + public async play(url: string, seekTime: number = 0) { const information = await this.getInformation(url);