962_j
962_j
DIAdiscord.js - Imagine an app
Created by 962_j on 2/3/2024 in #djs-voice
Auto pause
For some reason the bot is auto pausing the audio immediately once it starts, here's my code:
const connection = joinVoiceChannel({
channelId: channel.id,
guildId: guild.id,
adapterCreator: guild.voiceAdapterCreator,
});

const audioPlayer = createAudioPlayer({
behaviors: {
noSubscriber: NoSubscriberBehavior.Pause,
},
volume: 0.5,
});
connection.subscribe(audioPlayer);

const resource = createAudioResource("./DrinkingwithCupid.mp3", {
inputType: "ffmpeg",
inlineVolume: true,
});

audioPlayer.play(resource);
audioPlayer.on("stateChange", (oldState, newState) => {
console.log(`Player Status: ${oldState.status} -> ${newState.status}`);
if (newState.status === "Playing") {
console.log("Audio Player is now playing.");
}
});
const connection = joinVoiceChannel({
channelId: channel.id,
guildId: guild.id,
adapterCreator: guild.voiceAdapterCreator,
});

const audioPlayer = createAudioPlayer({
behaviors: {
noSubscriber: NoSubscriberBehavior.Pause,
},
volume: 0.5,
});
connection.subscribe(audioPlayer);

const resource = createAudioResource("./DrinkingwithCupid.mp3", {
inputType: "ffmpeg",
inlineVolume: true,
});

audioPlayer.play(resource);
audioPlayer.on("stateChange", (oldState, newState) => {
console.log(`Player Status: ${oldState.status} -> ${newState.status}`);
if (newState.status === "Playing") {
console.log("Audio Player is now playing.");
}
});
2 replies