mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-04-19 21:03:56 +02:00
Fix queue and player bugs
This commit is contained in:
parent
95ea8e9ad3
commit
334a2bf0a0
2 changed files with 28 additions and 20 deletions
|
@ -43,7 +43,7 @@ export default class {
|
||||||
if (isPlaying) {
|
if (isPlaying) {
|
||||||
oldPosition = player.getPosition();
|
oldPosition = player.getPosition();
|
||||||
|
|
||||||
await player.forward();
|
player.manualForward();
|
||||||
}
|
}
|
||||||
|
|
||||||
await player.seek(8);
|
await player.seek(8);
|
||||||
|
@ -51,13 +51,15 @@ export default class {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
player.removeCurrent();
|
if (player.getCurrent()?.title === 'GO PACKERS!') {
|
||||||
|
player.removeCurrent();
|
||||||
|
|
||||||
if (isPlaying) {
|
if (isPlaying) {
|
||||||
await player.back();
|
await player.back();
|
||||||
await player.seek(oldPosition);
|
await player.seek(oldPosition);
|
||||||
} else {
|
} else {
|
||||||
player.disconnect();
|
player.disconnect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve(true);
|
resolve(true);
|
||||||
|
|
|
@ -120,7 +120,9 @@ export default class {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Was disconnected, need to recreate stream
|
// Was disconnected, need to recreate stream
|
||||||
return this.seek(this.getPosition());
|
if (!currentSong.isLive) {
|
||||||
|
return this.seek(this.getPosition());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -160,20 +162,24 @@ export default class {
|
||||||
}
|
}
|
||||||
|
|
||||||
async forward(): Promise<void> {
|
async forward(): Promise<void> {
|
||||||
if (this.queuePosition < this.queueSize() + 1) {
|
this.manualForward();
|
||||||
this.queuePosition++;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (this.getCurrent() && this.status !== STATUS.PAUSED) {
|
if (this.getCurrent() && this.status !== STATUS.PAUSED) {
|
||||||
await this.play();
|
await this.play();
|
||||||
} else {
|
} else {
|
||||||
this.status = STATUS.PAUSED;
|
this.status = STATUS.PAUSED;
|
||||||
this.disconnect();
|
this.disconnect();
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
this.queuePosition--;
|
|
||||||
throw error;
|
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
this.queuePosition--;
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
manualForward(): void {
|
||||||
|
if (this.queuePosition < this.queue.length) {
|
||||||
|
this.queuePosition++;
|
||||||
} else {
|
} else {
|
||||||
throw new Error('No songs in queue to forward to.');
|
throw new Error('No songs in queue to forward to.');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue