Huge News!Announcing our $40M Series B led by Abstract Ventures.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
  • Socket score

Version published
Weekly downloads
5
decreased by-54.55%
Maintainers
1
Weekly downloads
 
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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc