Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Changing the playbackDuration of a resource, doesn't seek it #168

Closed
stijnb1234 opened this issue Aug 8, 2021 · 3 comments
Closed

Changing the playbackDuration of a resource, doesn't seek it #168

stijnb1234 opened this issue Aug 8, 2021 · 3 comments

Comments

@stijnb1234
Copy link

stijnb1234 commented Aug 8, 2021

Please describe the problem you are having in as much detail as possible:
When I use resource.playbackDuration = seek;, it doesn't seek the resource when I play it. It will just start playing at the beginning.

Include a reproducible code sample here, if possible:

const connection = joinVoiceChannel({
    channelId: channel.id,
    guildId: channel.guild.id,
    adapterCreator: channel.guild.voiceAdapterCreator,
});

const player = createAudioPlayer();

const seek = 5000; //Seek 5 sec

const resource = createAudioResource("./music.mp3", { inlineVolume: true });
resource.volume.setVolume(0.4);
resource.playbackDuration = seek;

player.play(resource);

connection.subscribe(player);

Further details:

  • @discordjs/voice version: 0.5.6
  • Node.js version: 16.6.1
  • Operating system: Windows 11
  • Priority this issue should have – please be realistic and elaborate if possible: Moderate

Relevant client options:

  • partials: none
  • gateway intents: GUILDS, GUILD_BANS, GUILD_MESSAGES, GUILD_MESSAGE_REACTIONS, DIRECT_MESSAGES, GUILD_MEMBERS, GUILD_VOICE_STATES
  • other: none
@stijnb1234 stijnb1234 added the bug Something isn't working label Aug 8, 2021
@amishshah
Copy link
Member

playbackDuration is intended as a read-only property, changing it won't do anything.

This library does not yet support seeking, if you'd like to do it, you'd need to use FFmpeg or some other tool.

@amishshah amishshah added feature request and removed bug Something isn't working labels Aug 8, 2021
@stijnb1234
Copy link
Author

Ah, okay. Because it's not defined as readOnly in the code itself. :P

#30 (comment)

Here you indicate that examples will come for it. Where can I find them? I'm not so familiar with ffmpeg that I can put that together myself. :P

@stijnb1234
Copy link
Author

#161 did it for me. ;)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants