Preface
Getting Started with WebRTC provides all the practical information you need to quickly understand what WebRTC is, how it works, and how you can add it to your own web applications. It includes clear working examples designed to help you get started with building WebRTC-enabled applications right away.
WebRTC delivers Web-based Real-Time Communication, and it is set to revolutionize our view of what the "Web" really is. The ability to stream audio and video from browser to browser alone is a significant innovation that will have far reaching implications for the telephony and video conferencing industries. But this is just the start. Opening raw access to the camera and microphone for JavaScript developers is already creating a whole new dynamic web that allows applications to interact with users through voice, gesture, and all kinds of new options.
On top of that, WebRTC also introduces real-time data channels that will allow interaction with dynamic data feeds from sensors and other devices. This really is a great time to be a web developer! However, WebRTC can also be quite daunting to get started with and many of its concepts can be new or a little confusing for even the most experienced web developers.
It's also important to understand that WebRTC is not really a single technology, but more a collection of standards and protocols, and it is still undergoing active evolution. The examples covered in this book are based on the latest version of the pre-1.0 version of the WebRTC standards at the time of writing. However, there are some areas of these standards that are under active debates and may change over the next year. The first is the way that the Session Description Protocol is integrated into the WebRTC call management process. The second is the general use of the overall offer/answer model that underlies the call setup process. And finally, there is also a strong push for the WebRTC standards to integrate the new Promise (previously known as Futures) design pattern. This all shows that this is a cutting edge, active, and exciting technology area, and that now is a great time to get involved as it grows and evolves.
We hope you appreciate this practical guide and that it makes it easy for you to get started with adding WebRTC to your applications right away.
What this book covers
Chapter 1, An Introduction to Web-based Real-Time Communication, introduces you to the concepts behind the new Web-based Real-Time Communication (WebRTC) standards.
Chapter 2, A More Technical Introduction to Web-based Real-Time Communication, takes you to the technical concepts behind the new Web-based Real-Time Communication (WebRTC) standards.
Chapter 3, Creating a Real-time Video Call, shows you how to use the MediaStream and RTCPeerConnection APIs to create a working peer-to-peer video chat application between two people.
Chapter 4, Creating an Audio Only Call, teaches you how to turn the video chat application we developed in the previous chapter into an audio only call application.
Chapter 5, Adding Text-based Chat, explains how to extend the video chat application we developed in Chapter 2, A More Technical Introduction to Web-based Real-Time Communication, to add support for text-based chat between the two users.
Chapter 6, Adding File Sharing, deals with how to extend the video chat application we developed in Chapter 2, A More Technical Introduction to Web-based Real-Time Communication and Chapter 4, Creating an Audio Only Call, to add support for file sharing between the two users.
Chapter 7, Example Application 1 — Education and E-learning, maps out what is involved in introducing WebRTC into e-learning applications.
Chapter 8, Example Application 2 — Team Communication, shows what is involved in introducing WebRTC into team your communication applications.
What you need for this book
All you need is:
A text editor for creating HTML and JavaScript files
A computer or server on which you can install Node.js (see instructions in Chapter 2, A More Technical Introduction to Web-based Real-Time Communication)
One or more WebRTC capable web browsers (see instructions in Chapter 1, An Introduction to Web-based Real-Time Communication)
Who this book is for
Getting Started with WebRTC is written for web developers with moderate JavaScript experience who are interested in adding sensor driven real-time, peer-to-peer communication to their web applications.
Conventions
In this book, you will find a number of styles of text that distinguish among different kinds of information. Here are some examples of these styles, and an explanation of their meaning:
Code words in text are shown as follows:
"We can include other contexts through the use of the include
directive."
A block of code is set as follows:
var page = undefined; fs.readFile("basic_video_call.html", function(error, data) { if (error) { log_error(error); } else { page = data; } });
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
function setup_audio() { get_user_media( { "audio": true, // request access to local microphone "video": false // don't request access to local camera }, function (local_stream) { // success callback ... }, log_error // error callback ); }
Any command-line input or output is written as follows:
# node webrtc_signal_server.js
New terms and important words are shown in bold.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really find useful.
To send us general feedback, simply send an e-mail to <feedback@packtpub.com>
, and mention the book title via the subject of your message.
If there is a topic in which you have expertise, and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Downloading the example code
You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <copyright@packtpub.com>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
Questions
You can contact us at <questions@packtpub.com>
if you are having a problem with any aspect of the book, and we will do our best to address it.