Book Image

WebRTC Cookbook

By : Andrii Sergiienko
Book Image

WebRTC Cookbook

By: Andrii Sergiienko

Overview of this book

Table of Contents (15 chapters)
WebRTC Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Making a simple video chat with rtc.io


rtc.io is a free and open source project for developing WebRTC applications. It provides simple and clean APIs. In this recipe, we will use rtc.io to create a basic video chat service.

Getting ready

Like most of the other considered frameworks, rtc.io serves its own signaling server, so you can create a basic application using just a few lines of JavaScript code and HTML. For this recipe, you will need a text editor and web browser.

How to do it…

Create an empty file in the text editor and add the following code. This is a plain HTML with a JavaScript section. Relevant places are commented inline.

  1. First of all, let's add the standard HTML heads and bit of styles:

    <!DOCTYPE html>
    <html>
    <head lang="en">
        <meta charset="UTF-8">
        <style>
            #messages {
                border: 1px solid black;
                min-height: 20px;
            }
        </style>
  2. Include the rtc.io framework in this project:

    <script src="https://rawgit...