Nurturing Pluto's Martians
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

@voxeet/react-components

0.30.7 • Public • Published

Voxeet React Components

Installation

npm i @voxeet/voxeet-web-sdk @voxeet/react-components --save
yarn add @voxeet/voxeet-web-sdk @voxet/react-components

Usage

Reducer

A redux reducer needs to be added to your store.

import { reducer as voxeetReducer } from '@voxeet/react-components';
 
const reducers = combineReducers({
  voxeet: voxeetReducer
});

Widget

import React from 'react'
import ReactDOM from 'react-dom'
import { Provider } from 'react-redux'
import thunkMidleware from 'redux-thunk'
import { combineReducers, createStore, applyMiddleware } from 'redux'
 
import { ConferenceRoom, reducer as voxeetReducer } from '@voxeet/react-components'
 
// Import Style
import '@voxeet/react-components/dist/voxeet-react-components.css';
 
const reducers = combineReducers({
  voxeet: voxeetReducer
});
 
const configureStore = () => createStore(
  reducers,
  applyMiddleware(thunkMidleware)
)
 
const settings = {
  consumerKey: 'consumerKey',
  consumerSecret: 'consumerSecret',
  conferenceAlias: 'Sample2'
}
 
ReactDOM.render(
  <Provider store={configureStore()}>
    <ConferenceRoom
      isWidget
      consumerKey={settings.consumerKey}
      consumerSecret={settings.consumerSecret}
      conferenceAlias={settings.conferenceAlias}
    />
  </Provider>,
  document.getElementById('app')
)

where consumerKey and consumerSecret or oauthToken (retrieve by backend) are your credentials and conferenceAlias the conference you want to join.

The Widget is translate in english and french. The language will be automatically choose base on your browser language.

Widget Properties

