Dreamio Web Inspector and Playback Diagnostics
Enabled development-only Safari inspection for Dreamio's WKWebView and added token-safe diagnostics for console warnings, promise rejections, video failures, navigation errors, and HTTP navigation statuses.
Summary
This pass improves observability without changing Dreamio's login, navigation, addon browsing, or playback behavior. Debug builds on iOS 16.4 and newer now opt the WebView into Safari Web Inspector, and page diagnostics flow back to Xcode logs with URL queries, fragments, bearer tokens, and long token-like path segments redacted.
Changes Made
- Enabled
webView.isInspectableforDEBUGbuilds on iOS 16.4 and newer. - Installed a small
WKUserScriptat document start to observe console warnings, console errors, unhandled promise rejections, and dynamically inserted<video>elements. - Added native logging for
WKNavigationDelegateresponse statuses and load failures. - Added native redaction helpers before diagnostic data is printed.
- Kept all diagnostics behind
#if DEBUGso release builds do not expose the inspection or message bridge surface.
Context
The current Debridio VOD failure appears to need browser-level evidence: stream URL shape, request headers, response metadata, MIME type, and JavaScript media errors. Before adding a native player path, Dreamio needs a reliable way to inspect hosted Stremio Web inside the app and collect media failure details from the page itself.
Important Implementation Details
- The diagnostics bridge posts messages through
window.webkit.messageHandlers.dreamioDiagnostics. - The user script attaches to existing videos and videos inserted later through a
MutationObserver. - Video diagnostics include
networkState,readyState,currentSrc, media error code, and media error message. - The native logger strips URL query strings and fragments, redacts obvious token-like key values, redacts bearer credentials, and replaces long token-like path segments.
- A weak message-handler wrapper avoids the common
WKUserContentControllerretain cycle.
Relevant Diff Snippets
The snippets below are rendered with @pierre/diffs from diffs.com-compatible components.
Expected Impact for End-Users
There should be no visible behavior change for ordinary app use. For development builds, Safari should now show an inspectable Dreamio or web.stremio.com target while the app is foregrounded, making the playback failure much easier to diagnose.
Validation
- Ran
DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer xcodebuild -list -project Dreamio.xcodeprojto confirm theDreamioscheme. - Ran
DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer xcodebuild -project Dreamio.xcodeproj -scheme Dreamio -configuration Debug -destination 'generic/platform=iOS Simulator' CODE_SIGNING_ALLOWED=NO build. - The Debug simulator build succeeded.
kellcd: launch Dreamio, open Safari inspection, reproduce the Debridio VOD failure, and collect Console, Network, and media logs.Issues, Limitations, and Mitigations
- This does not fix playback. It adds the evidence-gathering surface for the next diagnosis step.
- Safari Web Inspector availability still depends on the device, iOS version, Safari settings, and the app being a debug/development build.
- Redaction is intentionally conservative but cannot prove every possible secret shape is removed. It strips common URL and token forms before logging.
- The first
xcodebuildattempt failed because the active developer directory pointed at Command Line Tools. Re-running withDEVELOPER_DIR=/Applications/Xcode.app/Contents/Developersucceeded.
Follow-up Work
- Use Safari Web Inspector on
kellcdto capture the failing stream request and media error details. - File a follow-up Beads issue if the evidence points to a native-player fallback, MIME/header adjustment, or hosted Stremio compatibility gap.
- Consider adding a temporary debug menu to toggle diagnostics if the log volume gets noisy during broader testing.