Getting Started with WebRTC
eBook - ePub

Getting Started with WebRTC

  1. 114 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Getting Started with WebRTC

About this book

In Detail

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.

Approach

The book will follow a step-by-step tutorial approach to construct an application that allows video conferencing and calls between two browsers and a system for sharing files among a group.

Who this book is 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.

Trusted by 375,005 students

Access to over 1 million titles for a fair monthly price.

Study more efficiently using our study tools.

Getting Started with WebRTC


Table of Contents

Getting Started with WebRTC
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. An Introduction to Web-based Real-Time Communication
Introducing WebRTC
Uses for WebRTC
Try WebRTC yourself right now!
Browser compatibility
Chrome and Firefox on the PC
Chrome and Firefox on Android
Opera
Microsoft
Apple
Staying up-to-date
Summary
2. A More Technical Introduction to Web-based Real-Time Communication
Setting up communication
The general flow
Connect users
Start signals
Find candidates
Negotiate media sessions
Start RTCPeerConnection streams
Using WebSockets
Other signaling options
MediaStream API
RTCPeerConnection API
The caller's flow
Register the onicecandidate handler
Register the onaddstream handler
Register the message handler
Use getUserMedia to access the local camera
The JSEP offer/answer process
The callee's flow
Register the onicecandidate handler
Register the onaddstream handler
Register the message handler
Use getUserMedia to access the local camera
The JSEP offer/answer process
Where does RTCPeerConnection sit?
RTCDataChannel API
Summary
3. Creating a Real-time Video Call
Setting up a simple WebRTC video call
Using a web server to connect two users
Setting up a signaling server
Creating an offer in the caller's browser
Creating an answer in the callee's browser
Previewing the local video streams
Establishing peer-to-peer streams
Stream processing options
Extending this example into a Chatroulette app
Summary
4. Creating an Audio Only Call
Setting up a simple WebRTC audio only call
The HTML user interface for audio only calls
Adding an audio only flow to the signaling server
Audio stream processing options
Summary
5. Adding Text-based Chat
Adding text-based chat to our video chat app
The HTML user interface for text-based chat
Adding JavaScript functions to enable chatting
Handling text-based chat signals on the server
Other text message processing options
Summary
6. Adding File Sharing
Adding file sharing to our video chat app
The HTML user interface for file sharing
Adding JavaScript for enabling file sharing
Adding files using the <input> element
Adding support for drag-and-drop
Adding JavaScript for transferring files via WebSockets
Handling the file-sharing signals on the server
Sending a thumbnail preview before the entire file
Providing progress updates
Establishing an RTCDataChannel connection
Transfering files via an RTCDataChannel connection
Other file-sharing options
Summary
7. Example Application 1 – Education and E-learning
Applying WebRTC for education and e-learning
Overall application architecture
Educators
Students
WebRTC capable browser
Existing or new web application
Signaling server
TURN server
Archive server
Potential issues that may be faced
Privacy
Copyright and intellectual property
Restrictive networks
Restrictive SOEs
Outdated student browsers
Interoperability
Benefits that can be delivered
The opportunity for educators
Summary
8. Example Application 2 – Team Communication
Applying WebRTC for team communication
Overall application architecture
Managers
Team members
WebRTC capable browser
New and existing web applications
Signaling server
TURN server
Messaging server
Potential issues that may be faced
Privacy
Data security
Restrictive networks
Restrictive SOEs
Interoperability
Timezones
Benefits that can be delivered
The opportunity for managers
Summary
Index

Getting Started with WebRTC

Copyright © 2013 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: September 2013
Production Reference: 1180913
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK..
ISBN 978-1-78216-630-6
www.packtpub.com
Cover Image by Suresh Mogre ()

Credits

Author
Rob Manson
Reviewers
Todd Hunter
Alexandra Young
Acquisition Editor
Akram Hussain
Commissioning Editor
Shaon Basu
Technical Editors
Pratik More
Anusri Ramchandran
Project Coordinator
Akash Poojary
Proofreader
Clyde Jenkins
Indexers
Hemangini Bari
Mariammal Chettiyar
Graphics
Ronak Dhruv
Production Coordinator
Prachali Bhiwandkar
Cover Work
Prachali Bhiwandkar

About the Author

Rob Manson is the CEO and co-founder of buildAR.com, the world's leading Augmented Reality Content Management System. Rob is the Chairman of the W3C Augmented Web Community Group, and an Invited Expert with the ISO, W3C, and the Khronos Group. He is one of the co-founders of ARStandards.org and is an active evangelist within the global AR and standards communities. He is regularly invited to speak on the topics of the Augmented Web, Augmented Reality, WebRTC, and multi-device platforms.

About the Reviewers

Todd Hunter is a software developer with over 10 years experience of developing applications in a variety of industries. He is crazy enough to find his niche building interesting things with Perl, but with an eye for building things with the latest technologies. He has spent time in a wide range of companies, from the big multinationals to the smallest startups in industries ranging from large software companies, ...

Table of contents

  1. Getting Started with WebRTC

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 990+ topics, we’ve got you covered! Learn about our mission
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
Yes, you can access Getting Started with WebRTC by Rob Manson in PDF and/or ePUB format, as well as other popular books in Computer Science & Application Development. We have over one million books available in our catalogue for you to explore.