Naughty Programmer's Madness

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

    1.3.1 • Public • Published

    Bandwidth WebRTC

    Test

    OS Node
    Windows 2016 12, 14, 16
    Windows 2019 12, 14, 16
    Ubuntu 18.04 12, 14, 16
    Ubuntu 20.04 12, 14, 16

    Installation

    Use the following command to install the package.

    npm install @bandwidth/webrtc
    

    SDK Setup

    The following code will initialize the SDK client.

    import { Client } from '@bandwidth/webrtc';
    
    const client = new Client({
      basicAuthUserName: 'user',
      basicAuthPassword: 'pass'
    })

    Create Session

    import { Client, Session, ApiController } from '@bandwidth/webrtc';
    
    const client = new Client({
      basicAuthUserName: 'user',
      basicAuthPassword: 'pass',
    })
    const controller = new ApiController(client);
    const accountId = 'accountId0';
    const body: Session = {
      tag: 'session1'
    };
    
    const response = await controller.createSession(accountId, body);
    console.log(response.result.id);

    Create Participant

    import {
      Client,
      Participant,
      ApiController,
      ParticipantSubscription,
      Subscriptions,
    } from '@bandwidth/webrtc';
    
    const client = new Client({
      basicAuthUserName: 'user',
      basicAuthPassword: 'pass',
    })
    const controller = new ApiController(client);
    const accountId = 'accountId0';
    
    const body: Participant = {
      callbackUrl: 'https://example.com/callback',
      tag: 'participant1',
      deviceApiVersion: 'v3'
    };
    
    const response = await controller.createParticipant(accountId, body);
    console.log(response.result.participant.id);

    Add Participant to Session

    import {
      ApiController,
      Client
    } from '@bandwidth/webrtc';
    
    const client = new Client({
      basicAuthUserName: 'user',
      basicAuthPassword: 'pass',
    })
    const controller = new ApiController(client);
    
    const accountId = '01234';
    const sessionId = '56789';
    const participantId = '012';
    
    const participant1 = {
        participantId: '456'
    };
    
    const participant2 = {
      participantId: '789',
      streamAliases: ['alias1', 'alias2']
    };
    
    const sessionIdArg = '012345';
    
    const subscriptions = {
      sessionId: sessionIdArg,
      participants: [participant1, participant2]
    };
    
    controller.addParticipantToSession(accountId, sessionId, participantId, subscriptions);

    Bandwidth's WebRTC References

    Please visit our WebRTC home page for more information on Bandwidth's WebRTC platform.

    Keywords

    none

    Install

    npm i @bandwidth/webrtc

    DownloadsWeekly Downloads

    80

    Version

    1.3.1

    License

    MIT

    Unpacked Size

    561 kB

    Total Files

    86

    Last publish

    Collaborators

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