Everything you need to add live streaming to your game.
Use these credentials to test streaming immediately against our hosted API.
https://substream-sdk-production.up.railway.appdemo-child-001demo-tokendemo-viewer-tokenStream any HTML5 canvas game with 5 lines of code. Works with Phaser, Three.js, PixiJS, Unity WebGL, and more.
import Substream from '@substream/web-sdk';
const session = await Substream.startStream({
canvasElement: document.querySelector('canvas'),
backendUrl: 'https://your-api.com',
authToken: 'your-token',
});Copy the SDK scripts into your Unity project, add the streaming component, and configure your backend URL.
// 1. Add IVSRealTimeStreamControl to a GameObject
// 2. Configure in Inspector:
// Backend URL: https://your-api.com
// Streamer ID: player-123
// Auth Token: your-token
// 3. Start streaming:
streamControl.StartStreaming(); // or press 'U'For the simplest integration, just add two script tags. No npm, no bundler.
<script src="https://web-broadcast.live-video.net/1.32.0/amazon-ivs-web-broadcast.js"></script>
<script src="substream.js"></script>
<script>
const session = await Substream.startStream({
canvas: document.getElementById('game-canvas'),
backendUrl: 'https://your-api.com',
childId: 'player-123',
authToken: 'your-token',
});
</script>A stream is created when a player starts broadcasting. The SDK captures the canvas, encodes it via WebRTC, and publishes to an IVS Real-Time stage. Streams are tracked in the dashboard with live status, duration, and viewer count.
Every stream is automatically recorded to S3 via IVS. Recordings appear in the dashboard once the stream ends. They can be played back as VODs or used as input for AI highlight generation.
The highlight service analyzes recordings using Google Cloud Video Intelligence and Gemini to identify the best moments. It scores segments by visual action, audio intensity, and AI analysis, then assembles a polished highlight reel with crossfade transitions.
Register webhook endpoints to receive real-time notifications. Events include stream.started, stream.stopped, viewer.joined, and viewer.left. Payloads are HMAC-signed for security.
All endpoints require an Authorization: Bearer <token> header.
/api/streams/web-publishStart a stream (allocate IVS stage, get publish token)/api/streams/web-publishStop a stream (release stage)/api/streams/web-publishCheck stage pool status/api/streams/whipStart a stream via WHIP (Unity)/api/streams/{streamId}/viewerGet viewer subscribe token/api/webhooksRegister a webhook endpoint/api/webhooksList registered webhooks/api/webhooksRemove a webhook/api/healthService health checkStart streaming a canvas element. Returns a session object with stop(), streamId, viewerUrl, and isLive.
canvasElementHTMLCanvasElementYesThe canvas to capturebackendUrlstringYesSubstream API URLstreamerIdstringYesUnique player/streamer IDauthTokenstringYesAPI key or JWTorgIdstringNoOrganization IDtitlestringNoStream titlefpsnumberNoFrame rate (default: 30)audiobooleanNoInclude audio (default: true)onLivefunctionNoCalled when liveonErrorfunctionNoCalled on erroronStoppedfunctionNoCalled when stoppedEnable automatic audio capture. Must be called before the game engine creates its AudioContext. Monkey-patches AudioNode.connect to tee audio into a MediaStream. Audio still plays through speakers normally.