A fully WebRTC demo on Web, Android and iOS
- You need
NodeJSinstalled. To check: run commandnode -vin terminal. If you haven't installed yet. Search Google to install based in your OS - Android Studio and an Android device (if you want to test with Android)
First you need to start the signaling server, Open terminal at node-server and run:
npm install # or yarn install (to install dependencies)
npm run dev # or yarn dev
Server will be listening at: `localhost:4000
The usage of all clients are same, you just need to join clients in same room by input same roomID.
- To start web client, open terminal at
web-clientand run:
npm install # or yarn install (to install dependencies)
npm run serve # or yarn serve
Then open 2 browsers at localhost:8080 to test
Note: audio from local and remote stream is disabled by default to remove Echo during call, if you want to turn on audio simply remove
mutedfrom 2<video>element inApp.vue
- Open
android-clientin Android Studio and wait for Gradle to be synced - Change the value of
serverAddressin/app/src/main/res/values/strings.xmlto IP of your machine (can check by runningifconfigfor Mac/Linux andipconfigfor Windows). Keep port4000
- Open terminal at
ios-clientand run:pod installto install dependencies - Then
WebRTCDemo.xcworkspace(NOTWebRTCDemo.xcodeproj, note the filename) - Change the URL string in
CallViewControllerto your local IP and keep the port4000(Eg:http://192.168.1.129:4000)
By default audio will be played using internal microphone. If you want to play audio by Speaker (for louder sound). Then uncomment 2 sections in
CallViewController.swiftthat I marked
When develop, to get a detail debug information. Do the following:
- Go to
/app/src/main/AndroidManifest.xml, commentandroid:process=":CallActivityProcess"inCallActivity - Go to
PeerConnectionClient.java, in methodonDestroy, change like below:
public void onDestroy() {
factory.dispose();
socketClient.disconnect();
socketClient.close();
}
// If you finish developing, remember to change it back to initial setup like below
// public void onDestroy() {
// android.os.Process.killProcess(android.os.Process.myPid());
// }
// And change the AndroidManifest.xml like before- By doing this you'll get crash in some cases when you navigate back to previous activity and join room again, but you'll can easily debug your app during development
