Skip to content

Commit d93045e

Browse files
ditmanamantoux
authored andcommitted
[camera_web] Make plugin publishable for the first time. (flutter#4304)
1 parent 3575dd3 commit d93045e

File tree

3 files changed

+42
-30
lines changed

3 files changed

+42
-30
lines changed
Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
## 0.1.0+1
1+
## 0.2.0
22

3-
* Add `implements` to pubspec.
4-
5-
## 0.1.0
6-
7-
* Initial release
8-
* Added CameraOptions used to constrain the camera audio and video.
3+
* Initial release, adapted from the Flutter [I/O Photobooth](https://photobooth.flutter.dev/) project.

packages/camera/camera_web/README.md

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ The web implementation of [`camera`][camera].
66

77
## Usage
88

9-
This package is [endorsed](https://flutter.dev/docs/development/packages-and-plugins/developing-packages#endorsed-federated-plugin), which means you can simply use `camera` normally. This package will be automatically included in your app when you do.
9+
### Depend on the package
10+
11+
This package is not an [endorsed implementation](https://flutter.dev/docs/development/packages-and-plugins/developing-packages#endorsed-federated-plugin)
12+
of the google_maps_flutter plugin yet, so you'll need to [add it explicitly](https://pub.dev/packages/camera_web/install).
1013

1114
## Example
1215

@@ -16,41 +19,59 @@ Find the example in the [`camera` package](https://pub.dev/packages/camera#examp
1619

1720
### Camera devices
1821

19-
The camera devices are accessed with [Stream Web API](https://developer.mozilla.org/en-US/docs/Web/API/Media_Streams_API) with the following [browser support](https://caniuse.com/stream):
22+
The camera devices are accessed with [Stream Web API](https://developer.mozilla.org/en-US/docs/Web/API/Media_Streams_API)
23+
with the following [browser support](https://caniuse.com/stream):
2024

2125
![Data on support for the Stream feature across the major browsers from caniuse.com](https://caniuse.bitsofco.de/image/stream.png)
2226

23-
Accessing camera devices requires a [secure browsing context](https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts). This means that you might need to serve your web application over HTTPS. For insecure contexts `CameraPlatform.availableCameras` might throw a `CameraException` with the `permissionDenied` error code.
27+
Accessing camera devices requires a [secure browsing context](https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).
28+
Broadly speaking, this means that you need to serve your web application over HTTPS
29+
(or `localhost` for local development). For insecure contexts
30+
`CameraPlatform.availableCameras` might throw a `CameraException` with the
31+
`permissionDenied` error code.
2432

2533
### Device orientation
2634

27-
The device orientation implementation is backed by [`Screen Orientation Web API`](https://www.w3.org/TR/screen-orientation/) with the following [browser support](https://caniuse.com/screen-orientation):
35+
The device orientation implementation is backed by [`Screen Orientation Web API`](https://www.w3.org/TR/screen-orientation/)
36+
with the following [browser support](https://caniuse.com/screen-orientation):
2837

2938
![Data on support for the Screen Orientation feature across the major browsers from caniuse.com](https://caniuse.bitsofco.de/image/screen-orientation.png)
3039

3140
For the browsers that do not support the device orientation:
41+
3242
- `CameraPlatform.onDeviceOrientationChanged` returns an empty stream.
33-
- `CameraPlatform.lockCaptureOrientation` and `CameraPlatform.unlockCaptureOrientation` throw a `PlatformException` with the `orientationNotSupported` error code.
43+
- `CameraPlatform.lockCaptureOrientation` and `CameraPlatform.unlockCaptureOrientation`
44+
throw a `PlatformException` with the `orientationNotSupported` error code.
3445

3546
### Flash mode and zoom level
3647

37-
The flash mode and zoom level implementation is backed by [Image Capture Web API](https://w3c.github.io/mediacapture-image/) with the following [browser support](https://caniuse.com/mdn-api_imagecapture) (as of 12 August 2021):
48+
The flash mode and zoom level implementation is backed by [Image Capture Web API](https://w3c.github.io/mediacapture-image/)
49+
with the following [browser support](https://caniuse.com/mdn-api_imagecapture):
3850

39-
![Data on support for the Image Capture feature across the major browsers from caniuse.com](https://caniuse.bitsofco.de/static/v1/mdn-api__ImageCapture-1628778966589.png)
51+
![Data on support for the Image Capture feature across the major browsers from caniuse.com](https://caniuse.bitsofco.de/static/v1/mdn-api__ImageCapture-1628778966589.png)
4052

4153
For the browsers that do not support the flash mode:
42-
- `CameraPlatform.setFlashMode` throws a `PlatformException` with the `torchModeNotSupported` error code.
54+
55+
- `CameraPlatform.setFlashMode` throws a `PlatformException` with the
56+
`torchModeNotSupported` error code.
4357

4458
For the browsers that do not support the zoom level:
45-
- `CameraPlatform.getMaxZoomLevel`, `CameraPlatform.getMinZoomLevel` and `CameraPlatform.setZoomLevel` throw a `PlatformException` with the `zoomLevelNotSupported` error code.
59+
60+
- `CameraPlatform.getMaxZoomLevel`, `CameraPlatform.getMinZoomLevel` and
61+
`CameraPlatform.setZoomLevel` throw a `PlatformException` with the
62+
`zoomLevelNotSupported` error code.
4663

4764
### Taking a picture
4865

49-
The image capturing implementation is backed by [`URL.createObjectUrl` Web API](https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL) with the following [browser support](https://caniuse.com/bloburls):
66+
The image capturing implementation is backed by [`URL.createObjectUrl` Web API](https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL)
67+
with the following [browser support](https://caniuse.com/bloburls):
5068

5169
![Data on support for the Blob URLs feature across the major browsers from caniuse.com](https://caniuse.bitsofco.de/image/bloburls.png)
5270

53-
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 and should be displayed using `Image.network` or `Image.memory` after loading the image bytes to memory.
71+
The web platform does not support `dart:io`. Attempts to display a captured image
72+
using `Image.file` will throw an error. The capture image contains a network-accessible
73+
URL pointing to a location within the browser (blob) and can be displayed using
74+
`Image.network` or `Image.memory` after loading the image bytes to memory.
5475

5576
See the example below:
5677

@@ -65,13 +86,13 @@ if (kIsWeb) {
6586
## Missing implementation
6687

6788
The web implementation of [`camera`][camera] is missing the following features:
68-
- Video recording
89+
90+
- Video recording ([in progress](https://github.com/flutter/plugins/pull/4210))
6991
- Exposure mode, point and offset
7092
- Focus mode and point
71-
- Camera closing events
72-
- Camera sensor orientation
73-
- Camera image format group
74-
- Camera image streaming
93+
- Sensor orientation
94+
- Image format group
95+
- Streaming of frames
7596

7697
<!-- Links -->
77-
[camera]: https://pub.dev/packages/camera
98+
[camera]: https://pub.dev/packages/camera

packages/camera/camera_web/pubspec.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@ name: camera_web
22
description: A Flutter plugin for getting information about and controlling the camera on Web.
33
repository: https://github.com/flutter/plugins/tree/master/packages/camera/camera_web
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
5-
version: 0.1.0+1
6-
7-
# This plugin is under development and will be published
8-
# when the first working web camera implementation is added.
9-
# TODO(bselwe): Remove when camera_web should be published.
10-
publish_to: none
5+
version: 0.2.0
116

127
environment:
138
sdk: ">=2.12.0 <3.0.0"
@@ -27,6 +22,7 @@ dependencies:
2722
sdk: flutter
2823
flutter_web_plugins:
2924
sdk: flutter
25+
stream_transform: ^2.0.0
3026

3127
dev_dependencies:
3228
flutter_test:

0 commit comments

Comments
 (0)