M7 DONE via delegation — pv.youtube plays HD with audio

After hitting the segment-timing wall on our hand-rolled DASH MPD
(audio drifted -25s -> -44s behind video on long content), pivoted to
delegating playback to plugin.video.youtube v7.4.3 which already has
years of sidx-parsed SegmentTimeline + multi-client fallback work.

torttube._play() now:
  1. Tries _delegate_to_pv_youtube(yt_id) — sets a resolved URL of
     'plugin://plugin.video.youtube/play/?video_id=<id>'. Kodi
     chain-resolves to pv.youtube which builds the proper MPD and
     hands inputstream.adaptive a correctly-aligned manifest. Default.
  2. Falls back to our DASH builder (still in code, gated by
     'dash_enabled' setting + dash.on marker) if pv.youtube is absent.
  3. Falls through to yt-dlp progressive 360p as the final safety net.

When delegating, we skip our SponsorBlock monitor — pv.youtube has its
own and would double-skip otherwise.

Verified live on a LibreELEC Pi: LTT 'Trump Phone' (which crashed
our DASH with audio sync errors growing to -44s) now plays HD with
audio synced. 'Please sign in' message in log is from the tv_unplugged
Innertube client; pv.youtube falls back to a working client
automatically — no user account required.

Settings: prefer_pv_youtube boolean (default true). Addon v0.0.11.
Reference: https://kodi.wiki/view/Add-on:YouTube
This commit is contained in:
Sulkta 2026-05-23 11:58:12 -07:00
parent 69ab07778f
commit 025a86b7aa
5 changed files with 102 additions and 12 deletions

View file

@ -86,7 +86,30 @@
progressive) is deprecated by YouTube; higher quality needs DASH
manifest generation. Code path exists, gated behind `TORTTUBE_DASH=1`.
## M7 — DASH / HD playback [WIP — close on segment timing]
## M7 — HD playback [DONE via delegation]
**Strategy pivoted 2026-05-23.** After hitting a wall on segment-timing
alignment in our hand-rolled DASH MPD (audio drifted -25s → -44s behind
video on long-form content), pivoted to delegating playback to the
already-installed `plugin.video.youtube` v7.4.3. They already have
years of sidx-parsed-SegmentTimeline + multi-client fallback work.
Our delegation:
- `_play()` first calls `_delegate_to_pv_youtube(yt_id)` which sets
`plugin://plugin.video.youtube/play/?video_id=<id>` via setResolvedUrl
- Kodi chain-resolves to pv.youtube, which builds the proper MPD
- inputstream.adaptive plays 1080p H.264 cleanly, audio in sync
- Multi-client Innertube fallback handles "Please sign in" rejection
on the `tv_unplugged` client — succeeds on the next client without
needing the user to link an account
Verified live on a LibreELEC Pi 2026-05-23 — LTT 'Trump Phone' video
played at 1080p with audio, fullscreen.
Settings: `prefer_pv_youtube` (default true). Disable to fall through
to our native DASH/progressive paths.
## M7-rejected — native DASH builder [PARKED]
- [x] sidecar `resolve_dash` op returns rustypipe's full
`video_only_streams` + `audio_streams` arrays (16+ representations)