Skip to content

Dhruv-Raichand/music-player

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

24 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽต MUZIX - Music Player

GitHub stars GitHub forks GitHub issues GitHub last commit

A modern, fully-featured web-based music player with mood-based playlists, search functionality, and a beautiful dark/light theme interface. Built with vanilla JavaScript, HTML5, and CSS3.

Music Player Demo License HTML5 CSS3 JavaScript

๐Ÿ“– Description

MUZIX is a sleek, responsive web music player that provides a Spotify-like experience. It features mood-based playlist organization, real-time audio controls, and an elegant interface with animated card effects. Perfect for personal music collections or as a learning project for web development.

Keywords: music player, web audio player, HTML5 audio, responsive design, mood playlists, JavaScript audio, dark mode, CSS animations, web music app, audio streaming

โœจ Features

  • ๐ŸŽจ Dark/Light Theme Toggle - Switch between themes for comfortable listening
  • ๐ŸŽต Multiple Playlists - 7 mood-based playlists (Angry, Bright, Chill, Funky, Love, NCS, Uplifting)
  • ๐Ÿ” Search Functionality - Quickly find albums by title or description
  • โŒจ๏ธ Keyboard Controls - Space to play/pause, Arrow keys for next/previous track
  • ๐Ÿ“ฑ Responsive Design - Works seamlessly on desktop, tablet, and mobile
  • ๐ŸŽš๏ธ Full Audio Controls - Play, pause, next, previous, seek, volume control
  • ๐Ÿ–ผ๏ธ Album Art Display - Beautiful cover images for each playlist
  • ๐Ÿ“ Song Credits - Proper attribution with download and watch links
  • ๐ŸŽฏ Progress Bar - Visual seekbar with time display
  • โœจ Animated Cards - Rotating gradient border animations
  • ๐ŸŒ SEO Optimized - Meta tags and Open Graph support

๐Ÿ› ๏ธ Technologies Used

  • HTML5 - Semantic markup and audio element
  • CSS3 - Custom properties, animations, flexbox, grid
  • JavaScript (ES6+) - Async/await, fetch API, DOM manipulation
  • JSON - Data storage for songs and playlists
  • SVG - Scalable vector icons
  • Web Audio API - HTML5 audio playback

๐Ÿš€ Demo

Live Demo

๐Ÿ“‹ Prerequisites

  • A web server (Apache, Nginx) or static hosting service (Vercel, Netlify, GitHub Pages)
  • Modern web browser with HTML5 audio support
  • Basic knowledge of JSON for managing playlists

๐Ÿ“ Project Structure

music-player/
โ”œโ”€โ”€ index.html              # Main HTML file
โ”œโ”€โ”€ style.css              # Styling
โ”œโ”€โ”€ script.js              # Main JavaScript logic
โ”œโ”€โ”€ img/                   # UI icons (play, pause, volume, etc.)
โ”‚   โ”œโ”€โ”€ play.svg
โ”‚   โ”œโ”€โ”€ pause.svg
โ”‚   โ”œโ”€โ”€ volume.svg
โ”‚   โ””โ”€โ”€ mute.svg
โ””โ”€โ”€ songs/                 # Music library
    โ”œโ”€โ”€ ncs/
    โ”‚   โ”œโ”€โ”€ songs.json     # Song metadata
    โ”‚   โ”œโ”€โ”€ info.json      # Album information
    โ”‚   โ”œโ”€โ”€ cover.jpg      # Album artwork
    โ”‚   โ”œโ”€โ”€ Cradles.mp3
    โ”‚   โ””โ”€โ”€ Mortals.mp3
    โ”œโ”€โ”€ Angry_(mood)/
    โ”‚   โ”œโ”€โ”€ songs.json
    โ”‚   โ”œโ”€โ”€ info.json
    โ”‚   โ””โ”€โ”€ cover.jpg
    โ””โ”€โ”€ ... (other playlists)

๐Ÿ› ๏ธ Installation

