gemini-live-translate/README.md
2026-07-15 22:39:56 +02:00

34 lines
1.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Relay
A fully client-side, real-time audio translator built on Gemini Live. Relay captures audio from a user-selected tab, window, or screen and streams 16 kHz PCM directly from the browser to `gemini-3.5-live-translate-preview`. Translated 24 kHz PCM audio and transcripts are rendered in the browser.
## Run locally
```bash
npm install
npm run dev
```
Open the localhost URL, enter a Gemini API key, choose a target language, and click **Share audio & translate**. In the browser picker, select a source and explicitly enable audio sharing.
## Browser requirements
- A secure context (`https://` or localhost)
- `navigator.mediaDevices.getDisplayMedia()` with audio capture support
- `AudioWorklet` and Web Audio
- Chrome or Edge is recommended for tab/system audio sharing
- Output-device selection appears only when `HTMLMediaElement.setSinkId()` is supported
Prefer sharing the individual tab that is playing the source audio. Full system-audio capture may also include Relay's translated output in the digital mix. Relay requests `selfBrowserSurface: "exclude"` and `restrictOwnAudio: true` where supported; a separate output device can also help when the operating system isolates its audio from the captured source.
## Privacy and key handling
There is no application backend. The WebSocket connects directly to Googles Gemini Live endpoint, and the Gemini API key is stored in `localStorage` under `relay-gemini-api-key`. This bring-your-own-key design means any script or browser extension with access to this origin may be able to read the key; deploy the SPA only from a trusted origin.
## Checks
```bash
npm run build
npm run lint
```