#Seeking to different timestamps produces incorrect playbackDuration values

5 messages · Page 1 of 1 (latest)

wraith lintel
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

uncut ocean
#

I use this to seek through the resource

#

but whether it is causing the issue or not is beyond me

#
client.getResource = (queue, song, seekTime = 0) => {
        let Qargs = "";


        if (Qargs.startsWith(",")) Qargs = Qargs.substring(1)
        const requestOpts = {
            filter: "audioonly",
            fmt: "mp3",
            highWaterMark: 1 << 62,
            liveBuffer: 1 << 62,
            dlChunkSize: 0,
            seek: Math.floor(seekTime / 1000),
            bitrate: queue?.bitrate || 128,
            quality: "highestaudio",

        };
        if (client.Config.YOUTUBE_LOGIN_COOKIE && client.Config.YOUTUBE_LOGIN_COOKIE.length > 10) {
            requestOpts.requestOptions = {
                headers: {
                    cookie: client.Config.YOUTUBE_LOGIN_COOKIE,
                }
            }
        }
        const resource = createAudioResource(dcYtdl(client.getYTLink(`${song}`), requestOpts));
        const volume = queue && queue.volume && queue.volume <= 150 && queue.volume >= 1 ? (queue.volume / 100) : 0.15;  // queue.volume / 100;
        resource.playbackDuration = seekTime;
        return resource;
    }```