Name Type Default Description
sdk Function VoxeetSDK if you want to use an external Voxeet SDK
consumerKey String The consumer key
consumerSecret String The consumer secret
oauthToken String The oauth token retrieve from your backend (prevent using consumerKey/consumerSecret in frontend) ! Make sure to use this `refreshTokenCallback props of the widget too !
refreshTokenCallback func Provide this function that return a promise with the refreshed token, when this one expire
conferenceAlias String The conference you whant to join
displayActions Array ["mute" ,"recording", "screenshare", "video"] You can disable some actions buttons. Example : displayActions={["mute", "video"]} will allow to video and mute button (Strings : "mute", "video", "screenshare", "recording")
liveRecordingEnabled Boolean false Ability to record a conference in live. Generate an MP4 video of the conference. Can be retrieve by a webhook (a small delay might be necessary for process the video)
isWidget Boolean true Indicate if component used like widget or embedded in your app
isModal Boolean false Indicate if component displayed like modal
isWebinar Boolean false Launch the widget in Webinar mode, only admin can speak (Restriction in "tiles" mode)
autoJoin Boolean false Join automatically conference
displayModes Array ["list", "tiles", "speaker"] Indicate which mode is allowed (modes will be in the same order as the array)
isManualKickAllowed Boolean false Authorize admin (conference creator) to kick users in conference
isAdmin Boolean false Current user who join the conference is the admin
kickOnHangUp Boolean false Kick all users when admin (conference creator) leave the conference
userInfo Object {
  name: 'Guest ' + Math.floor((Math.random() * 100) + 1),
  externalId: '',
  avatarUrl: ''
}
User informations for voxeet sdk
conferenceReplayId String Replay automatically a conference
constraints Object {
  audio: true,
  video: false
}
The webrtc constraints for the sdk
actionsButtons React Component ActionsButtons - All buttons A react component to customize the actions buttons
handleOnLeave Function Function call on leave conference
handleOnConnect Function Function call when the current user is connected to the conference

For more documentation on userInfo and constraints you can look at Voxeet Sdk

Actions buttons

The default control buttons component is below, you can customize it for you needs. Just replace

import React, { Component } from 'react'
import PropTypes from 'prop-types'
 
import {
    HangupButton,
    ToggleSidebarButton,
    ToggleFullScreenButton,
    ToggleMicrophoneButton,
    ToggleRecordingButton,
    ToggleScreenShareButton,
    ToggleVideoButton,
    ToggleSettingsButton,
    ToggleModeButton
} from './buttons'
 
class ActionsButtons extends Component {
 
    constructor(props) {
        super(props)
    }
 
    render() {
        const { isBottomBar, forceFullscreen, isMuted, isRecording, isWidgetFullScreenOn,
            videoEnabled, displayModal, screenShareEnabled, mode,
            toggleMicrophone, toggleRecording, toggleVideo, toggleScreenShare,
            toggleModal, toggleMode, isWebinar, isAdmin } = this.props
        return (
            <ul>
                {!isWidgetFullScreenOn && !forceFullscreen && (!isWebinar || (isWebinar && isAdmin)) &&
                    <ToggleMicrophoneButton
                        isMuted={isMuted}
                        toggle={toggleMicrophone}
                        tooltipPlace={isBottomBar ? 'top' : 'right'}
                    />
                }
                {!isWidgetFullScreenOn && !forceFullscreen && (!isWebinar || (isWebinar && isAdmin)) &&
                    <ToggleRecordingButton
                        isRecording={isRecording}
                        toggle={toggleRecording}
                        tooltipPlace={isBottomBar ? 'top' : 'right'}
                    />
                }
                {!isWidgetFullScreenOn && !forceFullscreen && (!isWebinar || (isWebinar && isAdmin)) &&
                    <ToggleScreenShareButton
                        screenShareEnabled={screenShareEnabled}
                        toggle={toggleScreenShare}
                        tooltipPlace={isBottomBar ? 'top' : 'right'}
                    />
                }
                {!isWidgetFullScreenOn && !forceFullscreen && (!isWebinar || (isWebinar && isAdmin)) &&
                    <ToggleVideoButton
                        videoEnabled={videoEnabled}
                        toggle={toggleVideo}
                        tooltipPlace={isBottomBar ? 'top' : 'right'}
                    />
                }
                {!isWidgetFullScreenOn && !forceFullscreen &&
                    <ToggleSettingsButton
                        displayModal={displayModal}
                        toggle={toggleModal}
                        tooltipPlace={isBottomBar ? 'top' : 'right'}
                    />
                }
                {!isBottomBar &&
                    <ToggleModeButton
                        mode={mode}
                        toggleMode={toggleMode}
                    />
                }
            </ul>
        )
 
    }
}
 
ActionsButtons.propTypes = {
    isBottomBar: PropTypes.bool.isRequired,
    forceFullscreen: PropTypes.bool.isRequired,
    isMuted: PropTypes.bool.isRequired,
    isWebinar: PropTypes.bool.isRequired,
    isAdmin: PropTypes.bool.isRequired,
    videoEnabled: PropTypes.bool.isRequired,
    screenShareEnabled: PropTypes.bool.isRequired,
    displayModal: PropTypes.bool.isRequired,
    isRecording: PropTypes.bool.isRequired,
    isWidgetFullScreenOn: PropTypes.bool.isRequired,
    toggleMicrophone: PropTypes.func.isRequired,
    toggleRecording: PropTypes.func.isRequired,
    toggleVideo: PropTypes.func.isRequired,
    toggleScreenShare: PropTypes.func.isRequired,
    toggleModal: PropTypes.func.isRequired,
    toggleMode: PropTypes.func.isRequired,
    mode: PropTypes.string.isRequired,
}
 
ActionsButtons.defaultProps = {
    isBottomBar: false,
    forceFullscreen: false
}
 
export default ActionsButtons

Keywords

none

install

npm i @voxeet/react-components

Downloadsweekly downloads

14

version

0.30.7

license

none

last publish

collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
Report a vulnerability