Inquirium Usage Notes - remap/comhall-webrtc GitHub Wiki
THEORY OF OPERATION:
The system consists of four elements:
- PRODUCER, an HTML5 webapp that uses the video API to grab the video sources. It connects to a webservice written in NodeJS to publish its video stream using WebRTC protocols (?)
- CONSUMER, another HTML5 webapp which can query the NodeJS webservice to discover and display WebRTC streams from PRODUCER
- The NodeJS webservice that listens on either port 3001 or port 3002. It provides the bridge between the webapps.
- a Python HTTP server that listens on port 8000, which is what delivers the webapps' files to a browser. It is not part of the WebRTC critical path.
To run everything, you need to run the node webservice, which is what enables producers to publish to consumers as a "central switchboard". You also have to run the python http server to serve the files for http://localhost:8000/consumer
and http://localhost:8000/producer
because the node program is not programmed to do that.
Secondly, as documented in the "two camera" setup in the readme, you can specify which port to listen to for each instance of the node server. It invisibly defaults to 3001. Although you can select one of two cameras in PRODUCER or CONSUMER, if you select WEBCAM you will see CONNECTION REFUSED errors in the console. That's because WEBCAM is port 3002.
- When confirming that producer is running, press the
s
key to see what it's doing. The first time it runs, it has no idea what camera port to use and fails silently until you select one. After that, the value is saved in a browser cookie. - When confirming that consumer can connect to the publisher, make sure that the port that you select there is the same as what producer is set to.
- If nothing appears to be working, remember to check the port that the node server is listening to.
github repo notes
when you git clone
this repo the first time, you need to also pull the socket.io submodule otherwise execution will fail because of the missing library. There is no warning for this other than in the browser's javascript console.
If you are pulling the repo for the first time into a fresh directory, do this:
git clone --recursive <URL-OF-REPOSITORY>
If you have ALREADY pulled the repo without the --recursive
flag, you can do this:
cd <REPO-DIRECTORY>
git submodule init
git submodule update
After you do any pulls afterwards, use git submodule update --recursive
to update the submodules.
NOTE: If you are using GitHub for Mac to do the initial clone, it seems to initialize the submodules for you. Yay!
Understanding the source code
This high-level overview of WebRTC can help explain the WebRTC acronyms littered throughout the source code.