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

video-saas-client

v0.1.8

Published

Video calling SDK for Video SaaS

Readme

video-saas-client

Video calling SDK for Video SaaS. Connect to video rooms with token-based authentication.

Install

npm install video-saas-client

Getting a token

Tokens are generated server-side using video-saas-admin. Never expose your API key in the browser. For API key access, contact [email protected].

  1. Install the admin package in your backend:

    npm install video-saas-admin
  2. Create an API route that returns a token for a given room (example: Next.js):

    // app/api/room-token/route.js
    import { createRoomToken } from "video-saas-admin";
    
    export async function GET(request) {
      const roomId = request.nextUrl.searchParams.get("roomId");
      const token = await createRoomToken(roomId, { apiKey: process.env.VIDEO_SAAS_API_KEY });
      return Response.json({ token });
    }
  3. Fetch the token on the frontend before joining:

    const { token } = await fetch(`/api/room-token?roomId=${roomId}`).then(r => r.json());
    useVideoCall(roomId, { token });

Usage

import { useVideoCall } from "video-saas-client";

function MyVideoCall({ roomId, token }) {
  const {
    localStream,
    remoteStreams,
    isConnected,
    error,
    leaveRoom,
  } = useVideoCall(roomId, { token });

  return (
    <div>
      {localStream && <video ref={el => { if (el) el.srcObject = localStream; }} muted autoPlay />}
      {Array.from(remoteStreams.entries()).map(([peerId, stream]) => (
        <video key={peerId} ref={el => { if (el) el.srcObject = stream; }} autoPlay />
      ))}
      <button onClick={leaveRoom}>Leave</button>
    </div>
  );
}

With a custom video track (e.g. virtual background)

Pass a pre-processed MediaStreamTrack via videoTrack. The SDK will use it instead of calling getUserMedia for video.

import { useVideoCall } from "video-saas-client";

function MyVideoCall({ roomId, token }) {
  const [videoTrack, setVideoTrack] = useState(null);

  useEffect(() => {
    // Apply your virtual background and get a processed track
    applyVirtualBackground().then(track => setVideoTrack(track));
  }, []);

  const { localStream, remoteStreams, leaveRoom } = useVideoCall(roomId, { token, videoTrack });

  // ...
}

API

useVideoCall(roomId, options)

| Option | Type | Required | Description | |--------|------|----------|-------------| | token | string | Yes | Short-lived room token from video-saas-admin | | videoTrack | MediaStreamTrack | No | Custom video track — use this to pass a pre-processed track (e.g. with virtual background applied). Falls back to getUserMedia if not provided. |

Returns

| Value | Type | Description | |-------|------|-------------| | localStream | MediaStream | null | The local camera/mic stream | | remoteStreams | Map<peerId, MediaStream> | Streams from other participants | | isConnected | boolean | Whether the socket is connected | | error | string | null | Error message if something went wrong | | leaveRoom | () => void | Disconnect and stop all tracks | | startRecording | (patientPeerId) => Promise | Start recording (if supported by server) | | stopRecording | () => Promise | Stop recording | | isRecording | boolean | Whether recording is active | | recordingIds | { doctor, patient } | Active recording IDs |