0

I have integrated Agora Voice Call in Flutter Web using Accepted Answer of this question Is it possible to implement Agora Video Call in flutter web and flutter app?

but the issue is I am not able to hear voice of another person. He or she can hear my voice.

Integration showing as below :

  1. Initialozation
    agoraEngine =
        await RtcEngine.createWithContext(RtcEngineContext(agoraAppId));
    await setupEventHandler();
    await agoraEngine?.setAudioProfile(
        AudioProfile.SpeechStandard, AudioScenario.MEETING);
    await agoraEngine?.setClientRole(ClientRole.Broadcaster);
    await agoraEngine?.setChannelProfile(ChannelProfile.LiveBroadcasting);
    await agoraEngine?.enableAudio();
    _joinChannel();

  1. setupEventHandler
agoraEngine?.setEventHandler(
      RtcEngineEventHandler(
          remoteAudioStateChanged:(int uid, AudioRemoteState state, AudioRemoteStateReason reason, int elapsed){
            print(
                "_VoiceCallingScreenState.setupVoiceSDKEngine: -> remoteAudioStateChanged uid $uid state $state reason $reason elapsed $elapsed");
          },
          remoteAudioStats:(statcs){
            print(
                "_VoiceCallingScreenState.setupVoiceSDKEngine: -> remoteAudioStats statcs $statcs");
          },
          firstRemoteAudioFrame:(int uid, int elapsed){
            print(
                "_VoiceCallingScreenState.setupVoiceSDKEngine: -> firstRemoteAudioFrame uid $uid elapsed $elapsed");
          },
          audioQuality:(int uid, int quality, int delay, int lost){
            print(
                "_VoiceCallingScreenState.setupVoiceSDKEngine: -> audioQuality uid $uid quality $quality delay $delay lost $lost");
          },
        error: (code) {
          debugPrint(
              "_VoiceCallingScreenState.setupVoiceSDKEngine: -> error ==> $code");
        },
        joinChannelSuccess: (String channel, int uid, int elapsed) async {
/*
          await agoraEngine?.setEnableSpeakerphone(false);
          await agoraEngine?.setDefaultAudioRouteToSpeakerphone(false);
*/

          print(
              "_VoiceCallingScreenState.setupVoiceSDKEngine: -> local user $uid joined $channel");
        },
        userJoined: (int uid, int elapsed) {
          print(
              "_VoiceCallingScreenState.setupVoiceSDKEngine: -> remote user $uid joined");
          setState(() {
            _remoteUid = uid;
          });
          startTimer();
        },
        userOffline: (int uid, UserOfflineReason reason) {
          print(
              "_VoiceCallingScreenState.setupVoiceSDKEngine: ->remote user $uid left channel due to $reason" );
          _dropCall();
        },
        leaveChannel: (RtcStats stats) {
          debugPrint(
              "_VoiceCallingScreenState.setupVoiceSDKEngine: -> onLeaveChannel => ${stats.duration} => ${stats.duration}");
          _dropCall();
        },
        connectionStateChanged: (ConnectionStateType connectionStateType,
            ConnectionChangedReason reason) async {
          debugPrint(
              "_VoiceCallingScreenState.setupVoiceSDKEngine: -> onConnectionStateChanged -> $connectionStateType reason ==> $reason");
          if (reason == ConnectionChangedReason.LeaveChannel) {
            _dropCall();
          }
        },
      ),
    );
  1. Joining Channel
await agoraEngine?.joinChannel(
        rtcModel?.data?.senderRtcToken ?? '',
        rtcModel?.data?.channel ?? '',
        null,
        int.parse(rtcModel?.data?.senderUid ?? '0'),
        ChannelMediaOptions(
          autoSubscribeAudio: true,
        ));

Am I doing anything wrong?

Voice call using agora_rtc_engine: 4.1.0-alpha.2 in Flutter Web with two-way communication

0 Answers0