music player code example
There are two versions of source code for a music player. The simple player is for beginners and the full player is for experienced programmers.
Simple player: This is a very stripped down player intended to provide instruction and ideas for those who are learning how to program. See the material on simple player.
Full player: This is the full music player source code for experienced programmers. See the material on full player.
This is an example program for teaching computer programming. The example is a free music player, completely legal, that does not have any subscription fees, download costs, or advertisements.
I am posting heavily commented and described open source code for a free music player. A working example (started in February 2012 and having already served more than 12-million music videos) is at www.thissideofsanity.com/musicbox/musicbox.php. This source code is free for any legal non-commercial and/or non-profit and/or educational and/or private purpose. For those who need such a thing, the Apache 2.0 license material is just below.
I have the player running using videos from YouTube and Vimeo, as well as MP3s. The MP3s used are from my band, so I own the copyright. The YouTube and Vimeo materials all strictly follow their respective Terms of Service and allow legal access to real music videos (the heavy lifting on checking copyright validity is done by YouTube, Vimeo, and Vevo).
In addition to posting the raw source code, I am providing step by step instructions, isolating key points for easier undertstanding. Some readers will want to work through the examples for the purpose of learning how to program, while other readers are experienced developers who want to quickly grasp the essence of the techniques and apply the material to working websites. And I hope that some readers will want to help improve this source code.
the value of open source participation
While there is a lot of source code in this example, the real value over the long term is a collection of music and information about music that the general public can share. The large international corporations pay for a work force. The open source community can achieve higher quality through large numbers of social humans.
Bands can share their music with fans and potential fans.
Artists can share their graphics.
Musicians can share the works of their friends and influences.
Listeners can share their favorite music.
Serious fans can create music players for specific genres. This is particularly useful because the biggest two problems with YouTube music videos are (1) finding the best of several options and (2) replacing videos removed for copyright violations.
- simple music player code example
- adding music
- local server
- setting start time
- music data base
- number of songs
- song information
- actual music player
This is example code from This Side of Sanity, released under Apache License 2.0.
Copyright 2012, 2013, 2014 Milo
Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.