Discord Music bot-我播放的歌曲在播放结束前10到20秒停止,因此我添加了highWaterMark,现在这首歌曲几乎无法播放 [英] Discord Music bot - the song i play stopped 10-20 seconds before the end so i added highWaterMark and now the song barely plays at all

查看:65
本文介绍了Discord Music bot-我播放的歌曲在播放结束前10到20秒停止,因此我添加了highWaterMark,现在这首歌曲几乎无法播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以基本上我有这个问题,我得到一个解决方案,但是它没有用,所以我找到了一个解决办法,那就是在代码中添加highWaterMark,这样流就可以保持打开状态更长或更长时间了,所以这就是我的代码当前看起来像

So basically i had this issue and i got given a "solution" but it didn't work, so i found a fix and that was adding highWaterMark to my code so the stream stays open longer or whatever idk, so this is what my code looks like currently

    const dispatcher = serverQueue.connection.play(ytdl(song.url, {
        filter:"audioonly",
        highWaterMark: 1<<25 })
        .on("finish", () => {
            const shiffed = serverQueue.songs.shift();
            if (serverQueue.loop === true) {
                serverQueue.songs.push(shiffed);
            };
            play(guild, serverQueue.songs[0]);
        })
        .on("error", error => console.error(error)));
    dispatcher.setVolume(serverQueue.volume / 100);

但是现在我的问题是这首歌会播放10秒钟,然后停下来,我没有知道为什么这会使我的问题变得更糟,因为对于我看到的每个使用此解决方案的人,它都非常有效。请有人帮我解决我的问题,我得到了很多评论,但似乎没人愿意回答:/

but now my issue is that the song will play for like 10 seconds then just stop, i have no idea why this just made my issue worse because for everyone i seen that used this solution it worked perfectly. Please someone help me out with my issue i get tons of post views but no one seems to want to answer :/

推荐答案

您可能想尝试将流的类型更改为opus:

You might want to try to change the type of the stream to opus :

serverQueue.connection.play(ytdl(song.url, { filter:"audioonly", type: 'opus' });

这篇关于Discord Music bot-我播放的歌曲在播放结束前10到20秒停止,因此我添加了highWaterMark,现在这首歌曲几乎无法播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