PlayerOptions - startTime parameter isn't working
Hydro001 opened this issue ยท 10 comments
Hi, using this code :
const track_url = "QAAAhgIAIU5QQyByaWRlcyBoaXMgYmlrZSBpbnRvIHRoZSBtYXlvcgALTWVtZSBUeWNvb24AAAAAAAAfQAALMkpZSkY5TDVZVzQAAQAraHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj0ySllKRjlMNVlXNAAHeW91dHViZQAAAAAAAAAA"
await player.playTrack({
track: track_url,
startTime: 5
});
The video is 8 seconds long and i want it to start at five but it starts at the beggining whatever i do.
Have a nice day ๐
I already checked it, but i would like to know if the startTime is in milliseconds, in a timestamp, in seconds, because it's just written "Number" on the startTime property in : https://deivu.github.io/Shoukaku/interfaces/guild_Player.PlayOptions.html#options, and if it doesn't even work after knowing the format that it requires, i would like to know why it doesn't work.
Sorry for the delay of the response and have a nice rest of your day ๐
Anything that is sent to lavalink is 1:1 ratio and is not modified. Based on Lavalink its in ms, so it means this is also in ms
So i replaced the value of startTime from 5 to 5000 and it still isn't starting at 5 seconds, not sure if i'm still doing something wrong, i already checked the documentation and all.
Your code does not follow the documentation I linked above.
Compare your code example to the documentation play options
Could you please give me an exemple of what i need to change ?, i'm pretty new to programming, and i don't really understand well the documentation yet.
Sorry for being a newbie.
Play options has the property track
and options
, which options is an object.
Now options
is an object with these properties https://deivu.github.io/Shoukaku/interfaces/guild_Player.PlayOptions.html#options
So i tried this :
const options = { endTime: 8000, noReplace: true, pause: false, startTime: 5000 };
const track_url = "QAAAhgIAIU5QQyByaWRlcyBoaXMgYmlrZSBpbnRvIHRoZSBtYXlvcgALTWVtZSBUeWNvb24AAAAAAAAfQAALMkpZSkY5TDVZVzQAAQAraHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj0ySllKRjlMNVlXNAAHeW91dHViZQAAAAAAAAAA";
await player.playTrack(options, track_url);
Is that correct ?
You are confusing parameters over an object, what you did is just input track and options as a parameter. playTrack only accepts a single parameter. Which is an object, in the name of PlayOptions (Link: https://deivu.github.io/Shoukaku/interfaces/guild_Player.PlayOptions.html#options). Now in this documentation, you see on Index/Properties that you have an property of track and options here.
Now in my code example which is on Readme on the very bottom
https://github.com/Deivu/Kongou/blob/60770035184b56333ea1c5ebee8be1521226d92b/src/modules/KongouDispatcher.js#L68
What did I do, did I make two parameters or supplied a single parameter as an object? Now based on the documentation, it says this object only have track
and options
as its properties on PlayOptions. Now what is Options? I already told you that options is here (Link: https://deivu.github.io/Shoukaku/interfaces/guild_Player.PlayOptions.html#options). Now you would see this if you scrolled down a bit, but I would link it here for your convenience. Now you see clearly startTime and the other optional properties with {}
. Now what does that signify? It means its an object. Now it means playOptions accepts an object, with track
as string and options
as object. Now I think you get the gist now with this explanation
I understand better now, being new these misunderstandings tend to happen unfortunately, sorry to have bothered, thanks a lot for your patience.
Have a nice day and thanks again. ๐