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
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Getting Started with WebRTC

You're reading from   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.

Arrow left icon
Product type Paperback
Published in Sep 2013
Publisher Packt
ISBN-13 9781782166306
Length 114 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Rob Manson Rob Manson
Author Profile Icon Rob Manson
Rob Manson
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Getting Started with WebRTC
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. An Introduction to Web-based Real-Time Communication 2. A More Technical Introduction to Web-based Real-Time Communication FREE CHAPTER 3. Creating a Real-time Video Call 4. Creating an Audio Only Call 5. Adding Text-based Chat 6. Adding File Sharing 7. Example Application 1 – Education and E-learning 8. Example Application 2 – Team Communication Index

Adding JavaScript for enabling file sharing


First, we add a new global variable that is used to hold all the data that defines the list of files that have been shared.

var file_store = []; // shared file storage

Then, at the end of the start() function, we add an if/else block, which detects if our browser supports all of the capabilities required to enable file sharing.

  // setup file sharing
  if (!(window.File
        && window.FileReader
        && window.FileList
        && window.Blob)) {
    document.getElementById("file_sharing").style.display = "none";
    alert("This browser does not support File Sharing");
  } else {
    document.getElementById("file_add").onclick = click_file_input;
    document.getElementById("file_input").addEventListener("change",file_input, false);
    document.getElementById("open_call_state").addEventListener("dragover", drag_over, false);
    document.getElementById("open_call_state").addEventListener("drop", file_input, false);
...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime