mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-06-27 09:12:43 +02:00
Stop audioplayer properly (#1032)
This commit is contained in:
parent
cc0cf8379c
commit
29b61cc0b6
2 changed files with 15 additions and 3 deletions
|
@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
- Audioplayer not stopping properly
|
||||
|
||||
## [2.8.1] - 2024-04-28
|
||||
|
||||
### Fixed
|
||||
|
|
|
@ -126,7 +126,7 @@ export default class {
|
|||
|
||||
this.loopCurrentSong = false;
|
||||
this.voiceConnection.destroy();
|
||||
this.audioPlayer?.stop();
|
||||
this.audioPlayer?.stop(true);
|
||||
|
||||
this.voiceConnection = null;
|
||||
this.audioPlayer = null;
|
||||
|
@ -280,7 +280,7 @@ export default class {
|
|||
if (this.getCurrent() && this.status !== STATUS.PAUSED) {
|
||||
await this.play();
|
||||
} else {
|
||||
this.audioPlayer?.stop();
|
||||
this.audioPlayer?.stop(true);
|
||||
this.status = STATUS.IDLE;
|
||||
|
||||
const settings = await getGuildSettings(this.guildId);
|
||||
|
@ -429,6 +429,12 @@ export default class {
|
|||
}
|
||||
|
||||
private async getStream(song: QueuedSong, options: {seek?: number; to?: number} = {}): Promise<Readable> {
|
||||
if (this.status === STATUS.PLAYING) {
|
||||
this.audioPlayer?.stop();
|
||||
} else if (this.status === STATUS.PAUSED) {
|
||||
this.audioPlayer?.stop(true);
|
||||
}
|
||||
|
||||
if (song.source === MediaSource.HLS) {
|
||||
return this.createReadStream({url: song.url, cacheKey: song.url});
|
||||
}
|
||||
|
@ -619,7 +625,10 @@ export default class {
|
|||
stream.pipe(capacitor);
|
||||
|
||||
returnedStream.on('close', () => {
|
||||
stream.kill('SIGKILL');
|
||||
if (!options.cache) {
|
||||
stream.kill('SIGKILL');
|
||||
}
|
||||
|
||||
hasReturnedStreamClosed = true;
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue