Skip to content

johanholmerin/worker-webrtc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Worker WebRTC Polyfill travis

Makes it possible to use WebRTC in Workers.

Install

yarn add git+https://github.com/johanholmerin/worker-webrtc#semver:^0.1.1

Usage

// in window
import workerRTC from 'worker-webrtc/window.js';

const worker = new Worker('worker.js');
workerRTC(worker);
// worker.js
// NOTE: EventTarget polyfill needed here
import {
  RTCPeerConnection,
  RTCSessionDescription,
  RTCIceCandidate
} from 'worker-webrtc/worker.js';

const connection = new RTCPeerConnection();
const datachannel = connection.createDataChannel('label');
...

Notes - read before using

EventTarget

The polyfill extends EventTarget, which is not yet supported in all browsers. You are going to need a EventTarget polyfill, such as event-target.

This is only needed in the Worker.

Babel

If using Babel < 7, babel-plugin-transform-builtin-classes is required.

Streams

Media streams, accessible through getUserMedia() and captureStream(), are not supported by the polyfill.