Skip to content

Permission condition is false in flutter web  #430

@Zeinab-Kouhkan

Description

@Zeinab-Kouhkan

Package version

  • 5.2.0.

Environment

  • Browser [e.g. chrome, safari].

Describe the bug

The browser microphone permission is set to 'Allowed' after displaying the permission notification, and it’s confirmed by the user. However, when starting the recording, the hasPermission check returns false. I tested this on HTTPS with both the CanvasKit and HTML renderers, and it still returns false.

Add your record configuration

Future<void> startRecorder() async {
    try {
      if (await _audioRecorder.hasPermission()) {

        const encoder = AudioEncoder.wav;

        if (!await _isEncoderSupported(encoder)) {

          return;
        }

        final devs = await _audioRecorder.listInputDevices();
        debugPrint('Devices Has Microphone:  ${devs.toString()}');

        const config = RecordConfig(encoder: encoder, numChannels: 1);

        // Record to file
        await _recordFile(config);

        // Record to stream
        // await recordStream(_audioRecorder, config);

        _recordDuration.value = 0;

        _startTimer();
      }
    } catch (e) {
      debugPrint(e.toString());
    }
  }
  

Run flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.22.2, on Microsoft Windows [Version 10.0.19045.5011], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
X Android SDK file not found: D:\sdk\android\platforms\android-35\android.jar.
[√] Chrome - develop for the web
[X] Visual Studio - develop Windows apps
X Visual Studio not installed; this is necessary to develop Windows apps.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2024.1)
[√] VS Code (version 1.90.1)
[√] Connected device (6 available)
[√] Network resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions