yalu102
yalu102 copied to clipboard
Adding track player
Since I read you wanted to add this eventually, and since I was pretty bored, I decided to start implementing it.
The way this works is basically opening a directory inside yalu's app bundle (called tracks/
) and adds the .mp3 file paths in there into an array.
Then, it generates a random index for the first track to play, and starts playing it. Once done, the playerItemDidReachEnd
method gets automatically invoked and the next track is played. As soon as every track has been played, it starts over from the first one.
This also adds two labels to the main storyboard, one of these to show the name of the track currently playing. You can also change track by tapping on this label.
Last thing, I added a sample tracks/
dir inside the repo containing KJC diss tracks, it's ~20MB, so that people who build the project have some tracks by default. That can as well be removed to keep the repo size down, since the code also handles the case where the tracks/
dir is not present.
the code also handles the case where the tracks/ dir is not present.
bug, we should sha1 it
added checksum stuff, doesn't seem to affect launching speed at all