aboutsummaryrefslogtreecommitdiff
path: root/src/services
diff options
context:
space:
mode:
authorMax Isom <[email protected]>2020-03-18 18:29:32 -0500
committerMax Isom <[email protected]>2020-03-18 18:29:32 -0500
commit8340f9b95a377580871d6e73bf87eb29ed69e6c7 (patch)
tree40242bb31007ae75be6e3e3dae9e06469e96689c /src/services
parent6a02088b04392fad5bbdd43f222265c64317bfc1 (diff)
downloadmuse-8340f9b95a377580871d6e73bf87eb29ed69e6c7.tar.xz
muse-8340f9b95a377580871d6e73bf87eb29ed69e6c7.zip
Add disconnect command
Diffstat (limited to 'src/services')
-rw-r--r--src/services/player.ts14
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);