Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

webrtc-browser-test

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webrtc-browser-test

Test video and audio capabilities of the browser, verifying hardware works properly.

  • 1.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

webrtc-browser-test

Test video and audio capabilities of the browser, verifying hardware works properly.

This detects whether your browser supports the WebRTC API for video and audio, gathers video and audio hardware information, and initializes video and audio streaming to the browser. It will give feedback for whether the user has granted permission to the browser, and whether any other errors have occurred. It will also provide volume information from the microphone if it's enabled and working properly.

This will throw a few custom types of errors, depending on what breaks and when.

  • ParameterError - Parameter passed is either missing or incorrect type.
  • BrowserNotSupportedError - The browser either doesn't support Promises, WebRTC, or Web Audio (used for the volume meter).
  • VideoNotFoundError - The browser couldn't detect any video input hardware.
  • VideoDeniedError - The user denied permission to the browser to use the video input.
  • AudioNotFoundError - The browser couldn't detect any audio input hardware.
  • AudioDeniedError - The user denied permission to the browser to use the audio input.

Dependencies

None

Usage

var browserTest = WebRtcBrowserTest(opts);
browserTest.startAll();

Options:

  • mediaElementContainer (required) - The element (or selector) of where you want the video and audio elements to appear on the page.
  • onVolumeChange (optional) - Callback returning the current volume (RMS normalized from 0 to 1).

webrtc-browser-test uses Promises to run the various tests. The tests you can run are:

  • checkBrowser() - Check whether the browser has the getUserMedia() method.
  • startVideo() - Requests local video access and displays it in the browser.
  • startAudio() - Requests local video access and outputs it to the speakers. Also begins outputting volume to the optional onVolumeChange callback.
  • startAll() - Run all the above tests.
  • checkScreenSharing() - Check whether the browser supports the getDisplayMedia method.
  • startScreenSharing() - Initiates screen sharing.
  • endScreenSharing() - Stops screen sharing and resumes using the camera.

Example

var browserTest = WebRtcBrowserTest({
  mediaElementContainer: '#mediaContainer',
  onVolumeChange: function(level) {
    console.log('Volume: ' + level);
  }
});
browserTest.startAll().then(function() {
  console.log('started');
}).catch(function(err) {
  message.innerHTML = err.name + '\n' + err.message;
  console.log(err);
});

See index.html for full working example.

Demo

npm run demo

License

MIT

FAQs

Package last updated on 13 Mar 2019

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