AudioPlayer not working, not sure what's wrong
this._audioPlayer = createAudioPlayer();
const connection = joinVoiceChannel({
channelId: voiceState.channelId,
guildId: voiceState.guild.id,
adapterCreator: voiceState.guild.voiceAdapterCreator
});
connection.subscribe(this._audioPlayer);
this._audioPlayer.play(url);
try {
await entersState(this._audioPlayer, AudioPlayerStatus.Playing, 5_000);
// The player has entered the Playing state within 5 seconds
console.log('Playback has started!');
} catch (error) {
// The player has not entered the Playing state and either:
// 1) The 'error' event has been emitted and should be handled
// 2) 5 seconds have passed
console.error(error);
}
this._audioPlayer.on('stateChange', (oldState, newState) => {
console.log(`Audio player transitioned from ${oldState.status} to ${newState.status}`);
}) this._audioPlayer = createAudioPlayer();
const connection = joinVoiceChannel({
channelId: voiceState.channelId,
guildId: voiceState.guild.id,
adapterCreator: voiceState.guild.voiceAdapterCreator
});
connection.subscribe(this._audioPlayer);
this._audioPlayer.play(url);
try {
await entersState(this._audioPlayer, AudioPlayerStatus.Playing, 5_000);
// The player has entered the Playing state within 5 seconds
console.log('Playback has started!');
} catch (error) {
// The player has not entered the Playing state and either:
// 1) The 'error' event has been emitted and should be handled
// 2) 5 seconds have passed
console.error(error);
}
this._audioPlayer.on('stateChange', (oldState, newState) => {
console.log(`Audio player transitioned from ${oldState.status} to ${newState.status}`);
})The bot autopauses for no reason. Here are the logs:
Audio player transitioned from idle to buffering
Audio player transitioned from buffering to playing
Playback has started!
Audio player transitioned from playing to autopausedAudio player transitioned from idle to buffering
Audio player transitioned from buffering to playing
Playback has started!
Audio player transitioned from playing to autopaused├── @discordjs/voice@0.16.0
├── @sapphire/framework@4.5.3
├── @sapphire/plugin-subcommands@4.2.1
├── @sapphire/utilities@3.13.0
├── axios@1.5.0
├── discord.js@14.13.0
├── ffmpeg@0.0.4
├── libsodium-wrappers@0.7.11
├── opusscript@0.0.8
├── prism-media@1.3.5
├── tsc@2.0.4
└── typescript@5.2.2
discord.js@14.13.0
v18.17.1├── @discordjs/voice@0.16.0
├── @sapphire/framework@4.5.3
├── @sapphire/plugin-subcommands@4.2.1
├── @sapphire/utilities@3.13.0
├── axios@1.5.0
├── discord.js@14.13.0
├── ffmpeg@0.0.4
├── libsodium-wrappers@0.7.11
├── opusscript@0.0.8
├── prism-media@1.3.5
├── tsc@2.0.4
└── typescript@5.2.2
discord.js@14.13.0
v18.17.1