Code snippets of an Mp3 player for use on websites
Check out the demo at https://www.snakebeings.org/GitHubDemo/mp3_audio_player
FEATURES: *auto reading of mp3 files in same directory to create playlist using PHP
*Starts a HTML5 audio player playing each song on the list
*Update or add to the playlist by adding more .mp3 files into the directory on your website
*The filename, minus the .mp3 extention, is displayed as the track title
Uses .PHP & HTML5 linked with javascript code to move the php variable containing the list of .mp3 file locations to the JS playlist. Audio player uses HTML5 uses the tag.
Demo working versions: GitHubDemo
https://www.snakebeings.org/GitHubDemo/mp3_audio_player
File with all of the code
##Code snippets for single functions
https://www.snakebeings.org/GitHubDemo/mp3_audio_player/sound.php
directory reader, autoplaylist and .mp3 player part of the code
https://www.snakebeings.org/GitHubDemo/mp3_audio_player/image.php
Directory reader to print all images found
https://www.snakebeings.org/GitHubDemo/mp3_audio_player/text.php
Reads and prints text from a .txt file in the remote directory named text.txt
INSTRUCTIONS:
Upload the following into the same directory on your website:
index.php, download.php, text.txt, the mp3 and image files of your choice
Edit text.txt file with the description of the sounds
The play list for the mp3 player automatically adds any .mp3 files which are in the same directory
If you just want certain functions or to cut and paste the code into an existing .php webpage:
Choose the functions from the files:
audio.php (just the .mp3 player and auto playlist)
image.php (just displays any .jpg files in the same directory -you can choose the size of the image in the code)
text.php (reads and displays words from a file called text.txt located in the same directory)
download.php (displays the filename and size in KB of any .mp3 files found in the same directory)
Other demos:
https://www.snakebeings.org/GitHubDemo
Music used in this site Demo by Emit Snake-Beings
CREATIVE COMMONS LICENCE -
Non-Commercial sharing allowed,
attribute artist/s where possible,
no re-mix without permission.