Examples - Gruveo Embed API for Web

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 web app users in video or voice calls, please see Implementation Recipes.

A Simple Example

The Gruveo embed below will join the “mycode123” video call room when the “Call” button above it is clicked. The embed will end the call 10 seconds after it 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 Gruveo 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 after a call has been established (i.e. embed state switches to call), it will be set to end after 10 seconds.

Embed API Demo

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

Launch Embed API demo