Repository navigation
Camera plugin requesting audio access in web even with enableAudio set to false #112277
Copy link
Copy link
Closed
flutter/packages
#4263Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listassigned for triageissue is assigned to a domain expert for further triageissue is assigned to a domain expert for further triagefound in release: 3.3Found to occur in 3.3Found to occur in 3.3found in release: 3.4Found to occur in 3.4Found to occur in 3.4has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: cameraThe camera pluginThe camera pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-webWeb applications specificallyWeb applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-webOwned by Web platform teamOwned by Web platform teamtriaged-webTriaged by Web platform teamTriaged by Web platform team
Description
Steps to Reproduce
- Set enableAudio to false
- Debug example in the plugin.
Expected results:
Only camera permission should be requested and not the microphone.
Actual results:
Code sample
Reproducible on official example https://github.com/flutter/plugins/tree/main/packages/camera/camera/example
Logs
Not any exception
Analyzing example...
info • Avoid redundant argument values • integration_test/camera_test.dart:165:20 • avoid_redundant_argument_values
info • Avoid redundant argument values • integration_test/camera_test.dart:220:22 • avoid_redundant_argument_values
info • Avoid redundant argument values • integration_test/camera_test.dart:252:20 • avoid_redundant_argument_values
3 issues found. (ran in 1.5s)
[✓] Flutter (Channel stable, 3.3.1, on macOS 12.1 21C52 darwin-arm, locale en-ES)
• Flutter version 3.3.1 on channel stable at /Users/oscarmartin/fvm/versions/3.3.1
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 4f9d92fbbd (2 weeks ago), 2022-09-06 17:54:53 -0700
• Engine revision 3efdf03e73
• Dart version 2.18.0
• DevTools version 2.15.0
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/oscarmartin/Library/Android/sdk
• Platform android-32, build-tools 31.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 13F100
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
[✓] VS Code (version 1.71.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.48.0
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-arm64 • macOS 12.1 21C52 darwin-arm
• Chrome (web) • chrome • web-javascript • Google Chrome 105.0.5195.125
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listassigned for triageissue is assigned to a domain expert for further triageissue is assigned to a domain expert for further triagefound in release: 3.3Found to occur in 3.3Found to occur in 3.3found in release: 3.4Found to occur in 3.4Found to occur in 3.4has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: cameraThe camera pluginThe camera pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-webWeb applications specificallyWeb applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-webOwned by Web platform teamOwned by Web platform teamtriaged-webTriaged by Web platform teamTriaged by Web platform team

Activity
danagbemava-nc commentedon Sep 26, 2022
I can reproduce this issue using the code sample from the plugin example.
I did some digging and it looks like the permissions are requested way before the
enableAudioportion of the code is reached. I think theenableAudiois only meant to be used for enabling audio when recording a video and it doesn't actually have anything to do with the requested permissions.The permissions are requested in
availableCamerashttps://github.com/flutter/plugins/blob/main/packages/camera/camera_web/lib/src/camera_web.dart#L98-L104 and it looks like audio track has been enabled.Labeling for further insight from the team.
code sample
flutter doctor -v
abhi-shek2000 commentedon Sep 28, 2022
The user should be able to set permission when availableCameras() function is called.
ditman commentedon Sep 29, 2022
As @abhi-shek2000 said, it seems we're unconditionally requesting all permissions on the
availableCamerascall, here:https://github.com/flutter/plugins/blob/ded5528fa0224f943f9bd92f25e9ff1260f59490/packages/camera/camera_web/lib/src/camera_web.dart#L98-L111
It seems to me, that we do that so the next
enumerateDevicescall contains more useful information, see here.Passing a boolean with audio enabled or not to enumerateDevices is probably OK! (However, I'm not sure what will happen if the programmer later says: OK, now I want the microphone! That might trigger a second permissions request?)
23 remaining items
maciejbrzezinski commentedon Feb 13, 2023
Hello, any updates here? Our users are afraid of the app, because we ask for microphone permission to take a photo, it looks weird.
pogorv12 commentedon Mar 19, 2023
Hello!
I saw that PR was achieved and should be moved to packages now. Could it be expected in the nearest time?
maciejbrzezinski commentedon Jun 21, 2023
I've created a pull request for the issue, @ditman can you have a look?
ditman commentedon Jul 11, 2023
@maciejbrzezinski it's in my list! Apologies for the delay, I'm still catching up with older reviews for web plugins!
[camera] Removed the microphone permission request from availableCame…
github-actions commentedon Aug 15, 2023
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.