Repository: flutter
Issue: Several camera accesses are performed when using the camera plugin on web
Labels: platform-web,p: camera,package,has reproducible steps,P2,team-web,triaged-web,found in release: 3.19,found in release: 3.21

If you just wish to show e.g. the stream from the front-facing camera on a phone, it would be nice to be able to simply do so, without having to run [this rather brutal piece of code](https://github.com/flutter/packages/blob/bb97da8ec627466fdb45cdd36e2c0e35dee40e9e/packages/camera/camera_web/lib/src/camera_web.dart#L85), which opens all cameras and closes them again, even before the camera is needed.

### Steps to reproduce

Call `availableCameras` (as [required on web](https://github.com/flutter/packages/blob/bb97da8ec627466fdb45cdd36e2c0e35dee40e9e/packages/camera/camera_web/lib/src/camera_web.dart#L203)), then call `initialize()` on a Camera.

### Expected results

A single permission prompt and camera simply turning on, and no crashes.

### Actual results

1. The camera is turned on, then off, then on again, prompting
2. permission request already at the point of the call to `availableCameras` and sometimes again after due to the call to `initialize()`, and
3. device LED and OS camera status indicators flickering on and off
4. The camera activity stresses Firefox on Android to the point of crashing

### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
$ flutter doctor -v
[✓] Flutter (Channel stable, 3.19.3, on Microsoft Windows [Version 10.0.22631.3296], locale ...)
    • Flutter version 3.19.3 on channel stable at C:\Users\...
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ba39319843 (2 weeks ago), 2024-03-07 15:22:21 -0600
    • Engine revision 2e4ba9c6fb
    • Dart version 3.3.1
    • DevTools version 2.31.1

[✓] Windows Version (Installed version of Windows is version 10 or higher)

[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\...\AppData\Local\Android\sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.

[✗] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.4.5)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.4.33403.182
    • Windows 10 SDK version 10.0.22000.0

[✓] Android Studio (version 2023.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    • 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 17.0.9+0--11185874)

[✓] VS Code (version 1.87.2)
    • VS Code
    • Flutter extension version 3.84.0

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 2 categories.
```

</details>