Detecting User Joins / Disconnects
Detect user joins and disconnects in embedded VDO.Ninja streams using iframe postMessage events.
Understanding the VDO.Ninja IFRAME API: Detecting User Joins and Disconnects
How the IFRAME API Works
Setting Up the Basic Structure
// Create the iframe element
var iframe = document.createElement("iframe");
// Set necessary permissions
iframe.allow = "camera;microphone;fullscreen;display-capture;autoplay;";
// Set the source URL (your VDO.Ninja room)
iframe.src = "https://vdo.ninja/?room=your-room-name&cleanoutput";
// Add the iframe to your page
document.getElementById("container").appendChild(iframe);Setting Up the Event Listener
Detecting User Joins and Disconnects
Guest Connections
Disconnections
Complete Working Example
Waiting Room Example
Getting Additional Information About Connections
Best Practices
Last updated
Was this helpful?