2026-01-14 18:42:16 +01:00
2025-12-30 15:12:26 +01:00
2026-01-14 18:42:16 +01:00
2026-01-14 18:42:16 +01:00
2026-01-14 18:42:16 +01:00
2026-01-14 17:55:18 +01:00
2025-12-31 07:33:09 +01:00
2025-12-30 15:12:26 +01:00
2026-01-02 13:25:10 +01:00
2026-01-13 13:18:46 +01:00
2026-01-13 13:32:51 +01:00

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:

  1. Node.js: Download Node.js (LTS version recommended).
  2. Rust: Install via rustup.rs.
  3. Visual Studio C++ Build Tools (Windows only): Required for compiling Rust. Ensure "Desktop development with C++" is selected during installation.

Installation

  1. Clone the repository:
git clone <repository-url>
cd RadioPlayer
  1. Install dependencies:

    npm install
    
  2. 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 dev

If you want FFmpeg to be bundled into src-tauri/resources/ for local/native playback during dev, use:

npm run dev:native

This command will:

  1. Compile the Rust backend.
  2. Launch the application window.
  3. Watch for changes in src/ and src-tauri/.

Building for Production

To create an optimized, standalone executable for your operating system:

  1. Run the build command:

npm run build ```

  1. Locate the artifacts: After the build completes, the installers and executables will be found in:
    • Windows: src-tauri/target/release/bundle/msi/ or nsis/
    • macOS: src-tauri/target/release/bundle/dmg/ or macos/
    • Linux: src-tauri/target/release/bundle/deb/ or appimage/

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/lib.rs: Tauri command layer (native player commands, Cast commands, utility HTTP helpers).
  • src/player.rs: Native audio engine (FFmpeg decode → PCM ring buffer → CPAL output).
  • src/main.rs: Rust entry point (wires the Tauri app; most command logic lives in lib.rs). * 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 tauri not found: Ensure you are running commands via npm 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 update inside the src-tauri folder to update Rust dependencies.

FFmpeg (Optional) for Native Playback

Local/native playback uses an external FFmpeg binary to decode radio streams.

How the app finds FFmpeg

At runtime it searches in this order:

  1. RADIOPLAYER_FFMPEG environment variable (absolute or relative path)
  2. Next to the application executable (Windows: ffmpeg.exe, macOS/Linux: ffmpeg)
  3. Common bundle resource folders relative to the executable:
  • resources/ffmpeg(.exe)
  • Resources/ffmpeg(.exe)
  • ../resources/ffmpeg(.exe)
  • ../Resources/ffmpeg(.exe)
  1. Your system PATH

Optional: download FFmpeg automatically (Windows)

This is opt-in (it is not run automatically during build/run). It downloads a prebuilt FFmpeg zip and extracts ffmpeg.exe into tools/ffmpeg/bin/ffmpeg.exe.

npm run ffmpeg:download

Then run npm run dev:native (or npm run build) to copy FFmpeg into src-tauri/resources/ for bundling.

License

[Add License Information Here]

Release v0.2

Public beta (v0.2) — updates since v0.1:

  • Android build support: Project includes Android build scripts and Gradle wrappers. See scripts/build-android.sh and build-android.ps1. Prebuilt native helper binaries are available in src-tauri/binaries/ for convenience.
  • Web receiver & webapp: The receiver/ folder contains a Custom CAF Receiver UI (HTML/CSS/JS) and the webapp/ folder provides a standalone web distribution for hosting the app in browsers or PWAs.
  • Sidecar improvements: sidecar/index.js now retries launches when devices return NOT_ALLOWED by attempting to stop existing sessions before retrying. Check sidecar logs for Launch NOT_ALLOWED messages and retry attempts.
  • LIVE stream: The app continues to support the LIVE stream https://live.radio1.si/Radio1MB (contentType: audio/mpeg, streamType: LIVE).

Included receiver files:

  • receiver/index.html
  • receiver/receiver.js (CAF Receiver initialization + LOAD interceptor for LIVE metadata)
  • receiver/styles.css
  • receiver/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.html for production.

Sidecar / troubleshoot

  • If a Cast launch fails with NOT_ALLOWED, the sidecar will attempt to stop any existing sessions on the device and retry the launch (best-effort). Check sidecar logs for Launch NOT_ALLOWED and 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.
Description
No description provided
Readme 289 MiB
Languages
JavaScript 44.8%
CSS 31.2%
HTML 13%
Rust 11%