Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Closed
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c7a749a
Added maxVideoDuration to startVideoRecording
danielroek Dec 23, 2020
131918d
updated documentation
danielroek Dec 23, 2020
9b3ae14
updated documentation
danielroek Dec 23, 2020
3ca25df
Fixed long line in docs
danielroek Dec 23, 2020
5e626b9
Formatting
danielroek Dec 23, 2020
02811b7
Started implementation for Android
danielroek Dec 24, 2020
b8b07e2
WIP: Started implementation of stream when time limit is reached
danielroek Dec 24, 2020
aff2938
Merge remote-tracking branch 'origin/master' into limit_video_length
danielroek Jan 8, 2021
532cbb0
Merge remote-tracking branch 'origin/master' into limit_video_length
danielroek Jan 11, 2021
50edc53
Initial working implementation
danielroek Jan 11, 2021
6e31d7c
Android implementation works
danielroek Jan 11, 2021
d3bab02
Improved implementation
danielroek Jan 11, 2021
ae7365c
Updated README order
danielroek Jan 11, 2021
ae1b47c
removed debugPrints
danielroek Jan 11, 2021
4037b5e
Fixed url in README.md
danielroek Jan 11, 2021
36acc32
Formatting
danielroek Jan 11, 2021
5a78233
Merge remote-tracking branch 'origin/master' into limit_video_length
danielroek Jan 13, 2021
09dad16
Implemented Java feedback
danielroek Jan 13, 2021
771f116
Implemented Event and Stream to notify about videoRecording
danielroek Jan 13, 2021
16e43fb
stopVideoRecording now listens to VideoRecordedEvent
danielroek Jan 13, 2021
7cb73ef
Fixed future returning xFile
danielroek Jan 13, 2021
759f163
finished iOS implementation
Feb 3, 2021
0b4270d
Fixed formatting
Feb 3, 2021
12231da
fixed formatting
Feb 3, 2021
3b8d6ed
Reverted platform_interface changes
danielroek Feb 3, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Updated README order
  • Loading branch information
danielroek committed Jan 11, 2021
commit ae7365c5cdae1f36407517043d100f59c0d19050
57 changes: 28 additions & 29 deletions packages/camera/camera/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,34 @@ As of version [0.5.0](https://github.com/flutter/plugins/blob/master/packages/ca
}
```

As of version [0.6.5](https://github.com/flutter/plugins/blob/master/packages/camera/CHANGELOG.md#065) the startVideoRecording method can be used with the maxVideoDuration. To do this the result of the recording needs to be retrieved by calling controller.onCameraTimeLimitReachedEvent which accepts a callback to retrieve the XFile result. Like so:

```dart
Future<void> startVideoRecording() async {
if (!controller.value.isInitialized) {
showInSnackBar('Error: select a camera first.');
return;
}

if (controller.value.isRecordingVideo) {
// A recording is already started, do nothing.
return;
}

try {
await controller.startVideoRecording(
maxVideoDuration: const Duration(milliseconds: 5000),
);
controller.onCameraTimeLimitReachedEvent(onCameraTimeLimitReached: (XFile file) {
//Handle the XFile
debugPrint('onCameraTimeLimitReached ${file.path}');
});
} on CameraException catch (e) {
_showCameraException(e);
return;
}
}
```
### Example

Here is a small example flutter app displaying a full screen camera preview.
Expand Down Expand Up @@ -122,35 +150,6 @@ class _CameraAppState extends State<CameraApp> {
}
```

As of version [0.6.5](https://github.com/flutter/plugins/blob/master/packages/camera/CHANGELOG.md#065) the startVideoRecording method can be used with the maxVideoDuration. To do this the result of the recording needs to be retrieved by calling controller.onCameraTimeLimitReachedEvent which accepts a callback to retrieve the XFile result. Like so:

```dart
Future<void> startVideoRecording() async {
if (!controller.value.isInitialized) {
showInSnackBar('Error: select a camera first.');
return;
}

if (controller.value.isRecordingVideo) {
// A recording is already started, do nothing.
return;
}

try {
await controller.startVideoRecording(
maxVideoDuration: const Duration(milliseconds: 5000),
);
controller.onCameraTimeLimitReachedEvent(onCameraTimeLimitReached: (XFile file) {
//Handle the XFile
debugPrint('onCameraTimeLimitReached ${file.path}');
});
} on CameraException catch (e) {
_showCameraException(e);
return;
}
}
```

For a more elaborate usage example see [here](https://github.com/flutter/plugins/tree/master/packages/camera/example).

*Note*: This plugin is still under development, and some APIs might not be available yet.
Expand Down