This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {RtcConfigure, GridVideo, RtmConfigure, TracksConfigure, RemoteMutePopUp, LocalControls } from "agora-react-uikit"; | |
import { LocalUserContext, PropsContext } from "agora-react-uikit"; | |
const App = () => { | |
... | |
return ( | |
<> | |
<PropsContext.Provider | |
value={{ | |
rtcProps: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {RtcConfigure, GridVideo, RtmConfigure, PopUp} from "agora-rn-uikit/Components"; | |
import { LocalUserContext, PropsContext } from "agora-rn-uikit/Contexts"; | |
const App = () => { | |
... | |
return ( | |
<PropsContext.Provider | |
value={{ | |
rtcProps: { | |
appId: "<Agora App ID>", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const media = await navigator.mediaDevices.getUserMedia({ video: false, audio: true }) | |
let audioStream = modifyGain(media, 100) | |
let audioTrack = audioStream.getAudioTracks()[0] | |
rtc.current.localAudioTrack = AgoraRTC.createCustomAudioTrack({ mediaStreamTrack: audioTrack }); | |
// you could instead use the panner node: | |
const modifyGain = (stream, gainValue) => { | |
var ctx = new AudioContext(); | |
var src = ctx.createMediaStreamSource(stream); | |
var dst = ctx.createMediaStreamDestination(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
const styles = { | |
container: { width: '100vw', height: '100vh', display: 'flex', flex: 1, backgroundColor: '#007bff22'}, | |
heading: { textAlign: 'center' as const, marginBottom: 0 }, | |
videoContainer: { display: 'flex', flexDirection: 'column', flex: 1 } as React.CSSProperties, | |
nav: { display: 'flex', justifyContent: 'space-around' }, | |
btn: { backgroundColor: '#007bff', cursor: 'pointer', borderRadius: 5, padding: 5, color: '#ffffff', fontSize: 20 }, | |
} | |
export default App |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
return ( | |
<div style={styles.container}> | |
{videocall ? (<> | |
<div style={styles.nav}> | |
<p style={{ fontSize: 20, width: 200 }}>You're {isHost ? 'a host' : 'an audience'}</p> | |
<p style={styles.btn} onClick={() => setRole(!isHost)}>Change Role</p> | |
<p style={styles.btn} onClick={() => setPinned(!isPinned)}>Change Layout</p> | |
</div> | |
<AgoraUIKit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
const props: PropsInterface = { | |
rtcProps: { | |
appId: '<Your Agora App ID>', | |
channel: 'test', | |
role: isHost ? 'host' : 'audience', | |
layout: isPinned ? layout.pin : layout.grid, | |
}, | |
callbacks: { | |
EndCall: () => setVideocall(false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
import AgoraUIKit, { PropsInterface, layout } from 'agora-react-uikit' | |
const App: React.FunctionComponent = () => { | |
const [videocall, setVideocall] = useState(true) | |
const [isHost, setHost] = useState(false) | |
const [isPinned, setPinned] = useState(false) | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
return ( | |
<div style={styles.container}> | |
{videocall ? ( | |
<AgoraUIKit | |
rtcProps={props.rtcProps} | |
callbacks={props.callbacks} /> | |
) : ( | |
null | |
)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react' | |
import AgoraUIKit, { PropsInterface } from 'agora-react-uikit' | |
const App: React.FunctionComponent = () => { | |
const [videocall, setVideocall] = useState(true) | |
const props: PropsInterface = { | |
rtcProps: { | |
appId: '<Your Agora App ID>', | |
channel: 'test', | |
token: null, // pass in channel token if the app is in secure mode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body> | |
<script src="agora-uikit.js"></script> | |
<agora-react-web-uikit | |
style="width: 100%; height: 100vh; display: flex;" | |
appId='<YourAgoraAppIDHere>' | |
channel='test' | |
/> | |
</body> |
NewerOlder