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

@substream/web-sdk

v1.0.0

Published

Stream any HTML5 canvas game to viewers via Substream + AWS IVS

Readme

@substream/web-sdk

Stream any HTML5 canvas game to viewers via WebRTC. Works with Phaser, Three.js, PixiJS, Unity WebGL, Cocos, Construct, and any engine that renders to <canvas>.

Install

npm install @substream/web-sdk amazon-ivs-web-broadcast

Usage

import { SubstreamSDK } from '@substream/web-sdk';

// Optional: capture game audio (call before game engine initializes)
SubstreamSDK.captureAudio();

// Start streaming
const session = await SubstreamSDK.startStream({
  canvasElement: document.querySelector('canvas'),
  backendUrl: 'https://your-api.com',
  streamerId: 'player-123',
  authToken: 'your-token',
  title: 'My Game Stream',
  onLive: ({ streamId, viewerUrl }) => {
    console.log('Live!', viewerUrl);
  },
});

// Stop streaming
await session.stop();

Configuration

| Option | Type | Required | Description | |--------|------|----------|-------------| | canvasElement | HTMLCanvasElement | Yes | The canvas to capture | | backendUrl | string | Yes | Substream API URL | | streamerId | string | Yes | Unique player/streamer ID | | authToken | string | Yes | API key or JWT token | | orgId | string | No | Organization ID for dashboard | | streamerName | string | No | Display name | | title | string | No | Stream title | | fps | number | No | Frame rate (default: 30) | | audio | boolean | No | Include audio (default: true) | | onLive | function | No | Called when stream goes live | | onError | function | No | Called on error | | onStopped | function | No | Called when stream stops |

Audio Capture

Canvas streaming only captures video by default. To include game audio, call SubstreamSDK.captureAudio() before your game engine creates its AudioContext:

SubstreamSDK.captureAudio(); // Must be called first
// Then initialize your game engine

This monkey-patches AudioNode.connect to tee audio into a MediaStream alongside the video. Audio still plays through speakers normally.

Demo

Test with our hosted demo API:

const session = await SubstreamSDK.startStream({
  canvasElement: document.querySelector('canvas'),
  backendUrl: 'https://substream-sdk-production.up.railway.app',
  streamerId: 'demo-child-001',
  authToken: 'demo-token',
});

Script Tag Usage

For zero-build-step usage, see examples/web-game-demo/ which uses substream.js directly via <script> tags.

License

MIT