jmcker / WebRTC-Audio-Stream-Example

Proof-of-concept work for streaming audio over a WebRTC connection (Socket.io signaling server)
MIT License
17 stars 8 forks source link
audio-streaming signaling-server webrtc webrtc-demos

WebRTC-Audio-Stream-Example

Node/Socket.io Signaling Server

The signaling server identifies and facilitates negotiations between transceivers before they drop into a peer-to-peer connection. It must be run on a machine that is accessible by both transceivers.

  1. npm install
  2. Run node ./server.js on a machine accessible by both planned transceivers.
  3. Update the IP or URL and port in the index.html call to new Socket(ipaddr, port). These should point to your signaling server.
  4. Leave this running.

Electron Transceiver

  1. npm install
  2. Run npm start.
  3. Enter a room name.
  4. Select the stream source.
  5. Press the Connect button.
  6. Audio/video should start to flow.

Browser Receiver

Serve the required files over file:// or HTTP to use them in the browser. This has been confirmed to work (some receiver only) in Chrome, FireFox, and Chrome Android.

Make sure to npm install or some of the dependencies won't exist.

file:// protocol

  1. The simplest test would be loading the file over the file:// protocol.
  2. Open index.html in a browser by double-clicking it or dragging it into an open window.

HTTP Server

Notes