Initial commit
24
.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
3
.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"recommendations": ["tauri-apps.tauri-vscode", "rust-lang.rust-analyzer"]
|
||||
}
|
||||
108
README.md
Normal file
@@ -0,0 +1,108 @@
|
||||
# RadioCast
|
||||
|
||||
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](https://nodejs.org/) (LTS version recommended).
|
||||
2. **Rust**: Install via [rustup.rs](https://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**:
|
||||
```bash
|
||||
git clone <repository-url>
|
||||
cd RadioCast
|
||||
```
|
||||
|
||||
2. **Install dependencies**:
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
3. **Verify Rust environment**:
|
||||
It's good practice to ensure your Rust environment is ready.
|
||||
```bash
|
||||
cd src-tauri
|
||||
cargo check
|
||||
cd ..
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
To start the application in development mode (with hot-reloading for frontend changes):
|
||||
|
||||
```bash
|
||||
npm run tauri dev
|
||||
```
|
||||
|
||||
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**:
|
||||
```bash
|
||||
npm run tauri build
|
||||
```
|
||||
|
||||
2. **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/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`:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"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`:
|
||||
|
||||
```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](https://developer.microsoft.com/en-us/microsoft-edge/webview2/) is installed.
|
||||
* **Build Failures**: Try running `cargo update` inside the `src-tauri` folder to update Rust dependencies.
|
||||
|
||||
## License
|
||||
|
||||
[Add License Information Here]
|
||||
256
layout2_plan.md
Normal file
@@ -0,0 +1,256 @@
|
||||
# Beautify “Connect to Device” Popup (Tauri + HTML)
|
||||
|
||||
## Goal
|
||||
|
||||
Redesign the **Connect to Device** popup/modal to match the app’s **glassmorphism + neon purple** style:
|
||||
|
||||
* Frosted glass modal
|
||||
* Blurred/dimmed overlay background
|
||||
* Clean device list with hover + selected states
|
||||
* Premium rounded corners and soft glow
|
||||
* Works smoothly inside **Tauri WebView** (desktop)
|
||||
|
||||
---
|
||||
|
||||
## Requirements
|
||||
|
||||
### Functional
|
||||
|
||||
* Modal opens/closes via existing app logic (do not change behavior).
|
||||
* Device list supports:
|
||||
|
||||
* Hover highlight
|
||||
* Single selected device (one at a time)
|
||||
* Click selects device (and triggers existing handler)
|
||||
* “Cancel” button closes modal (existing handler).
|
||||
* Include “This Computer (Local Playback)” option at top.
|
||||
|
||||
### Visual
|
||||
|
||||
* Overlay blur + dark tint behind modal.
|
||||
* Modal background: semi-transparent glass with blur.
|
||||
* No harsh borders; use subtle border + soft shadow.
|
||||
* Selected device: gradient accent + glow.
|
||||
* Smooth animation on open (scale + fade).
|
||||
* Desktop-friendly sizing (320–420px wide).
|
||||
|
||||
### Tauri Safety / Performance
|
||||
|
||||
* Keep CSS lightweight.
|
||||
* Avoid heavy SVG masks or expensive filters beyond `backdrop-filter: blur(...)`.
|
||||
* Ensure modal area is `-webkit-app-region: no-drag` if you use draggable window headers.
|
||||
|
||||
---
|
||||
|
||||
## Target Structure
|
||||
|
||||
### HTML (keep semantic + simple)
|
||||
|
||||
Use or adapt this structure in the renderer HTML:
|
||||
|
||||
```html
|
||||
<div id="deviceOverlay" class="overlay hidden" aria-hidden="true">
|
||||
<div class="modal" role="dialog" aria-modal="true" aria-labelledby="deviceTitle">
|
||||
<h2 id="deviceTitle">Connect to Device</h2>
|
||||
|
||||
<ul id="deviceList" class="device-list">
|
||||
<!-- Render device items here -->
|
||||
<!-- Example item:
|
||||
<li class="device local selected" data-device="local">
|
||||
<div class="device-main">This Computer</div>
|
||||
<div class="device-sub">Local Playback</div>
|
||||
</li>
|
||||
-->
|
||||
</ul>
|
||||
|
||||
<button id="deviceCancelBtn" class="btn cancel" type="button">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
```
|
||||
|
||||
Notes:
|
||||
|
||||
* Use `hidden` class to toggle visibility.
|
||||
* Each `<li>` must have `data-device="<name-or-id>"` for click handling.
|
||||
* Selected item uses `.selected`.
|
||||
|
||||
---
|
||||
|
||||
## CSS (Glassmorphism Modal)
|
||||
|
||||
Add/merge this CSS into your stylesheet:
|
||||
|
||||
```css
|
||||
/* Overlay */
|
||||
.overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(20, 10, 35, 0.45);
|
||||
backdrop-filter: blur(14px);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.hidden { display: none !important; }
|
||||
|
||||
/* Modal */
|
||||
.modal {
|
||||
width: min(420px, calc(100vw - 48px));
|
||||
padding: 22px;
|
||||
border-radius: 22px;
|
||||
background: rgba(30, 30, 40, 0.82);
|
||||
border: 1px solid rgba(255,255,255,0.12);
|
||||
box-shadow: 0 30px 80px rgba(0,0,0,0.6);
|
||||
color: #fff;
|
||||
animation: pop 0.22s ease;
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
|
||||
@keyframes pop {
|
||||
from { transform: scale(0.94); opacity: 0; }
|
||||
to { transform: scale(1); opacity: 1; }
|
||||
}
|
||||
|
||||
.modal h2 {
|
||||
margin: 0 0 14px;
|
||||
text-align: center;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
/* Device list */
|
||||
.device-list {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0 0 18px;
|
||||
max-height: 360px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/* Device row */
|
||||
.device {
|
||||
padding: 12px 14px;
|
||||
border-radius: 14px;
|
||||
margin-bottom: 8px;
|
||||
cursor: pointer;
|
||||
background: rgba(255,255,255,0.05);
|
||||
transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
|
||||
}
|
||||
|
||||
.device:hover {
|
||||
background: rgba(255,255,255,0.10);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.device .device-main {
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.device .device-sub {
|
||||
margin-top: 3px;
|
||||
font-size: 12px;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
/* Selected device */
|
||||
.device.selected {
|
||||
background: linear-gradient(135deg, #c77dff, #8b5cf6);
|
||||
box-shadow: 0 0 18px rgba(199,125,255,0.65);
|
||||
color: #111;
|
||||
}
|
||||
|
||||
.device.selected .device-sub {
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
/* Optional: disabled group devices */
|
||||
.device.disabled {
|
||||
opacity: 0.45;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Cancel button */
|
||||
.btn.cancel {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
border-radius: 999px;
|
||||
border: none;
|
||||
background: #d16b7d;
|
||||
color: #fff;
|
||||
font-size: 15px;
|
||||
cursor: pointer;
|
||||
transition: transform 0.15s ease;
|
||||
}
|
||||
|
||||
.btn.cancel:hover {
|
||||
transform: scale(1.02);
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## JavaScript Behavior (Minimal)
|
||||
|
||||
### Selection logic
|
||||
|
||||
* When a device row is clicked:
|
||||
|
||||
1. Remove `.selected` from all device `<li>`
|
||||
2. Add `.selected` to clicked `<li>`
|
||||
3. Call existing “connect/cast to device” handler with `data-device`
|
||||
|
||||
Pseudo-code (adapt to existing app code):
|
||||
|
||||
```js
|
||||
deviceList.addEventListener("click", (e) => {
|
||||
const item = e.target.closest(".device");
|
||||
if (!item) return;
|
||||
|
||||
deviceList.querySelectorAll(".device.selected")
|
||||
.forEach(el => el.classList.remove("selected"));
|
||||
|
||||
item.classList.add("selected");
|
||||
|
||||
const deviceName = item.dataset.device;
|
||||
// call existing connect logic:
|
||||
// connectToDevice(deviceName);
|
||||
});
|
||||
```
|
||||
|
||||
### Close modal
|
||||
|
||||
* Cancel button closes modal (existing function):
|
||||
|
||||
```js
|
||||
deviceCancelBtn.addEventListener("click", closeDeviceModal);
|
||||
```
|
||||
|
||||
### Optional: close on overlay click
|
||||
|
||||
* Only if app UX allows:
|
||||
|
||||
```js
|
||||
deviceOverlay.addEventListener("click", (e) => {
|
||||
if (e.target === deviceOverlay) closeDeviceModal();
|
||||
});
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
* Popup visually matches glassmorphism theme.
|
||||
* Overlay dims and blurs background.
|
||||
* Device list has hover + selected glow.
|
||||
* Exactly one device can be selected.
|
||||
* Cancel closes modal.
|
||||
* Runs smoothly in Tauri WebView without lag.
|
||||
|
||||
---
|
||||
|
||||
## Notes / Future Enhancements (Optional)
|
||||
|
||||
* Mark “Speaker Groups” as `.disabled` if casting library can’t support them.
|
||||
* Add small icons per device type (local vs cast).
|
||||
* Remember last selected device and preselect it on open.
|
||||
212
layout_plan.md
Normal file
@@ -0,0 +1,212 @@
|
||||
# Radio1 Player – Glassmorphism UI Redesign (Tauri + HTML)
|
||||
|
||||
## Objective
|
||||
|
||||
Redesign the **Radio1 Player** UI to match a **modern glassmorphism style** inspired by high-end music player apps.
|
||||
|
||||
The app is built with:
|
||||
|
||||
* **Tauri**
|
||||
* **HTML / CSS / Vanilla JS**
|
||||
* Desktop-first (Windows)
|
||||
|
||||
The UI must feel:
|
||||
|
||||
* Premium
|
||||
* Lightweight
|
||||
* Native
|
||||
* Smooth
|
||||
* Purple / neon themed
|
||||
|
||||
---
|
||||
|
||||
## Visual Reference
|
||||
|
||||
Style inspiration:
|
||||
|
||||
* Frosted glass cards
|
||||
* Soft purple / blue gradient background
|
||||
* Rounded corners everywhere
|
||||
* Subtle glow instead of hard borders
|
||||
* Floating controls
|
||||
|
||||
Target aesthetic keywords:
|
||||
|
||||
> glassmorphism, neon glow, frosted glass, modern music player, soft gradients
|
||||
|
||||
---
|
||||
|
||||
## Layout Structure
|
||||
|
||||
Single centered player card:
|
||||
|
||||
```
|
||||
┌──────────────────────────────┐
|
||||
│ Radio1 Player │
|
||||
│ ● Playing / Ready │
|
||||
│ │
|
||||
│ [ Station Artwork / Logo ] │
|
||||
│ │
|
||||
│ Radio 1 MB │
|
||||
│ Live Stream │
|
||||
│ │
|
||||
│ ────────●──────── │
|
||||
│ │
|
||||
│ ⏮ ▶ / ⏸ ⏭ │
|
||||
│ │
|
||||
│ 🔊 ─────●──── 50% │
|
||||
└──────────────────────────────┘
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Required UI Elements
|
||||
|
||||
### Header
|
||||
|
||||
* Title: `Radio1 Player`
|
||||
* Status indicator:
|
||||
|
||||
* `● Ready`
|
||||
* `● Playing`
|
||||
* `● Casting to <Device>`
|
||||
|
||||
### Artwork Area
|
||||
|
||||
* Square (1:1)
|
||||
* Rounded corners (20–24px)
|
||||
* Gradient or station logo
|
||||
* Soft glow around container
|
||||
|
||||
### Metadata
|
||||
|
||||
* Station name (Radio 1 MB)
|
||||
* Subtitle (Live Stream / Casting Mode)
|
||||
|
||||
### Playback Controls
|
||||
|
||||
* Previous (optional, visual only)
|
||||
* Play / Pause (primary accent button)
|
||||
* Next (optional, visual only)
|
||||
|
||||
### Volume Control
|
||||
|
||||
* Speaker icon
|
||||
* Horizontal slider
|
||||
* Percentage text
|
||||
* * / – buttons optional
|
||||
|
||||
---
|
||||
|
||||
## Color Palette
|
||||
|
||||
```css
|
||||
--background-gradient: linear-gradient(135deg, #7b7fd8, #b57cf2);
|
||||
--glass-bg: rgba(255, 255, 255, 0.15);
|
||||
--glass-border: rgba(255, 255, 255, 0.25);
|
||||
--accent: #c77dff;
|
||||
--accent-glow: rgba(199, 125, 255, 0.7);
|
||||
--text-main: #ffffff;
|
||||
--text-muted: rgba(255, 255, 255, 0.65);
|
||||
--success: #7dffb3;
|
||||
--danger: #ff5f5f;
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Styling Rules
|
||||
|
||||
* Use **glassmorphism**
|
||||
|
||||
* `backdrop-filter: blur(20px)`
|
||||
* Semi-transparent backgrounds
|
||||
* No hard borders
|
||||
* Use glow (`box-shadow`) instead of outlines
|
||||
* Large border radius (20–28px)
|
||||
* Smooth hover animations
|
||||
* No external UI libraries
|
||||
|
||||
---
|
||||
|
||||
## CSS Requirements
|
||||
|
||||
* Must work inside **Tauri WebView**
|
||||
* Avoid heavy filters or SVG masks
|
||||
* Use `accent-color` for sliders
|
||||
* Buttons should animate on hover (`scale`, `glow`)
|
||||
|
||||
---
|
||||
|
||||
## Tauri-Specific Enhancements
|
||||
|
||||
### Frameless Window
|
||||
|
||||
```ts
|
||||
appWindow.setDecorations(false);
|
||||
```
|
||||
|
||||
### Draggable Header
|
||||
|
||||
```css
|
||||
header {
|
||||
-webkit-app-region: drag;
|
||||
}
|
||||
button, input {
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## States to Support
|
||||
|
||||
### Playback States
|
||||
|
||||
* Ready
|
||||
* Playing locally
|
||||
* Casting to Google Speaker
|
||||
* Stopped
|
||||
|
||||
### UI Feedback
|
||||
|
||||
* Change accent glow when playing
|
||||
* Dim Play button when active
|
||||
* Update status text dynamically
|
||||
|
||||
---
|
||||
|
||||
## Accessibility & UX
|
||||
|
||||
* Buttons ≥ 44px
|
||||
* Clear contrast for text
|
||||
* Keyboard accessible controls
|
||||
* Volume slider supports mouse wheel
|
||||
|
||||
---
|
||||
|
||||
## Non-Goals
|
||||
|
||||
* No playlists
|
||||
* No track seeking (live stream)
|
||||
* No mobile layout
|
||||
* No heavy animations
|
||||
|
||||
---
|
||||
|
||||
## Success Criteria
|
||||
|
||||
* UI visually matches glassmorphism inspiration
|
||||
* Smooth performance in Tauri
|
||||
* Looks premium and modern
|
||||
* Clean HTML & CSS
|
||||
* Easy to extend later
|
||||
|
||||
---
|
||||
|
||||
## Instructions for Copilot Agent
|
||||
|
||||
* Generate **HTML + CSS only**
|
||||
* Keep JavaScript minimal
|
||||
* Prioritize visual fidelity
|
||||
* Avoid overengineering
|
||||
* Comment code where helpful
|
||||
232
package-lock.json
generated
Normal file
@@ -0,0 +1,232 @@
|
||||
{
|
||||
"name": "radio-tauri",
|
||||
"version": "0.1.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "radio-tauri",
|
||||
"version": "0.1.0",
|
||||
"devDependencies": {
|
||||
"@tauri-apps/cli": "^2"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/cli": {
|
||||
"version": "2.9.6",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli/-/cli-2.9.6.tgz",
|
||||
"integrity": "sha512-3xDdXL5omQ3sPfBfdC8fCtDKcnyV7OqyzQgfyT5P3+zY6lcPqIYKQBvUasNvppi21RSdfhy44ttvJmftb0PCDw==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"bin": {
|
||||
"tauri": "tauri.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/tauri"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@tauri-apps/cli-darwin-arm64": "2.9.6",
|
||||
"@tauri-apps/cli-darwin-x64": "2.9.6",
|
||||
"@tauri-apps/cli-linux-arm-gnueabihf": "2.9.6",
|
||||
"@tauri-apps/cli-linux-arm64-gnu": "2.9.6",
|
||||
"@tauri-apps/cli-linux-arm64-musl": "2.9.6",
|
||||
"@tauri-apps/cli-linux-riscv64-gnu": "2.9.6",
|
||||
"@tauri-apps/cli-linux-x64-gnu": "2.9.6",
|
||||
"@tauri-apps/cli-linux-x64-musl": "2.9.6",
|
||||
"@tauri-apps/cli-win32-arm64-msvc": "2.9.6",
|
||||
"@tauri-apps/cli-win32-ia32-msvc": "2.9.6",
|
||||
"@tauri-apps/cli-win32-x64-msvc": "2.9.6"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/cli-darwin-arm64": {
|
||||
"version": "2.9.6",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-arm64/-/cli-darwin-arm64-2.9.6.tgz",
|
||||
"integrity": "sha512-gf5no6N9FCk1qMrti4lfwP77JHP5haASZgVbBgpZG7BUepB3fhiLCXGUK8LvuOjP36HivXewjg72LTnPDScnQQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/cli-darwin-x64": {
|
||||
"version": "2.9.6",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-x64/-/cli-darwin-x64-2.9.6.tgz",
|
||||
"integrity": "sha512-oWh74WmqbERwwrwcueJyY6HYhgCksUc6NT7WKeXyrlY/FPmNgdyQAgcLuTSkhRFuQ6zh4Np1HZpOqCTpeZBDcw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/cli-linux-arm-gnueabihf": {
|
||||
"version": "2.9.6",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm-gnueabihf/-/cli-linux-arm-gnueabihf-2.9.6.tgz",
|
||||
"integrity": "sha512-/zde3bFroFsNXOHN204DC2qUxAcAanUjVXXSdEGmhwMUZeAQalNj5cz2Qli2elsRjKN/hVbZOJj0gQ5zaYUjSg==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/cli-linux-arm64-gnu": {
|
||||
"version": "2.9.6",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-gnu/-/cli-linux-arm64-gnu-2.9.6.tgz",
|
||||
"integrity": "sha512-pvbljdhp9VOo4RnID5ywSxgBs7qiylTPlK56cTk7InR3kYSTJKYMqv/4Q/4rGo/mG8cVppesKIeBMH42fw6wjg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/cli-linux-arm64-musl": {
|
||||
"version": "2.9.6",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.9.6.tgz",
|
||||
"integrity": "sha512-02TKUndpodXBCR0oP//6dZWGYcc22Upf2eP27NvC6z0DIqvkBBFziQUcvi2n6SrwTRL0yGgQjkm9K5NIn8s6jw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/cli-linux-riscv64-gnu": {
|
||||
"version": "2.9.6",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-riscv64-gnu/-/cli-linux-riscv64-gnu-2.9.6.tgz",
|
||||
"integrity": "sha512-fmp1hnulbqzl1GkXl4aTX9fV+ubHw2LqlLH1PE3BxZ11EQk+l/TmiEongjnxF0ie4kV8DQfDNJ1KGiIdWe1GvQ==",
|
||||
"cpu": [
|
||||
"riscv64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/cli-linux-x64-gnu": {
|
||||
"version": "2.9.6",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-gnu/-/cli-linux-x64-gnu-2.9.6.tgz",
|
||||
"integrity": "sha512-vY0le8ad2KaV1PJr+jCd8fUF9VOjwwQP/uBuTJvhvKTloEwxYA/kAjKK9OpIslGA9m/zcnSo74czI6bBrm2sYA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/cli-linux-x64-musl": {
|
||||
"version": "2.9.6",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-musl/-/cli-linux-x64-musl-2.9.6.tgz",
|
||||
"integrity": "sha512-TOEuB8YCFZTWVDzsO2yW0+zGcoMiPPwcUgdnW1ODnmgfwccpnihDRoks+ABT1e3fHb1ol8QQWsHSCovb3o2ENQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/cli-win32-arm64-msvc": {
|
||||
"version": "2.9.6",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-arm64-msvc/-/cli-win32-arm64-msvc-2.9.6.tgz",
|
||||
"integrity": "sha512-ujmDGMRc4qRLAnj8nNG26Rlz9klJ0I0jmZs2BPpmNNf0gM/rcVHhqbEkAaHPTBVIrtUdf7bGvQAD2pyIiUrBHQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/cli-win32-ia32-msvc": {
|
||||
"version": "2.9.6",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-ia32-msvc/-/cli-win32-ia32-msvc-2.9.6.tgz",
|
||||
"integrity": "sha512-S4pT0yAJgFX8QRCyKA1iKjZ9Q/oPjCZf66A/VlG5Yw54Nnr88J1uBpmenINbXxzyhduWrIXBaUbEY1K80ZbpMg==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/cli-win32-x64-msvc": {
|
||||
"version": "2.9.6",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-x64-msvc/-/cli-win32-x64-msvc-2.9.6.tgz",
|
||||
"integrity": "sha512-ldWuWSSkWbKOPjQMJoYVj9wLHcOniv7diyI5UAJ4XsBdtaFB0pKHQsqw/ItUma0VXGC7vB4E9fZjivmxur60aw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
14
package.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "radio-tauri",
|
||||
"private": true,
|
||||
"version": "0.1.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "tauri dev",
|
||||
"build": "tauri build",
|
||||
"tauri": "tauri"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tauri-apps/cli": "^2"
|
||||
}
|
||||
}
|
||||
7
src-tauri/.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
|
||||
# Generated by Tauri
|
||||
# will have schema files for capabilities auto-completion
|
||||
/gen/schemas
|
||||
5553
src-tauri/Cargo.lock
generated
Normal file
28
src-tauri/Cargo.toml
Normal file
@@ -0,0 +1,28 @@
|
||||
[package]
|
||||
name = "radio-tauri"
|
||||
version = "0.1.0"
|
||||
description = "A Tauri App"
|
||||
authors = ["you"]
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[lib]
|
||||
# The `_lib` suffix may seem redundant but it is necessary
|
||||
# to make the lib name unique and wouldn't conflict with the bin name.
|
||||
# This seems to be only an issue on Windows, see https://github.com/rust-lang/cargo/issues/8519
|
||||
name = "radio_tauri_lib"
|
||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "2", features = [] }
|
||||
|
||||
[dependencies]
|
||||
tauri = { version = "2", features = [] }
|
||||
tauri-plugin-opener = "2"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
rust_cast = "0.19.0"
|
||||
mdns-sd = "0.17.1"
|
||||
tokio = { version = "1.48.0", features = ["full"] }
|
||||
|
||||
3
src-tauri/build.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
tauri_build::build()
|
||||
}
|
||||
11
src-tauri/capabilities/default.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"$schema": "../gen/schemas/desktop-schema.json",
|
||||
"identifier": "default",
|
||||
"description": "Capability for the main window",
|
||||
"windows": ["main"],
|
||||
"permissions": [
|
||||
"core:default",
|
||||
"core:window:allow-close",
|
||||
"opener:default"
|
||||
]
|
||||
}
|
||||
29
src-tauri/check_log.txt
Normal file
@@ -0,0 +1,29 @@
|
||||
Checking radio-tauri v0.1.0 (D:\Sites\Work\Radio1\radio-tauri\src-tauri)
|
||||
warning: variable does not need to be mutable
|
||||
--> src\lib.rs:38:9
|
||||
|
|
||||
38 | let mut device = CastDevice::connect_without_host_verification(ip_addr.to_string(), 8009)
|
||||
| ----^^^^^^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
|
||||
= note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default
|
||||
|
||||
warning: variable does not need to be mutable
|
||||
--> src\lib.rs:75:9
|
||||
|
|
||||
75 | let mut device = CastDevice::connect_without_host_verification(ip_addr.to_string(), 8009)
|
||||
| ----^^^^^^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
||||
warning: variable does not need to be mutable
|
||||
--> src\lib.rs:99:9
|
||||
|
|
||||
99 | let mut device = CastDevice::connect_without_host_verification(ip_addr.to_string(), 8009)
|
||||
| ----^^^^^^
|
||||
| |
|
||||
| help: remove this `mut`
|
||||
|
||||
warning: `radio-tauri` (lib) generated 3 warnings (run `cargo fix --lib -p radio-tauri` to apply 3 suggestions)
|
||||
Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.78s
|
||||
BIN
src-tauri/icons/128x128.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
src-tauri/icons/128x128@2x.png
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
BIN
src-tauri/icons/32x32.png
Normal file
|
After Width: | Height: | Size: 974 B |
BIN
src-tauri/icons/Square107x107Logo.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
src-tauri/icons/Square142x142Logo.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
src-tauri/icons/Square150x150Logo.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
src-tauri/icons/Square284x284Logo.png
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
BIN
src-tauri/icons/Square30x30Logo.png
Normal file
|
After Width: | Height: | Size: 903 B |
BIN
src-tauri/icons/Square310x310Logo.png
Normal file
|
After Width: | Height: | Size: 8.4 KiB |
BIN
src-tauri/icons/Square44x44Logo.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
src-tauri/icons/Square71x71Logo.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
src-tauri/icons/Square89x89Logo.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
src-tauri/icons/StoreLogo.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
src-tauri/icons/icon.icns
Normal file
BIN
src-tauri/icons/icon.ico
Normal file
|
After Width: | Height: | Size: 85 KiB |
BIN
src-tauri/icons/icon.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
222
src-tauri/src/lib.rs
Normal file
@@ -0,0 +1,222 @@
|
||||
use std::collections::HashMap;
|
||||
use std::net::IpAddr;
|
||||
use std::str::FromStr;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::thread;
|
||||
|
||||
use mdns_sd::{ServiceDaemon, ServiceEvent};
|
||||
use rust_cast::channels::media::{Media, StreamType};
|
||||
use rust_cast::channels::receiver::CastDeviceApp;
|
||||
use rust_cast::CastDevice;
|
||||
use tauri::State;
|
||||
|
||||
struct AppState {
|
||||
known_devices: Mutex<HashMap<String, String>>,
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn list_cast_devices(state: State<'_, Arc<AppState>>) -> Result<Vec<String>, String> {
|
||||
let devices = state.known_devices.lock().unwrap();
|
||||
let mut list: Vec<String> = devices.keys().cloned().collect();
|
||||
list.sort();
|
||||
Ok(list)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn cast_play(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
device_name: String,
|
||||
url: String,
|
||||
) -> Result<(), String> {
|
||||
let ip = {
|
||||
let devices = state.known_devices.lock().unwrap();
|
||||
devices
|
||||
.get(&device_name)
|
||||
.cloned()
|
||||
.ok_or("Device not found")?
|
||||
};
|
||||
|
||||
println!("Connecting to {} ({})", device_name, ip);
|
||||
|
||||
// Run connection logic
|
||||
let ip_addr = IpAddr::from_str(&ip).map_err(|e| e.to_string())?;
|
||||
|
||||
// Connect to port 8009
|
||||
let device = CastDevice::connect_without_host_verification(ip_addr.to_string(), 8009)
|
||||
.map_err(|e| format!("Failed to connect: {:?}", e))?;
|
||||
|
||||
device
|
||||
.connection
|
||||
.connect("receiver-0")
|
||||
.map_err(|e| format!("Failed to connect receiver: {:?}", e))?;
|
||||
|
||||
// Check if Default Media Receiver is already running
|
||||
let app = CastDeviceApp::DefaultMediaReceiver;
|
||||
let status = device
|
||||
.receiver
|
||||
.get_status()
|
||||
.map_err(|e| format!("Failed to get status: {:?}", e))?;
|
||||
|
||||
// Determine if we need to launch or if we can use existing
|
||||
let application = status.applications.iter().find(|a| a.app_id == "CC1AD845"); // Default Media Receiver ID
|
||||
|
||||
let (transport_id, session_id) = if let Some(app_instance) = application {
|
||||
println!(
|
||||
"App already running, joining session {}",
|
||||
app_instance.session_id
|
||||
);
|
||||
(
|
||||
app_instance.transport_id.clone(),
|
||||
app_instance.session_id.clone(),
|
||||
)
|
||||
} else {
|
||||
println!("Launching app...");
|
||||
let app_instance = device
|
||||
.receiver
|
||||
.launch_app(&app)
|
||||
.map_err(|e| format!("Failed to launch app: {:?}", e))?;
|
||||
(app_instance.transport_id, app_instance.session_id)
|
||||
};
|
||||
|
||||
device
|
||||
.connection
|
||||
.connect(&transport_id)
|
||||
.map_err(|e| format!("Failed to connect transport: {:?}", e))?;
|
||||
|
||||
// Load Media
|
||||
let media = Media {
|
||||
content_id: url,
|
||||
stream_type: StreamType::Live, // Live stream
|
||||
content_type: "audio/mp3".to_string(),
|
||||
metadata: None,
|
||||
duration: None,
|
||||
};
|
||||
|
||||
device
|
||||
.media
|
||||
.load(&transport_id, &session_id, &media)
|
||||
.map_err(|e| format!("Failed to load media: {:?}", e))?;
|
||||
|
||||
println!("Playing on {}", device_name);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn cast_stop(state: State<'_, Arc<AppState>>, device_name: String) -> Result<(), String> {
|
||||
let ip = {
|
||||
let devices = state.known_devices.lock().unwrap();
|
||||
devices
|
||||
.get(&device_name)
|
||||
.cloned()
|
||||
.ok_or("Device not found")?
|
||||
};
|
||||
|
||||
let ip_addr = IpAddr::from_str(&ip).map_err(|e| e.to_string())?;
|
||||
let device = CastDevice::connect_without_host_verification(ip_addr.to_string(), 8009)
|
||||
.map_err(|e| format!("Failed to connect: {:?}", e))?;
|
||||
|
||||
device.connection.connect("receiver-0").unwrap();
|
||||
let status = device
|
||||
.receiver
|
||||
.get_status()
|
||||
.map_err(|e| format!("{:?}", e))?;
|
||||
|
||||
if let Some(app) = status.applications.first() {
|
||||
let _transport_id = &app.transport_id;
|
||||
// device.connection.connect(transport_id).unwrap();
|
||||
|
||||
device
|
||||
.receiver
|
||||
.stop_app(app.session_id.as_str())
|
||||
.map_err(|e| format!("{:?}", e))?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn cast_set_volume(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
device_name: String,
|
||||
volume: f32,
|
||||
) -> Result<(), String> {
|
||||
let ip = {
|
||||
let devices = state.known_devices.lock().unwrap();
|
||||
devices
|
||||
.get(&device_name)
|
||||
.cloned()
|
||||
.ok_or("Device not found")?
|
||||
};
|
||||
|
||||
let ip_addr = IpAddr::from_str(&ip).map_err(|e| e.to_string())?;
|
||||
let device = CastDevice::connect_without_host_verification(ip_addr.to_string(), 8009)
|
||||
.map_err(|e| format!("Failed to connect: {:?}", e))?;
|
||||
|
||||
device.connection.connect("receiver-0").unwrap();
|
||||
|
||||
// Volume is on the receiver struct
|
||||
let vol = rust_cast::channels::receiver::Volume {
|
||||
level: Some(volume),
|
||||
muted: None,
|
||||
};
|
||||
|
||||
device
|
||||
.receiver
|
||||
.set_volume(vol)
|
||||
.map_err(|e| format!("{:?}", e))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
let app_state = Arc::new(AppState {
|
||||
known_devices: Mutex::new(HashMap::new()),
|
||||
});
|
||||
|
||||
let state_clone = app_state.clone();
|
||||
|
||||
// Start Discovery Thread
|
||||
thread::spawn(move || {
|
||||
let mdns = ServiceDaemon::new().expect("Failed to create daemon");
|
||||
// Google Cast service
|
||||
let receiver = mdns
|
||||
.browse("_googlecast._tcp.local.")
|
||||
.expect("Failed to browse");
|
||||
|
||||
while let Ok(event) = receiver.recv() {
|
||||
match event {
|
||||
ServiceEvent::ServiceResolved(info) => {
|
||||
// Try to get "fn" property for Friendly Name
|
||||
let name = info
|
||||
.get_property_val_str("fn")
|
||||
.or_else(|| Some(info.get_fullname()))
|
||||
.unwrap()
|
||||
.to_string();
|
||||
|
||||
if let Some(ip) = info.get_addresses().iter().next() {
|
||||
let ip_str = ip.to_string();
|
||||
let mut devices = state_clone.known_devices.lock().unwrap();
|
||||
if !devices.contains_key(&name) {
|
||||
println!("Discovered Cast Device: {} at {}", name, ip_str);
|
||||
devices.insert(name, ip_str);
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_opener::init())
|
||||
.manage(app_state)
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
list_cast_devices,
|
||||
cast_play,
|
||||
cast_stop,
|
||||
cast_set_volume
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
6
src-tauri/src/main.rs
Normal file
@@ -0,0 +1,6 @@
|
||||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
fn main() {
|
||||
radio_tauri_lib::run()
|
||||
}
|
||||
36
src-tauri/tauri.conf.json
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "RadioPlayer",
|
||||
"version": "0.1.0",
|
||||
"identifier": "com.radio.player",
|
||||
"build": {
|
||||
"frontendDist": "../src"
|
||||
},
|
||||
"app": {
|
||||
"withGlobalTauri": true,
|
||||
"windows": [
|
||||
{
|
||||
"title": "RadioPlayer",
|
||||
"width": 360,
|
||||
"height": 720,
|
||||
"resizable": false,
|
||||
"decorations": false,
|
||||
"transparent": true
|
||||
}
|
||||
],
|
||||
"security": {
|
||||
"csp": null
|
||||
}
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"targets": "all",
|
||||
"icon": [
|
||||
"icons/32x32.png",
|
||||
"icons/128x128.png",
|
||||
"icons/128x128@2x.png",
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico"
|
||||
]
|
||||
}
|
||||
}
|
||||
1
src/assets/javascript.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="32" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path fill="#F7DF1E" d="M0 0h256v256H0V0Z"></path><path d="m67.312 213.932l19.59-11.856c3.78 6.701 7.218 12.371 15.465 12.371c7.905 0 12.89-3.092 12.89-15.12v-81.798h24.057v82.138c0 24.917-14.606 36.259-35.916 36.259c-19.245 0-30.416-9.967-36.087-21.996m85.07-2.576l19.588-11.341c5.157 8.421 11.859 14.607 23.715 14.607c9.969 0 16.325-4.984 16.325-11.858c0-8.248-6.53-11.17-17.528-15.98l-6.013-2.58c-17.357-7.387-28.87-16.667-28.87-36.257c0-18.044 13.747-31.792 35.228-31.792c15.294 0 26.292 5.328 34.196 19.247l-18.732 12.03c-4.125-7.389-8.591-10.31-15.465-10.31c-7.046 0-11.514 4.468-11.514 10.31c0 7.217 4.468 10.14 14.778 14.608l6.014 2.577c20.45 8.765 31.963 17.7 31.963 37.804c0 21.654-17.012 33.51-39.867 33.51c-22.339 0-36.774-10.654-43.819-24.574"></path></svg>
|
||||
|
After Width: | Height: | Size: 995 B |
6
src/assets/tauri.svg
Normal file
@@ -0,0 +1,6 @@
|
||||
<svg width="206" height="231" viewBox="0 0 206 231" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M143.143 84C143.143 96.1503 133.293 106 121.143 106C108.992 106 99.1426 96.1503 99.1426 84C99.1426 71.8497 108.992 62 121.143 62C133.293 62 143.143 71.8497 143.143 84Z" fill="#FFC131"/>
|
||||
<ellipse cx="84.1426" cy="147" rx="22" ry="22" transform="rotate(180 84.1426 147)" fill="#24C8DB"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M166.738 154.548C157.86 160.286 148.023 164.269 137.757 166.341C139.858 160.282 141 153.774 141 147C141 144.543 140.85 142.121 140.558 139.743C144.975 138.204 149.215 136.139 153.183 133.575C162.73 127.404 170.292 118.608 174.961 108.244C179.63 97.8797 181.207 86.3876 179.502 75.1487C177.798 63.9098 172.884 53.4021 165.352 44.8883C157.82 36.3744 147.99 30.2165 137.042 27.1546C126.095 24.0926 114.496 24.2568 103.64 27.6274C92.7839 30.998 83.1319 37.4317 75.8437 46.1553C74.9102 47.2727 74.0206 48.4216 73.176 49.5993C61.9292 50.8488 51.0363 54.0318 40.9629 58.9556C44.2417 48.4586 49.5653 38.6591 56.679 30.1442C67.0505 17.7298 80.7861 8.57426 96.2354 3.77762C111.685 -1.01901 128.19 -1.25267 143.769 3.10474C159.348 7.46215 173.337 16.2252 184.056 28.3411C194.775 40.457 201.767 55.4101 204.193 71.404C206.619 87.3978 204.374 103.752 197.73 118.501C191.086 133.25 180.324 145.767 166.738 154.548ZM41.9631 74.275L62.5557 76.8042C63.0459 72.813 63.9401 68.9018 65.2138 65.1274C57.0465 67.0016 49.2088 70.087 41.9631 74.275Z" fill="#FFC131"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M38.4045 76.4519C47.3493 70.6709 57.2677 66.6712 67.6171 64.6132C65.2774 70.9669 64 77.8343 64 85.0001C64 87.1434 64.1143 89.26 64.3371 91.3442C60.0093 92.8732 55.8533 94.9092 51.9599 97.4256C42.4128 103.596 34.8505 112.392 30.1816 122.756C25.5126 133.12 23.9357 144.612 25.6403 155.851C27.3449 167.09 32.2584 177.598 39.7906 186.112C47.3227 194.626 57.153 200.784 68.1003 203.846C79.0476 206.907 90.6462 206.743 101.502 203.373C112.359 200.002 122.011 193.568 129.299 184.845C130.237 183.722 131.131 182.567 131.979 181.383C143.235 180.114 154.132 176.91 164.205 171.962C160.929 182.49 155.596 192.319 148.464 200.856C138.092 213.27 124.357 222.426 108.907 227.222C93.458 232.019 76.9524 232.253 61.3736 227.895C45.7948 223.538 31.8055 214.775 21.0867 202.659C10.3679 190.543 3.37557 175.59 0.949823 159.596C-1.47592 143.602 0.768139 127.248 7.41237 112.499C14.0566 97.7497 24.8183 85.2327 38.4045 76.4519ZM163.062 156.711L163.062 156.711C162.954 156.773 162.846 156.835 162.738 156.897C162.846 156.835 162.954 156.773 163.062 156.711Z" fill="#24C8DB"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.5 KiB |
127
src/index.html
Normal file
@@ -0,0 +1,127 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Radio1 Player</title>
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<script src="main.js" defer type="module"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="app-container">
|
||||
<div class="bg-shape shape-1"></div>
|
||||
<div class="bg-shape shape-2"></div>
|
||||
|
||||
<main class="glass-card">
|
||||
<header data-tauri-drag-region>
|
||||
<button id="menu-btn" class="icon-btn" aria-label="Menu">
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
|
||||
stroke-linecap="round" stroke-linejoin="round">
|
||||
<line x1="3" y1="12" x2="21" y2="12"></line>
|
||||
<line x1="3" y1="6" x2="21" y2="6"></line>
|
||||
<line x1="3" y1="18" x2="21" y2="18"></line>
|
||||
</svg>
|
||||
</button>
|
||||
<div class="header-info" data-tauri-drag-region>
|
||||
<span class="app-title">Radio1 Player</span>
|
||||
<span class="status-indicator" id="status-indicator">
|
||||
<span class="status-dot"></span> <span id="status-text">Ready</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="header-buttons">
|
||||
<button id="cast-toggle-btn" class="icon-btn" aria-label="Cast">
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
|
||||
stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M2 16.1A5 5 0 0 1 5.9 20M2 12.05A9 9 0 0 1 9.95 20M2 8V6a14 14 0 0 1 14 14h-2" />
|
||||
<rect x="2" y="2" width="20" height="20" rx="2" ry="2" style="opacity:0" />
|
||||
</svg>
|
||||
</button>
|
||||
<button id="close-btn" class="icon-btn close-btn" aria-label="Close">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
|
||||
stroke-linecap="round" stroke-linejoin="round">
|
||||
<line x1="18" y1="6" x2="6" y2="18"></line>
|
||||
<line x1="6" y1="6" x2="18" y2="18"></line>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section class="artwork-section">
|
||||
<div class="artwork-container">
|
||||
<div class="artwork-placeholder">
|
||||
<span class="station-logo-text">1</span>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="track-info">
|
||||
<h2 id="station-name">Radio 1 MB</h2>
|
||||
<p id="station-subtitle">Live Stream</p>
|
||||
</section>
|
||||
|
||||
<!-- Visual Progress Bar (Live) -->
|
||||
<div class="progress-container">
|
||||
<div class="progress-bar">
|
||||
<div class="progress-fill"></div>
|
||||
<div class="progress-handle"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section class="controls-section">
|
||||
<button id="prev-btn" class="control-btn secondary" aria-label="Previous Station">
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor">
|
||||
<path d="M6 6h2v12H6zm3.5 6l8.5 6V6z" />
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<button id="play-btn" class="control-btn primary" aria-label="Play">
|
||||
<div class="icon-container">
|
||||
<!-- Play Icon -->
|
||||
<svg id="icon-play" width="32" height="32" viewBox="0 0 24 24" fill="currentColor">
|
||||
<path d="M8 5v14l11-7z" />
|
||||
</svg>
|
||||
<!-- Stop/Pause Icon (Hidden by default) -->
|
||||
<svg id="icon-stop" class="hidden" width="32" height="32" viewBox="0 0 24 24" fill="currentColor">
|
||||
<path d="M6 6h12v12H6z" />
|
||||
</svg>
|
||||
</div>
|
||||
</button>
|
||||
|
||||
<button id="next-btn" class="control-btn secondary" aria-label="Next Station">
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor">
|
||||
<path d="M6 18l8.5-6L6 6v12zM16 6v12h2V6h-2z" />
|
||||
</svg>
|
||||
</button>
|
||||
</section>
|
||||
|
||||
<section class="volume-section">
|
||||
<button id="mute-btn" class="icon-btn small">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon>
|
||||
<path d="M19.07 4.93a10 10 0 0 1 0 14.14M15.54 8.46a5 5 0 0 1 0 7.07"></path>
|
||||
</svg>
|
||||
</button>
|
||||
<div class="slider-container">
|
||||
<input type="range" id="volume-slider" min="0" max="100" value="50">
|
||||
</div>
|
||||
<span id="volume-value">50%</span>
|
||||
</section>
|
||||
|
||||
<!-- Hidden Cast Overlay -->
|
||||
<div id="cast-overlay" class="overlay hidden">
|
||||
<div class="overlay-content">
|
||||
<h3>Connect to Device</h3>
|
||||
<ul id="device-list">
|
||||
<li>Searching...</li>
|
||||
</ul>
|
||||
<button id="close-overlay">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</main>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
277
src/main.js
Normal file
@@ -0,0 +1,277 @@
|
||||
const { invoke } = window.__TAURI__.core;
|
||||
const { getCurrentWindow } = window.__TAURI__.window;
|
||||
|
||||
// State
|
||||
let stations = [];
|
||||
let currentIndex = 0;
|
||||
let isPlaying = false;
|
||||
let currentMode = 'local'; // 'local' | 'cast'
|
||||
let currentCastDevice = null;
|
||||
const audio = new Audio();
|
||||
|
||||
// UI Elements
|
||||
const stationNameEl = document.getElementById('station-name');
|
||||
const stationSubtitleEl = document.getElementById('station-subtitle');
|
||||
const statusTextEl = document.getElementById('status-text');
|
||||
const statusDotEl = document.querySelector('.status-dot');
|
||||
const playBtn = document.getElementById('play-btn');
|
||||
const iconPlay = document.getElementById('icon-play');
|
||||
const iconStop = document.getElementById('icon-stop');
|
||||
const prevBtn = document.getElementById('prev-btn');
|
||||
const nextBtn = document.getElementById('next-btn');
|
||||
const volumeSlider = document.getElementById('volume-slider');
|
||||
const volumeValue = document.getElementById('volume-value');
|
||||
const castBtn = document.getElementById('cast-toggle-btn');
|
||||
const castOverlay = document.getElementById('cast-overlay');
|
||||
const closeOverlayBtn = document.getElementById('close-overlay');
|
||||
const deviceListEl = document.getElementById('device-list');
|
||||
const logoTextEl = document.querySelector('.station-logo-text');
|
||||
|
||||
// Init
|
||||
async function init() {
|
||||
await loadStations();
|
||||
setupEventListeners();
|
||||
updateUI();
|
||||
}
|
||||
|
||||
async function loadStations() {
|
||||
try {
|
||||
const resp = await fetch('stations.json');
|
||||
stations = await resp.json();
|
||||
if (stations.length > 0) {
|
||||
currentIndex = 0;
|
||||
loadStation(currentIndex);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Failed to load stations', e);
|
||||
statusTextEl.textContent = 'Error loading stations';
|
||||
}
|
||||
}
|
||||
|
||||
function setupEventListeners() {
|
||||
playBtn.addEventListener('click', togglePlay);
|
||||
prevBtn.addEventListener('click', playPrev);
|
||||
nextBtn.addEventListener('click', playNext);
|
||||
|
||||
volumeSlider.addEventListener('input', handleVolumeInput);
|
||||
|
||||
castBtn.addEventListener('click', openCastOverlay);
|
||||
closeOverlayBtn.addEventListener('click', closeCastOverlay);
|
||||
|
||||
// Close button
|
||||
document.getElementById('close-btn').addEventListener('click', async () => {
|
||||
const appWindow = getCurrentWindow();
|
||||
await appWindow.close();
|
||||
});
|
||||
|
||||
// Menu button - explicit functionality or placeholder?
|
||||
// For now just log or maybe show about
|
||||
document.getElementById('menu-btn').addEventListener('click', () => {
|
||||
// Future: Settings menu
|
||||
console.log('Menu clicked');
|
||||
});
|
||||
|
||||
// Hotkeys?
|
||||
}
|
||||
|
||||
function loadStation(index) {
|
||||
if (index < 0 || index >= stations.length) return;
|
||||
const station = stations[index];
|
||||
|
||||
stationNameEl.textContent = station.name;
|
||||
stationSubtitleEl.textContent = currentMode === 'cast' ? `Casting to ${currentCastDevice}` : 'Live Stream';
|
||||
|
||||
// Update Logo Text (First letter or number)
|
||||
// Simple heuristic: if name has a number, use it, else first letter
|
||||
const numberMatch = station.name.match(/\d+/);
|
||||
if (numberMatch) {
|
||||
logoTextEl.textContent = numberMatch[0];
|
||||
} else {
|
||||
logoTextEl.textContent = station.name.charAt(0).toUpperCase();
|
||||
}
|
||||
}
|
||||
|
||||
async function togglePlay() {
|
||||
if (isPlaying) {
|
||||
await stop();
|
||||
} else {
|
||||
await play();
|
||||
}
|
||||
}
|
||||
|
||||
async function play() {
|
||||
const station = stations[currentIndex];
|
||||
if (!station) return;
|
||||
|
||||
statusTextEl.textContent = 'Buffering...';
|
||||
statusDotEl.style.backgroundColor = 'var(--text-muted)'; // Grey/Yellow while loading
|
||||
|
||||
if (currentMode === 'local') {
|
||||
audio.src = station.url;
|
||||
audio.volume = volumeSlider.value / 100;
|
||||
try {
|
||||
await audio.play();
|
||||
isPlaying = true;
|
||||
updateUI();
|
||||
} catch (e) {
|
||||
console.error('Playback failed', e);
|
||||
statusTextEl.textContent = 'Error';
|
||||
}
|
||||
} else if (currentMode === 'cast' && currentCastDevice) {
|
||||
// Cast logic
|
||||
try {
|
||||
await invoke('cast_play', { deviceName: currentCastDevice, url: station.url });
|
||||
isPlaying = true;
|
||||
// Sync volume
|
||||
const vol = volumeSlider.value / 100;
|
||||
invoke('cast_set_volume', { deviceName: currentCastDevice, volume: vol });
|
||||
updateUI();
|
||||
} catch (e) {
|
||||
console.error('Cast failed', e);
|
||||
statusTextEl.textContent = 'Cast Error';
|
||||
currentMode = 'local'; // Fallback
|
||||
updateUI();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function stop() {
|
||||
if (currentMode === 'local') {
|
||||
audio.pause();
|
||||
audio.src = '';
|
||||
} else if (currentMode === 'cast' && currentCastDevice) {
|
||||
try {
|
||||
await invoke('cast_stop', { deviceName: currentCastDevice });
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
isPlaying = false;
|
||||
updateUI();
|
||||
}
|
||||
|
||||
async function playNext() {
|
||||
if (stations.length === 0) return;
|
||||
|
||||
// If playing, stop first? Or seamless?
|
||||
// For radio, seamless switch requires stop then play new URL
|
||||
const wasPlaying = isPlaying;
|
||||
|
||||
if (wasPlaying) await stop();
|
||||
|
||||
currentIndex = (currentIndex + 1) % stations.length;
|
||||
loadStation(currentIndex);
|
||||
|
||||
if (wasPlaying) await play();
|
||||
}
|
||||
|
||||
async function playPrev() {
|
||||
if (stations.length === 0) return;
|
||||
|
||||
const wasPlaying = isPlaying;
|
||||
|
||||
if (wasPlaying) await stop();
|
||||
|
||||
currentIndex = (currentIndex - 1 + stations.length) % stations.length;
|
||||
loadStation(currentIndex);
|
||||
|
||||
if (wasPlaying) await play();
|
||||
}
|
||||
|
||||
function updateUI() {
|
||||
// Play/Stop Button
|
||||
if (isPlaying) {
|
||||
iconPlay.classList.add('hidden');
|
||||
iconStop.classList.remove('hidden');
|
||||
playBtn.classList.add('playing'); // Add pulsing ring animation
|
||||
statusTextEl.textContent = 'Playing';
|
||||
statusDotEl.style.backgroundColor = 'var(--success)';
|
||||
stationSubtitleEl.textContent = currentMode === 'cast' ? `Casting to ${currentCastDevice}` : 'Live Stream';
|
||||
} else {
|
||||
iconPlay.classList.remove('hidden');
|
||||
iconStop.classList.add('hidden');
|
||||
playBtn.classList.remove('playing'); // Remove pulsing ring
|
||||
statusTextEl.textContent = 'Ready';
|
||||
statusDotEl.style.backgroundColor = 'var(--text-muted)';
|
||||
stationSubtitleEl.textContent = currentMode === 'cast' ? `Connected to ${currentCastDevice}` : 'Live Stream';
|
||||
}
|
||||
}
|
||||
|
||||
function handleVolumeInput() {
|
||||
const val = volumeSlider.value;
|
||||
volumeValue.textContent = `${val}%`;
|
||||
const decimals = val / 100;
|
||||
|
||||
if (currentMode === 'local') {
|
||||
audio.volume = decimals;
|
||||
} else if (currentMode === 'cast' && currentCastDevice) {
|
||||
invoke('cast_set_volume', { deviceName: currentCastDevice, volume: decimals });
|
||||
}
|
||||
}
|
||||
|
||||
// Cast Logic
|
||||
async function openCastOverlay() {
|
||||
castOverlay.classList.remove('hidden');
|
||||
deviceListEl.innerHTML = '<li>Scanning...</li>';
|
||||
|
||||
try {
|
||||
const devices = await invoke('list_cast_devices');
|
||||
deviceListEl.innerHTML = '';
|
||||
|
||||
// Add "Stop Casting / Local" option
|
||||
const localLi = document.createElement('li');
|
||||
localLi.textContent = 'This Computer (Local Playback)';
|
||||
localLi.onclick = () => selectCastDevice(null);
|
||||
deviceListEl.appendChild(localLi);
|
||||
|
||||
if (devices.length === 0) {
|
||||
const li = document.createElement('li');
|
||||
li.textContent = 'No speakers found';
|
||||
deviceListEl.appendChild(li);
|
||||
} else {
|
||||
devices.forEach(d => {
|
||||
const li = document.createElement('li');
|
||||
li.textContent = d;
|
||||
li.onclick = () => selectCastDevice(d);
|
||||
deviceListEl.appendChild(li);
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
deviceListEl.innerHTML = `<li>Error: ${e}</li>`;
|
||||
}
|
||||
}
|
||||
|
||||
function closeCastOverlay() {
|
||||
castOverlay.classList.add('hidden');
|
||||
}
|
||||
|
||||
async function selectCastDevice(deviceName) {
|
||||
closeCastOverlay();
|
||||
|
||||
// If checking same device, do nothing
|
||||
if (deviceName === currentCastDevice) return;
|
||||
|
||||
// If switching mode, stop current playback
|
||||
if (isPlaying) {
|
||||
await stop();
|
||||
}
|
||||
|
||||
if (deviceName) {
|
||||
currentMode = 'cast';
|
||||
currentCastDevice = deviceName;
|
||||
castBtn.style.color = 'var(--success)';
|
||||
} else {
|
||||
currentMode = 'local';
|
||||
currentCastDevice = null;
|
||||
castBtn.style.color = 'var(--text-main)';
|
||||
}
|
||||
|
||||
updateUI();
|
||||
|
||||
// Auto-play if we were playing? Let's stay stopped to be safe/explicit
|
||||
// Or auto-play for better UX?
|
||||
// Let's prompt user to play.
|
||||
}
|
||||
|
||||
window.addEventListener('DOMContentLoaded', init);
|
||||
8
src/stations.json
Normal file
@@ -0,0 +1,8 @@
|
||||
[
|
||||
{ "name": "Radio 1 (Maribor)", "url": "https://live.radio1.si/Radio1MB" },
|
||||
{ "name": "Radio 1 Rock", "url": "https://live.radio.si/Radio1Rock" },
|
||||
{ "name": "Toti Radio", "url": "https://live.radio.si/Toti" },
|
||||
{ "name": "Radio City", "url": "https://stream1.radiocity.si/CityMp3128.mp3" },
|
||||
{ "name": "Radio 1 SLO 320", "url": "https://live.radio.si/Radio1SLO320" },
|
||||
{ "name": "Radio S", "url": "https://live.radio.si/radios" }
|
||||
]
|
||||
473
src/styles.css
Normal file
@@ -0,0 +1,473 @@
|
||||
:root {
|
||||
--bg-gradient: linear-gradient(135deg, #7b7fd8, #b57cf2);
|
||||
--glass-bg: rgba(255, 255, 255, 0.1);
|
||||
--glass-border: rgba(255, 255, 255, 0.2);
|
||||
--accent: #dfa6ff;
|
||||
--accent-glow: rgba(223, 166, 255, 0.5);
|
||||
--text-main: #ffffff;
|
||||
--text-muted: rgba(255, 255, 255, 0.7);
|
||||
--danger: #cf6679;
|
||||
--success: #7dffb3;
|
||||
--card-radius: 10px;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
user-select: none;
|
||||
-webkit-user-drag: none;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/* Hide Scrollbars */
|
||||
::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
background: linear-gradient(-45deg, #7b7fd8, #b57cf2, #8b5cf6, #6930c3);
|
||||
background-size: 400% 400%;
|
||||
animation: gradientShift 15s ease infinite;
|
||||
font-family: 'Segoe UI', system-ui, sans-serif;
|
||||
color: var(--text-main);
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
@keyframes gradientShift {
|
||||
0% {
|
||||
background-position: 0% 50%;
|
||||
}
|
||||
50% {
|
||||
background-position: 100% 50%;
|
||||
}
|
||||
100% {
|
||||
background-position: 0% 50%;
|
||||
}
|
||||
}
|
||||
|
||||
/* Background Blobs */
|
||||
.bg-shape {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
filter: blur(60px);
|
||||
z-index: 0;
|
||||
opacity: 0.6;
|
||||
animation: float 10s infinite alternate;
|
||||
}
|
||||
|
||||
.shape-1 {
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
background: #5e60ce;
|
||||
top: -50px;
|
||||
left: -50px;
|
||||
}
|
||||
|
||||
.shape-2 {
|
||||
width: 250px;
|
||||
height: 250px;
|
||||
background: #ff6bf0;
|
||||
bottom: -50px;
|
||||
right: -50px;
|
||||
animation-delay: -5s;
|
||||
}
|
||||
|
||||
@keyframes float {
|
||||
0% { transform: translate(0, 0); }
|
||||
100% { transform: translate(30px, 30px); }
|
||||
}
|
||||
|
||||
.app-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
padding: 10px; /* Slight padding from window edges if desired, or 0 */
|
||||
}
|
||||
|
||||
.glass-card {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: var(--glass-bg);
|
||||
border: 1px solid var(--glass-border);
|
||||
backdrop-filter: blur(24px);
|
||||
border-radius: var(--card-radius);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 24px;
|
||||
box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
/* Header */
|
||||
header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 20px;
|
||||
-webkit-app-region: drag; /* Draggable area */
|
||||
}
|
||||
|
||||
.header-info {
|
||||
text-align: center;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.app-title {
|
||||
font-weight: 600;
|
||||
font-size: 1rem;
|
||||
color: var(--text-main);
|
||||
}
|
||||
|
||||
.status-indicator {
|
||||
font-size: 0.8rem;
|
||||
color: var(--success);
|
||||
margin-top: 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.status-dot {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
background-color: var(--success);
|
||||
border-radius: 50%;
|
||||
box-shadow: 0 0 8px var(--success);
|
||||
}
|
||||
|
||||
.icon-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--text-main);
|
||||
padding: 8px;
|
||||
cursor: pointer;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: background 0.2s;
|
||||
-webkit-app-region: no-drag; /* Buttons clickable */
|
||||
}
|
||||
|
||||
.icon-btn:hover {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.header-buttons {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
align-items: center;
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
|
||||
.close-btn:hover {
|
||||
background: rgba(207, 102, 121, 0.3) !important;
|
||||
color: var(--danger);
|
||||
}
|
||||
|
||||
/* Artwork */
|
||||
.artwork-section {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.artwork-container {
|
||||
width: 220px;
|
||||
height: 220px;
|
||||
border-radius: 24px;
|
||||
padding: 6px; /* spacing for ring */
|
||||
background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0));
|
||||
box-shadow: 5px 5px 15px rgba(0,0,0,0.1), inset 1px 1px 2px rgba(255,255,255,0.3);
|
||||
}
|
||||
|
||||
.artwork-placeholder {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(135deg, #4ea8de, #6930c3);
|
||||
border-radius: 20px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
box-shadow: inset 0 0 20px rgba(0,0,0,0.2);
|
||||
}
|
||||
|
||||
.station-logo-text {
|
||||
font-size: 5rem;
|
||||
font-weight: 800;
|
||||
font-style: italic;
|
||||
color: rgba(255,255,255,0.9);
|
||||
text-shadow: 0 4px 10px rgba(0,0,0,0.3);
|
||||
}
|
||||
|
||||
/* Track Info */
|
||||
.track-info {
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.track-info h2 {
|
||||
margin: 0;
|
||||
font-size: 1.5rem;
|
||||
font-weight: 600;
|
||||
text-shadow: 0 2px 4px rgba(0,0,0,0.2);
|
||||
}
|
||||
|
||||
.track-info p {
|
||||
margin: 6px 0 0;
|
||||
color: var(--text-muted);
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
/* Progress Bar (Visual) */
|
||||
.progress-container {
|
||||
width: 100%;
|
||||
height: 4px;
|
||||
background: rgba(255,255,255,0.1);
|
||||
border-radius: 2px;
|
||||
margin-bottom: 30px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.progress-fill {
|
||||
width: 100%; /* Live always full or pulsing */
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, var(--accent), #fff);
|
||||
border-radius: 2px;
|
||||
opacity: 0.8;
|
||||
box-shadow: 0 0 10px var(--accent-glow);
|
||||
}
|
||||
|
||||
.progress-handle {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 50%;
|
||||
transform: translate(50%, -50%);
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
background: #fff;
|
||||
border-radius: 50%;
|
||||
box-shadow: 0 0 10px rgba(255,255,255,0.8);
|
||||
}
|
||||
|
||||
/* Controls */
|
||||
.controls-section {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 30px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.control-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--text-main);
|
||||
cursor: pointer;
|
||||
transition: transform 0.1s, opacity 0.2s;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.control-btn:active {
|
||||
transform: scale(0.9);
|
||||
}
|
||||
|
||||
.control-btn.secondary {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border-radius: 50%;
|
||||
background: rgba(255,255,255,0.05);
|
||||
border: 1px solid rgba(255,255,255,0.1);
|
||||
box-shadow: 0 4px 10px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.control-btn.primary {
|
||||
width: 72px;
|
||||
height: 72px;
|
||||
border-radius: 50%;
|
||||
background: linear-gradient(135deg, rgba(255,255,255,0.2), rgba(255,255,255,0.05));
|
||||
border: 1px solid rgba(255,255,255,0.3);
|
||||
box-shadow: 0 8px 20px rgba(0,0,0,0.2), inset 0 0 10px rgba(255,255,255,0.1);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.control-btn.primary svg {
|
||||
filter: drop-shadow(0 0 5px var(--accent-glow));
|
||||
}
|
||||
|
||||
/* Playing state - pulsing glow ring */
|
||||
.control-btn.primary.playing {
|
||||
animation: pulse-ring 2s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes pulse-ring {
|
||||
0%, 100% {
|
||||
box-shadow: 0 8px 20px rgba(0,0,0,0.2),
|
||||
inset 0 0 10px rgba(255,255,255,0.1),
|
||||
0 0 0 0 rgba(223, 166, 255, 0.7);
|
||||
}
|
||||
50% {
|
||||
box-shadow: 0 8px 20px rgba(0,0,0,0.2),
|
||||
inset 0 0 10px rgba(255,255,255,0.1),
|
||||
0 0 0 8px rgba(223, 166, 255, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Icon container prevents layout jump */
|
||||
.icon-container {
|
||||
position: relative;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.icon-container svg {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Volume */
|
||||
.volume-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin-top: auto;
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
.slider-container {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
input[type=range] {
|
||||
width: 100%;
|
||||
background: transparent;
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
|
||||
input[type=range]::-webkit-slider-runnable-track {
|
||||
width: 100%;
|
||||
height: 4px;
|
||||
cursor: pointer;
|
||||
background: rgba(255,255,255,0.2);
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
input[type=range]::-webkit-slider-thumb {
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
border-radius: 50%;
|
||||
background: #ffffff;
|
||||
cursor: pointer;
|
||||
-webkit-appearance: none;
|
||||
margin-top: -6px; /* align with track */
|
||||
box-shadow: 0 0 10px rgba(0,0,0,0.2);
|
||||
}
|
||||
|
||||
#volume-value {
|
||||
font-size: 0.8rem;
|
||||
font-weight: 500;
|
||||
width: 30px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.icon-btn.small {
|
||||
padding: 0;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
/* Cast Overlay */
|
||||
.overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0,0,0,0.6);
|
||||
backdrop-filter: blur(10px);
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: var(--card-radius);
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: opacity 0.3s;
|
||||
}
|
||||
|
||||
.overlay:not(.hidden) {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.overlay-content {
|
||||
background: #2a2a2a;
|
||||
padding: 24px;
|
||||
border-radius: 16px;
|
||||
width: 80%;
|
||||
max-height: 70%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-shadow: 0 10px 30px rgba(0,0,0,0.5);
|
||||
color: var(--text-main);
|
||||
}
|
||||
|
||||
.overlay-content h3 {
|
||||
margin-top: 0;
|
||||
font-size: 1.1rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#device-list {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 16px 0;
|
||||
overflow-y: auto;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
#device-list li {
|
||||
padding: 10px;
|
||||
border-bottom: 1px solid rgba(255,255,255,0.1);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#device-list li:hover {
|
||||
background: rgba(255,255,255,0.1);
|
||||
}
|
||||
|
||||
#close-overlay {
|
||||
background: var(--danger);
|
||||
border: none;
|
||||
padding: 10px;
|
||||
border-radius: 8px;
|
||||
color: white;
|
||||
cursor: pointer;
|
||||
font-weight: 600;
|
||||
}
|
||||