My first ApiRTC call

Load Library

The enterprise version of ApiRTC is served though our domain cloud.apizee.com. It is part of our PaaS offer.

In our first example, apiRTC will manage all displayed information in the “div” elements of your page. This is why all div elements descriptors are completed with your webpage associated div Ids. the WebRTC Client object is defined in the apiRTC library :apiRTCWebRTCClient A more complete description, including all available features, is included in the API description. For instance to establish an audio and video communication, you simply have to use call() function.

HTML

You can then define the different tags “div” elements of your page in order to manage the display of your phone :

  • command : used to display command button of your phone : call, hangup, mute
  • status : used to display status information : incoming call, remote hangup …
  • local : myLocalVideo : used to display your local video on call establishment
  • remote :
    • myRemoteVideo : used to display the video of the other person during the call
    • mini : myMiniVideo : used to display your video during the call.

Javascript

Session Creation

To start using ApiRTC, you have to create a session. Creating a session will establish a communication between your application and the server. This session will then be used to establish communication on your app (instant messaging, audio, video).

Required parameters on init() are :

  • apiKey : “myDemoApiKey”. API Key that was sent to you after your account creation. This will be used to identify you and activate your different options depending on your subscription
  • onReady : this is a callback function that will be called when the session has been established with our communication servers
  • apiRTCId : OPTIONAL : This is an optional parameters that enable you to set your client number. This is useful if you have an account database on your side and want to associate an apiRTC identifier to theses accounts

The “Session” object is defined in apiRTC library: apiRTCSession

Adding audio & video support – WebRTC Support

WebRTC support on your application can easily be added by creating a webRTCClient. This has to be done on the onReady function handler, as the session needs to be already successfully established prior to creating a webRTCClient.