RadioPlayer
A lightweight, cross-platform radio player built with Tauri and Vanilla JavaScript. Features local playback and Google Cast integration.
Prerequisites
Before you begin, ensure you have the following installed on your machine:
- Node.js: Download Node.js (LTS version recommended).
- Rust: Install via rustup.rs.
- Visual Studio C++ Build Tools (Windows only): Required for compiling Rust. Ensure "Desktop development with C++" is selected during installation.
Installation
- Clone the repository:
git clone <repository-url>
cd RadioPlayer
-
Install dependencies:
npm install -
Verify Rust environment: It's good practice to ensure your Rust environment is ready.
cd src-tauri cargo check cd ..
Development
To start the application in development mode (with hot-reloading for frontend changes):
npm run tauri dev
This command will:
- Compile the Rust backend.
- Launch the application window.
- Watch for changes in
src/andsrc-tauri/.
Building for Production
To create an optimized, standalone executable for your operating system:
-
Run the build command:
npm run tauri build -
Locate the artifacts: After the build completes, the installers and executables will be found in:
- Windows:
src-tauri/target/release/bundle/msi/ornsis/ - macOS:
src-tauri/target/release/bundle/dmg/ormacos/ - Linux:
src-tauri/target/release/bundle/deb/orappimage/
- Windows:
Project Structure
src/: Frontend source code (Vanilla HTML/CSS/JS).index.html: The main entry point of the app.main.js: Core logic, handles UI events and communication with the Tauri backend.styles.css: Application styling.stations.json: Configuration file for available radio streams.
src-tauri/: Rust backend code.src/main.rs: The entry point for the Rust process. Handles Google Cast discovery and playback logic.tauri.conf.json: Configuration for the Tauri app (window size, permissions, package info).
Customization
Adding Radio Stations
To add new stations, edit the src/stations.json file. Add a new object to the array with a name and stream url:
[
{
"name": "My New Station",
"url": "https://stream-url.com/stream"
}
]
Adjusting Window Size
To change the default window size, edit src-tauri/tauri.conf.json:
"windows": [
{
"width": 360, // Change width
"height": 720, // Change height
"resizable": false
}
]
Troubleshooting
- Command
taurinot found: Ensure you are running commands vianpm run tauri ...or global install@tauri-apps/cli. - WebView2 Error (Windows): If the app doesn't start on Windows, ensure the Microsoft Edge WebView2 Runtime is installed.
- Build Failures: Try running
cargo updateinside thesrc-taurifolder to update Rust dependencies.
License
[Add License Information Here]
Release v0.1
Initial public preview (v0.1) — a minimal, working RadioPlayer experience:
- Custom CAF Receiver UI (HTML/CSS/JS) in
receiver/with branded artwork and playback status. - Plays LIVE stream:
https://live.radio1.si/Radio1MB(contentType:audio/mpeg, streamType:LIVE). - Desktop sidecar (
sidecar/index.js) launches the Default Media Receiver and sends LOAD commands; launch flow now retries if the device reportsNOT_ALLOWEDby stopping existing sessions first.
Included receiver files:
receiver/index.htmlreceiver/receiver.js(CAF Receiver initialization + LOAD interceptor for LIVE metadata)receiver/styles.cssreceiver/assets/logo.svg
Quick testing notes
- The receiver must be served over HTTPS for Cast devices to load it. For quick local testing you can use
mkcert+ a static HTTPS server:
# create local certs
mkcert -install
mkcert localhost
# serve the receiver folder over HTTPS
npx http-server receiver -p 8443 -S -C localhost.pem -K localhost-key.pem
- Use the Default Media Receiver App ID while developing, or register a Custom Receiver App in the Cast Developer Console and point its URL to your hosted
index.htmlfor production.
Sidecar / troubleshoot
- If a Cast launch fails with
NOT_ALLOWED, the sidecar will now attempt to stop any existing sessions on the device and retry the launch (best-effort). Check sidecar logs forLaunch NOT_ALLOWEDand subsequent retry attempts. - Note: the sidecar uses
castv2-client(not the official Google sender SDK). Group/stereo behavior may vary across device types — for full sender capabilities consider adding an official sender implementation.