Examples

Note: The examples below showcase the technicalities of interacting with the Embed API. For a discussion of the common implementation scenarios for connecting your app’s users in video or voice calls, please see Implementation Recipes.

A Simple Example

The Videola.io widget below will join the “mycode123” video call room when the “Call” button above it is clicked. The embed will generate a test console message saying “10 seconds have passed” 10 seconds after the call is established.

Open this page in two tabs and click the “Call” button in both to see the example in action.

 

Here is the source code for the example.

This example builds upon the code found in the Embedding the Widget section and adds the following functionality:

  • The onEmbedReady() event handler is bound to the embed’s ready event and so it will be called when the embed is loaded and is ready for operation. In onEmbedReady(), a click event listener is added to the “Call” button which invokes the embed’s embed.call() method to initiate a call.
  • The onEmbedStateChange() function will be called whenever the embed’s state changes, which may indicate that a call has been initialized, a “no WebRTC” message is displayed and so forth. The function indicates that 10 seconds after a call has been established (i.e. the embed state switches to call), a test console message will be output.

Embed API Demo

The Embed API Demo is a more involved example of interacting with the Videola.io Embed API. Launch the demo using the button below, or check out its source code on GitHub.

Launch Embed API demo