diff options
| author | Max Isom <[email protected]> | 2022-01-29 22:01:03 -0500 |
|---|---|---|
| committer | Max Isom <[email protected]> | 2022-01-29 22:01:03 -0500 |
| commit | c519a436200253636b37fa30768cfb2c3fdf0ed1 (patch) | |
| tree | 00a9a831ef117e3e06266c47a35d1c3b05ed5b65 /src/services/player.ts | |
| parent | af05210be4a8857ea707866192efa79b3945b314 (diff) | |
| download | muse-c519a436200253636b37fa30768cfb2c3fdf0ed1.tar.xz muse-c519a436200253636b37fa30768cfb2c3fdf0ed1.zip | |
Fix livestreams
Diffstat (limited to 'src/services/player.ts')
| -rw-r--r-- | src/services/player.ts | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/services/player.ts b/src/services/player.ts index fc4b989..f46240a 100644 --- a/src/services/player.ts +++ b/src/services/player.ts @@ -52,14 +52,11 @@ export default class { } async connect(channel: VoiceChannel): Promise<void> { - const conn = joinVoiceChannel({ + this.voiceConnection = joinVoiceChannel({ channelId: channel.id, guildId: channel.guild.id, - // @ts-expect-error (see https://github.com/discordjs/voice/issues/166) adapterCreator: channel.guild.voiceAdapterCreator, }); - - this.voiceConnection = conn; } disconnect(): void { @@ -94,7 +91,12 @@ export default class { } const stream = await this.getStream(currentSong.url, {seek: positionSeconds}); - this.audioPlayer = createAudioPlayer(); + this.audioPlayer = createAudioPlayer({ + behaviors: { + // Needs to be somewhat high for livestreams + maxMissedFrames: 50, + }, + }); this.voiceConnection.subscribe(this.audioPlayer); this.audioPlayer.play(createAudioResource(stream, { inputType: StreamType.WebmOpus, @@ -141,7 +143,12 @@ export default class { try { const stream = await this.getStream(currentSong.url); - this.audioPlayer = createAudioPlayer(); + this.audioPlayer = createAudioPlayer({ + behaviors: { + // Needs to be somewhat high for livestreams + maxMissedFrames: 50, + }, + }); this.voiceConnection.subscribe(this.audioPlayer); this.audioPlayer.play(createAudioResource(stream, { inputType: StreamType.WebmOpus, |