Option 1: Local Development

  1. Clone the repository

    git clone https://github.com/Dhruv-Raichand/music-player.git
    cd music-player
  2. Add SEO Meta Tags (Optional but recommended)

    • Add the meta tags from meta-tags.html to your index.html <head> section
    • Update URLs and author information
    • Add a manifest.json file for PWA support
  3. Start a local server

    # Using Python 3
    python -m http.server 8000
    
    # Using PHP
    php -S localhost:8000
    
    # Using Node.js http-server
    npx http-server -p 8000
  4. Open in browser

    http://localhost:8000
    

Option 2: Deploy to Vercel

  1. Install Vercel CLI

    npm i -g vercel
  2. Deploy

    vercel
  3. Note: Vercel has file size limits. For MP3 files, consider using external storage (see Troubleshooting section).

Option 3: Deploy to Netlify

  1. Drag and drop your project folder to Netlify Drop
  2. Or use Netlify CLI:
    npm install netlify-cli -g
    netlify deploy

๐Ÿ“ Configuration

Adding a New Playlist

  1. Create a folder in /songs/ directory:

    /songs/YourPlaylist/
    
  2. Add info.json:

    {
      "title": "Your Playlist Name",
      "description": "Playlist description"
    }
  3. Add songs.json:

    [
      {
        "name": "Song Title",
        "artist": "Artist Name",
        "file": "song-file.mp3",
        "watch": "https://youtube.com/watch?v=...",
        "download": "https://download-link.com",
        "credit": "Song: Artist - Title [Release Info]"
      }
    ]
  4. Add files:

    • Place MP3 files in the folder
    • Add cover.jpg (recommended: 300x300px)
  5. Update script.js: Add your playlist to the albums array (around line 116):

    {folder: 'YourPlaylist', title: 'Your Playlist Name', description: 'Description'}

Optional: Create /albums.json

To dynamically load all albums, create this file in the root:

[
  {"folder": "ncs", "title": "NCS Songs", "description": "Songs for you"},
  {"folder": "YourPlaylist", "title": "Your Playlist", "description": "Description"}
]

โŒจ๏ธ Keyboard Shortcuts

Key Action
Space Play / Pause
โ†’ (Right Arrow) Next track
โ† (Left Arrow) Previous track

๐ŸŽจ Customization

Change Theme Colors

Edit style.css to customize colors:

:root {
  --primary-color: #your-color;
  --background: #your-background;
}

Modify Player Controls

The player controls are in index.html. You can add more buttons or features by:

  1. Adding HTML elements
  2. Creating event listeners in script.js
  3. Styling in style.css

๐Ÿ› Troubleshooting

MP3 Files Not Playing on Vercel

Problem: Vercel has file size limits and may not deploy large MP3 files.

Solutions:

  1. Use external hosting for MP3 files:

    • Upload MP3s to Cloudinary, AWS S3, or Google Cloud Storage
    • Update playMusic() function in script.js:
      currentSong.src = `https://your-cdn.com/${currFolder}/${track}`;
  2. Use Netlify instead - Better for hosting media files

  3. Compress MP3 files to reduce size

Songs Not Loading

  • Check browser console (F12) for errors
  • Verify songs.json format is correct
  • Ensure file paths match exactly (case-sensitive)
  • Check that MP3 files are in the correct folders

Theme Not Saving

This is expected behavior - the theme resets on page reload. To persist theme:

  • Use a backend to store preferences
  • Or uncomment the localStorage code (note: may not work in all hosting environments)

๐Ÿค Contributing

Contributions are welcome! Here's how:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Credits

  • NCS Music - NoCopyrightSounds for royalty-free music
  • Icons - SVG icons for player controls
  • Fonts - [Your font source]

๐Ÿ“ง Contact

GitHub: @Dhruv-Raichand
Email: dhruvraichand70@gmail.com
LinkedIn: Dhruv Raichand

Project Link: https://github.com/Dhruv-Raichand/music-player
Live Demo: https://music-player-six-taupe.vercel.app


โญ Star this repo if you found it helpful!

๐Ÿ”ฎ Future Enhancements

  • Playlist creation and management
  • Shuffle and repeat modes
  • Lyrics display
  • Audio visualizer
  • Social sharing features
  • User accounts and favorites
  • Queue management
  • Equalizer controls

About

๐ŸŽต Modern web music player with mood playlists, dark/light themes, keyboard controls & animated cards. Vanilla JS, HTML5 audio, CSS3. Fully responsive.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors