Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Getting Started with WebRTC
Getting Started with WebRTC

Getting Started with WebRTC: If you have basic HTML and JavaScript, you're well on the way to adding real time, peer-to-peer communication to your web applications using WebRTC. This book shows you how through a totally practical, structured course.

eBook
R$80 R$164.99
Paperback
R$206.99
Subscription
Free Trial
Renews at R$50p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Getting Started with WebRTC

Chapter 2. A More Technical Introduction to Web-based Real-Time Communication

This chapter introduces you to the technical concepts behind the new Web-based Real-Time Communication (WebRTC) standards. After reading this chapter, you will have a clear understanding of the following topics:

  • How to set up peer-to-peer communication

  • The signaling options available

  • How the key APIs relate to each other

Setting up communication


Although the basis of WebRTC communication is peer-to-peer, the initial step of setting up this communication requires some sort of coordination. This is most commonly provided by a web server and/or a signaling server. This enables two or more WebRTC capable devices or peers to find each other, exchange contact details, negotiate a session that defines how they will communicate, and then finally establish the direct peer-to-peer streams of media that flows between them.

The general flow

There are a wide range of scenarios, ranging from single web page demos running on a single device to complex distributed multi-party conferencing with a combination of media relays and archiving services. To get started, we will focus on the most common flow, which covers two web browsers using WebRTC to set up a simple video call between them.

Following is the summary of this flow:

  • Connect users

  • Start signals

  • Find candidates

  • Negotiate media sessions

  • Start RTCPeerConnection streams

Connect...

MediaStream API


The MediaStream API is designed to allow you to access streams of media from local input devices, such as cameras and microphones. It was initially focused upon the getUserMedia API or gUM for short, but has now been formalized as the broader media capture and streams API, or MediaStream API for short. However, the getUserMedia() method is still the primary way to initiate access to local input devices.

Each MediaStream object can contain a number of different MediaStreamTrack objects that each represents different input media, such as video or audio from different input sources.

Each MediaStreamTrack can then contain multiple channels (for example, the left and right audio channels). These channels are the smallest units that are defined by the MediaStream API.

MediaStream objects can then be output in two key ways. First, they can be used to render output into a MediaElement such as a <video> or <audio> element (although the latter may require pre-processing...

RTCPeerConnection API


The RTCPeerConnection API is the heart of the peer-to-peer connection between each of the WebRTC enabled browsers or peers. To create an RTCPeerConnection object, you use the var peerconnection = RTCPeerConnection(configuration); constructor. The configuration variable contains at least one key named iceServers, which is an array of URL objects that contain information about STUN, and possibly TURN servers, used during the finding candidates phase.

The peerconnection object is then used in slightly different ways on each client, depending upon whether you are the caller or the callee.

The caller's flow

Here's a summary of the caller's flow after the peerconnection object is created:

  • Register the onicecandidate handler

  • Register the onaddstream handler

  • Register the message handler

  • Use getUserMedia to access the local camera

  • The JSEP offer/answer process

Register the onicecandidate handler

First, you register an onicecandidate handler that sends any ICE candidates to the other peer...

RTCDataChannel API


As well as sending media streams between peers using WebRTC, it is also possible to use the DataChannel API to send arbitrary streams of data. Although many people commonly refer to this as the RTCDataChannel API, it is more accurately defined as just the WebRTC DataChannel API and is created by using the var datachannel = peerconnection.createDataChannel(label); constructor. It is a very flexible and powerful solution that has been specifically designed to be similar to the WebSocket API through the send() method and the onmessage event.

At the time of writing this chapter, this API is still in a state of flux with the varying browser implementations still struggling with standardization.

Summary


You should now have a clear overview of the various APIs and protocols that combine to make WebRTC work.

Throughout the rest of the book, we will explore the MediaStream, RTCPeerConnection, and RTCDataChannel APIs in more detail as we work to apply these concepts to real world examples.

First, we will start by fleshing out the simple peer-to-peer video call scenario into a fully working application.

Then, we will explore how this can be simplified down to just an audio only call or extended with text-based chat and file sharing.

And then, we will explore two real-world application scenarios based upon e-learning and team communication.

Left arrow icon Right arrow icon

Key benefits

  • Set up video calls easily with a low bandwidth audio only option using WebRTC
  • Extend your application using real-time text-based chat, and collaborate easily by adding real-time drag-and-drop file sharing
  • Create your own fully working WebRTC application in minutes

Description

WebRTC delivers web-based real-time communication and is set to revolutionize our view of what the Web really is. Streaming audio and video from browser to browser, as well as opening raw access to the camera and microphone, is already creating a whole new dynamic web. 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! Getting Started with WebRTC provides all of 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 building your own WebRTC-enabled applications right away. Getting Started with WebRTC will guide you through the process of creating your own WebRTC application that can be applied in a number of different real-world situations, using well documented and clearly explained code examples. You will learn how to quickly and easily create a practical peer-to-peer video chat application, an audio only call option, and how a Web-Socket-based signaling server can also be used to enable real-time text-based chat. You will also be shown how this same server and application structure can easily be extended to include simple drag-and-drop file sharing with transfer updates and thumbnail previews.

Who is this book for?

This book is ideal for developers new to the WebRTC standards who are interested in adding sensor-driven, real-time, peer-to-peer communication to their web applications. You will only need basic experience with HTML and JavaScript.

What you will learn

  • Discover how to offer an audio only option as an alternative
  • Create an extensible Web Socket signaling server
  • Detect which browsers support WebRTC
  • Extend your application with real-time text-based chat
  • Add rich collaboration with drag-and-drop file sharing
  • Use RTCDataChannels to share real-time data
  • Design a state-based user interface for WebRTC apps
  • Explore the options available for image and audio post-processing and analysis

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Sep 25, 2013
Length: 114 pages
Edition : 1st
Language : English
ISBN-13 : 9781782166313
Vendor :
Node.js Developers
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Sep 25, 2013
Length: 114 pages
Edition : 1st
Language : English
ISBN-13 : 9781782166313
Vendor :
Node.js Developers
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
R$50 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
R$500 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just R$25 each
Feature tick icon Exclusive print discounts
R$800 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just R$25 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total R$ 463.98
Getting Started with WebRTC
R$206.99
WebRTC Blueprints
R$256.99
Total R$ 463.98 Stars icon
Banner background image

Table of Contents

8 Chapters
An Introduction to Web-based Real-Time Communication Chevron down icon Chevron up icon
A More Technical Introduction to Web-based Real-Time Communication Chevron down icon Chevron up icon
Creating a Real-time Video Call Chevron down icon Chevron up icon
Creating an Audio Only Call Chevron down icon Chevron up icon
Adding Text-based Chat Chevron down icon Chevron up icon
Adding File Sharing Chevron down icon Chevron up icon
Example Application 1 – Education and E-learning Chevron down icon Chevron up icon
Example Application 2 – Team Communication Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3
(12 Ratings)
5 star 66.7%
4 star 16.7%
3 star 0%
2 star 16.7%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




George Chen Mar 02, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
A good introduction for WebRTC.If you are new to the WebRTC, you should try it to get some useful knowledge.
Amazon Verified review Amazon
nacho Dec 04, 2013
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book makes a first introduction to WebRTC in a very general way, easy to understand for everyone.After this part, more technical details have been compiled so it also gives you a general overview of how a communication using WebRTC technology works and how to build your own service. The level of details in this part of the book I think is quite good for beginners.Finally, two scenarios are described in detail so the advantages of using WebRTC are shown. I really appreciate the sections highlighting the potential issues to be taken under account for each of the scenarios.As other user commented, I wish I could have had this book some months ago. Nevertheless, I would recommend it to anyone getting into WebRTC.
Amazon Verified review Amazon
Junaid Kirkire Apr 17, 2016
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Great for programmers who want a hands-on introduction to WebRTC.
Amazon Verified review Amazon
Kader Khan Dec 22, 2013
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Hi,I am not a developer since more than 10 years now. However I was curious to understand the basics of WebRTC from developer perpective. There were lot of resources in internet however was not clear enough to get started and as well to understand the whole picture.I read the "Getting Started with WebRTC" book, and i can say this book is well structured for the starters and leads to a way to advanced programming left to the one skills and imagination. The best part is the example working code and the clear exlanation is exemplenary.I for sure recommend this book for all individuals who needs to understand and excel in thier WebRTC world of Career.Best Regards,Kader.
Amazon Verified review Amazon
Peter C Salerno Nov 04, 2013
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The book "Getting Started with WebRTC" by Rob Manson ( [...] )is an easy to understand introduction to building WebRTC applications. It is a good investment for anyone wanting to build the next generation of social networking services. The book can be view as having three sections: top-level, basic cookbook, and conciderations for advanced use cases.The first chapters cover the top-level information. Chapter 1 is a general introduction including a bit of the the why and who of WebRTC. Chapter 2 goes into the overall technical architecture. The information is organized and accurate, but it could benefit from a diagram or two to illustrate the text.Chapters 3 to 6 provide a cookbook approach. Starting with basic video and audio applications. There is an interesting twist where he adds a chatroulette feature to the application. Then the application is rounded out by adding in text chat and filesharing. Adding to the value of the bbok, the code for these chapters is available for download.The last two chapters focus on applying WebRTC in E-learning and Team Communication use-cases. Rob discusses consideration of the users and the network. Privacy, security and network adminstraion issues are rasied.Overall this is a very good book to get you started with WebRTC.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.