如何解决如何使用 Agora.io 请求用户加入频道开始通话
我在我的 React Native 项目中使用 Agora.io 进行视频通话,我想知道我什么时候会给某人打电话,我会加入频道,但我如何在应用程序中显示来电 UI在接收器手机上。这样他也可以加入频道开始通话。如果你有任何资源,请告诉我。谢谢
这里是初始化 agro sdk 的代码
init = async () => {
const {appId} = this.state;
this._engine = await RtcEngine.create(appId);
await this._engine.enableVideo();
this.startCall();
this._engine.addListener('Warning',(warn) => {
console.log('Warning',warn);
});
this._engine.addListener('Error',(err) => {
console.log('Error',err);
});
this._engine.addListener('UserJoined',(uid,elapsed) => {
console.log('UserJoined',uid,elapsed);
// Get current peer IDs
const {peerIds} = this.state;
// If new user
if (peerIds.indexOf(uid) === -1) {
this.setState({
// Add peer ID to state array
peerIds: [...peerIds,uid],});
}
});
this._engine.addListener('UserOffline',reason) => {
console.log('UserOffline',reason);
const {peerIds} = this.state;
this.setState({
// Remove peer ID from state array
peerIds: peerIds.filter((id) => id !== uid),});
});
// If Local user joins RTC channel
this._engine.addListener('JoinChannelSuccess',(channel,elapsed) => {
console.log('JoinChannelSuccess',channel,elapsed);
// Set state variable to true
this.setState({
joinSucceed: true,});
});
};
这是开始呼叫的代码
startCall = async () => {
// Join Channel using null token and channel name
await this._engine?.joinChannel(
this.state.token,this.state.channelName,null,);
};
接收方如何接听电话
解决方法
Agora SDK 没有任何内置功能。
Private Sub Button1_Click(sender As Object,e As EventArgs) Handles Button1.Click
Dim dt = CountMissedParts()
'Add a grid to your form just to see what data was returned
'If all is well delete grid and the following line
DataGridView1.DataSource = dt
'To show you how to access the data
'Inside the For loop is where you would put the code to fill you graph
For Each row As DataRow In dt.Rows
Debug.Print($"{row("M/Y OF LOG")} - {row("Total")}")
Next
End Sub
是一个很棒的图书馆。
https://github.com/react-native-webrtc/react-native-callkeep
本质上,当有人试图给您打电话时,该库将帮助您绘制 UI。它使用 firebase 推送通知来通知被调用者。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。