A Web library to simply integrate Agora Video Calling or Live Video Streaming to your website with just a few lines of code

Overview

Agora React Web UIKit

Instantly integrate Agora video calling or streaming into your web application using a React based UIKit for the Agora Web SDK.

NPM JavaScript Style Guide

Getting started

Requirements

You can also use the UIKit outside a React project (for example in a vanilla-js project) using web-components. Find out more in the /web-component directory.

Installation

To a react application, add the following:

npm i agora-react-uikit

Usage

This UIKit contains a high level component called AgoraUIKit. You can check out code explanation here.

A simple sample app integrating Agora UI Kit:

import React, {useState} from 'react';
import AgoraUIKit from 'agora-react-uikit';

const App = () => {
  const [videoCall, setVideoCall] = useState(true);
  const rtcProps = {
    appId: '<Agora App ID>',
    channel: 'test', // your agora channel
    token: '<Your channel Token>' // use null or skip if using app in testing mode
  };
  const callbacks = {
    EndCall: () => setVideoCall(false),
  };
  return videoCall ? (
    <div style={{display: 'flex', width: '100vw', height: '100vh'}}>
      <AgoraUIKit rtcProps={rtcProps} callbacks={callbacks} />
    </div>
  ) : (
    <h3 onClick={() => setVideoCall(true)}>Start Call</h3>
  );
};

export default App;

Insert your Agora AppID and Token.

Demo Project

There's a demo project in the repo here.

Instructions for running the demo:

  1. Add your Agora App ID to /example/src/App.tsx
  2. Run npm start to start the bundler to build the library
  3. Execute cd example && npm start to run the example app

Documentation

For full documentation, see our docs page.

You can visit the wiki for other examples and in depth guide.

