New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

spreadcast

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spreadcast

Broadcast a WebRTC stream to many subscribers

0.2.0
Source
npm
Version published
Maintainers
1
Created
Source

spreadcast.js

npm version

Broadcast WebRTC streams to many subscribers

Installation

npm install spreadcast --save

Usage

Node Server

var Spreadcast = require('spreadcast');

var server = require('http').createServer();
server.listen();

Spreadcast.serve({server: server});

Browser Client

// If you use Browserify in your project already,
// you can require spreadcast directly

var Spreadcast = require('spreadcast');

// Otherwise include the bundle from
// ./node_modules/spreadcast/dist/spreadcast.min.js in your HTML

// Use the Room class to easily implement a video chat
// among several publishers with many viewers

var room = new Spreadcast.Room('roomName');

room.onAddStream = function(video) {
  document.body.appendChild(video);
};

room.onRemoveStream = function(video) {
  video.parentElement.removeChild(video);
};

// Call publish/unpublish anytime 
room.publish({
  video: {
    width: 320,
    height: 240,
    frameRate: 20
  }
}, function(error, video) {
  if(error) return console.error(error);
  document.body.appendChild(video);
});


// You can also use the Broadcast class directly
// to implement simple one-to-many scenarios

var publisher = new Spreadcast.Broadcast('streamName');

publisher.publish({
  video: {
    width: 640,
    height: 480,
    frameRate: 30
  }
}, function(error, video) {
  if(error) console.error(error);
  document.body.appendChild(video);
});

var receiver = new Spreadcast.Broadcast('streamName');

receiver.receive(function(error, video) {
  if(error) console.error(error);
  document.body.appendChild(video);
});

License

MIT

Keywords

webrtc

FAQs

Package last updated on 15 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts