This application is a Web-Based Media Remote Control designed to run on a Windows computer. It creates a local web server that allows you to control your computer's media playback (like Spotify, Apple Music, YouTube in a browser, etc.) and system volume from any other device on the same local network (such as your smartphone, tablet, or another laptop) via a clean, modern web browser interface.
It also features a live synced lyrics viewer, grabbing the lyrics for whatever song is currently playing on your PC.
- Backend (Python/Flask): The Python script uses a micro web-framework called Flask to host a local web server on port
5001. It provides various API endpoints (/nowplaying,/volume,/playpause, etc.). - System Integration:
- It hooks into the Windows OS using the
winsdklibrary to fetch the globally playing media (title, artist, album art, and timestamp). - It uses
pycawto read and control the Windows master volume. - It uses
pyautoguito simulate physical keyboard media button presses (Play/Pause, Next Track, Previous Track).
- It hooks into the Windows OS using the
- Frontend (HTML/CSS/JS): When you navigate to the app's IP address, the server sends a single HTML page. The JavaScript on this page continuously polls the
/nowplayingAPI every 3 seconds to update the album art, track name, and current time. It also fetches lyrics dynamically from an external API (lrclib.net).
- You run the script (
prj.py) on your Windows PC. - The script starts a web server accessible on your local network.
- You open a web browser on your phone and enter your PC's local IP address with port 5001 (e.g.,
http://192.168.1.15:5001). - The web interface loads, showing the song currently playing on your PC.
- You can tap the play/pause buttons, adjust the volume slider, or open the lyrics view. These actions send HTTP requests back to the Python script.
- The Python script translates those HTTP requests into actual system commands on your PC.
- Language: Python 3.x
- Web Framework: Flask
- System Control Libraries:
winsdk(Windows SDK for Python) - To read what media is currently playing.pycaw(Python Core Audio Windows Library) - To control system volume.pyautogui- To simulate keyboard media key presses.
- Frontend: HTML5, CSS3, Vanilla JavaScript.
- External API:
lrclib.net(for fetching song lyrics).
- A computer running Windows 10 or Windows 11 (since it relies heavily on Windows-specific libraries).
- Python 3.x installed.
- Both devices (the Windows PC running the script and the device controlling it) must be connected to the same Wi-Fi/local network.
If you haven't already, download and install Python from python.org. Make sure to check the box that says "Add Python to PATH" during installation.
Open your terminal or command prompt (cmd) and run the following command to install the required Python packages:
pip install Flask pyautogui winsdk pycawNavigate to the folder containing remote.py` and run the script:
python remote.pyYou should see output indicating that the Flask server is running on 0.0.0.0:5001.
To access the app from your phone, you need your PC's local IP address:
- Open Command Prompt on your PC.
- Type
ipconfigand press Enter. - Look for the
IPv4 Addressunder your active network adapter (it usually looks like192.168.x.xor10.0.x.x).
- Open a web browser on your smartphone or tablet.
- In the address bar, type your PC's IP address followed by
:5001. Example:http://192.168.1.15:5001 - You should now see the remote control interface. Play a song on your PC (e.g., on Spotify) and the app will update to show the current track and allow you to control it!