Skip to content

Adding track player#335

Open
jndok wants to merge 5 commits intokpwn:masterfrom
jndok:master
Open

Adding track player#335
jndok wants to merge 5 commits intokpwn:masterfrom
jndok:master

Conversation

@jndok
Copy link

@jndok jndok commented Jan 31, 2017

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.

@kpwn
Copy link
Owner

kpwn commented Jan 31, 2017

the code also handles the case where the tracks/ dir is not present.

bug, we should sha1 it

@jndok
Copy link
Author

jndok commented Jan 31, 2017

added checksum stuff, doesn't seem to affect launching speed at all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants