question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error 403, 410, Cannot play a resource that has already ended; Can't find music/video or write EPIPE when play by link

See original GitHub issue

Describe the bug [PlayerError] Cannot play a resource that has already ended (and return error code 403 or 410) Return Can’t find music/video or write EPIPE when play by link

To Reproduce Command Bot play music Expected behavior Bot play music

Screenshots image image image image image

Please complete the following information:

  • Node Version: 16.11.0
  • Discord Player Version: 5.1.0
  • Discord.js Version: 13.2.0
  • FFmpeg-static Version: 4.4.0

Additional context Code:

main.js:

//{code}

client.player = new Player(client, {
    ytdlDownloadOptions: {
        filter: "audioonly"
    }
});

client.player.on("error", (queue, error) => {
    console.log(colors.red(`Lỗi trong hàng đợi: ${error.message}`));
    queue.metadata.send(`❌ | Lỗi trong hàng đợi: ` + "`" + `${error.message}` + "`" + `. Vui lòng thử lại sau`)
});
client.player.on("connectionError", (queue, error) => {
    console.log(colors.red(`Lỗi kết nối: ${error.message}`));
    queue.metadata.send(`❌ | Lỗi kết nối: ` + "`" + `${error.message}` + "`" + `. Vui lòng thử lại sau`)
});

client.player.on("trackStart", (queue, track) => {
    queue.metadata.send(`🎶 | Bắt đầu phát **${track.title}** trong **${queue.connection.channel.name}**!`);
});

client.player.on("trackAdd", (queue, track) => {
    queue.metadata.send(`🎶 | Bài **${track.title}** đã được thêm vào hàng đợi!`);
});

client.player.on("botDisconnect", (queue) => {
    queue.metadata.send("❌ | Xóa hàng đợi do bị ngắt kết nối khỏi kênh nói thủ công!");
});

client.player.on("channelEmpty", (queue) => {
    queue.metadata.send("❌ | Tự thoát do không có người nghe");
});

client.player.on("queueEnd", (queue) => {
    queue.metadata.send("**✅ | Đã phát xong!** *Nếu bài của bạn vẫn chưa được phát, vui lòng thử lại*");
});

//{some code}

play.js:

const Discord = require('discord.js')
const { Player, QueryType, QueueRepeatMode } = require("discord-player");

module.exports = {
    name: "play",
    description: "play songs",

    async run (client, message, args) {
        const player = client.player;
        if (!message.member.voice.channel) return message.channel.send("❌ | **Bạn phải ở trong một kênh nói!**");
        if (message.guild.me.voice.channel && message.member.voice.channel.id !== message.guild.me.voice.channel.id) return message.channel.send(":x: | **Bạn phải ở cùng kênh nói với Bot!**"); 

        const queue = await player.createQueue(message.guild, {
            metadata: message.channel
        });
        try {
            if (!queue.connection) await queue.connect(message.member.voice.channel);
        } catch {
            queue.destroy();
            return message.channel.send("❌ | Đã xảy ra lỗi khi tham gia kênh nói!");
        }
        const searchResult = await player.search(args.join(" "), {
            requestedBy: message.user,
            searchEngine: QueryType.AUTO
        })
        if (!searchResult || !searchResult.tracks.length) return message.channel.send("❌ | Không tìm thấy nhạc/video hoặc đã xảy ra lỗi khi tìm kiếm");
        message.channel.send(`⏱ | Đang tải ${searchResult.playlist ? "danh sách phát" : "bài nhạc"}...` );
        if (searchResult.playlist) {queue.addTracks(searchResult.tracks)} else {queue.addTrack(searchResult.tracks[0])};
        if (!queue.playing) await queue.play();
    }
}

Run Command : node --max-old-space-size=4096 main.js

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12

github_iconTop GitHub Comments

9reactions
PiousGamingcommented, Oct 10, 2021

That why u have EPIPE error, uninstall ffmpeg-static package cuz that package is not stable. Let download ffmpeg from https://www.ffmpeg.org/download.html and about error 410, it will reduce if you use cookies about error 403, i asked ytdl and they said “there is no way to fix yet, its probably caused on youtube’s side”

0reactions
tomihbkcommented, Apr 6, 2022

Any new developments on this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

AudioPlayerError: write EPIPE ytdl-core discordjs
I have been trying to make a music system ...
Read more >
Untitled
Top fly fishing guide schools, Gentiana sino ornata alba, Xrxsnmp.dll was not found, Edith marquez mirame descargar mp3, Taylor swift new album 2914, ......
Read more >
Untitled
Adalit l'3000 anleitung, St louis cardinals wreath, End has a start video, ... Qtranslate wp 3.6, Play joust online midway, Dawson jackson eagles, ......
Read more >
Video File Cannot Be Played? Fix Different Video Error Codes
The video file cannot be played when various video error codes occur, we need to first diagnose the problem and later resolve it....
Read more >
Untitled
Michael svarc the age, Jabber play, Ps blog au, Boer goat breeders in illinois, Eji in the dream letra, Alkany alkeny i alkiny...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found