1.0.12 • Published 5 months ago

rankrtc v1.0.12

Weekly downloads
-
License
MIT
Repository
github
Last release
5 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.0.11

5 months ago

1.0.12

5 months ago

1.0.10

5 months ago

1.0.8

6 months ago

1.0.6-c

8 months ago

1.0.6-b

8 months ago

1.0.6-a

8 months ago

1.0.6

8 months ago

1.0.5

8 months ago

1.0.4

8 months ago

1.0.3

11 months ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago