Demos
Each demo is a single HTML page that loads vdoninja-sdk.js and runs in your browser. Open one, follow the numbered steps, and use its share link to connect a second tab or device. View the page source to copy the code.
Data and messaging
Peer-to-peer data channels, no media
Auto-connect mesh
The smallest example: join a room, connect to every peer automatically, and exchange messages.
Data channel messaging
Two nodes exchanging chat, custom JSON, and targeted messages, with app-level topic filtering.
Clipboard sync
Share text between your devices in real time over a direct connection.
Pub/sub channels
Subscribe to named channels and publish to them with the SDK's built-in channel helpers.
Pub/sub over P2P only
The same channel pattern, but subscribing only after the peer-to-peer data channel is open.
Broadcast
One publisher sends messages to many viewers, and each viewer can reply.
Audio and video
Camera, canvas, and synthesized media over WebRTC
Two-way video chat
Bidirectional audio and video using canvas animations and tone generators, no camera needed.
Canvas and Web Audio
Stream programmatically drawn video and synthesized audio, viewable in VDO.Ninja.
Publisher with scene links
Publish your camera and get matching VDO.Ninja viewer, scene, and director links.
Media quality controls
Change resolution, frame rate, bitrate, and codec preferences on a live stream.
Video mute state
Mute and unmute video, and show the remote mute state on the viewer side.
Stream tracking
Watch every stream in a room appear and disappear, with timestamps and previews.
Advanced
Tracks, networking, and diagnostics
Dynamic media
Add and remove audio and video tracks while a connection is live.
Track management
Replace, toggle, and switch individual tracks, including switching cameras.
TURN configuration
Use the default relays, your own TURN server, or force relayed connections for testing.
SDK monitoring
Inspect connections, streams, and SDK events live while you publish and view.
WHIP and WHEP
Standard WebRTC streaming to and from media services, separate from VDO.Ninja rooms
WHIP publish
Publish your camera or screen to Meshcast, Cloudflare Stream, Twitch, or any WHIP endpoint.
WHEP view
Watch a stream from any WHEP endpoint, such as the one you just published with WHIP.
Browser extension auto-publisher
An example Chrome extension script that republishes Discord video streams to VDO.Ninja.
Node.js samples
Run from a checkout of the repository with node demos/<file>
Minimal Node peer
Auto-detects a WebRTC runtime, announces a data-only stream, and logs messages.
.jsRoom audio recorder
Joins a room, finds every publisher, and saves each participant's audio as a WAV file.
.jsRoom media recorder
Records each participant's audio and video using ffmpeg.
.jsSine-wave publisher
Streams a generated tone from Node with RTCAudioSource and prints viewer links.
Social Stream Ninja listener
Receives consolidated live chat from Social Stream Ninja over P2P data channels.
.cjsRequest and response workflows
Two peers using onRequest for status checks, authorized commands, and binary payloads.
OBS tally to VRChat OSC
Discover browser cameras by label, read program/preview tally, and send OSC. Tested setup.
npm install @vdoninja/sdk @roamhq/wrtc (or node-datachannel for data-only peers), then run, for example, node demos/node-example.js. See the Node.js guide.
Tips for testing
- Two tabs
- Use a demo's Open second tab link. The room is in the URL, so both tabs join the same one.
- Other devices
- Copy the share link to a phone or another computer. Peers connect directly, so no server setup is needed.
- Camera and microphone
- Browsers only allow capture on HTTPS or
localhost. - Debugging
- Open the browser console for detailed SDK connection logs.