YouTube Playlist Randomizer
Input YouTube Playlist Here:
Mute Player
Usage Tips
- To loop the current video, just right click on the player and select "loop".
- This only works with public or unlisted playlists.
- Any "unavailable" videos encountered in the playlist (e.g. ones blocked on copyright grounds) will be automatically skipped. Deleted videos will not be recognized.
Why is this Necessary?
For whatever reason, YouTube has a very poor playlist randomization player. I frequently listen to long music playlists on YouTube while I study and work and while doing so have run into many problems including repitition of songs, the player randomly exiting the playlist (and loading videos in the sidebar instead), and more. I was using this website as an alternative, but due to the popularity of the site (due to the ineptitude of YouTube :)), it was reaching its daily API request quota early morning every day, meaning it wouldn't be able to work at all past mid-morning daily. So, I got fed up and made own version.
Development Notes/Software/TODO
This web app was written in Javascript and used JQuery for API calls. Essentially, the code does the following... First, it repeatedly queries the YouTube Data API to collect video IDs. It loops through each page of API responses to fill up an array with all video IDs of all videos in the playlist. It then randomized the array with the video IDs (via the Fisher-Yates aka Knuth shuffling algorithm) and displays the first one. It then works linearly through the array. In terms of upgrades to the player, some things I'd like to add in the future include the following:
- A "loop" checkbox button (added next to the "mute" button)
- A better random number generator function for playlist creation than javascript's built-in Math.random(). I bet there's an API out there that can feed you true (or true-er) random numbers.
- Display the name of the current video just above the player