Skip to content

🐛 YouTube player shows Error 153 in production Tauri build #2

@BunsDev

Description

@BunsDev

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

  1. Open KnotCode desktop app (production build)
  2. Go to YouTube plugin in sidebar
  3. Paste any YouTube video or playlist link
  4. 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

  1. 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.
  2. Open in external browser: When in Tauri production mode, open YouTube in the system browser or a separate webview window with an HTTP origin.
  3. Proxy approach: Route the YouTube embed through a local HTTP server running in the Tauri backend (Rust side).
  4. 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.tsxbuildEmbedUrl(), 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions