Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
fix(output): load audio metadata on chrome
Browse files
src/lib/components/players/AudioPlayer.svelte
CHANGED
@@ -55,25 +55,25 @@
|
|
55 |
<CarbonPause class="mx-auto my-auto text-gray-600 dark:text-gray-300" />
|
56 |
{/if}
|
57 |
</button>
|
58 |
-
|
59 |
<div class="overflow-hidden">
|
60 |
<div class="truncate font-medium">{name}</div>
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
<div
|
65 |
-
class="relative h-2 flex-1 rounded-full bg-gray-200 dark:bg-gray-700"
|
66 |
-
on:pointerdown={() => {
|
67 |
-
paused = true;
|
68 |
-
}}
|
69 |
-
on:pointerup={seek}
|
70 |
-
>
|
71 |
<div
|
72 |
-
class="
|
73 |
-
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
</div>
|
76 |
-
|
77 |
-
</div>
|
78 |
</div>
|
79 |
</div>
|
|
|
55 |
<CarbonPause class="mx-auto my-auto text-gray-600 dark:text-gray-300" />
|
56 |
{/if}
|
57 |
</button>
|
|
|
58 |
<div class="overflow-hidden">
|
59 |
<div class="truncate font-medium">{name}</div>
|
60 |
+
{#if duration !== Infinity}
|
61 |
+
<div class="flex items-center gap-2">
|
62 |
+
<span class="text-xs">{format(time)}</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
<div
|
64 |
+
class="relative h-2 flex-1 rounded-full bg-gray-200 dark:bg-gray-700"
|
65 |
+
on:pointerdown={() => {
|
66 |
+
paused = true;
|
67 |
+
}}
|
68 |
+
on:pointerup={seek}
|
69 |
+
>
|
70 |
+
<div
|
71 |
+
class="absolute inset-0 h-full bg-gray-400 dark:bg-gray-600"
|
72 |
+
style="width: {(time / duration) * 100}%"
|
73 |
+
/>
|
74 |
+
</div>
|
75 |
+
<span class="text-xs">{duration ? format(duration) : "--:--"}</span>
|
76 |
</div>
|
77 |
+
{/if}
|
|
|
78 |
</div>
|
79 |
</div>
|
src/routes/conversation/[id]/output/[sha256]/+server.ts
CHANGED
@@ -41,11 +41,14 @@ export const GET: RequestHandler = async ({ locals, params }) => {
|
|
41 |
|
42 |
const { value, mime } = await downloadFile(sha256, params.id);
|
43 |
|
44 |
-
|
|
|
45 |
headers: {
|
46 |
"Content-Type": mime ?? "application/octet-stream",
|
47 |
"Content-Security-Policy":
|
48 |
"default-src 'none'; script-src 'none'; style-src 'none'; sandbox;",
|
|
|
|
|
49 |
},
|
50 |
});
|
51 |
};
|
|
|
41 |
|
42 |
const { value, mime } = await downloadFile(sha256, params.id);
|
43 |
|
44 |
+
const b64Value = Buffer.from(value, "base64");
|
45 |
+
return new Response(b64Value, {
|
46 |
headers: {
|
47 |
"Content-Type": mime ?? "application/octet-stream",
|
48 |
"Content-Security-Policy":
|
49 |
"default-src 'none'; script-src 'none'; style-src 'none'; sandbox;",
|
50 |
+
"Content-Length": b64Value.length.toString(),
|
51 |
+
"Accept-Range": "bytes",
|
52 |
},
|
53 |
});
|
54 |
};
|