A react (react.js) wrapper for Agora RTC NG SDK.
6 |This wrapper supports React >= v16.8
7 | 8 | 9 |npm install agora-rtc-react
12 |
13 |
14 |
15 | 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%'}} />
)
}
18 |
19 |
20 |
21 | A full videocall example using the wrapper can be found here.
24 | 25 | 26 |You can view the methods in the wrapper here.
29 |Generated using TypeDoc
mute("audio")}> 174 | {trackState.audio ? "MuteAudio" : "UnmuteAudio"} 175 |
176 |mute("video")}> 178 | {trackState.video ? "MuteVideo" : "UnmuteVideo"} 179 |
180 | {leaveChannel()}>Leave
} 181 |mute("audio")}> 173 | {trackState.audio ? "MuteAudio" : "UnmuteAudio"} 174 |
175 |mute("video")}> 177 | {trackState.video ? "MuteVideo" : "UnmuteVideo"} 178 |
179 | {leaveChannel()}>Leave
} 180 |