Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 30 additions & 9 deletions examples/avatar/index.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>AudioFlow avatar viewer</title>
<style>body{font:18px system-ui;max-width:800px;margin:40px auto;padding:16px}video{width:100%;max-height:480px}button,input{margin:8px;padding:8px}#status{white-space:pre-wrap}</style>
<h1>LiveAvatar finite utterance viewer</h1>
<p>Select raw mono PCM16LE at 24 kHz, at most 10 seconds. Each start provisions a new paid provider session. No local PCM playback. No persistent avatar continuity.</p>
<p>Live calls are disabled unless the server has AVATAR_LIVE=1 and credentials. Generation, lip-sync, acoustics, account permissions and TURN remain unverified without credentials.</p>
<input id="pcm" type="file" accept=".pcm,.raw" aria-label="24 kHz raw PCM file">
<button id="start" disabled>Start utterance</button><button id="play" disabled>Enable audio / video</button><button id="cancel" disabled>Cancel utterance</button><button id="disconnect" disabled>Disconnect</button><button id="connect">Connect controls</button>
<p id="status" role="status">Connect controls to begin. No provider call is made on connection.</p><div id="media"></div>
<script type="module" src="/main.ts"></script></html>
<!doctype html>
<html lang="en">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>AudioFlow avatar viewer</title>
<body>
<main class="wrap">
<div class="brand">
<svg viewBox="0 0 32 32" aria-hidden="true"><rect width="32" height="32" rx="8" fill="#5B2E91" /><g stroke="#7CE0C3" stroke-width="2.4" stroke-linecap="round"><path d="M8 14v4" /><path d="M12 10v12" /><path d="M16 7v18" /><path d="M20 11v10" /><path d="M24 14v4" /></g></svg>
AudioFlow
</div>
<h1>LiveAvatar finite utterance viewer</h1>
<p class="lede">Select raw mono PCM16LE at 24 kHz, at most 10 seconds. Each start provisions a new paid provider session. No local PCM playback. No persistent avatar continuity.</p>
<p class="lede">Live calls are disabled unless the server has AVATAR_LIVE=1 and credentials. Generation, lip-sync, acoustics, account permissions and TURN remain unverified without credentials.</p>
<div class="controls">
<label>24 kHz raw PCM file <input id="pcm" type="file" accept=".pcm,.raw"></label>
</div>
<div class="controls">
<button id="connect" class="primary">Connect controls</button>
<button id="start" class="primary" disabled>Start utterance</button>
<button id="play" disabled>Enable audio / video</button>
<button id="cancel" disabled>Cancel utterance</button>
<button id="disconnect" disabled>Disconnect</button>
</div>
<p id="status" class="status" role="status">Connect controls to begin. No provider call is made on connection.</p>
<div id="media"></div>
</main>
<script type="module" src="/main.ts"></script>
</body>
</html>
3 changes: 3 additions & 0 deletions examples/avatar/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import '@fontsource-variable/bricolage-grotesque/standard.css';
import '@fontsource/ibm-plex-mono/400.css';
import './theme.css';
import { Receiver } from './receiver';
const button = (id: string) => document.getElementById(id) as HTMLButtonElement;
const file = document.getElementById('pcm') as HTMLInputElement;
Expand Down
20 changes: 20 additions & 0 deletions examples/avatar/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions examples/avatar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
"build": "vite build"
},
"dependencies": {
"@fontsource-variable/bricolage-grotesque": "^5.3.0",
"@fontsource/ibm-plex-mono": "^5.3.0",
"livekit-client": "2.17.2"
},
"devDependencies": {
Expand Down
91 changes: 91 additions & 0 deletions examples/avatar/theme.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/* The docs theme (site/src/styles/docs.css): AudioFlow lavender and Elixir purple.
Keep this file the same as examples/rtvi-client/theme.css. */
:root {
--bg: #fbfaff;
--surface: #f6f4fc;
--ink: #1d1638;
--muted: #6b6585;
--rule: #d9d4ea;
--accent: #5b2e91;
--accent-hover: #4a2378;
--on-accent: #ffffff;
--console: #1d1638;
--console-ink: #ece9f5;
--sans: 'Bricolage Grotesque Variable', system-ui, sans-serif;
--mono: 'IBM Plex Mono', ui-monospace, monospace;
color-scheme: light;
}

@media (prefers-color-scheme: dark) {
:root {
--bg: #19132b;
--surface: #261f3d;
--ink: #ece9f5;
--muted: #9890b3;
--rule: #3b3457;
--accent: #9a6fd6;
--accent-hover: #b08ce0;
--on-accent: #19132b;
--console: #261f3d;
color-scheme: dark;
}
}

* { box-sizing: border-box; }

body {
margin: 0;
background: var(--bg);
color: var(--ink);
font: 400 1.0625rem/1.6 var(--sans);
-webkit-font-smoothing: antialiased;
}

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { width: min(800px, 100% - 2rem); margin-inline: auto; padding-block: 1.5rem 4rem; }

.brand {
display: inline-flex; align-items: center; gap: 0.6rem; margin-bottom: 2.5rem;
font-weight: 700; font-size: 1.2rem; letter-spacing: -0.02em;
}
.brand svg { width: 30px; height: 30px; }

h1 {
margin: 0 0 1rem; font-size: clamp(2rem, 6vw, 3rem); line-height: 1; font-weight: 800;
font-stretch: 88%; letter-spacing: -0.02em; text-wrap: balance;
}

p { max-width: 40rem; }
.lede { color: var(--muted); }

.controls { display: flex; flex-wrap: wrap; align-items: end; gap: 0.75rem; margin-block: 1.5rem; }

label { display: grid; gap: 0.35rem; font-weight: 600; font-size: 0.95rem; }

input {
font: inherit; font-weight: 400; color: var(--ink); background: var(--surface);
border: 1px solid var(--rule); border-radius: 10px; padding: 0.6rem 0.8rem; min-width: 0;
}
input[type='file'] { padding: 0.45rem 0.6rem; }
input[type='file']::file-selector-button {
font: inherit; font-weight: 600; color: var(--ink); background: transparent;
border: 1.5px solid var(--ink); border-radius: 999px; padding: 0.3rem 0.9rem; margin-right: 0.75rem; cursor: pointer;
}

button {
font: inherit; font-weight: 600; color: var(--ink); background: transparent; cursor: pointer;
padding: 0.6rem 1.15rem; border-radius: 999px; border: 1.5px solid var(--ink);
}
button:hover:not(:disabled) { background: var(--ink); color: var(--bg); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

.status {
margin: 1.5rem 0; padding: 1rem 1.25rem; min-height: 3.5rem; max-width: none;
background: var(--console); color: var(--console-ink); border-radius: 14px;
font: 0.9rem/1.7 var(--mono); white-space: pre-wrap; overflow-x: auto;
}

video { display: block; width: 100%; max-height: 480px; border-radius: 14px; background: var(--console); }
3 changes: 2 additions & 1 deletion examples/chat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@ and stops playback. Microphone access requires `localhost` or HTTPS.

`live_base`, `live_shadcn`, and `live_ai_elements` come from a pinned
live_shadcn commit. Set `LIVE_SHADCN_PATH` to a local checkout to use it
instead. `button`, `badge`, `native-select`, and `spinner` were copied with `mix ui.add`; `mix ui.sync`
instead. `alert`, `badge`, `button`, `card`, `collapsible`, `empty`, `field`, `item`,
`native-select`, and `spinner` were copied with `mix ui.add`; `mix ui.sync`
reports upstream changes. The shadcn style sheets in `assets/css/upstream` are
pinned to the commit in live_shadcn's `registry/UPSTREAM.json`.

Expand Down
82 changes: 80 additions & 2 deletions examples/chat/assets/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,86 @@
@source "../../deps/live_shadcn/packages/live_shadcn/priv/registry";
@source "../../deps/live_ai_elements/packages/live_ai_elements/lib";

/* The docs theme (site/src/styles/docs.css): AudioFlow lavender and Elixir
purple, Bricolage Grotesque and IBM Plex Mono. The layout loads the fonts.
Keep the same as ui/assets/css/app.css. */
:root {
--font-sans: ui-sans-serif, system-ui, sans-serif;
--font-sans: "Bricolage Grotesque Variable", ui-sans-serif, system-ui, sans-serif;
--font-heading: var(--font-sans);
--font-mono: ui-monospace, monospace;
--font-mono: "IBM Plex Mono", ui-monospace, monospace;

--background: #fbfaff;
--foreground: #1d1638;
--card: #f6f4fc;
--card-foreground: #1d1638;
--popover: #fbfaff;
--popover-foreground: #1d1638;
--primary: #5b2e91;
--primary-foreground: #ffffff;
--secondary: #ebe8f5;
--secondary-foreground: #2b2447;
--muted: #ebe8f5;
--muted-foreground: #6b6585;
--accent: #e7defa;
--accent-foreground: #2e1452;
--border: #d9d4ea;
--input: #d9d4ea;
--ring: #5b2e91;
--sidebar: #f6f4fc;
--sidebar-foreground: #1d1638;
--sidebar-primary: #5b2e91;
--sidebar-primary-foreground: #ffffff;
--sidebar-accent: #e7defa;
--sidebar-accent-foreground: #2e1452;
--sidebar-border: #d9d4ea;
--sidebar-ring: #5b2e91;
--surface: #f6f4fc;
--surface-foreground: #1d1638;
--code-highlight: #ebe8f5;
--code-number: #6b6585;
--selection: #5b2e91;
--selection-foreground: #ffffff;
}

.dark {
--background: #19132b;
--foreground: #ece9f5;
--card: #261f3d;
--card-foreground: #ece9f5;
--popover: #261f3d;
--popover-foreground: #ece9f5;
--primary: #9a6fd6;
--primary-foreground: #19132b;
--secondary: #2b2447;
--secondary-foreground: #ece9f5;
--muted: #261f3d;
--muted-foreground: #9890b3;
--accent: #3b3457;
--accent-foreground: #ece9f5;
--border: #3b3457;
--input: #3b3457;
--ring: #9a6fd6;
--sidebar: #261f3d;
--sidebar-foreground: #ece9f5;
--sidebar-primary: #9a6fd6;
--sidebar-primary-foreground: #19132b;
--sidebar-accent: #3b3457;
--sidebar-accent-foreground: #ece9f5;
--sidebar-border: #3b3457;
--sidebar-ring: #9a6fd6;
--surface: #261f3d;
--surface-foreground: #c9c3dc;
--code-highlight: #3b3457;
--code-number: #9890b3;
--selection: #e3d6f7;
--selection-foreground: #2a1a46;
}

@layer base {
h1,
h2,
h3 {
letter-spacing: -0.02em;
font-stretch: 88%;
}
}
24 changes: 24 additions & 0 deletions examples/chat/assets/fonts.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copies the docs fonts into priv/static/assets/fonts. Tailwind does not copy
// the font files that @fontsource stylesheets reference, so the layout links
// these copies directly. Only the files each stylesheet names are copied.
import { cpSync, readFileSync } from "node:fs";
import { createRequire } from "node:module";
import path from "node:path";

const require = createRequire(import.meta.url);
const out = path.resolve(import.meta.dirname, "../priv/static/assets/fonts");

for (const [name, sheets] of [
["@fontsource-variable/bricolage-grotesque", ["standard.css"]],
["@fontsource/ibm-plex-mono", ["400.css", "600.css"]],
]) {
const root = path.dirname(require.resolve(`${name}/package.json`));
const dest = path.join(out, path.basename(name));

for (const sheet of sheets) {
const css = readFileSync(path.join(root, sheet), "utf8");
const files = [sheet, ...css.matchAll(/url\(\.\/([^)]+)\)/g).map((m) => m[1])];

for (const file of files) cpSync(path.join(root, file), path.join(dest, file));
}
}
20 changes: 20 additions & 0 deletions examples/chat/assets/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions examples/chat/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
"private": true,
"type": "module",
"scripts": {
"build": "npm run build:css && npm run build:js",
"build": "npm run build:css && npm run build:js && npm run build:fonts",
"build:css": "tailwindcss --input=css/app.css --output=../priv/static/assets/app.css",
"build:js": "rolldown -c rolldown.config.mjs"
"build:js": "rolldown -c rolldown.config.mjs",
"build:fonts": "node fonts.mjs"
},
"dependencies": {
"@floating-ui/dom": "^1.8.0",
"@fontsource-variable/bricolage-grotesque": "^5.3.0",
"@fontsource/ibm-plex-mono": "^5.3.0",
"@rive-app/webgl2": "2.34.1",
"embla-carousel": "8.5.2",
"embla-carousel-autoplay": "8.5.2",
Expand Down
Loading
Loading