Building the Video Call app
Everything's in place, so let's start coding. As usual, as we did in the previous apps, open your home.js
file and create your Home
class with a constructor:
class Home { constructor() { } }
After that, create an instance of the Home
class and assign it to an object, home
, as follows:
const home = new Home();
We are going to have a use for the home object later. We now add the SimpleWebRTC
package to our project by running the following command in the terminal from our project root folder:
npm install -S simplewebrtc
And add the following import statement to the top of your home.js
file:
import SimpleWebRTC from 'simplewebrtc';
As per the SimpleWebRTC
documentation, we need to create an instance of the SimpleWebRTC
class with some configuration to use it in our application. In your home.js
file, before the Home
class, add the following code:
const webrtc = new SimpleWebRTC({ localVideoEl: 'localVideo', remoteVideosEl: '', autoRequestMedia: true, debug: false...