- Removed use of decpreated API .addStream() and use track() instead
- Changed to FireStore (instead of Realtime Database)
- Use my personal Turn server credentials
- Use Firebase hosting
firebase init
etc.
- Use Firebase automated inclusion of framework depending on environment
- Moved deployable files to /public directory, for Firebase hosting
Then changed the code to make it easier for me to understand, with:
- Use async / await instead of promise chain syntax
- Use of type hints in VSCode
- Use npm install of Firebase to take advantage of automatic type aquisition in VSCode
npm install firebase --save-dev
- Removed referring to Bootstrap CSS on CD, to reduce prevent CDN from cookieing you incorrectly, resulting in browser warning
- Removed use of bootstrap CSS and icons entirely to just make one button pretty, to reduce cognitive noise
- Added favicon to stop Chrome devtools from complaining
Live depolyment is at
https://webrtc-firestore.web.app/
To make private repo, followed instructions at:
https://help.github.com/en/github/creating-cloning-and-archiving-repositories/duplicating-a-repository
Changed origin with:
$ git remote rm origin
$ git remote add origin https://github.com/SumitBando/simple-webrtc-video-chat-using-firebase.git
$ git config master.remote origin
$ git config master.merge refs/heads/master
$ git push --set-upstream origin master
https://strongloop.com/strongblog/type-hinting-in-javascript/
Automatic type aquisition requies https://code.visualstudio.com/docs/nodejs/working-with-javascript
// allow other clients firebase serve --only hosting --host 0.0.0.0
Original code was from:
https://github.com/WebsiteBeaver/simple-webrtc-video-chat-using-firebase
This is a 1-to-1 video chat using WebRTC and Firebase as the signaling server. You can use socket.io for your signaling server instead of Firebase, but this uses Firebase to keep things simple. If you've never used WebRTC, this is the perfect repo for you to learn the basics.
Try out the demo at https://codepen.io/dmarcus/pen/PWmRmj. Open the CodePen on two different computers or mobile phones, press change the Firebase credentials and Viagenie credentials as described below, and press call to see the 1-to-1 video chat in action. Here's a video showing us using the demo:
You don't need to follow this tutorial. You change simply download this repo, and run the code on your https server. But if you'd like to understand how the code works, take a look at the tutorial that goes with this repo.
Create a Firebase account, and replace these credentials with your credentials. Be sure to make it readable and writable to the world as explained in the tutorial. These credentials are found in js/script.js
var config = {
apiKey: "AIzaSyCTw5HVSY8nZ7QpRp_gBOUyde_IPU9UfXU",
authDomain: "websitebeaver-de9a6.firebaseapp.com",
databaseURL: "https://websitebeaver-de9a6.firebaseio.com",
storageBucket: "websitebeaver-de9a6.appspot.com",
messagingSenderId: "411433309494"
};
You should also create an account on Viagenie, and replace the following code from js/script.js with the information from your account.
{'urls': 'turn:numb.viagenie.ca','credential': 'websitebeaver','username': '[email protected]'}
- WebRTC - Used for real-time communication
- Firebase - Used for signaling
- Bootstrap - Used for styling
MIT License
Copyright (c) 2017 David Marcus
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.