-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Playlist Order #17
Comments
I have run into that same issue. Playlist order is not stable, and when the order is wrong, a video (for example the 3rd video) is shown in the 1st position, highlighted as if it was playing. It is a really nice library, just hoping for this fix so that I can use it. |
I have a pull request for this and should be pushing a solution by the end of the weekend. |
I'll take a look. |
Oh, okay, I think the issue is that the Promises for each requested vimeo id are not properly chained, so they are resolving when they do, which isn't necessarily the order of the requests. The issue happens right at line 219, I'm looping over each id, making a fetch to vimeo, then creating a doc frag to render each item to a template before adding it back to the DOM. Need to ensure the promises are chained in the correct order. Will work on a solution shortly. But, if you have a solution @vinnycodes, feel free to send that PR (thanks!). |
Hey @stephenscaff! I found the issue at line 129 as well in how the fetch is happening asynchronously. I'm wrapping up some client work today and should have it back to you. I went ahead and used Promise.all to and that helped. I'll send it back assap. |
@vinnycodes Yep. Promises.all is the move imo. Need to beef up error handling a bit too, if an id doesn't exist. Thanks for your help. Will also try to branch a solution if I get a sec today. Thanks again. |
@vinnycodes I did a fix, here's the PR:. Wraps fetches in a Promise.all. Created a util to abstract. Also added some new options for playlist-items that you can see in readme. Though should probs rethink that a bit. Anyway, will merge the PR later unless you think you have something better? Im sure my solution could be better but I just had a baby girl and my brain is a tad fried. |
@stephenscaff Thank you for taking time away to look at this. Your PR looks very clean. I like how you did it. Here's the PR I have I solely added it for the reasons below. Of course feel free to use whatever you would like and throw away what you don't.
Thank you again and hope this can better the project. It's been really helpful for me. |
@vinnycodes Thanks bud! appreciate the kind words. Few thoughts / questions: 1. First, question about Promise.all approachesIs it better to loop over an array of promises, like in your solution, or is it better to have a single Promise and loop over the In your solution, we loop over the fetch requests to create an array of Promises.
Then, we use In my solution, we loop over the requests inside a Promise.all (
that we can Which is better? Which is more performant? Let me know what you think. 2. Second, we should swallow up 404 request errorsAdding an undefined check so a 404 error (from bad id) won't kill the app. 3. Finally, on ShuffleGreat idea. Thinking it should maybe be a control / toggle though. In the same way we have playlist controls for next, prev, fullscreen, perhaps Shuffle should just be a button/trigger. Then, the shuffle trigger could just randomly reorder the existing playlist (rather than shuffle the list before it's built. Does that make sense? |
Hey @stephenscaff ! You're welcome.
Thank you again. I'm learning a lot on this one. |
@stephenscaff & @vinnycodes can this be merged? I'm currently experiencing this same issue and would like to get it resolved. |
When a playlist is rendered, it is not always in order. Looking for a solution to try and create an "orderedPlaylist" option.
The text was updated successfully, but these errors were encountered: