diff --git a/.beads/issues.jsonl b/.beads/issues.jsonl new file mode 100644 index 0000000..8ad1742 --- /dev/null +++ b/.beads/issues.jsonl @@ -0,0 +1 @@ +{"_type":"issue","id":"dreamio-4yn","title":"Build WKWebView MVP shell","description":"Create the first Dreamio MVP implementation: a minimal iOS WKWebView wrapper around hosted Stremio Web, with configuration, launch behavior, diagnostics, and documentation for real-device viability testing.","acceptance_criteria":"App project exists; WKWebView loads hosted Stremio Web; external/new-window navigation is handled; basic diagnostics and manual test documentation exist; quality gates are run or documented.","status":"closed","priority":1,"issue_type":"feature","owner":"dishes@dpdrm.com","created_at":"2026-05-24T14:55:12Z","created_by":"dirtydishes","updated_at":"2026-05-24T14:59:44Z","closed_at":"2026-05-24T14:59:44Z","close_reason":"Implemented the MVP WKWebView iOS shell, added run and validation documentation, and recorded current validation limits.","dependency_count":0,"dependent_count":0,"comment_count":0} diff --git a/PLAN.md b/PLAN.md new file mode 100644 index 0000000..60ce690 --- /dev/null +++ b/PLAN.md @@ -0,0 +1,245 @@ +# Dreamio iOS Plan + +## Goal + +Build **Dreamio**, a thin iOS wrapper around `stremio-web` for TestFlight, personal sideload, and private-device use. The v1 target is direct web playback only: debrid-backed HTTP/HLS sources that iOS WebKit can play without an on-device torrent engine or local streaming server. + +## Product Positioning + +Dreamio is not a public App Store product by default. Treat TestFlight and personal sideload as the intended distribution path until a separate App Store review strategy exists. + +Avoid bundling, hardcoding, or presenting anything that implies unauthorized content access. Dreamio should behave like a web shell for user-configured Stremio flows, not a content service. + +## Non-Goals + +- On-device torrent engine +- Local streaming server parity with desktop +- Public App Store release in v1 +- Full desktop feature parity in v1 +- Large native rewrite in Swift/UIKit +- Native player bridge unless real-device testing proves it is needed + +## Recommended Base + +1. Use `stremio-web` as the app UI and flow source. +2. Do not start from `stremio-shell` because the desktop Qt shell does not map cleanly to iOS. +3. Keep native iOS code minimal; let the web app do most work. +4. Start with hosted `stremio-web` in `WKWebView` before investing in local bundling. +5. Pin the upstream `stremio-web` version or commit once bundling begins. + +## Architecture (v1) + +1. Native iOS host app using `WKWebView`. +2. Hosted `stremio-web` viability check first. +3. Bundled `stremio-web` static assets only after hosted viability passes. +4. Local `index.html` loaded inside `WKWebView`, assuming routing, storage, CORS, CSP, and auth still work from the bundled context. +5. Tiny JS <-> native bridge only for proven gaps such as fullscreen, PiP, external links, share sheet behavior, or subtitles. +6. Optional `AVPlayer` bridge only if real-device playback or subtitle behavior makes web playback unacceptable. + +## Why This Is Feasible + +- Direct web playback removes the hardest iOS blockers. +- No torrent/local-streaming process is needed. +- iOS WebKit can handle a practical subset of media formats, especially HLS and many MP4 streams. +- `WKWebView` can host the Stremio web flow with minimal native code if auth, storage, and media constraints are handled carefully. + +## Feasibility Gates + +Do not move to the next phase until the current gate passes on a real iPhone. + +1. **Hosted web gate:** hosted `stremio-web` works inside `WKWebView` for login, browsing, addon flow, and library screens. +2. **Playback gate:** representative debrid-backed HLS and MP4 streams play on real iPhone/iPad hardware. +3. **Bundled app gate:** bundled static assets work without routing, storage, CORS, CSP, service worker, or auth regressions. +4. **Web-player sufficiency gate:** fullscreen, subtitles, PiP expectations, pause/resume, and background/foreground behavior are acceptable without a native player bridge. + +## Hard Blockers / Stop Conditions + +Pause or redesign the approach if any of these remain unresolved after focused investigation: + +1. Login cannot persist reliably in `WKWebView`. +2. Direct playback fails for both HLS and MP4 on real iOS devices. +3. `stremio-web` depends on browser APIs unavailable in `WKWebView` with no practical workaround. +4. Debrid or addon flows depend on blocked origins, popups, redirects, or auth behavior that cannot be safely handled. +5. Bundled local assets introduce CORS, CSP, or storage behavior that cannot be fixed without turning Dreamio into a large fork. + +## Implementation Steps + +### 1) Fast viability check + +1. Create a throwaway iOS app with a single `WKWebView`. +2. Point it to hosted `stremio-web` first. +3. Enable Safari Web Inspector for real-device debugging. +4. Verify login, browsing, addon install/config, catalog navigation, and library sync. +5. Test one representative playback flow before doing any local bundling. + +### 2) Playback validation (critical) + +1. Test known direct debrid streams on real iPhone and iPad hardware. +2. Validate at minimum: + - HLS (`.m3u8`), expected best path + - MP4, expected generally workable + - MKV/custom codecs, expected mixed or unsupported + - HEVC/H.265, especially device-generation differences + - HDR, surround audio, and embedded subtitles as likely edge cases +3. Track failures by protocol, container, codec, subtitle type, MIME/content type, HTTP status, and WebKit media error. +4. Do not track failures only by provider name; provider labels are less useful than format behavior. + +### 3) Local bundle integration + +1. Pin the upstream `stremio-web` version or commit. +2. Build `stremio-web` static assets. +3. Copy build output into Xcode project resources through a reproducible script or documented build step. +4. Load bundled `index.html` from the app sandbox. +5. Verify routing, static asset paths, service worker behavior, API origins, CSP, CORS, auth redirects, cookies, local storage, and IndexedDB. +6. Document any local patches separately so upstream updates remain possible. + +### 4) WebKit compatibility patches + +1. Handle service worker limitations by disabling, bypassing, or adapting the affected behavior if needed. +2. Fix popup and new-tab flows in `WKWebView`. +3. Confirm auth/session persistence across app relaunch. +4. Confirm local storage and IndexedDB behavior under normal iOS cache pressure. +5. Confirm touch UX, viewport sizing, safe areas, and rotation. +6. Confirm ATS/HTTPS behavior for all required remote requests. + +### 5) Optional native bridge additions + +Add only when real-device tests show a specific gap: + +- Fullscreen controls +- Picture in Picture +- External URL handling +- Share sheet/open-in-app behavior +- Subtitle import glue +- Minimal native player surface using `AVPlayer` + +## Native Bridge Decision Rule + +Stay web-only if HTML `