mirror of
https://github.com/YuzuZensai/NekoMelody.git
synced 2026-01-31 14:57:58 +00:00
✨ feat: Save previous audio information
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user