Agora-Flutter-SDK icon indicating copy to clipboard operation
Agora-Flutter-SDK copied to clipboard

[Mac OS] Microphone permission is requested even if the client role is set to audience

Open danielwilliamson opened this issue 6 months ago • 7 comments

Version of the agora_rtc_engine

6.5.2

Platforms affected

  • [ ] Android
  • [ ] iOS
  • [x] macOS
  • [ ] Windows
  • [ ] Web

Steps to reproduce

  1. Set the client role to ClientRoleType.clientRoleAudience
  2. Call joinChannel
  3. See that the microphone permission alert will appear

Expected results

When the client role is set to ClientRoleType.clientRoleAudience microphone permission won't be requested.

Actual results

When the client role is set to ClientRoleType.clientRoleAudience the microphone permission alert is shown.

Code sample

Code sample
await engine.setClientRole(role: ClientRoleType.clientRoleAudience);
await engine.enableVideo();
await engine.joinChannelWithUserAccount(...);

Screenshots or Video

Screenshots / Video demonstration

Image

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[!] Flutter (Channel [user-branch], 3.29.3, on macOS 15.4 24E248 darwin-arm64, locale en-AU)
    ! Flutter version 3.29.3 on channel [user-branch] at /Users/danielwilliamson/development/flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/setup.
    ! Upstream repository unknown source is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error.
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.1)
[✓] VS Code (version 1.99.3)
[✓] Connected device (4 available)
    ! Error: Browsing on the local area network for iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources

danielwilliamson avatar May 22 '25 08:05 danielwilliamson

Hi @danielwilliamson ,

Would please call engine.enableLocalAudio(false) before joinChannel and try again?

peilinok avatar May 22 '25 09:05 peilinok

Hi @peilinok thanks for the quick response. Unfortunately this didn't resolve the issue. Please see a snapshot of the logs below:

[2025-05-23 10:06:16.216] [81765] [info] [iris_rtc_device_manager_impl.cc:29] IrisRtcDeviceManagerImpl Initialize
[2025-05-23 10:06:16.216] [81765] [info] [iris_rtc_media_player_impl.cc:30] IrisMediaPlayerImpl Initialize
[2025-05-23 10:06:16.216] [81765] [info] [iris_rtc_spatial_audio_engine_impl.cc:202] IrisLocalSpatialAudioEngineImpl Initialize
[2025-05-23 10:06:16.216] [81765] [info] [iris_rtc_media_recorder_impl.cc:17] IrisMediaRecorderImpl Initialize
[2025-05-23 10:06:16.217] [81765] [info] [iris_rtc_music_center_impl.cc:20] IrisMusicPlayerImpl Initialize
[2025-05-23 10:06:16.217] [81765] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_initialize ret 0 result {"result":0}
[2025-05-23 10:06:16.217] [81765] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_setAppType params {"appType":4}
[2025-05-23 10:06:16.217] [81765] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_setAppType ret 0 result {"result":0}
[2025-05-23 10:06:16.217] [81765] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_enableVideo params {}
[2025-05-23 10:06:16.217] [81765] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_enableVideo ret 0 result {"result":0}
[2025-05-23 10:06:16.218] [81765] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_enableAudio params {}
[2025-05-23 10:06:16.218] [81765] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_enableAudio ret 0 result {"result":0}
[2025-05-23 10:06:16.220] [81765] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_registerEventHandler params {"event":105553164551120}
[2025-05-23 10:06:16.220] [81765] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_registerEventHandler ret 0 result {"result":0}
[2025-05-23 10:06:16.220] [81765] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_setChannelProfile params {"profile":1}
[2025-05-23 10:06:16.220] [81765] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_setChannelProfile ret 0 result {"result":0}
[2025-05-23 10:06:16.226] [81765] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_setAudioProfile params {"profile":5,"scenario":3}
[2025-05-23 10:06:16.227] [81765] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_setAudioProfile ret 0 result {"result":0}
[2025-05-23 10:06:16.228] [81765] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_setVideoEncoderConfiguration params {"config":{"dimensions":{"width":1280,"height":720},"frameRate":30,"orientationMode":2}}
[2025-05-23 10:06:16.228] [81765] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_setVideoEncoderConfiguration ret 0 result {"result":0}
[2025-05-23 10:06:16.229] [81765] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_setClientRole params {"role":2,"options":null}
[2025-05-23 10:06:16.229] [81765] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_setClientRole ret 0 result {"result":0}
[2025-05-23 10:06:16.238] [81765] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_enableLocalAudio params {"enabled":false}
[2025-05-23 10:06:16.238] [81765] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_enableLocalAudio ret 0 result {"result":0}
[2025-05-23 10:06:16.251] [81765] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_enableVideo params {}
[2025-05-23 10:06:16.251] [81765] [info] [iris_rtc_engine_impl.cc:112] api name RtcEngine_enableVideo ret 0 result {"result":0}
[2025-05-23 10:06:16.251] [81765] [info] [iris_rtc_engine_impl.cc:96] api name RtcEngine_joinChannelWithUserAccount params 

danielwilliamson avatar May 23 '25 00:05 danielwilliamson

Hi @danielwilliamson ,

After consulting with our engineering team, we can confirm that our SDK only requests microphone access when explicitly calling joinChannel with microphone functionality enabled. Could you please verify if you have properly implemented the microphone permission request in your application, perhaps using a permission management solution like permission_handler? This is a crucial prerequisite for microphone access on the device.

peilinok avatar May 23 '25 02:05 peilinok

Hi @peilinok, the app in question is 1 to many live streaming app where there is 1 host and multiple viewers. So in this case it's not appropriate to prompt the user (the viewer) to accept microphone permissions when they themselves will never broadcast their voice.

This functionality works correctly on iOS. We don't prompt for microphone permission and when joining the Agora channel the user isn't prompted to accept the microphone permission. This is only an issue on Mac OS.

danielwilliamson avatar May 26 '25 04:05 danielwilliamson

Hi @danielwilliamson , I will continue investigating this issue and will inform you immediately of any progress.

peilinok avatar May 26 '25 08:05 peilinok

This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Jun 10 '25 08:06 github-actions[bot]

@peilinok are there any updates on this?

danielwilliamson avatar Aug 26 '25 05:08 danielwilliamson