pcardune / Agora-RTC-React

A react wrapper for Agora RTC NG SDK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Agora RTC SDK React Wrapper

A react (react.js) wrapper for Agora RTC NG SDK.

This wrapper supports React >= v16.8

Install

npm install agora-rtc-react

Usage

import React from "react";
import { AgoraVideoPlayer, createClient, createMicrophoneAndCameraTracks } from "agora-rtc-react";

const config = {mode: "rtc", codec: "vp8"}

const useClient = createClient(config);
const useMicrophoneAndCameraTracks = createMicrophoneAndCameraTracks();

const App = () => {
  const client = useClient();
  const { ready, tracks } = useMicrophoneAndCameraTracks();

  return (
    ready && <AgoraVideoPlayer videoTrack={tracks[1]} style={{height: '100%', width: '100%'}} />
  )
}

Example

A full videocall example using the wrapper can be found here.

Reference

You can view the methods in the wrapper here.

About

A react wrapper for Agora RTC NG SDK


Languages

Language:TypeScript 80.5%Language:CSS 13.9%Language:HTML 5.3%Language:JavaScript 0.3%