A music player that connects to your cloud/distributed storage.
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: add stream support to ResolvedUri type

+27 -10
+4 -1
src/common/types.d.ts
··· 50 50 51 51 // TRACKS 52 52 53 - export type ResolvedUri = undefined | { url: string; expiresAt: number }; // TODO: Streams? 53 + export type ResolvedUri = undefined | { 54 + stream: ReadableStream; 55 + expiresAt: number; 56 + } | { url: string; expiresAt: number };
+11 -5
src/components/orchestrator/process-tracks/worker.js
··· 1 1 import deepDiff from "@fry69/deep-diff"; 2 - import { define, ostiary, proxyProvider, use } from "@common/worker.js"; 2 + import { define, ostiary, proxyProvider } from "@common/worker.js"; 3 3 import { INPUT_ACTIONS } from "@common/constants.js"; 4 4 5 5 /** ··· 53 53 uri: track.uri, 54 54 }); 55 55 56 - const resHead = await input.resolve({ 56 + if (!resGet) return [...acc, track]; 57 + 58 + const resHead = "stream" in resGet ? undefined : await input.resolve({ 57 59 method: "HEAD", 58 60 uri: track.uri, 59 61 }); 60 62 61 - if (!resGet) return [...acc, track]; 62 - 63 63 const { stats, tags } = await metadataProcessor.supply({ 64 - urls: { get: resGet.url, head: resHead?.url || resGet.url }, 64 + stream: "stream" in resGet ? resGet.stream : undefined, 65 + urls: "url" in resGet 66 + ? { 67 + get: resGet.url, 68 + head: resHead && "url" in resHead ? resHead.url : resGet.url, 69 + } 70 + : undefined, 65 71 }); 66 72 67 73 return [...acc, { ...track, stats, tags }];
+8 -4
src/components/orchestrator/queue-audio/element.js
··· 55 55 const isPlaying = untracked(this.audio.isPlaying); 56 56 57 57 // Resolve URIs 58 - const url = activeTrack 59 - ? await this.input.resolve({ method: "GET", uri: activeTrack.uri }).then( 60 - (a) => a?.url, 61 - ) 58 + const resolvedUri = activeTrack 59 + ? await this.input.resolve({ method: "GET", uri: activeTrack.uri }) 62 60 : undefined; 61 + 62 + if (resolvedUri && "stream" in resolvedUri) { 63 + throw new Error("Streams are not supported yet."); 64 + } 65 + 66 + const url = resolvedUri?.url; 63 67 64 68 // Check if we still need to render 65 69 if (this.queue.now?.()?.id !== activeTrack?.id) return;
+4
src/themes/webamp/index.js
··· 52 52 async function loadOverride(uri, autoPlay) { 53 53 const resp = await input.resolve({ method: "GET", uri }); 54 54 if (!resp) throw new Error("Failed to resolve URI"); 55 + if (resp && "stream" in resp) { 56 + throw new Error("Webamp does not support playing streams."); 57 + } 58 + 55 59 return await loadFromUrl(resp.url, autoPlay); 56 60 } 57 61