IFRAME API for Directors

Enhanced IFRAME API Documentation - HTTP/WSS API Integration

Overview

The VDO.Ninja IFRAME API provides access to all HTTP/WSS API commands through the action parameter. This means you can use any command from the HTTP/WSS API directly through the iframe's postMessage interface.

Using HTTP/WSS API Commands via IFRAME

All commands available in the HTTP/WSS API can be accessed through the IFRAME API using this format:

iframe.contentWindow.postMessage({
    action: "commandName",
    value: "value",
    value2: "optional",
    target: "optional", // for director commands
    cib: "callback-id" // optional callback identifier
}, "*");

Director Permissions

Important: To use director commands for remote control, you must have director permissions:

  1. Use &director=roomname instead of &room=roomname in your iframe URL

  2. Or combine with &codirector=password to enable multiple directors

  3. Without proper permissions, director commands will fail silently

Example iframe URL with director permissions:

Complete Command Reference

Self Commands (No Target Required)

These commands affect the local VDO.Ninja instance:

Director Commands (Target Required)

These commands require director permissions and target specific guests:

Using targetGuest Function (Legacy)

The targetGuest function provides another way to control guests:

Using Commands Function

Access any command from the Commands object:

Advanced DOM Manipulation

Target specific video elements by stream ID:

Special Functions

Handling Responses

Listen for responses with callback IDs:

Complete Example: Director Control Panel

Important Notes

  1. Director Permissions: Always use &director=roomname or &codirector=password for director commands

  2. Target Format: Use slot numbers (1, 2, 3) or stream IDs for targeting

  3. Callback IDs: Use unique cib values to track responses

  4. Error Handling: Commands may fail silently without proper permissions

  5. Timing: Wait for iframe to load before sending commands

Troubleshooting

  • Commands not working: Check director permissions in iframe URL

  • No response: Verify callback ID handling and message source

  • Guest not found: Confirm target value matches slot or stream ID

  • Permission errors: Ensure using &director= not &room=

This integration allows you to build powerful control interfaces using the full capabilities of the VDO.Ninja API through simple iframe messaging.

Last updated

Was this helpful?