What is the minimum code I need to make a video call from a browser?

This article shows the minimum code required to make a video call from a browser. The application used is very simple and consists of the most basic web page with embedded JavaScript. Session provisioning is handled via an ajax call to a PHP file.

The code example caters for browsers that require plugins by implementing the SDK's appropriate callback function.

The files, available on bitbucket along with detailed step-by-step instructions, can be deployed on a web server capable of serving PHP, MAMP / Apache for example.

  • index.html (basic web page with embedded JavaScript)
  • session.php (PHP invoked by web page to provision session.)

The application uses the Fusion Client javascript SDK to make a call on page load.

  1. Provision a session suitable for anonymous calling.
  2. Initialise UC by calling UC.start passing in the encoded session token obtained when the session was provisioned.
  3. In the implementation of UC.onInitialised create the call, then call the Call.dial method.

Notes:

  • You will need to add the following web application id using the web admin UI - the-minimal-code.
    • Alternatively change the webAppId in session.php to match one already created.
  • You will need to change the IP address in the source files, your.server.ip.address, to match your FCSDK instance.
  • The curl has an option (CURLOPT_SSL_VERIFYPEER) that allows you to make the post internally (between your app server and the web gateway) over https. It's worth noting that this way is not secure, it simply handles http as https, when you don't have trust certificates established between you app server and the web gateway.
  • You will also need to change the domain in the provisioning JSON to match your cluster domain. If you don't know the domain value, you can get it from the FCSDK sample app as highlighted below:

The application is defaulted to make the call to destination 1001. This is one of the default numbers created when the FCSDK sample application is installed.

 

 You can download the sample code below or you can fork the project here.

 

Comments are disabled on these articles if you require help contact support@cafex.com.

Have more questions? Submit a request

Comments

Powered by Zendesk