From 382d5afc7e2ac24f67b7c891328b8b9bb7e91058 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 13 Jul 2021 23:14:20 -0300 Subject: timestamp files!!! --- backend.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'backend.js') diff --git a/backend.js b/backend.js index ad13127..048aec5 100644 --- a/backend.js +++ b/backend.js @@ -368,7 +368,7 @@ class QueuePlayer extends EventEmitter { } - async play(item) { + async play(item, startTime) { if (this.player === null) { throw new Error('Attempted to play before a player was loaded') } @@ -425,7 +425,7 @@ class QueuePlayer extends EventEmitter { } else { this.player.setPause(false) } - await this.player.playFile(downloadFile) + await this.player.playFile(downloadFile, startTime) } // playingThisTrack now means whether the track played through to the end @@ -510,6 +510,15 @@ class QueuePlayer extends EventEmitter { return false } + async playOrSeek(item, time) { + if (item === this.playingTrack) { + this.seekTo(time) + } else { + this.queue(item, this.playingTrack) + this.play(item, time) + } + } + clearPlayingTrack() { if (this.playingTrack !== null) { const oldTrack = this.playingTrack @@ -531,6 +540,10 @@ class QueuePlayer extends EventEmitter { this.player.seekBack(seconds) } + seekTo(seconds) { + this.player.seekTo(seconds) + } + togglePause() { this.player.togglePause() } -- cgit 1.3.0-6-gf8a5