Skip to content

[Feature]: Audition a search result before extracting it #442

Closed

Description

@thcp

Follow-on from #441.

The problem

Search returns a title, a channel and a duration. That is often not enough to tell a live take from a studio one, a remaster from the original, or the right cover from six wrong ones.

Getting it wrong costs a full separation, which is minutes. Hearing ten seconds would have answered it.

What it needs to do

  • A control on each result that plays it, with pause and a seekable position bar
  • Auditioning is not selecting. Pressing it must not choose the track or start an import.
  • One at a time, and silent the moment the dropdown closes

The constraint that decides the design

The CSP allows media-src 'self' blob: data:. A googlevideo.com URL in an <audio> tag is blocked, and widening media-src so it would work lets any injected string in the webview pull media from anywhere. That CSP exists for #171 and should not be traded away for a convenience button.

So the audio has to be proxied: the browser talks to us, and we fetch a URL that yt-dlp resolved from an already-allowlisted page. The browser never talks to YouTube.

What that costs, and how to keep it small

  • Resolving is the expensive half, roughly two seconds, and the result is stable for hours. It should be cached.
  • The smallest audio-only stream is about 1.2 MB for a four minute track against 11.8 MB for the 360p video. For an audition, smallest wins.
  • Range must be forwarded, so seeking is a partial request rather than a re-download.
  • A paused <audio> keeps its connection open. For a proxied stream that means holding a socket on the backend for a preview nobody is listening to, so the src needs dropping on close, not just a pause.

Deliberately out of scope

Video. A progressive video+audio stream (format 18) is only reachable with the JS challenge solver, which is on hold in #438. It is also ten times the bytes for a question the audio already answers.

HLS. Refuse it rather than serve it and let it fail in the player. A manifest rewrite plus a segment proxy is a lot of machinery for an audition button.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions