1.1.3 • Published 3 months ago

rankrtc v1.1.3

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

rankrtc

React component that embeds Janus client inside react application

NPM JavaScript Style Guide

Install

npm install --save rankrtc

Usage

import React, { Component } from 'react'

import {
  RankRTC,
  hangup, 
  isAudioMuted,
  isVideoMuted, 
  muteAudio, 
  muteVideo, 
  unmuteAudio, 
  unmuteVideo,
  shareScreen, 
  stopShare,
  setBackground
} from 'rankrtc'
import 'rankrtc/dist/index.css'
const bkg = require('./Backdrop_Blue_Background.jpg');

const config = {
  server: serverUrl,
  iceServers: [
    {
      urls: "turn:<turn server url>",
      username: "<turn username>",
      credential: "<turn password>"
    }
  ],
  backgroundChangeMode: 'static',
  backgroundImage: bkg
}

class Example extends Component {

  const eventHandler = {
    joinSuccess: () => {
      console.log('joined successfully');
      setConfJoined(true);
    },
    joinFail: (event) => {
      console.log('join failed', event.detail.reason);
    },
    leave: () => {
      window.location.reload()
    },
    publishSuccess: () => { console.log('feed published') },
    publishFail: (event) => {
      setPublished(false)
      console.log('publish failed', event.detail.reason);
      console.warn("Maximum publisher limit reached. No one can see or hear you! You will still be able to view all the publishers.")
    },
    participantJoined: (participant) => {
      console.log('participant joined', participant)
    },
    participantLeft: (participant) => {
      console.log('participant left', participant)
    },
    participantListUpdated: (participants) => {
      console.log('participants', participants)
      setParticipantList(participants)
    },
    videoMuted: () => { },
    videoUnmuted: () => { },
    audioMuted: () => { },
    audioUnmuted: () => { },
    shareStarted: () => { },
    shareStopped: () => { },
    shareFailed: () => { },
  }

  render() {
    return <RankRTC
                displayName="Participant name"
                roomName="Room id in integer"
                configParams={config}
                joinNow={true} // if it is true, joining will be done immediately
                on={eventHandler} // events emitted from component
              />
  }
}

License

MIT © webdevrank

1.1.1

4 months ago

1.0.19

4 months ago

1.1.0

4 months ago

1.0.17

7 months ago

1.1.3

3 months ago

1.1.2

4 months ago

1.0.21

4 months ago

1.0.20

4 months ago

1.0.13

10 months ago

1.0.11

2 years ago

1.0.12

2 years ago

1.0.10

2 years ago

1.0.8

2 years ago

1.0.6-c

2 years ago

1.0.6-b

2 years ago

1.0.6-a

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago