About this ebook
- Explore task-based recipes on integrating your WebRTC application with systems such as Asterisk and Freeswitch
- Set up cutting-edge communicating networks by understanding the fundamentals of debugging, security, integration, attendant services, and more
- Gain advanced knowledge of WebRTC with these incredibly effective recipes
If you are a JavaScript developer with a basic knowledge of WebRTC and software development, but want to explore how to use it in more depth, this book is for you.
Related to WebRTC Cookbook
Related ebooks
WebRTC Blueprints Rating: 0 out of 5 stars0 ratingsGetting Started with WebRTC Rating: 0 out of 5 stars0 ratingsLearning WebRTC Rating: 0 out of 5 stars0 ratingsNode Web Development, Second Edition Rating: 0 out of 5 stars0 ratingsProgramming Backend with Go Rating: 0 out of 5 stars0 ratingsRabbitMQ Essentials Rating: 0 out of 5 stars0 ratingsGradle Effective Implementation Guide Rating: 3 out of 5 stars3/5Apache Karaf Cookbook Rating: 0 out of 5 stars0 ratingsNode Cookbook Rating: 0 out of 5 stars0 ratingsMastering Google App Engine: Build robust and highly scalable web applications with Google App Engine Rating: 0 out of 5 stars0 ratingsMastering Go: Navigating the World of Concurrent Programming Rating: 0 out of 5 stars0 ratingsModern Web Development with Go: Build real-world, fast, efficient and scalable web server apps using Go programming language Rating: 0 out of 5 stars0 ratingsPractical C++ Backend Programming Rating: 0 out of 5 stars0 ratingsCode with Java 21: A practical approach for building robust and efficient applications (English Edition) Rating: 0 out of 5 stars0 ratingsGo Programming Cookbook: Over 75+ recipes to program microservices, networking, database and APIs using Golang Rating: 0 out of 5 stars0 ratingsNode.js: Novice to Ninja Rating: 0 out of 5 stars0 ratingsReact Components Rating: 0 out of 5 stars0 ratingsHeroku Cloud Application Development Rating: 0 out of 5 stars0 ratingsMastering Erlang Programming: From Basics to Expert Proficiency Rating: 0 out of 5 stars0 ratingsSignalR Realtime Application Cookbook Rating: 0 out of 5 stars0 ratingsNetwork Programming in Python : The Basic: A Detailed Guide to Python 3 Network Programming and Management Rating: 0 out of 5 stars0 ratingsLearning RabbitMQ with C#: A magical tool for the IT world Rating: 0 out of 5 stars0 ratingsMastering SaltStack - Second Edition Rating: 0 out of 5 stars0 ratingsMastering Java EE Development with WildFly Rating: 0 out of 5 stars0 ratingsRabbitMQ Cookbook Rating: 0 out of 5 stars0 ratingsBackend Handbook: for Ruby on Rails Apps Rating: 1 out of 5 stars1/5CORS Essentials Rating: 0 out of 5 stars0 ratingsWebRTC Integrator's Guide Rating: 5 out of 5 stars5/5Your First Week With Node.js Rating: 0 out of 5 stars0 ratings
Internet & Web For You
Python: Learn Python in 24 Hours Rating: 4 out of 5 stars4/5The $1,000,000 Web Designer Guide: A Practical Guide for Wealth and Freedom as an Online Freelancer Rating: 4 out of 5 stars4/5Coding For Dummies Rating: 5 out of 5 stars5/5Notion for Beginners: Notion for Work, Play, and Productivity Rating: 4 out of 5 stars4/5Coding All-in-One For Dummies Rating: 4 out of 5 stars4/52022 Adobe® Premiere Pro Guide For Filmmakers and YouTubers Rating: 5 out of 5 stars5/5UX/UI Design Playbook Rating: 4 out of 5 stars4/5Get Into UX: A foolproof guide to getting your first user experience job Rating: 4 out of 5 stars4/5Canva Tips and Tricks Beyond The Limits Rating: 3 out of 5 stars3/5JavaScript All-in-One For Dummies Rating: 5 out of 5 stars5/5More Porn - Faster!: 50 Tips & Tools for Faster and More Efficient Porn Browsing Rating: 3 out of 5 stars3/5How to Be Invisible: Protect Your Home, Your Children, Your Assets, and Your Life Rating: 4 out of 5 stars4/5The Digital Marketing Handbook: A Step-By-Step Guide to Creating Websites That Sell Rating: 5 out of 5 stars5/5Social Engineering: The Science of Human Hacking Rating: 3 out of 5 stars3/5Learn NodeJS in 1 Day: Complete Node JS Guide with Examples Rating: 3 out of 5 stars3/5Cybersecurity For Dummies Rating: 5 out of 5 stars5/5The Beginner's Affiliate Marketing Blueprint Rating: 4 out of 5 stars4/5From Nothing Rating: 5 out of 5 stars5/5Web Design For Dummies Rating: 4 out of 5 stars4/5Tor and the Dark Art of Anonymity Rating: 5 out of 5 stars5/5Stop Asking Questions: How to Lead High-Impact Interviews and Learn Anything from Anyone Rating: 5 out of 5 stars5/5An Ultimate Guide to Kali Linux for Beginners Rating: 3 out of 5 stars3/5How to Disappear and Live Off the Grid: A CIA Insider's Guide Rating: 0 out of 5 stars0 ratingsSurveillance and Surveillance Detection: A CIA Insider's Guide Rating: 3 out of 5 stars3/5The Basics of User Experience Design by Interaction Design Foundation Rating: 4 out of 5 stars4/5
Reviews for WebRTC Cookbook
0 ratings0 reviews
Book preview
WebRTC Cookbook - Andrii Sergiienko
Table of Contents
WebRTC Cookbook
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
Downloading the color images of this book
Errata
Piracy
Questions
1. Peer Connections
Introduction
Building a signaling server in Erlang
Getting ready
How to do it…
How it works…
There's more…
See also
Building a signaling server in Java
Getting ready
How to do it…
How it works…
There's more…
See also
Detecting WebRTC functions supported by a browser
Getting ready
How to do it…
How it works…
There's more…
See also
Making and answering calls
Getting ready
How to do it…
Making a call
Answering a call
How it works…
There's more…
See also
Implementing a chat using data channels
Getting ready
How to do it…
Creating the main HTML page of the application
Creating the JavaScript helper library
How it works…
There's more…
See also
Implementing a chat using a signaling server
How to do it…
How it works…
There's more…
See also
Configuring and using STUN
Getting ready
How to do it…
How it works…
There's more…
See also
Configuring and using TURN
Getting ready
How to do it…
Installing the TURN server
Using TURN in WebRTC application
How it works…
There's more…
See also
2. Supporting Security
Introduction
Generating a self-signed certificate
Getting ready
How to do it…
How it works…
There's more…
See also
Configuring a TURN server with authentication
Getting ready
How to do it…
Implementing the client-side code
Implementing the server-side code
How it works…
There's more…
See also
Configuring a web server to work over HTTPS
Getting ready
How to do it…
Configuring Nginx
Configuring Apache
Configuring IIS
There's more…
See also
Configuring a WebSockets proxy on the web server
Getting ready
How to do it…
Configuring Nginx
Configuring Apache
Configuring IIS
How it works…
There's more…
See also
Configuring a firewall
Getting ready
How to do it…
Configuring a firewall on a server
Configuring a firewall on a client
See also
3. Integrating WebRTC
Introduction
Integrating WebRTC with Asterisk
Getting ready
How to do it…
Installing libSRTP
Installing Asterisk
How it works…
There's more…
See also
Integrating WebRTC with FreeSWITCH
Getting ready
How to do it…
Installing FreeSWITCH
Enabling WebRTC
Starting FreeSWITCH
How it works…
There's more…
See also
Making calls from a web page
Getting ready
How to do it…
Installing sipML5
How it works…
There's more…
See also
Integration of WebRTC with web cameras
Getting ready
How to do it…
Configuring the webcam
Installing WebRTC media server
Time for magic
How it works…
There's more…
4. Debugging a WebRTC Application
Introduction
Working with a WebRTC statistics API
Getting ready
How to do it…
Checking estimated bandwidth
Checking packet loss
How it works…
There's more…
See also
Debugging with Chrome
Getting ready
How to do it…
Using webrtc-internals
Using Chrome logging mechanism
How it works…
There's more…
See also
Debugging TURN
Getting ready
How to do it…
How it works…
There's more…
See also
Debugging using Wireshark
Getting ready
How to do it…
How it works…
There's more…
See also
5. Working with Filters
Introduction
Working with colors and grayscale
How to do it…
How it works…
Working with brightness
How to do it…
How it works…
Working with contrast
How to do it…
How it works…
Working with saturation
How to do it…
How it works…
Working with hue
How to do it…
How it works…
Using the sepia filter
How to do it…
How it works…
Using the opacity filter
How to do it…
How it works…
Inverting colors
How to do it…
How it works…
Implementing the blur effect
How to do it…
How it works…
Implementing the dropped shadow effect
How to do it…
How it works…
Combining filters
How to do it…
How it works…
Custom video processing
How to do it…
How it works…
6. Native Applications
Introduction
Building a customized WebRTC demo for iOS
Getting ready
How to do it…
There's more…
Building a demo project for a iOS simulator
See also
Compiling and running an original demo for iOS
Getting ready
How to do it…
Building a demo project for an iOS device
Building a demo project for an iOS simulator
There's more…
See also
Compiling and running a demo for Android
Getting ready
Preparing the system
Installing Oracle JDK
Getting the WebRTC source code
Installing Android Developer Tools
How to do it…
Running on the Android simulator
Fixing a bug with GLSurfaceView
Running on a physical Android device
There's more…
See also
Building an OpenWebRTC library
Getting ready
How to do it…
There's more…
7. Third-party Libraries
Introduction
Building a video conference using SimpleWebRTC
Getting ready
How to do it…
How it works…
There's more…
Creating an application using RTCMultiConnection
Getting ready
How to do it…
How it works…
There's more…
Developing a simple WebRTC chat using PeerJS
Getting ready
How to do it…
How it works…
There's more…
Making a simple video chat with rtc.io
Getting ready
How to do it…
How it works…
There's more…
Using OpenTok to create a WebRTC application
Getting ready
How to do it…
How it works…
There's more…
Creating a multiuser conference using WebRTCO
Getting ready
How to do it…
How it works…
There's more…
8. Advanced Functions
Introduction
Visualizing a microphone's sound level
Getting ready
How to do it…
How it works…
See also
Muting a microphone
Getting ready
How to do it…
How it works…
There's more…
See also
Pausing a video
Getting ready
How to do it…
How it works…
See also
Taking a screenshot
Getting ready
How to do it…
How it works…
See also
Streaming media
Getting ready
How to do it…
How it works…
See also
Index
WebRTC Cookbook
WebRTC Cookbook
Copyright © 2015 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: February 2015
Production reference: 1200215
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78328-445-0
www.packtpub.com
Credits
Author
Andrii Sergiienko
Reviewers
Pasquale Boemio
Jose López
Marcos de Vera Piquero
Commissioning Editor
Usha Iyer
Acquisition Editor
Sam Wood
Content Development Editor
Rahul Nair
Technical Editor
Siddhi Rane
Copy Editor
Neha Vyas
Project Coordinator
Judie Jose
Proofreaders
Ting Baker
Simran Bhogal
Maria Gould
Paul Hindle
Indexer
Hemangini Bari
Production Coordinator
Melwyn Dsa
Cover Work
Melwyn Dsa
About the Author
Andrii Sergiienko is a computer software developer from Ukraine and is passionate about information technologies. From his early childhood, he was interested in computer programming and hardware. He took his first step into these fields more than 20 years ago. He has experience of a wide set of languages and technologies including C, C++, Java, assembly language, Erlang, JavaScript, PHP, Riak, shell scripting, computer networks, and security.
During his career he worked for both small, local companies such as domestic ISP and large, worldwide corporations such as Hewlett Packard. He also started his own projects—some of them were relatively successful.
Today, he is the owner and inspirer of OSLIKAS OÜ, a computer software company with headquarters in Estonia. The company (http://www.oslikas.com) focuses on modern IT technologies and solutions.
Working on this book was a really great and interesting experience for me. All this would be impossible without the help of certain people. And now is the time for me to say thank you to them.
First of all, I would like to thank my parents Olga and Alexander for my happy childhood that established the foundation for my life and career.
I would like to say thank you to my wife Inna for her patience, encouragement, and support during this process.
I would like to thank the Packt Publishing team as well. These guys are doing really great work and making the world a better place. We contacted some of them directly during the work, and others stayed behind the scenes. However, I know that a lot of people spent part of their lives to make this book possible. Thank you all.
About the Reviewers
Pasquale Boemio fell in love with Linux and the open source philosophy at the age of 12. Following this passion, he studied computer engineering at University of Naples Federico II from where he graduated with a master's degree.
Currently, he is working as a researcher in the Department of Electrical Engineering and Information Technology (DIETI) in the University of Naples Federico II, contributing to the development of real-time communication technologies. His efforts in this field are concretized by supporting the Meetecho project (www.meetecho.com).
Meetecho is a university spin-off and a tool for the collaborative work currently used by the Internet Engineering Task Force (IETF) to provide remote participation to the working groups. Meetecho leverages some state-of-the-art technologies (such as WebRTC and Docker) to implement a comprehensive architecture that can be lightweight and portable. Meetecho's best project is the Janus WebRTC Gateway (http://janus.conf.meetecho.com/), mentioned later in this book, which allows a user the ability to integrate different, real-time technologies without any pains.
In his spare time, Pasquale works on some personal open source projects (https://github.com/helloIAmPau) and helps the community by giving his contributions to cool projects found on the GitHub platform.
He has already worked with Packt Publishing by reviewing WebRTC Integrator's Guide, a useful guide for anyone who needs to integrate WebRTC with a retro technology such as SIP.
Jose López was born in Galicia, Spain. He is a telecommunications engineer with a large amount of experience in software development, and is also focused on real-time audio/video communications. He started working for Quobis Networks in 2013, a leading company in WebRTC solutions.
Marcos de Vera Piquero is a software engineer who has mainly worked with Python and CoffeeScript. His area of development is now focused on the server side of real-time multimedia applications at Quobis, his current employer. He's also a free software enthusiast and is trying to make it a real alternative.
www.PacktPub.com
Support files, eBooks, discount offers, and more
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
Support files, eBooks, discount offers, and morehttps://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.
Why Subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Free Access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.
Preface
WebRTC is a relatively new and revolutionary technology that opens new horizons in the area of interactive applications and services. Most of the popular web browsers support it natively (such as Chrome and Firefox) or via extensions (such as Safari). Mobile platforms such as Android and iOS allow you to develop native WebRTC applications.
This book covers a wide set of topics on how to develop software using a WebRTC stack. Using practical recipes, it considers basic concepts, security, debugging, integration with other technologies, and other important themes of the development process in a friendly manner.
You will not only learn about WebRTC-specific features, but also attendant technologies (CSS3, HTML5, and WebSockets), and how to use them along with WebRTC.
What this book covers
Chapter 1, Peer Connections, introduces you to the very basic concepts of WebRTC. This includes practical recipes on peer connections. You will also find simple demo applications in this chapter.
Chapter 2, Supporting Security, leads you through various security-related topics and covers how to secure a typical WebRTC application's infrastructure components: SSL/TLS certificates, WebSockets, web servers, STUN/TURN, data channels, and more.
Chapter 3, Integrating WebRTC, considers integrating a WebRTC application with other technologies and third-party software. This chapter describes practical cases and solutions on integration.
Chapter 4, Debugging a WebRTC Application, is dedicated to application debugging—an important topic of the software development process. In this chapter, you will learn about the topics relating to debugging in the scope of WebRTC.
Chapter 5, Working with Filters, teaches you how to use CSS3 filters with WebRTC applications. This chapter also covers custom image processing.
Chapter 6, Native Applications, contains practical, step-by-step recipes dedicated to developing native WebRTC applications on mobile platforms.
Chapter 7, Third-party Libraries, describes general use cases and practical solutions based on third-party WebRTC frameworks and services.
Chapter 8, Advanced Functions, covers how to use advanced WebRTC features. It contains practical recipes on file transferring, streaming, audio/video controlling, and more.
What you need for this book
To use the recipes and codes provided and considered in this book, you will need a few pieces of software installed:
Java SE 7: Note that for Android-related recipes from Chapter 6, Native Applications, you need Java SE 6 as well—the installation and configuration process