diff options
| author | Max Isom <[email protected]> | 2020-03-18 18:29:32 -0500 |
|---|---|---|
| committer | Max Isom <[email protected]> | 2020-03-18 18:29:32 -0500 |
| commit | 8340f9b95a377580871d6e73bf87eb29ed69e6c7 (patch) | |
| tree | 40242bb31007ae75be6e3e3dae9e06469e96689c /src/services | |
| parent | 6a02088b04392fad5bbdd43f222265c64317bfc1 (diff) | |
| download | muse-8340f9b95a377580871d6e73bf87eb29ed69e6c7.tar.xz muse-8340f9b95a377580871d6e73bf87eb29ed69e6c7.zip | |
Add disconnect command
Diffstat (limited to 'src/services')
| -rw-r--r-- | src/services/player.ts | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/services/player.ts b/src/services/player.ts index 38a92aa..e4d54a6 100644 --- a/src/services/player.ts +++ b/src/services/player.ts @@ -45,7 +45,6 @@ export default class { this.voiceConnection.disconnect(); } - this.positionInSeconds = 0; this.voiceConnection = null; this.dispatcher = null; } @@ -97,10 +96,15 @@ export default class { } // Resume from paused state - if (this.status === STATUS.PAUSED && this.getPosition() !== 0 && this.dispatcher && currentSong.url === this.nowPlaying?.url) { - this.dispatcher.resume(); - this.status = STATUS.PLAYING; - return; + if (this.status === STATUS.PAUSED && this.getPosition() !== 0 && currentSong.url === this.nowPlaying?.url) { + if (this.dispatcher) { + this.dispatcher.resume(); + this.status = STATUS.PLAYING; + return; + } + + // Was disconnected, need to recreate stream + return this.seek(this.getPosition()); } const stream = await this.getStream(currentSong.url); |
