天涯盡頭無女友
2023-03-18 17:28:00
我可以使用來自 agora.io 的臨時(shí)令牌進(jìn)行基本視頻通話,但是當(dāng)我從我的服務(wù)器創(chuàng)建令牌時(shí),出現(xiàn)此錯(cuò)誤。我正在使用 NgxAgora 數(shù)據(jù)包。我嘗試設(shè)置區(qū)號,但在 NgxAgora 中沒有此選項(xiàng)。這是我的角度代碼: this.api.getmethod("appointment/gettoken/" + atob(this.acRouter.snapshot.params.id)).subscribe((data) => { this.token = data['token'] this.client = this.ngxAgoraService.createClient({ mode: 'rtc', codec: 'h264' }); this.assignClientHandlers(); this.localStream = this.ngxAgoraService.createStream({ streamID: this.uid, audio: true, video: true, screen: false }); this.assignLocalStreamHandlers(); // Join and publish methods added in this step this.initLocalStream(() => this.join(uid => this.publish(), error => console.error(error))); })我使用 C# 在 web api 端使用這個(gè)函數(shù): public string createagoratoken(string appointmentUid,DateTime appointmentDate,int appointmentId) { var tokenbuilder = new AgoraEntegration.Media.AccessToken(AgoraEntegration.AgoraEnums.AppEnums.appId, AgoraEntegration.AgoraEnums.AppEnums.appCertificate, appointmentUid, appointmentId.ToString()); appointmentDate = appointmentDate.AddMinutes(20); Int32 unixTimestamp = (Int32)(appointmentDate.Subtract(new DateTime(1970, 1, 1))).TotalSeconds; tokenbuilder.addPrivilege(AgoraEntegration.Media.Privileges.kJoinChannel, (uint)unixTimestamp); tokenbuilder.addPrivilege(AgoraEntegration.Media.Privileges.kInvitePublishAudioStream, (uint)unixTimestamp); tokenbuilder.addPrivilege(AgoraEntegration.Media.Privileges.kInvitePublishVideoStream,(uint)unixTimestamp); string token = tokenbuilder.build(); return token; }我還使用這個(gè)庫作為 C# 的訪問令牌 Github 訪問令牌
1 回答

隔江千里
TA貢獻(xiàn)1906條經(jīng)驗(yàn) 獲得超10個(gè)贊
CANNOT_MEET_AREA_DEMAND通常出現(xiàn)在以下情況:連接失敗,因?yàn)橛脩舨辉谶x擇的連接區(qū)域。比如你設(shè)置ClientConfig.areaCode為[AgoraRTC.AREAS.EUROPE],北美的用戶嘗試加入頻道,就會(huì)出現(xiàn)這個(gè)錯(cuò)誤。如果不顯式設(shè)置ClientConfig.areaCode,SDK會(huì)默認(rèn)請求跨地域的服務(wù)器,并選擇最優(yōu)連接,所以當(dāng)用戶加入頻道時(shí)控制臺(tái)日志可能會(huì)打印此錯(cuò)誤。在這種情況下,您可以忽略該錯(cuò)誤。
嘗試將 areaCode 設(shè)置為 GLOBAL:
this.rtc = AgoraRTC.createClient({
//
areaCode: ['GLOBAL']
});
添加回答
舉報(bào)
0/150
提交
取消