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

Visualizing a microphone's sound level


If your application works with audio and video (for example, you're developing a video conferencing service), it would be probably a good idea to add a live indication of the microphone sound level. Using this feature, peers can estimate and control their microphone's audio levels. So, in this recipe, we're implementing microphone activity indication.

Getting ready

This recipe is simple, and you will just need a text editor to create and edit HTML. To test this recipe, you should have a web server installed and configured—it is highly recommended to test the example via a web server rather than just on a local filesystem; otherwise, the web browser might block calls to the WebRTC API.

How to do it…

Perform the following steps:

  1. Create an HTML file and insert the following codes. Note that the important places are commented inline:

    <!DOCTYPE html>
    <html>
    <head lang="en">
        <meta charset="UTF-8">
  2. Include the WebRTC adapter from Google...