Audio Dying after some Minutes of Playback

My Audio dies after some minutes of playback of a mp3 stream
24 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Tay
Tay2y ago
"discord.js": "^13.6.0",
Jiron
Jiron2y ago
Any partial code or error you can provide?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Tay
Tay2y ago
It does not give an error @jiron
const {
SlashCommandBuilder
} = require('@discordjs/builders');
const {
MessageEmbed,
InteractionCollector,
MessageActionRow,
MessageButton
} = require('discord.js');
const fetch = require('node-fetch')
const voice = require("@discordjs/voice");
const { EmbedBuilder, Embed } = require("discord.js");
const { joinVoiceChannel, createAudioPlayer, createAudioResource, createReadStream } = require('@discordjs/voice')

module.exports = {
data: new SlashCommandBuilder()
.setName('play')
.setDescription('Joins your current voice channel!'),
async execute(interaction, client) {
try{
await interaction.deferReply({ ephemeral: true })
if (!interaction.member.voice.channelId) {
return interaction.editReply("You're not in a voice channel!", { ephemeral: true })
}
let channelId = interaction.member.voice.channelId
async function runStream() {
if (!interaction.member.voice) {
return interaction.editReply("You're not in a voice channel!", { ephemeral: true })
} else {
const connection = voice.joinVoiceChannel({
channelId: interaction.member.voice.channelId,
guildId: interaction.guildId,
adapterCreator: interaction.guild.voiceAdapterCreator
})
const player = voice.createAudioPlayer()

const resource = voice.createAudioResource("https://stream.itshorizon.net", { inlineVolume: true })
resource.volume.setVolume(0.5)
player.play(resource)
connection.subscribe(player)

player.on(voice.AudioPlayerStatus.Playing, () => {
interaction.editReply({ embeds: [new MessageEmbed().setDescription('Now playing Horizon Radio!').setColor("#6831de")], ephemeral: true })
})

}
}
runStream()
} catch (err) {
console.log("I made an oops.")
}
}
};
const {
SlashCommandBuilder
} = require('@discordjs/builders');
const {
MessageEmbed,
InteractionCollector,
MessageActionRow,
MessageButton
} = require('discord.js');
const fetch = require('node-fetch')
const voice = require("@discordjs/voice");
const { EmbedBuilder, Embed } = require("discord.js");
const { joinVoiceChannel, createAudioPlayer, createAudioResource, createReadStream } = require('@discordjs/voice')

module.exports = {
data: new SlashCommandBuilder()
.setName('play')
.setDescription('Joins your current voice channel!'),
async execute(interaction, client) {
try{
await interaction.deferReply({ ephemeral: true })
if (!interaction.member.voice.channelId) {
return interaction.editReply("You're not in a voice channel!", { ephemeral: true })
}
let channelId = interaction.member.voice.channelId
async function runStream() {
if (!interaction.member.voice) {
return interaction.editReply("You're not in a voice channel!", { ephemeral: true })
} else {
const connection = voice.joinVoiceChannel({
channelId: interaction.member.voice.channelId,
guildId: interaction.guildId,
adapterCreator: interaction.guild.voiceAdapterCreator
})
const player = voice.createAudioPlayer()

const resource = voice.createAudioResource("https://stream.itshorizon.net", { inlineVolume: true })
resource.volume.setVolume(0.5)
player.play(resource)
connection.subscribe(player)

player.on(voice.AudioPlayerStatus.Playing, () => {
interaction.editReply({ embeds: [new MessageEmbed().setDescription('Now playing Horizon Radio!').setColor("#6831de")], ephemeral: true })
})

}
}
runStream()
} catch (err) {
console.log("I made an oops.")
}
}
};
This is the Code tho
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Tay
Tay2y ago
Maybe this solution works for me too, trying that atm
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Tay
Tay2y ago
It seems like your Solution helped Thank you very much What causes the Issue tho? is that something new with Discord's API?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Tay
Tay2y ago
Ooooo That explains it
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Tay
Tay2y ago
Ahh Yea, aslong as it works now we good
Want results from more Discord servers?
Add your server