Git Product home page Git Product logo

web-broadcasting-software's Introduction

Web Broadcasting Software (WBS)

JavaScript Style Guide

screenshot

Try the Live Demo

Live broadcasting and recording software for the web, inspired by OBS. WBS allows broadcasters to record video and audio, create video composites, apply audiovisual effects and eventually output to a broadcast transport (which is not within the scope of this project)... all within the browser.

The UI and functionality of WBS is modeled around Open Broadcasting Software (OBS), but can be easily modified to suit less technical users.

If you've never used similar software:

  1. Click "+" on scenes.
  2. Click "+" on sources.
  3. Select a media device.
  4. You can then drag and resize that video, or add more videos to make a composite.
  5. Switch between scenes and active videos by click on them.
  6. "Start Streaming" emits an output MediaStream that can be used in other modules.

install

<script src="wbs.js"></script>

usage

<div></div>
<script>
  var wbs = new WBS('div') // Element or selector to place the UI
  
  wbs.on('stream', function (stream) {
    // fired when user presses "Start Streaming"
    // stream is the MediaStream output
  })
  wbs.on('stopstream', function () {
    // fired when the user presses "Stop Streaming"
  })
</script>

api

var wbs = new WBS(element, [opts])

element is a HTMLElement or CSS selector string. The display will attempt to fit inside this element.

This constructor must be wrapped in a user gesture like a "click" event listener.

Optional opts is a configuration object that will override the following defaults:

{
  output: {
    width: 1200,  // resolution of the output stream
    height: 900,
    fps: 40       // frames per second of the output stream
  },
  injectStyles: true, // whether to inject the WBS css
  inputs: [array of input devices - see below]
}

adding input devices

WBS automatically detects AV devices on the system. However, any method to get a MediaStream can be used as an input. To add your own, put an object inside the opts.inputs array that has the following format:

{
  name: 'Display Name of Device', // Can be anything, but it should be descriptive
  getStream: function (callback) {
    // This function should call "callback" with the following arguments
    callback(err, name, isVideo, stream)  
      - "err" is any error thrown, null otherwise
      - "name" is the name of the device, with the kind (Video/Audio Input/Ouput) in brackets
      - "isVideo" is true if the stream will have only video tracks, false if only audio tracks.
      - "stream" is the input MediaStream
  }
}

Here is an example device:

{
  name: 'Video Camera (Video Input)',
  hasVideo: true, // false for
  getStream: function (callback) {
    getusermedia({audio:false, video:true}, function (err, stream) {
      callback(err, 'Video Camera', true, stream)
    })
  }
}

notes

wbs does not broadcast your video, it simply gives you an output MediaStream to do with as you wish.

You could send it over a WebRTC connection, record it as a file, send to to a proxy RTMP server, pipe it through FFMPEG... anything.

For an example P2P transport using Dat and BeakerBrowser, see wbs-plus-hypercast. (Only works with Beaker Browser.)

Sponsors

Support this project by becoming a sponsor. Your logo will appear here with a link to your website. [Become a sponsor]

web-broadcasting-software's People

Contributors

t-mullen avatar rationalcoding avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.