Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[camera] A fix for stopImageStream method which solves a stale images bug #2655

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions packages/camera/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.5.7+6

* Fixed an issue, where after restarting a subscription of the image stream, first few received images would be stale (typically images from the end of the first stream).

## 0.5.7+5

* Replace deprecated `getFlutterEngine` call on Android.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,11 @@ private void setImageStreamImageAvailableListener(final EventChannel.EventSink i
null);
}

public void stopImageStream() throws CameraAccessException {
imageStreamReader.setOnImageAvailableListener(null, null);
startPreview();
}

private void closeCaptureSession() {
if (cameraCaptureSession != null) {
cameraCaptureSession.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull final Result result)
case "stopImageStream":
{
try {
camera.startPreview();
camera.stopImageStream();
result.success(null);
} catch (Exception e) {
handleException(e, result);
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: camera
description: A Flutter plugin for getting information about and controlling the
camera on Android and iOS. Supports previewing the camera feed, capturing images, capturing video,
and streaming image buffers to dart.
version: 0.5.7+5
version: 0.5.7+6

homepage: https://github.com/flutter/plugins/tree/master/packages/camera

Expand Down