This repository was archived by the owner on Dec 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 363
Streaming to Discord voice channel? #339
Copy link
Copy link
Open
Description
Hey,
I've been using ytdl-core library to stream youtube videos (audio) to a voice channel, but it stopped working, giving me 429 error, which made me move to youtube-dl which works (not sure how, in case my ip was blacklisted by youtube)
This is the code I currently have:
var video = yt(url,["--format=bestaudio,worstaudio"]);
video.on('info', async function(info) {
var dispatcher = data.voiceConnection
.play(video)
.on("finish", () => {
nextsong();
})
.on("error", error => {
console.error("Error while playing audio",error);
nextsong();
});
});
The music plays for 20-30 secs, then throwing me the following error:
Error: ESOCKETTIMEDOUT
at ClientRequest.<anonymous> (/root/app/node_modules/request/request.js:816:19)
at Object.onceWrapper (events.js:421:28)
at ClientRequest.emit (events.js:315:20)
at TLSSocket.emitRequestTimeout (_http_client.js:784:9)
at Object.onceWrapper (events.js:421:28)
at TLSSocket.emit (events.js:327:22)
at TLSSocket.Socket._onTimeout (net.js:483:8)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7) {
code: 'ESOCKETTIMEDOUT',
connect: false
}
From what I found, this is due to me not consuming the incoming stream. How could I pass the stream to the voice channel and consume it so the socket does not timeout?
Thanks for any help.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels