react-native-agora 远程视频质量很差,只能卡顿

React-native-agora remote video quality very poor, only freezing

我正在开发一个 React Native 视频通话应用程序,我使用 React-Native-Agora,除了 远程视频质量极差,我什么也看不到,只是冻结。 我使用 react native 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);
    });
}

提前致谢。

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

我只是做了这个 videoEncoderConfiguration :

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