npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

gemilive-js

v0.1.3

Published

Browser SDK for the gemilive Gemini Live AI proxy — real-time voice & video with minimal setup.

Readme

gemilive-js

npm version

IMPORTANT: This is the companion Frontend SDK for the Python gemilive FastAPI package. It must be connected to a backend running gemilive.

gemilive-js handles the complex browser APIs required for real-time AI streaming so you don't have to. It manages native WebSockets, microphone capture, audio resampling, video frame sampling, and timeline-based gapless PCM playback.

With this SDK, your frontend integrates perfectly with the Gemini Multimodal Live API proxy provided by gemilive.

Install

npm install gemilive-js

Or via CDN (no bundler needed):

<script src="https://cdn.jsdelivr.net/npm/gemilive-js/dist/gemilive.min.js"></script>

Usage

import { GemiliveClient } from 'gemilive-js';

// The URL MUST point to the FastAPI endpoint where you mounted `mount_gemilive()`
const client = new GemiliveClient("ws://localhost:8000/ws/live", {
    systemPrompt: "You are a helpful assistant." // Overrides or appends to backend prompt
});

// React to Gemini
client.onMessage = (text) => console.log("Gemini:", text);
client.onError   = (err)  => console.error(err);
client.onClose   = ()     => console.log("disconnected");

// Connect — automatically requests mic + camera permissions
await client.start();

// Toggle camera on/off mid-session (audio continues)
// client.toggleVideo(false);

// Send text messages concurrently
client.sendText("What do you see?");

// Disconnect and release devices
// client.stop();

API

new GemiliveClient(url, options)

| Param | Type | Description | |---|---|---| | url | string | The WebSocket URL of your gemilive Python backend endpoint | | options.systemPrompt | string | Optional system prompt sent dynamically at connect time |

Methods

| Method | Description | |---|---| | start() | Connect to the backend and begin audio+video capture. Returns a Promise. | | stop() | Disconnect the WebSocket, stop all tracks, and release hardware devices. | | sendText(text) | Send a text string instantly to Gemini. | | toggleVideo(enabled) | Pause or resume sending video frames. Audio remains uninterrupted. |

Callbacks

| Callback | Signature | Description | |---|---|---| | onMessage | (text: string) => void | Fired when Gemini streams a block of text | | onAudio | (base64: string) => void | Backdoor callback: Fired when an audio chunk is received, but already played by the SDK | | onError | (error: Error) => void | Fired on WebSocket failures or media permission rejections | | onClose | () => void | Fired when the session ends or backend disconnects |

Technical Notes

  • HTTPS Required: Browsers completely block getUserMedia() on HTTP connections. You must run your remote frontend over HTTPS (Localhost is exempt).
  • Audio Resampling: Most browsers record at 44.1kHz or 48kHz. This SDK strictly downsamples outgoing audio to 16kHz PCM as required by Gemini. Responses from Gemini are natively 24kHz PCM, which this SDK plays back gaplessly using JavaScript Web Audio Time Scheduling.
  • Video Framerate: Video frames are snapped from a hidden <video> element to a hidden <canvas> and sent as JPEG payloads at precisely 1 frame per second.

License

MIT