Player quality + captions controls (piped-features)

- Quality button opens a modal picker over the video: Auto at the top plus
  every rung from the HLS master's variant list (parsed in the router;
  Piped videoStreams is unreliable), virtual-focus list like the rest of
  the dev player's chrome, OK applies / Back cancels, panel auto-sizes.
- Applying a quality rebuilds the /api/hls URL with the quality filter and
  restarts at the saved position (stop->stopped-edge->play), persists to
  playback.preferred_quality, keeps the retry URL list consistent.
- Captions button toggles globalCaptionMode On/Off (+ first-track fallback
  when the OS language match finds nothing); N/A when the video has none.
- Status line above the button row: 'Quality: Auto (1080p) | Captions: On'
  tracks streamingSegment while auto ramps.
- Fix: QualityLevelsFromPiped sort crashed the /streams converter (string
  vs AA compare); replaced by QualityLevelsFromHlsMaster.
- Seam tests for picker open/navigate/apply/cancel/clamp + captions toggle;
  ButtonRow specs updated for the 4-button row. Lib tag PIPED-LIB-26.
This commit is contained in:
spaghet committed 2026-11-24 21:50:41 -05:00
1 parent b7183f3603
commit 7577f89df6
19 files changed
+887 -23

No files matched your search

@@ -129,7 +129,7 @@ namespace Http
end function
function LibBuildTag() as string
return "PIPED-LIB-24"
return "PIPED-LIB-26"
end function
function FetchJson(path as string, params = invalid as object) as dynamic
@@ -680,10 +680,34 @@ namespace Http
return true
end if
m.SendJson(response, PipedToInvidious.VideoMetadataFromPiped(data, ValidString(context.videoId)))
metadata = PipedToInvidious.VideoMetadataFromPiped(data, ValidString(context.videoId))
m.FillQualityLadder(metadata, ValidString(data.hls))
m.SendJson(response, metadata)
return true
end function
' The picker's ladder must mirror the HLS master's variants (that is what
' the /api/hls quality filter slices). videoStreams is unreliable: often
' empty or missing the master's top rungs. One extra small-text fetch per
' video; on failure the ladder stays empty and the player falls back to
' the standard rung list.
function FillQualityLadder(metadata as object, masterUrl as string) as void
if StringUtils.IsNullOrEmpty(masterUrl) or not IsAssociativeArray(metadata)
return
end if
response = HttpClient.Get(masterUrl).Await()
if not response.IsSuccess()
LogWarn("Piped backend: HLS master fetch failed", response.StatusCode())
return
end if
levels = PipedToInvidious.QualityLevelsFromHlsMaster(response.Text())
if levels.Count() > 0
metadata["qualityLevels"] = levels
end if
end function
function GetComments(context as object) as boolean
request = context.request
response = context.response