feat(player): stream at the chosen quality + per-track optimize (§6.6)
The Playback quality setting now drives streaming: getStreamUrl appends ?quality= and useAudioPlayer feeds the server-synced streamQuality, so the backend transcodes on demand (miss → original). Adds an optimizeTrack mutation and an Optimize action in the metadata editor to warm a track's rendition. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -5,9 +5,17 @@ import { getApiBaseUrl } from '../../config/runtime-config';
|
||||
* param because `<audio>` can't send an `Authorization` header; the backend
|
||||
* accepts `?token=` on `GET /stream/{id}` for exactly this reason.
|
||||
*/
|
||||
export function getStreamUrl(trackId: string, token: string): string {
|
||||
export function getStreamUrl(
|
||||
trackId: string,
|
||||
token: string,
|
||||
quality?: string,
|
||||
): string {
|
||||
const base = getApiBaseUrl();
|
||||
return `${base}/stream/${trackId}?token=${encodeURIComponent(token)}`;
|
||||
const q =
|
||||
quality && quality !== 'original'
|
||||
? `&quality=${encodeURIComponent(quality)}`
|
||||
: '';
|
||||
return `${base}/stream/${trackId}?token=${encodeURIComponent(token)}${q}`;
|
||||
}
|
||||
|
||||
export function getCoverUrl(artUrl: string | undefined): string | undefined {
|
||||
|
||||
Reference in New Issue
Block a user