Description
YouTube embedded player fails with Error 153 ("Video player configuration error") in the production Tauri desktop build. Videos/playlists load but cannot play.
Root Cause
YouTube's iframe embed API blocks playback from non-standard origins. In production Tauri builds, the webview serves content from tauri://localhost (custom protocol scheme), not a standard http:// or https:// origin. YouTube's embed player rejects this as an unauthorized embedding context.
Error 153 is part of YouTube's iframe API onError codes:
- 150/153: "The requested content cannot be played in an embedded player"
This works in dev mode because the origin is http://127.0.0.1:3080 (a standard HTTP origin).
Steps to Reproduce
- Open KnotCode desktop app (production build)
- Go to YouTube plugin in sidebar
- Paste any YouTube video or playlist link
- Observe: Player loads but shows Error 153 / "Video player configuration error"
Expected Behavior
YouTube videos and playlists should play in the embedded player.
Possible Solutions
- Tauri
devUrl in production (recommended): Configure Tauri to serve the frontend via a local HTTP server even in production builds, giving the webview a standard http://localhost:PORT origin. This can be done via the devUrl config or a Tauri plugin.
- Open in external browser: When in Tauri production mode, open YouTube in the system browser or a separate webview window with an HTTP origin.
- Proxy approach: Route the YouTube embed through a local HTTP server running in the Tauri backend (Rust side).
- Custom WebView configuration: Configure the Tauri webview to use
http://localhost as its origin instead of tauri://localhost.
Note: This issue and #1 (Spotify login) share the same root cause — Tauri's custom protocol origin breaking third-party services that expect standard HTTP origins. A unified solution (e.g., always serving from http://localhost in production) would fix both.
Affected Files
components/plugins/youtube/youtube-player.tsx — buildEmbedUrl(), iframe embed
src-tauri/tauri.conf.json — webview origin configuration
Environment
- KnotCode v1.0.0 (production Tauri build)
- macOS (Apple Silicon)
- Works correctly in
pnpm desktop:dev
Description
YouTube embedded player fails with Error 153 ("Video player configuration error") in the production Tauri desktop build. Videos/playlists load but cannot play.
Root Cause
YouTube's iframe embed API blocks playback from non-standard origins. In production Tauri builds, the webview serves content from
tauri://localhost(custom protocol scheme), not a standardhttp://orhttps://origin. YouTube's embed player rejects this as an unauthorized embedding context.Error 153 is part of YouTube's iframe API
onErrorcodes:This works in dev mode because the origin is
http://127.0.0.1:3080(a standard HTTP origin).Steps to Reproduce
Expected Behavior
YouTube videos and playlists should play in the embedded player.
Possible Solutions
devUrlin production (recommended): Configure Tauri to serve the frontend via a local HTTP server even in production builds, giving the webview a standardhttp://localhost:PORTorigin. This can be done via thedevUrlconfig or a Tauri plugin.http://localhostas its origin instead oftauri://localhost.Affected Files
components/plugins/youtube/youtube-player.tsx—buildEmbedUrl(), iframe embedsrc-tauri/tauri.conf.json— webview origin configurationEnvironment
pnpm desktop:dev