Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 thetracks/
dir is not present.