Skip to content

Instantly share code, notes, and snippets.

@mazhar266
Created April 25, 2019 15:06
Show Gist options
  • Save mazhar266/ee8de2c7b57c4608188128c0e96ca916 to your computer and use it in GitHub Desktop.
Save mazhar266/ee8de2c7b57c4608188128c0e96ca916 to your computer and use it in GitHub Desktop.
WebRTC Video Chat Procedure

WebRTC Video Chat Procedure Now that we have Firebase set up, let’s talk a little about how WebRTC can be used to set up a video chat. Say we have two computers, yours and your friend’s. Here is the step-by-step procedure needed to make the video chat work. (Note that I bolded words that sound strange, but are actually just JavaScript objects in JSON. I’ll give you examples of each right after these steps.)

  1. Display a MediaStream video of yourself on your computer
  2. Display a MediaStream video of your friend on his computer
  3. Create a PeerConnection on your computer
  4. Create a PeerConnection on your friend’s computer
  5. Create an Offer on your computer
  6. Add that Offer to the PeerConnection on your computer
  7. Send that Offer to your friend’s computer
  8. Add that Offer to the PeerConnection on your friend’s computer
  9. Generate ICE Candidates on your computer
  10. Send those ICE Candidates to your friend’s computer
  11. Add ICE Candidates to the PeerConnection on your friend’s computer
  12. Create an Answer on your friend’s computer
  13. Add that Answer to the PeerConnection on your friend’s computer
  14. Send that Answer to your computer
  15. Add that Answer to the PeerConnection on your computer
  16. Generate ICE Candidates on your friend’s computer
  17. Send those ICE Candidates to your computer
  18. Add ICE Candidates to the PeerConnection on your computer
  19. Display a MediaStream video of your friend on your computer
  20. Display a MediaStream video of yourself on your friend’s computer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment