Git Product home page Git Product logo

apple-music-js's Introduction

og

Built by Tanner Villarete

Connect with me on LinkedIn! I'll be graduating soon ;)

How far can JavaScript take us?

Turns out, pretty dang far. This web app was my attempt at mimicking Apple's iOS music app, and I think I've come pretty close!

Check out a live demo here


screen shot 2018-08-12 at 9 49 19 am

screen shot 2018-08-12 at 9 49 27 am

I'm in my fourth year of college, and it's been super cool to see how much I've improved and continue to improve all aspects of programming.

Backend API

The API is hosted on a Raspberry Pi, and it's kept private (but still accessible if you try) so that it doesn't get overloaded. If you're interested in building your own backend to plug into this tool, here's what my database and endpoints look like:

Database

There are six required columns:

  • name: The name of the song
  • artist: The artist name
  • album: The album name
  • track: The index of the song relative to the album (To order songs in an album)
  • url: A URL to the audio file
  • artwork: A URL to the album artwork image
mysql> use music;

Database changed
mysql> desc tracks;
+------------+------------------+------+-----+---------+----------------+
| Field      | Type             | Null | Key | Default | Extra          |
+------------+------------------+------+-----+---------+----------------+
| id         | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| created_at | timestamp        | YES  |     | NULL    |                |
| updated_at | timestamp        | YES  |     | NULL    |                |
| name       | varchar(255)     | NO   |     | NULL    |                |
| artist     | varchar(255)     | NO   |     | NULL    |                |
| album      | varchar(255)     | NO   |     | NULL    |                |
| track      | int(11)          | NO   |     | NULL    |                |
| url        | varchar(255)     | NO   |     | NULL    |                |
| artwork    | varchar(255)     | NO   |     | NULL    |                |
+------------+------------------+------+-----+---------+----------------+
9 rows in set (0.05 sec)

API Endpoints

The backend is built with PHP using the Laravel ORM. I only needed a few API endpoints to get this working:

  • /albums - Returns a list of all album names with their corresponding artist
  • /album/{album} - Returns a list of songs from a specified album
  • /artists - Returns a list of all artists
  • /artist/{artist} - Returns a list of all albums from a specific artist

Feel free to reach out if you have questions!

Local Development

To run this app locally, clone the project (or download it as a zip and unzip it to a directory), navigate to the root directory with a command prompt or terminal (where the package.json file is located), and run npm install to download the necessary dependencies onto your local machine.

Inside the root directory, you can run some built-in commands:

npm start

Runs the app in development mode.

Open http://localhost:3000 to view it in the browser.

The page will automatically reload if you make changes to the code.

You will see the build errors and lint warnings in the console.

npm run build

Builds the app for production to the build folder.

It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.

Your app is ready to be deployed.

apple-music-js's People

Contributors

dependabot[bot] avatar thx1766 avatar tvillarete avatar vernondegoede avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

apple-music-js's Issues

forked-daapd integration?

This would make a killer replacement for the default forked-daapd web UI, although it would take some re-working of the endpoints.

Screenshots

Would be great if you share some screenshots in the README.md file. ๐Ÿ™‚

Implementation Questions

Hey there! First of all, nice work! I am also working on an Apple Music client and this isn't so much an issue as it is a question if you have time to help. Looking through the project, I don't see how the audio is actually being played. I see the actions and reducers that control playback state, but I don't see any use of the Audio class, audio tags, or some other side effect that would play the track. Can you help me understand how this is working? Thanks so much for your time and open sourcing this great project :)

Cheers,
Patrick

Tie to ampache

Hey tanner
Are you up for some freelancing? I intend to launch my own indies app soon and need some help connecting the dots with
https://github.com/ampache/ampache
And since it has some social features, to include that would be aplreciated as well ๐Ÿ˜…

TypeError: Cannot read property 'currentTime' of null

This pops up after a song is finished playing:

TypeError: Cannot read property 'currentTime' of null
(anonymous function)
src/js/components/bar/components/controls/index.js:97
94 | createTimeInterval() {
95 | this.playInterval = setInterval(() => {
96 | this.props.updateTime({
97 | current: this.audio.currentTime,
98 | max: this.audio.duration,
99 | });
100 | }, 1000);

97 is the one that is making the error happen I believe.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.