mirror of
https://github.com/LukeHagar/website.git
synced 2025-12-10 04:22:18 +00:00
feat: add audio example
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
export let title: string;
|
export let title: string;
|
||||||
|
|
||||||
const inTable = hasContext('in-table') ? getContext('in-table') : false;
|
const inTable = hasContext('in-table') ? getContext('in-table') : false;
|
||||||
|
const isAudio = /\.(wav|mp3|m4a|ogg)$/i.test(src);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
elements: { portalled, trigger, content, overlay },
|
elements: { portalled, trigger, content, overlay },
|
||||||
@@ -19,12 +20,17 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if inTable}
|
{#if inTable || isAudio}
|
||||||
|
{#if isAudio}
|
||||||
|
<audio {src} controls class="u-width-full-line">
|
||||||
|
Your browser does not support the audio element.
|
||||||
|
</audio>
|
||||||
|
{:else}
|
||||||
<img {src} {alt} {title} loading="lazy" style:vertical-align="middle" />
|
<img {src} {alt} {title} loading="lazy" style:vertical-align="middle" />
|
||||||
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
<div class="web-media main">
|
<div class="web-media main">
|
||||||
<img {src} {alt} {title} loading="lazy" class="web-u-media-ratio-16-9 u-width-full-line" />
|
<img {src} {alt} {title} loading="lazy" class="web-u-media-ratio-16-9 u-width-full-line" />
|
||||||
|
|
||||||
<div class="abs">
|
<div class="abs">
|
||||||
<Tooltip closeOnPointerDown>
|
<Tooltip closeOnPointerDown>
|
||||||
<button class="web-button is-secondary" use:melt={$trigger}>
|
<button class="web-button is-secondary" use:melt={$trigger}>
|
||||||
|
|||||||
@@ -153,5 +153,7 @@ Click **Execute** and you should see a response similar to the following:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Use the fileId to download the generated audio file from the Appwrite Storage.
|
Use the fileId to download the generated audio file from the Appwrite Storage. Here's an example of music generated from the prompt above:
|
||||||
|
|
||||||
|

|
||||||
{% /section %}
|
{% /section %}
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user