# FFmpeg (Optional) for Native Playback

The native player uses an external **FFmpeg** binary to decode radio streams.

## Why this exists

- The app intentionally does **not** download or embed FFmpeg automatically.
- You provide FFmpeg yourself (license/compliance-friendly).

## 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)`
4. Your system `PATH`

## Recommended setup (Windows dev)

- Put `ffmpeg.exe` somewhere stable, then set:

`RADIOPLAYER_FFMPEG=C:\\path\\to\\ffmpeg.exe`

Or copy `ffmpeg.exe` next to the built app binary:

- `src-tauri/target/debug/ffmpeg.exe` (dev)
- `src-tauri/target/release/ffmpeg.exe` (release)

## Optional: download helper (Windows)

You can also run:

`npm run ffmpeg:download`

This downloads a prebuilt FFmpeg zip and extracts `ffmpeg.exe` into `tools/ffmpeg/bin/ffmpeg.exe`.

## Notes

- The player will fail fast with a clear error if FFmpeg is missing.
- The project already includes a copy step (`tools/copy-ffmpeg.js`) that runs before `tauri`/`build` and places FFmpeg into `src-tauri/resources/` for bundling.