Skip to content

Adding track player #335

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Adding track player #335

wants to merge 5 commits into from

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