Comments
  • Some Suggestions

    Some Suggestions

    Thanks for coming up with the idea of a higher level API for demystifying Agora video processing. The Agora Web UI Kit is easy to use. I applaud you for that. Nonetheless, for a developer with need to integrate video into a business systems, some heavy customization might be needed. Look and feel is what UI is all about. It is great, one can recompose the UI and I think that's where most serious developers will put their focus on if they want to use the kit.

    I am assuming you wrote the kit for easy integration to UI frameworks and in particular React developers. I know it is COOL to use TypeScript for development. But I can tell you that as a consultant that work with US companies "Raw React JS" is used 95% of the time because it is easier to integrate with other components used heavily in most companies.

    My humble suggestions (others can help in the implementation)

    1. A good example of the kit using just pure React (no TypeScript). There is simple TypeScript example already.
    2. A detailed example of recomposing the kit using raw React and TypeScript with emphasis on:
    • capturing local and remote video
    • How to customize the video containers, buttons and icons with the freedom to place icons and control bars in any desired location
    • In short a better exposure (example) on how to use most of the functions and props in raw React and TypeScript.
    1. I am open to help build a POC application by recomposing the UI Kit.

    Thanks Agora for your SDKs and special thanks to Ekaansh Arora for coming up with UI web kit.

    Jonathan Ekwempu

    opened by onyii5119 4
  • Unable to view local video.

    Unable to view local video.

    I try to run the example project and add my app id in /example/src/App.tsx file. I am using the secure token for authentication so i add tokens in rtcProps and give a role as host and channel name which i used to generate the token. Still not able to view my local video. Screens show just blank

    opened by iamkunall 3
  • Unable to find the sendChannelMessage method

    Unable to find the sendChannelMessage method

    I am trying to integrate Agora UI Kits into my react app, the connection part works and I am able to connect to both RTM and RTC channels, now I want to be able to send a message to everyone in the channel, I see there is a "sendChannelMessage" method under "RtmContext" in the library but I am unable to figure out how to import and use this method? Even if I import RtmContext it doesn't seem to expose the sendChannelMessage method somehow? Please help me, thanks!

    I tried referring to this: https://agoraio-community.github.io/Web-React-UIKit/interfaces/internal.rtmContext.html#sendChannelMessage but I'm unable to understand how to import this into React

    enhancement hacktoberfest 
    opened by monizb 2
  • Invalid App ID

    Invalid App ID

    I am trying to integrate UI Kit with my app, I generate join token server side and when I try to render the Agora UI Kit, I get the following error :

    **"'AgoraRTCException', code: 'CAN_NOT_GET_GATEWAY_SERVER', message: 'AgoraRTCError CAN_NOT_GET_GATEWAY_SERVER: invalid vendor key, can not find appid'**

    I thought it was a mistake on my end, I went to the Agora dashboard and clicked on "create web demo link" and it didn't work there as well, the same error was popping up on the console.

    P.S: My app ID is correct

    opened by monizb 2
  • know when the audio and video mute button is clicked

    know when the audio and video mute button is clicked

    know when the audio and video mute button is clicked,,

    I have tried the following but it doesn't work

    callbacks: { "local-user-mute-audio": (status) => { console.log('status', status) }, },

    thank you

    opened by ronny141 2
  • How to add a new component to LocalControls?

    How to add a new component to LocalControls?

    I want to add a new new component to LocalControls, I checked the repo but I didn't find any solution. Can you plz tell me how to do that? I want to add a timer and few other buttons as follows:

    image

    opened by gdSuhail 2
  • Gatsby - error

    Gatsby - error "window" is not available during server side rendering.

    Hi @EkaanshArora, Thanks for the UiKit.

    I have added the UIKit to one of our Gatsby project and it is working great but the problem is occuring during the build process. I am getting the error "window" is not available during server side rendering. error during running the build. The error is coming in the AgoraRTC_N-production.js file. I tried checking the condition of isBrowser() and then rendering the AgoraUIKit but still the same error is occuring. Please tell me how can I fix this issue. Thanks

    image

    opened by gdSuhail 2
  • enableVideo: false or enableAudio: false not working for LocalParticipant

    enableVideo: false or enableAudio: false not working for LocalParticipant

    Hi,

    I have the following configuration and seems to not work for the LocalParticipant even though i set the camera and mic to false.
    

    const [rtcProps, setRTCProps] = React.useState<RtcPropsInterface>({ CustomVideoPlaceholder: Placeholder, appId: "c532a7b1c4e04ad3a35052133adafaa6", channel: "", token: "", activeSpeaker: true, enableAudio: queryParams["audio"] === "on" ? true : false, enableVideo: queryParams["video"] === "on" ? true : false, role: "host", uid: authUserId as number, layout: layout.grid, disableRtm: true, });

    Any idea why this is not working???

    opened by Mihai-github 1
  • Changes in Wiki

    Changes in Wiki

    So , in the wiki image There is an extra div closing tag under the example section Along with that, on 6th line of the same code snippet, SetRole is not defined (can be replaced with setHost perhaps)

    opened by BearTS 1
  • fix(buttons): fixing custom icons in buttons template

    fix(buttons): fixing custom icons in buttons template

    There's an error when only some cusom icons are passed trough props. Project icons aren't shown if, for example, only call end icon is in props.

    This fix verify if there's a custom icon with button name and show default icon if not instead.

    opened by elenitaex5 0
  • fix: fixing custom icons in buttons template

    fix: fixing custom icons in buttons template

    There's an error when only some cusom icons are passed trough props. Project icons aren't shown if, for example, only call end icon is in props.

    This fix verify if there's a custom icon with button name and show default icon if not instead.

    opened by elenitaex5 0
  • Is it somehow possible to disable the video and just use the audio?

    Is it somehow possible to disable the video and just use the audio?

    Feature request: I know the name of the component is VideoUIKit, but I would really like a switch to start everybody without video (and keep them that way). I only need the audio and, I really like the code here, so is there a start-up-props etc. option to do this. If not then this is my feature request.

    enhancement 
    opened by esoinila 4
  • feature to switch between mirror or non mirror mode for VideoPlayer

    feature to switch between mirror or non mirror mode for VideoPlayer

    The Web API has the capability to switch between mirror and non-mirrored. However, this is not available for React UIKit.

    See

    https://docs.agora.io/en/Interactive%20Broadcast/API%20Reference/web_ng/interfaces/videoplayerconfig.html?platform=Web#mirror

    Please add this feature as it is useful for specific use cases.

    enhancement 
    opened by benghui-agora 0
  • rear camera on mobile devices?

    rear camera on mobile devices?

    Hi, I would like to display the rear camera on mobile devices. I search the doc but could not find which setting to set. Could you provide any guide? Thank you.

    enhancement 
    opened by pongsagon 1
  • Custom css style for web component

    Custom css style for web component

    Hello, I am using agora-react-web-uikit web component in a Vuejs application. Are there any ideas to add StyleProp using web component approach? Thank you

    enhancement 
    opened by vuminhhieu1311 1
