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

@bandwidth/bandwidth-rtc-sdk-client

Package Overview
Dependencies
Maintainers
15
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bandwidth/bandwidth-rtc-sdk-client

SDK for Bandwidth WebRTC Browser Applications

  • 1.0.11
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
15
Weekly downloads
 
Created
Source

Bandwidth WebRTC Client SDK Documentation

Initialize the Bandwidth WebRTC SDK

import BandwidthRtc from "@bandwidth/bandwidth-rtc-sdk-client";

const bandwidthRtc = new BandwidthRtc();

API Methods

connect

  • Params:
    • authParams: The conferenceId and participantId.
    • options: Optional SDK settings (can be omitted).
      • websocketUrl: override the default Bandwidth RTC connection url (this should not generally be needed)
  • Description: Connect participant to a conference.
await bandwidthRtc.connect({
  conferenceId: conferenceId,
  participantId: participantId
});

publish

  • Params:
    • constraints: The media stream constraints such as audio, peerIdentity, video
      • Type: MediaStreamConstraints
  • Return:
    • userMedia: A media stream with the supplied media stream constraints.
  • Description: Publish media
Publish with default settings:
let localStream: MediaStream = await bandwidthRtc.publish();
Publish audio only
const mediaConstraints: MediaStreamConstraints = {
  audio: true,
  video: false
};
let localStream: MediaStream = await bandwidthRtc.publish(mediaConstraints);
Publish with customized constraints
const mediaConstraints: MediaStreamConstraints = {
  audio: {
    autoGainControl: true,
    channelCount: 1,
    deviceId: "default",
    echoCancellation: true,
    latency: 0.01,
    noiseSuppression: true,
    sampleRate: 48000,
    sampleSize: 16
  },
  video: {
    aspectRatio: 1.3333333333333333,
    frameRate: 30,
    width: { min: 640, ideal: 1280 },
    height: { min: 480, ideal: 720 },
    resizeMode: "none"
  }
};
let localStream: MediaStream = await bandwidthRtc.publish(mediaConstraints);

Please see the following resources for more information on MediaStreamConstraints and MediaTrackConstraints that can be specified here:

  • https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraints
  • https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints

disconnect

  • Description: Disconnect from conference.

Event Listeners

onSubscribe

  • Description: Listens for the subscribe event and execute provided callback.
bandwidthRtc.onSubscribe(event => {
  console.log(`The stream ${event.streamId} has been subscribed to.`);
});

onUnsubscribe

  • Descripton: Listens for the unsubscribe event.
bandwidthRtc.onUnsubscribe(event => {
  console.log(`The stream ${event.streamId} has been unsubscribed from.`);
});

onConferenceEnded

  • Description: Listens for the conference ended event.
bandwidthRtc.onConferenceEnded(event => {
  console.log(`The conference ${event.conferenceId} ended.`);
});

FAQs

Package last updated on 28 Jan 2020

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