├── .firebaserc ├── database.rules.json ├── README.md ├── firebase.json ├── .gitignore └── public ├── main.css ├── index.html └── app.js /.firebaserc: -------------------------------------------------------------------------------- 1 | { 2 | "projects": { 3 | "default": "fir-rtc-89b99" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /database.rules.json: -------------------------------------------------------------------------------- 1 | { 2 | /* Visit https://firebase.google.com/docs/database/security to learn more about security rules. */ 3 | "rules": { 4 | ".read": false, 5 | ".write": false 6 | } 7 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Firebase + WebRTC Codelab 2 | ### Full code solution can be found under the branch: _solution_ 3 | This is the GitHub repo for the FirebaseRTC codelab. This will teach you how 4 | to use Firebase Cloud Firestore for signalling in a WebRTC video chat application. 5 | 6 | The solution to this codelab can be seen in the _solution_ branch. 7 | 8 | See http://webrtc.org for details. 9 | -------------------------------------------------------------------------------- /firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "database": { 3 | "rules": "database.rules.json" 4 | }, 5 | "hosting": { 6 | "public": "public", 7 | "ignore": [ 8 | "firebase.json", 9 | "**/.*", 10 | "**/node_modules/**" 11 | ], 12 | "rewrites": [ 13 | { 14 | "source": "**", 15 | "destination": "/index.html" 16 | } 17 | ] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | firebase-debug.log* 8 | 9 | # Firebase cache 10 | .firebase/ 11 | 12 | # Firebase config 13 | 14 | # Uncomment this if you'd like others to create their own Firebase project. 15 | # For a team working on the same Firebase project(s), it is recommended to leave 16 | # it commented so all members can deploy to the same project(s) in .firebaserc. 17 | # .firebaserc 18 | 19 | # Runtime data 20 | pids 21 | *.pid 22 | *.seed 23 | *.pid.lock 24 | 25 | # Directory for instrumented libs generated by jscoverage/JSCover 26 | lib-cov 27 | 28 | # Coverage directory used by tools like istanbul 29 | coverage 30 | 31 | # nyc test coverage 32 | .nyc_output 33 | 34 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 35 | .grunt 36 | 37 | # Bower dependency directory (https://bower.io/) 38 | bower_components 39 | 40 | # node-waf configuration 41 | .lock-wscript 42 | 43 | # Compiled binary addons (http://nodejs.org/api/addons.html) 44 | build/Release 45 | 46 | # Dependency directories 47 | node_modules/ 48 | 49 | # Optional npm cache directory 50 | .npm 51 | 52 | # Optional eslint cache 53 | .eslintcache 54 | 55 | # Optional REPL history 56 | .node_repl_history 57 | 58 | # Output of 'npm pack' 59 | *.tgz 60 | 61 | # Yarn Integrity file 62 | .yarn-integrity 63 | 64 | # dotenv environment variables file 65 | .env 66 | 67 | .idea 68 | -------------------------------------------------------------------------------- /public/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: #ECEFF1; 3 | color: rgba(0, 0, 0, 0.87); 4 | font-family: Roboto, Helvetica, Arial, sans-serif; 5 | margin: 0; 6 | padding: 0; 7 | } 8 | 9 | #message { 10 | background: white; 11 | max-width: 360px; 12 | margin: 100px auto 16px; 13 | padding: 32px 24px; 14 | border-radius: 3px; 15 | } 16 | 17 | #message h2 { 18 | color: #ffa100; 19 | font-weight: bold; 20 | font-size: 16px; 21 | margin: 0 0 8px; 22 | } 23 | 24 | #message h1 { 25 | font-size: 22px; 26 | font-weight: 300; 27 | color: rgba(0, 0, 0, 0.6); 28 | margin: 0 0 16px; 29 | } 30 | 31 | #message p { 32 | line-height: 140%; 33 | margin: 16px 0 24px; 34 | font-size: 14px; 35 | } 36 | 37 | #message a { 38 | display: block; 39 | text-align: center; 40 | background: #039be5; 41 | text-transform: uppercase; 42 | text-decoration: none; 43 | color: white; 44 | padding: 16px; 45 | border-radius: 4px; 46 | } 47 | 48 | #message, #message a { 49 | box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); 50 | } 51 | 52 | #load { 53 | color: rgba(0, 0, 0, 0.4); 54 | text-align: center; 55 | font-size: 13px; 56 | } 57 | 58 | @media (max-width: 600px) { 59 | body, #message { 60 | margin-top: 0; 61 | background: white; 62 | box-shadow: none; 63 | } 64 | 65 | body { 66 | border-top: 16px solid #ffa100; 67 | } 68 | } 69 | 70 | body { 71 | margin: 1em; 72 | } 73 | 74 | button { 75 | margin: 0.2em 0.1em; 76 | } 77 | 78 | div#videos { 79 | display: flex; 80 | flex-direction: row; 81 | flex-wrap: wrap; 82 | } 83 | 84 | div#videos > video { 85 | background: black; 86 | width: 640px; 87 | height: 100%; 88 | display: block; 89 | margin: 1em; 90 | } 91 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 |