反应本地agora远程视频质量很差,只有冻结



我正在开发一个react原生视频通话应用程序,我使用react原生agora,除了远程视频质量非常差,我什么也看不见,只是很冷。我使用react原生agora版本:3.2.2

我的rtcEngine初始化函数:

/**
* @name init
* @description Function to initialize the Rtc Engine, attach event listeners and actions
*/
const init = async () => {
const {token, appId} = await getToken();
setAppId(appId);
setToken(token);
engine = await RtcEngine.create(appId);
await engine.enableVideo();
await engine.enableAudio();
await engine?.joinChannel(token, `${session.id}`, null, 0);
engine.addListener('Warning', (warn) => {
console.log('Warning', warn);
});
engine.addListener('Error', async (err) => {
if(err === 17){
if(!engine){
engine = await RtcEngine.create(appId);
}
await engine?.leaveChannel();
setPeerIds(peerIds => []);
await engine?.joinChannel(token, `${session.id}`, null, 0);
}
console.log('Error', err);
});
engine.addListener('UserJoined', async (uid, elapsed) => {
console.log('UserJoined', uid, elapsed);
// Get current peer IDs
// If new user
if (peerIds.indexOf(uid) === -1) {
setPeerIds(peerIds => [...peerIds, uid]);
}
});
engine.addListener('UserOffline', (uid, reason) => {
console.log('UserOffline', uid, reason);
setPeerIds(peerIds => [...peerIds.filter((id) => id !== uid)]);
});
// If Local user joins RTC channel
engine.addListener('JoinChannelSuccess', (channel, uid, elapsed) => {
console.log('JoinChannelSuccess', channel, uid, elapsed);
// Set state variable to true
setJoinSucceed(true);
});
}

提前谢谢。

我终于解决了我的问题,对于那些有同样问题的人,我在这里给出了我的解决方案:

我只是做这个视频编码器配置:

await engine.setVideoEncoderConfiguration(new VideoEncoderConfiguration({
dimensions: new VideoDimensions(320, 240),
bitrate: 140,
frameRate: VideoFrameRate.Fps30,
degradationPrefer: 0
}))

相关内容

  • 没有找到相关文章

最新更新