Releases(v1.2.0)
Owner
Agora.io Community
For & by the community 🤓
Agora.io Community
Let's learn React by building react within 100 lines of code

kReact Let's learn React by building react within 100 lines of code ???? Medium article: https://kamesh-dev.medium.com/kreact-building-your-own-react-

kamesh sethupathi 6 Aug 11, 2022
Embed code samples from different frameworks with a live preview inside your existing Docusaurus pages.

docusaurus-plugin-code-preview Embed code samples from different frameworks with a live preview inside your existing Docusaurus pages. Quick Installat

Sean Perkins 4 Nov 29, 2022
Raycast lets you control your tools with a few keystrokes.

Raycast Extensions (Beta) Raycast lets you control your tools with a few keystrokes. This repository contains all extensions that are available in the

Raycast 2.8k Jan 3, 2023
Code Kitchen - a React live-coding playground

Code Kitchen is a React live-coding playground which allows the developers to embed React component demos into a React UI library’s web documents.

FreeWheel, a Comcast Company 68 Jan 7, 2023
React Dev Inspector - jump to local IDE code directly from browser React component by just a simple click

React Dev Inspector Introduction This package allows users to jump to local IDE code directly from browser React component by just a simple click, whi

zthxxx 855 Jan 3, 2023
Integrate user-agent detection in an idiomatic React way

react-useragent Integrate user-agent detection in an idiomatic React way. Installation yarn add @quentin-sommer/react-useragent or npm i -s @quentin-s

Quentin Sommer 163 Dec 19, 2022
ReactJS-Travel-Website - This is a travel(adventure) website made with ReactJS.

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

Saurav Dhakal 1 Jan 1, 2022
Sapling - A convenient way to traverse your React app in VS Code

Sapling - A convenient way to traverse your React app in VS Code

OSLabs Beta 474 Dec 17, 2022
The recommended Code Splitting library for React ✂️✨

React code splitting made easy. Reduce your bundle size without stress ✂️ ✨ . npm install @loadable/component Docs See the documentation at loadable-c

Greg Bergé 7k Jan 2, 2023
🌟 JavaScript Style Guide, with linter & automatic code fixer

JavaScript Standard Style Sponsored by English • Español (Latinoamérica) • Français • Bahasa Indonesia • Italiano (Italian) • 日本語 (Japanese) • 한국어 (Ko

Standard JS 27.8k Jan 3, 2023
CodeSwing is an interactive coding playground for VS Code

?? CodeSwing is an interactive coding playground for VS Code, that allows you to build/explore/learn rich web applications ("swings"). It's

Jonathan Carter 916 Dec 27, 2022
Use SWC with Rollup to transform ESNext and TypeScript code.

rollup-plugin-swc SWC is an extensible Rust-based platform for the next generation of fast developer tools. This plugin is designed to replace rollup-

Sukka 73 Dec 29, 2022
🦋 Jump to local IDE source code while click the element of browser automatically

?? Why When developing a React app, you have a lot of components in your app. Sometimes you may forget where the code is located that you want to edit

Frozen FIsh 111 Jan 7, 2023
Easily detect React components source code from Chrome!

Easily detect React components source code from Chrome!

Kyohei Fukuda 121 Dec 25, 2022
Typing test website build with React

typing-test NOTE: This is my recreation of already existing monkeytype This site is currently live: Visit Here How to run locally git clone https://gi

Salman Shaikh 97 Jan 3, 2023
LensKart Website Built With React And MongoDB

LensKart where you will get the best lenses This project was bootstrapped with react,express, mongodb, tailwind, a part of bootstrap, swiper and other

Awal Hossain 1 Jan 1, 2022
Landing Page For Tv E-commerce Website

About Landing Page For A TV E-Commerce Website As An Instance Of A Template Visit The Website From Here MicroOne Usage As it is a React app, you must

Amine Ait Ouazghour 32 Dec 6, 2022
A next.js website that fetches random user data using axios

next.js random user using axios.get() example typescript by: UnusualAbsurd Live

UnusualAbsurd 1 Dec 17, 2021
React Static Website Starter Project

React Static Website Starter Project This repo is an example of a React static website. The project has the following features: ES6 code Babel v6 tran

null 5 Nov 22, 2021