diff --git a/README.md b/README.md new file mode 100644 index 0000000..aaa1749 --- /dev/null +++ b/README.md @@ -0,0 +1,42 @@ +# ytLive + +A creator-proof live-streaming and recording app for YouTube — native Windows (C# / WPF / .NET 8). + +## Design Principle + +> This software is so intuitive that even the most right-brained person can easily intuit and use it. + +Every feature is measured against this. One-click go-live, sane YouTube defaults, visual scene +building, and no dead ends — every action has a visible outcome. + +## Why ytLive + +OBS treats YouTube as an afterthought; SLOBS is Twitch-first with YouTube bolted on. ytLive is +designed and dedicated to YouTube livestreaming and recording, and to YouTube's specific quirks. + +## Run + +```bash +dotnet build # Windows only — WPF +dotnet run +``` + +## Version Roadmap + +| Version | Scope | +|---------|-------| +| v0.1 | Scene/source management, YouTube RTMP ingest, YouTube OAuth2, live chat, stream health | +| v0.2 | Recording to local file | +| v0.3 | Stream scheduling | +| v0.4 | Multi-destination restreaming | +| 1.0 | General availability | + +## Structure + +| Path | Role | +|------|------| +| `Models/` | Scene, Source, StreamConfig, StreamHealth, YouTube channel/chat | +| `ViewModels/` | MainViewModel — scenes, stream controls, chat | +| `Services/` | YouTubeAuthService (OAuth2), YouTubeStreamService (broadcast/health), YouTubeChatService (chat polling) | +| `Helpers/` | ViewModelBase, RelayCommand | +| `MainWindow.xaml` | Dark-theme main UI: scene/source panel, preview, chat, status bar | diff --git a/TASKS.md b/TASKS.md new file mode 100644 index 0000000..e69e282 --- /dev/null +++ b/TASKS.md @@ -0,0 +1,90 @@ +# ytLive — Task List + +## TASK 1 — Initial Scaffold + +**Goal:** Working C# / WPF project with MVVM architecture, dark-theme main window, and YouTube service stubs. + +### Status: ✅ Done +- Models: Scene, Source, StreamConfig, StreamHealth, YouTubeChannel, ChatMessage +- Services: YouTubeAuthService (OAuth2), YouTubeStreamService (broadcast/health), YouTubeChatService (chat polling) +- MainViewModel: scene management, stream controls, chat +- MainWindow: scene/source panel, preview area, chat panel, status bar +- Clean build, 0 warnings (WSL + Windows) + +--- + +## TASK 2 — YouTube OAuth2 Authentication + +**Goal:** Fully working Google OAuth2 flow — user clicks "YouTube", browser opens, authorization callback lands, channel info is stored. + +### Requirements: + +1. **Google Cloud OAuth credentials** — client ID + secret (user provides; needs "Localhost" redirect URI) +2. **Local HTTP listener** — `HttpListener` on `http://localhost:PORT/oauth2/callback` to catch the redirect +3. **Browser launch** — open the authorization URL in the default browser +4. **Token persistence** — store access/refresh tokens securely (Windows DPAPI), reload on startup +5. **UI state** — account name/avatar shown when connected, connection status reflected + +### Tests: + +- Mock token exchange response, verify channel info parsed +- Verify token refresh triggers when near expiry +- Verify credential load/save roundtrip + +### Status: Not started + +--- + +## TASK 3 — Capture Pipeline (Scenes/Sources) + +**Goal:** Real video preview in the center panel — display capture, window capture, webcam, images, text overlays, composited per scene. + +### Requirements: + +1. **Display capture** — Windows.Graphics.Capture API (WinRT), enumerate monitors +2. **Window capture** — enumerate top-level windows, capture per-window +3. **Webcam** — MediaCapture (WinRT) with device enumeration +4. **Image / text overlay** — static sources positioned/scaled/opacity +5. **Scene compositing** — per-scene source layering (z-order), preview rendered via D3DImage or MediaElement +6. **Drag/drop source placement** — intuitive, visual (per design principle) + +### Status: Not started + +--- + +## TASK 4 — RTMP Ingest to YouTube + +**Goal:** Push encoded video to YouTube's RTMP ingest. + +### Requirements: + +1. **Encoding** — H.264 (hardware via NVENC/AMD, fallback x264) + AAC audio +2. **RTMP push** — FFmpeg subprocess or native RTMP library +3. **Stream key management** — save keys securely, prefill default YouTube ingest URL `rtmp://a.rtmp.youtube.com/live2` +4. **Health stats** — bitrate, FPS, dropped frames reported live in the bottom bar +5. **One-click go live** — defaults that work out of the box + +### Status: Not started + +--- + +## TASK 5 — YouTube Live Stream Management + +**Goal:** Create/bind broadcasts, monitor YouTube-side stream health. + +### Requirements: + +1. **Broadcast creation** — title/description/visibility via API +2. **Stream binding** — create stream, bind to broadcast +3. **Health monitoring** — poll `liveBroadcasts` lifecycle status, surface YouTube health messages +4. **Live chat** — poll `liveChat/messages`, render in right panel, support Super Chat + membership badges + +### Status: Not started + +--- + +## Backlog (future versions) + +- v0.2 — Recording to local file +- v0.3 — Stream scheduling +- v0.4 — Multi-destination restreaming diff --git a/ai.md b/ai.md new file mode 100644 index 0000000..62500c4 --- /dev/null +++ b/ai.md @@ -0,0 +1,52 @@ +# ytLive — AI Guide + +## Run + +```bash +dotnet build # Windows only — WPF requires Windows target +dotnet run +``` + +Note: `EnableWindowsTargeting=true` is set in `ytLive.csproj`, so the project can be restored/built from WSL, but running requires Windows. + +## Tests + +No test framework set up yet. When added: `dotnet test`. + +## Architecture + +C# / WPF (.NET 8) following MVVM: + +| Path | Role | +|------|------| +| `Models/` | Plain data types — Scene, Source, StreamConfig, StreamHealth, YouTubeChannel, ChatMessage | +| `ViewModels/` | MainViewModel — exposes collections + commands for the UI | +| `Services/` | YouTube OAuth2, stream/broadcast management, live chat polling | +| `Helpers/` | ViewModelBase (INotifyPropertyChanged), RelayCommand | +| `MainWindow.xaml` | Dark theme; layout: top bar (controls), center (preview), left (scenes/sources), right (chat), bottom (health) | + +### Key patterns + +- `ViewModelBase.SetProperty()` for property change notifications +- `RelayCommand` for all button actions; commands gate on state (e.g. Start only when Offline) +- ViewModels are constructed in XAML (`` as DataContext) +- Services are currently instantiated in MainViewModel's constructor — no DI container yet + +### Current limitations / TODOs + +- `YouTubeAuthService` constructor takes empty client ID/secret strings — needs Google Cloud credentials +- `StartStream` is a stub (Task.Delay simulation) +- `ConnectYouTube` is a stub +- Preview panel is placeholder text +- No capture/encoding/RTMP yet +- No persistence layer (tokens, scenes, stream config all in-memory) + +## Design Principle + +> This software is so intuitive that even the most right-brained person can easily intuit and use it. + +Apply this to every UI decision: +- One-click go-live with working defaults +- Prefilled YouTube defaults (RTMP URL, bitrate, resolution, latency) +- Visual/drag-and-drop scene building over property panels +- Every action produces a visible outcome — no dead ends