Narcoleptic Pasta Manufacturer

    This package has been deprecated

    Author message:

    This package has been deprecated. Please use @bandwidth/webrtc-browser instead.

    @bandwidth/webrtc-browser-sdk
    TypeScript icon, indicating that this package has built-in type declarations

    1.2.1 • Public • Published

    Bandwidth WebRTC Client SDK Documentation

    Initialize the Bandwidth WebRTC SDK

    import BandwidthRtc from "@bandwidth/webrtc-browser-sdk";
     
    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:

    disconnect

    • Description: Disconnect from conference.

    Event Listeners

    onUnpublished

    • Description: Listens for the unpublished event.
    bandwidthRtc.onUnpublished((event) => {
      console.log(`The stream ${event.streamId} has been unpublished.`);
    });

    onSubscribe

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

    onUnsubscribed

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

    onRemoved

    • Description: Listens for the removed from conference event.
    bandwidth.onRemoved((event) => {
      console.log(`Participant ${event.participantId} has been removed from the conference.`);
    });

    onConferenceEnded

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

    Keywords

    none

    Install

    npm i @bandwidth/webrtc-browser-sdk

    DownloadsWeekly Downloads

    12

    Version

    1.2.1

    License

    MIT

    Unpacked Size

    364 kB

    Total Files

    53

    Last publish

    Collaborators

    • mhamer-bw
    • jmulford-bandwidth
    • tbowen
    • zelitzsi
    • themikez
    • nguyer
    • developerhelp-bandwidth
    • cejohnson-bw