← All demos
Connection monitoring
Join a room and watch what the SDK reports: its events, the vdo.connections map, the streams it has seen (vdo.getStreams()), and vdo.state.
- Connect to the room in the URL.
- Publish your camera (optional) so another tab has something to view.
- Open a second tab with the share link, connect there, and click View on a stream.
- Watch both logs. Each side logs
peerConnected; disconnect one tab and the other logspeerDisconnected.
Controls
Not connectedNot publishing.
Active connections
vdo.connectionsNot connected
Streams seen in the room
vdo.getStreams()No room joined
Event log
SDK state
vdo.state{}Key SDK calls in this demo
const vdo = new VDONinjaSDK({ room, salt: 'vdo.ninja', debug: true });
vdo.addEventListener('listing', (e) => { /* once for the whole list, then once per stream */ });
vdo.addEventListener('peerConnected', (e) => console.log('peer up', e.detail.uuid));
vdo.addEventListener('peerDisconnected', (e) => console.log('peer gone', e.detail.uuid));
await vdo.connect();
await vdo.joinRoom({ room });
await vdo.publish(camera, { streamID }); // optional
await vdo.view(otherStreamID, { audio: false, video: false }); // data-only peer link
console.log(vdo.connections, vdo.getStreams(), vdo.state);
await vdo.disconnect();
camera.getTracks().forEach((t) => t.stop()); // disconnect() leaves your camera on