[Enhancement] Shuffle/Loop playlist
Is your enhancement request related to a problem? Please describe.
I use invidious for listening music. It currently doesn't have ability to shuffle or loop playlist. It's annoying since it just stops playing when it reaches the last video of playlist. Describe the solution you'd like
It'd be great to shuffle or loop playlist. Describe alternatives you've considered
Always loop playlist option in settings
Additional context
^ Youtube's playlist control
I added an experimental loop setting on my instance, but the current implementation has some drawbacks when dealing with bigger playlist >50 videos. This is the code I use to get the "first" video url with out the need of extra api calls
if (xhr.response.nextVideo) {
...
} else if (video_data.params.always_loop_playlist) {
player.on("ended", function () {
location.assign(
document.getElementById("playlist").childNodes[2].childNodes[1].childNodes[1].childNodes[1].href);
});
}
But this has the drawback that after 50 videos the offset controls what the first video is but I'm working on a "right" way to improve the feature and then I would open a pr after some testing^^
Would love to have this :+1:
@CartoonFan I have a shuffle mode live on my instance but its for all playlists and can be disabled in the settings but my instance is not on list currently.. But you can check it out on my playlist but it has some obvious errors still but will get there Would like to hear feedback :)
Sorry for the late reply @11Tuvork28! I tried out your shuffle mode; it seems to work quite well! I don't know if I can directly make use of it (I normally use the tiekoetter instance), but it's good to know something like this is out there. Were you able to make any progress on looping playlists?
All good, yes I'm working on some javascript code that would solve all the problems with my current solution and has the possibility to be extended with more functions in the future. Like creating temporary playlists :) But it will be sometime till I get it to work, but will keep you updated
I added an experimental loop setting on my instance, but the current implementation has some drawbacks when dealing with bigger playlist >50 videos. This is the code I use to get the "first" video url with out the need of extra api calls
if (xhr.response.nextVideo) { ... } else if (video_data.params.always_loop_playlist) { player.on("ended", function () { location.assign( document.getElementById("playlist").childNodes[2].childNodes[1].childNodes[1].childNodes[1].href); }); }But this has the drawback that after 50 videos the offset controls what the first video is but I'm working on a "right" way to improve the feature and then I would open a pr after some testing^^
Feel free to submit your code, even if it is experimental.
@SamantazFox I guess we could have an experimental section in the player preferences for this type of stuff?
I'm wondering how youtube does the shuffling? Is there a request parameter for that? If yes, could we use that instead of rolling our own (except for invidious playlists)?
@SamantazFox I guess we could have an experimental section in the player preferences for this type of stuff?
Yes, agreed!
@11Tuvork28 Would you mind contributing to the code in order to add your js code as an experimental feature in Invidious?
Yeah sure would love to, once I'm done moving which will be tomorrow I will start working on it after finishing another PR^^ Would comeback to this tomorrow once I thought about how to implement it and ask you all if you think its fine or if it could be done better.
So I thougt about it and I think it would be best if we use different js files for that to save bandwidth, since I only modified watch.js so far. I would create a new entry in the preferences and add watch_experimental.js which will then be send instead of the original or the other way around. Since I really don't want dead js code send to the client for obvious reasons.
What love to hear your thoughts on this :)
I work a litle more on it, @CartoonFan give it a try :) Also I implemented temporary playlists like Youtube but they persist reloads and you dont need to be logged in.
@11Tuvork28 Shuffle seems to work, but I can't get playlists to autoplay, so it's hard to test the loop function. The settings seem to be fine, so...not really sure :shrug:
Good work so far, though! :+1:
Yeah my bad I messed up an if statement^^ but thanks for the feedback will keep working on this.