文件最后提交记录最后更新时间
[camera_web] Fix camera initialization failure on Firefox Android (#10341) ## Description Fixes camera initialization failure on Firefox Android when no video constraints are specified. Firefox Android rejects getUserMedia({video: {}}) with an AbortError, but accepts {video: true}. This PR modifies VideoConstraints.toMediaStreamConstraints() to return true.toJS instead of an empty object when no constraints are specified, improving browser compatibility. ## Related Issue This fix addresses camera initialization failures on Firefox Android where the camera plugin would fail with a CameraException(cameraAbort) error. Fixes https://github.com/flutter/flutter/issues/115892 ## Testing Tested on Firefox Android with camera initialization - camera now successfully initializes where it previously failed. ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ---5 个月前
[camera_web] Fix camera initialization failure on Firefox Android (#10341) ## Description Fixes camera initialization failure on Firefox Android when no video constraints are specified. Firefox Android rejects getUserMedia({video: {}}) with an AbortError, but accepts {video: true}. This PR modifies VideoConstraints.toMediaStreamConstraints() to return true.toJS instead of an empty object when no constraints are specified, improving browser compatibility. ## Related Issue This fix addresses camera initialization failures on Firefox Android where the camera plugin would fail with a CameraException(cameraAbort) error. Fixes https://github.com/flutter/flutter/issues/115892 ## Testing Tested on Firefox Android with camera initialization - camera now successfully initializes where it previously failed. ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ---5 个月前
Remove "All right reserved" from all files (#10066) Per guidance from legal on current preferred practice, remove "All rights reserved" from all LICENSE files and header blocks, and update the repo tool check accordingly.7 个月前
Require authors file (#4367) Adds a check to publish-check that there is an AUTHORS file present, since our license refers to "The Flutter Authors", so we want to have a file distributed with each package that says who the AUTHORS are (vs. just having a top-level repo AUTHORS file, which is not part of package distribution). Adds AUTHORS files to packages that have been created since the earlier one-time fix that added them, but didn't add a check to prevent future issues. Also updates the publish-check failure tests to include checks for specific output so that we know that they are failing for the reasons the test is expecting, bringing them up to current repo standards for failure tests. Fixes https://github.com/flutter/flutter/issues/896804 年前
[camera_web] Fix camera initialization failure on Firefox Android (#10341) ## Description Fixes camera initialization failure on Firefox Android when no video constraints are specified. Firefox Android rejects getUserMedia({video: {}}) with an AbortError, but accepts {video: true}. This PR modifies VideoConstraints.toMediaStreamConstraints() to return true.toJS instead of an empty object when no constraints are specified, improving browser compatibility. ## Related Issue This fix addresses camera initialization failures on Firefox Android where the camera plugin would fail with a CameraException(cameraAbort) error. Fixes https://github.com/flutter/flutter/issues/115892 ## Testing Tested on Firefox Android with camera initialization - camera now successfully initializes where it previously failed. ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ---5 个月前
Remove "All right reserved" from all files (#10066) Per guidance from legal on current preferred practice, remove "All rights reserved" from all LICENSE files and header blocks, and update the repo tool check accordingly.7 个月前
[various] Update flutter.dev links to more reliable destinations (#6963) Contributes to https://github.com/flutter/website/issues/10363 by updating to the latest links and updating some links to use new /to/ links that can be updated as needed.1 年前
[camera_web] Fix camera initialization failure on Firefox Android (#10341) ## Description Fixes camera initialization failure on Firefox Android when no video constraints are specified. Firefox Android rejects getUserMedia({video: {}}) with an AbortError, but accepts {video: true}. This PR modifies VideoConstraints.toMediaStreamConstraints() to return true.toJS instead of an empty object when no constraints are specified, improving browser compatibility. ## Related Issue This fix addresses camera initialization failures on Firefox Android where the camera plugin would fail with a CameraException(cameraAbort) error. Fixes https://github.com/flutter/flutter/issues/115892 ## Testing Tested on Firefox Android with camera initialization - camera now successfully initializes where it previously failed. ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ---5 个月前
README.md

Camera Web Plugin

The web implementation of camera.

Note: This plugin is under development. See missing implementation.

Usage

Depend on the package

This package is endorsed, which means you can simply use camera normally. This package will be automatically included in your app when you do, so you do not need to add it to your pubspec.yaml.

However, if you import this package to use any of its APIs directly, you should add it to your pubspec.yaml as usual.

Example

Find the example in the camera package.

Limitations on the web platform

Camera devices

The camera devices are accessed with Stream Web API with the following browser support:

Data on support for the Stream feature across the major browsers from caniuse.com

Accessing camera devices requires a secure browsing context. Broadly speaking, this means that you need to serve your web application over HTTPS (or localhost for local development). For insecure contexts CameraPlatform.availableCameras might throw a CameraException with the permissionDenied error code.

Device orientation

The device orientation implementation is backed by Screen Orientation Web API with the following browser support:

Data on support for the Screen Orientation feature across the major browsers from caniuse.com

For the browsers that do not support the device orientation:

  • CameraPlatform.onDeviceOrientationChanged returns an empty stream.
  • CameraPlatform.lockCaptureOrientation and CameraPlatform.unlockCaptureOrientation throw a PlatformException with the orientationNotSupported error code.

Flash mode and zoom level

The flash mode and zoom level implementation is backed by Image Capture Web API with the following browser support:

Data on support for the Image Capture feature across the major browsers from caniuse.com

For the browsers that do not support the flash mode:

  • CameraPlatform.setFlashMode throws a PlatformException with the torchModeNotSupported error code.

For the browsers that do not support the zoom level:

  • CameraPlatform.getMaxZoomLevel, CameraPlatform.getMinZoomLevel and CameraPlatform.setZoomLevel throw a PlatformException with the zoomLevelNotSupported error code.

Taking a picture

The image capturing implementation is backed by URL.createObjectUrl Web API with the following browser support:

Data on support for the Blob URLs feature across the major browsers from caniuse.com

The web platform does not support dart:io. Attempts to display a captured image using Image.file will throw an error. The capture image contains a network-accessible URL pointing to a location within the browser (blob) and can be displayed using Image.network or Image.memory after loading the image bytes to memory.

See the example below:

final Image image;
if (kIsWeb) {
  image = Image.network(capturedImage.path);
} else {
  image = Image.file(File(capturedImage.path));
}

Video recording

The video recording implementation is backed by MediaRecorder Web API with the following browser support:

Data on support for the MediaRecorder feature across the major browsers from caniuse.com.

A video is recorded in one of the following video MIME types:

  • video/webm (e.g. on Chrome or Firefox)
  • video/mp4 (e.g. on Safari)

Pausing, resuming or stopping the video recording throws a PlatformException with the videoRecordingNotStarted error code if the video recording was not started.

For the browsers that do not support the video recording:

  • CameraPlatform.startVideoRecording throws a PlatformException with the notSupported error code.

Missing implementation

The web implementation of camera is missing the following features:

  • Exposure mode, point and offset
  • Focus mode and point
  • Sensor orientation
  • Image format group
  • Streaming of frames