# TunePrime — Complete Ecosystem Specification & Machine-Readable Documentation

> TunePrime (`https://tuneprime.app`) is an independent, distraction-free media ecosystem. It provides high-performance web and mobile applications for audio and video entertainment without ads, subscriptions, or account walls.

## Ecosystem Architecture & Endpoints

| Service | Production URL | Description | Supported Platforms |
|---|---|---|---|
| **TunePrime Landing** | https://tuneprime.app | Central umbrella portal & live geo-radio taste player | Web, Mobile, Desktop |
| **TunePrime Radio & Podcasts** | https://radio.tuneprime.app | Live radio tuner (50k+ stations) & offline podcast downloader | PWA (iOS Safari / Android), Android APK, Desktop |
| **TunePrime TV** | https://tv.tuneprime.app | 4K Ultra HD 60fps IPTV player with 4-screen MultiView | Smart TV / Android TV, Web, Mobile |

---

## 1. TunePrime Radio & Podcasts (`https://radio.tuneprime.app`)

### Philosophy
- **"Just radio. Nothing else."** Designed specifically for car use, commuting, and distraction-free daily listening.
- **Zero Ads**: No banner ads, no inserted audio ads, no sponsor popups.
- **Zero Accounts**: No registration, no login, no tracking of personal identifiable information.

### Core Features
1. **50,000+ Worldwide Stations**:
   - Queryable and ranked live by popularity (`clickcount`) per country.
   - Comprehensive country directories (Romania, United Kingdom, United States, Germany, France, Italy, Spain, Netherlands, Moldova, etc.).
   - Curated high-reliability sports radios (TalkSPORT UK, Radio România Sport, Sport Total FM, Radio Marca Spain, Radio Sportiva Italy, RMC France, Grand Prix Radio F1).
2. **Car Cockpit UI**:
   - 6 oversized quick-access memory presets with tactile haptic feedback.
   - Day & Night high-contrast themes.
   - Sleep Timer (15, 30, 45, 60 minutes).
   - Adaptive two-finger Pinch-to-Zoom layout (dynamically adjusts to phones, tablets, car head units, and foldables like Samsung Galaxy Fold 4).
3. **Podcasts & 100% Offline Downloads**:
   - Apple iTunes & PodcastIndex directory with category browsing and search.
   - Offline episode download support using browser CacheStorage on Web (via Cloudflare CORS proxy) and local disk streaming on Android.
   - Dedicated "Downloaded" management view with exact file sizes in MB, download progress, and single or bulk delete.
4. **Offline-First PWA (Airplane Mode)**:
   - Custom Service Worker caching the entire App Shell (`web/sw.js`).
   - Launches instantaneously even in Airplane Mode without internet on iPhone (Safari PWA) and Android.

---

## 2. TunePrime TV (`https://tv.tuneprime.app`)

### Core Features
1. **4K Ultra HD & 60fps Playback Engine**:
   - Hardware-accelerated video decoding (HEVC/H.265, H.264, HDR10).
   - Zero-latency channel zapping and adaptive stream buffering.
2. **MultiView (Simultaneous Split-Screen)**:
   - 2×2 Quad MultiView (watch 4 live channels simultaneously).
   - 2×1 Dual MultiView (watch 2 live channels side-by-side).
   - 1-tap active audio switching between simultaneous streams.
3. **M3U, Xtream Codes & EPG**:
   - Native support for custom M3U playlists and Xtream Codes accounts.
   - Electronic Program Guide (EPG) with live timeline, program descriptions, and catch-up.
4. **Cross-Platform**:
   - Smart TV (Android TV / Google TV), tablet, smartphone, and desktop web.

---

## 3. Public APIs & Telemetry
- **Geo Detection**: `GET https://tuneprime.app/geo` → returns `{ country, continent, timezone }` based on Cloudflare edge inspection.
- **Live Online Presence**: `GET https://radio.tuneprime.app/heartbeat-stats` → returns `{ online_now, total_launches, days }` tracked via privacy-friendly Cloudflare KV.
- **Authentication**: None required. All public endpoints are open and CORS-enabled (`Access-Control-Allow-Origin: *`).
