You are previewing Getting Started with WebRTC.
O'Reilly logo
Getting Started with WebRTC

Book Description

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.

  • 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

  • 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.

    Table of Contents

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