Control your Spotify playback using hand gestures with OpenCV, MediaPipe, and the Spotify Web API.
Use your webcam to:
- โ Play
- โ Pause
- ๐ Next / Previous track
- ๐ Replay
- ๐ Control volume by changing thumbโindex distance
- ๐ Watch a rotating vinyl disc made from album art
- ๐ View a vertical volume slider + Spotify-like progress bar
- ๐ Rotating vinyl disc created from Spotify album art
- ๐ถ Real-time progress bar synced with song progress
- ๐ Gesture-based playback control
- ๐ Vertical volume bar
- ๐จ Custom UI overlay designed inside OpenCV
- โ๏ธ Full integration with Spotify Web API (requires Premium for some features)
| Technology | Purpose |
|---|---|
| Python | Core language |
| OpenCV | Drawing UI + capturing webcam frames |
| MediaPipe | Real-time hand landmark tracking |
| Spotipy | Sending playback commands to Spotify |
| Pillow (PIL) | Image processing for vinyl disc |
| NumPy | Fast math operations |
| python-dotenv | Loading Spotify API keys from .env |
1๏ธโฃ Clone the Repository git clone https://github.com/YOUR_USERNAME/spotify-gesture-controller.git cd spotify-gesture-controller
2๏ธโฃ Create Virtual Environment python -m venv venv venv\Scripts\activate # Windows
3๏ธโฃ Install Dependencies pip install -r requirements.txt
4๏ธโฃ Create a .env File for Spotify Credentials Create a file named .env inside the project folder:
SPOTIPY_CLIENT_ID=your_client_id_here
SPOTIPY_CLIENT_SECRET=your_client_secret_here
SPOTIPY_REDIRECT_URI=http://127.0.0.1:8888/callback
Get these values from: ๐ https://developer.spotify.com/dashboard
5๏ธโฃ Run the App python spotify_controller.py
Your webcam window will open and start detecting gestures.
๐ฎ Gesture Controls (Cheat Sheet) Gesture Action
| Gesture | Action |
|---|---|
| โ Open Palm | Play |
| โ Fist | Pause |
| โ๏ธโ๏ธ Index + Middle extended | Next track |
| ๐โ๏ธโ๏ธ Thumb + Index + Middle | Previous track |
| ๐ค Ring + Pinky | Replay |
| ๐โ๏ธ ThumbโIndex distance | Volume control |
๐จ UI Showcase
๐ Rotating vinyl disc with album art
โ Center control buttons (Play/Pause/Next/Previous/Replay)
๐ Spotify-style progress bar
๐ Vertical volume slider
๐ Live hand landmark overlay
๐ Project Structure spotify-gesture-controller/
โ
โโโ spotify_controller.py
โโโ requirements.txt
โโโ README.md
โโโ .gitignore
โโโ .env (ignored in GitHub)
๐งฉ Possible Future Improvements Add pinch-to-seek progress control Custom Spotify-themed UI skin Hand tracking with ML model instead of rule-based detection Multiple gesture modes (simple / advanced)
๐ License
MIT License.
IF YOU LIKE THIS PROJECT GIVE IT A STAR ON GITHUB WOULD MEAN A LOT THANKYOU!!!!


