Agora Video Calling Error on Flutter (IOS): AgoraRtcException(-2, null)

56 Views Asked by At

I implement agora video call in flutter. This works perfectly on android but for ios, it creates problem. The ios user can't see their local video and the other user can't see the remote video of the ios user. if both users are ios users, then both can't see the local and remote video as well (full white screen). This ios error occured in ios emulator but when comes to real ios device, the app crash and close automatically when try to start video call. In ios emulator it gives the following error in debugconsole:

setupVideoView error: AgoraRtcException(-2, null)

I searched about this error and found that this error occured due to joinChannel method of agora Engine. Implementation of the method is following:

ChannelMediaOptions options = const ChannelMediaOptions(
      clientRoleType: ClientRoleType.clientRoleBroadcaster,
      channelProfile: ChannelProfileType.channelProfileCommunication,
    );

await agoraEngine.joinChannel(
        token: newToken,
        channelId: channelName,
        uid: currentUserId,
        options: options,
      );

The values of the above parameter is:

newToken = "007eJ..../mbsbMg=="
channelName = "4950"
currentUserId = 50

The ui of the video call is:

// Display local video preview
  Widget localPreview({required VideoCallController controller}) {
    return AgoraVideoView(
        controller: VideoViewController(
      rtcEngine: agoraEngine,
      canvas: const VideoCanvas(uid: 0),
    ));
  }

// Display remote user's video
  Widget remoteVideo({required VideoCallController controller}) {
    return AgoraVideoView(
      controller: VideoViewController.remote(
        rtcEngine: agoraEngine,
        canvas: VideoCanvas(uid: controller.remoteUid),
        connection: RtcConnection(channelId: controller.channelName),
      ),
    );
  }

Here, remoteUid = 49

I expect smooth video calling in ios just like implemented in andoid

0

There are 0 best solutions below