Git Product home page Git Product logo

webrtcjs's Introduction

WebRTC Javascript library

WebRTC JavaScript publisher library allows adding WebRTC publishing capabilities to your web pages. It uses WHIP signaling.

Use its code in your projects or take it as is for embedding into your pages to connect your users to Nimble Streamer. To learn more about server setup, read WebRTC setup article.

The following codecs can be used:

Specific codecs can be set via "videocodecs" parameter is WHIP URL.

Use demo publishing page to publish to your Nimble Streamer instance.

Getting Started

Add library to HTML

<script defer="defer" src="e32af6a81c16a82154b7.bundle.js"></script>

Usage

var config = {
  whipUrl: 'https://127.0.0.1:8443/live/whip?whipauth=username:password'
};
var publisher = new WebRTCjs(config);
publisher.publish();

Full example

<!DOCTYPE html>
<html>
  <head>
    <script defer="defer" src="e32af6a81c16a82154b7.bundle.js"></script>
  </head>
  <body>
    <script type="text/javascript">
      document.addEventListener("DOMContentLoaded", function(event) {
        var config = {
          whipUrl: 'https://127.0.0.1:8443/live/whip?whipauth=username:password',
        };
        var publisher = new WebRTCjs(config);
        publisher.publish();
      });
    </script>
  </body>
</html>

Configuration options

  • whipUrl - publishing URL with authorization parameters.
  • logLevel - the log level: info, or error.
  • videoElement - <video> tag to local monitoring published stream.
  • videoSelect - <select> tag with available cameras.

Callbacks

  • onPublisherCreated - called when publisher instance has been created with the provided configuration. Parameters: settings.
  • onConnectionStateChange - called when connection state has changed. Parameters: connectionState.
  • onOffer - called when SDP offer is ready. Parameters: offer.
  • onAnswer - called when server answer has been received. Parameters: answer.
  • onConnectionError - called if connection error happens. Has no parameters.

Callback usage example

var config = {
  whipUrl: 'https://127.0.0.1:8443/live/whip?whipauth=username:password',

  onPublisherCreated: function(settings){ console.log('Ready to WebRTC publishing'); }
};

Related documentation

webrtcjs's People

Contributors

shovtyuk avatar wmspanel avatar alexpokotilo avatar juaoose 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.