-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[camerax] Implement video capture for CameraX android camera re-write #3467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
f876e73
ca2a353
22eea7a
77dfba1
daf385b
167f9c2
23ec03e
034a508
d5affdd
9797067
c76d1a4
3141b02
92a51b8
5e776a5
0ba0dfc
89d7936
9eecbed
f8eee31
fb4770b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -421,6 +421,11 @@ class AndroidCameraCameraX extends CameraPlatform { | |
| assert(cameraSelector != null); | ||
| assert(processCameraProvider != null); | ||
|
|
||
| if (recording != null) { | ||
| // There is currently an active recording, so do not start a new one. | ||
| return; | ||
| } | ||
|
|
||
| if (!(await processCameraProvider!.isBound(videoCapture!))) { | ||
| camera = await processCameraProvider! | ||
| .bindToLifecycle(cameraSelector!, <UseCase>[videoCapture!]); | ||
|
|
@@ -444,6 +449,11 @@ class AndroidCameraCameraX extends CameraPlatform { | |
| 'video recording while no recording is in progress.'); | ||
| } | ||
| if (videoOutputPath == null) { | ||
| // Stop the current active recording as we will be unable to complete it | ||
| // in this error case. | ||
| recording!.close(); | ||
| recording = null; | ||
| pendingRecording = null; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here about adding it to the doc
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a note on the cleanup of the recording objects in the doc |
||
| throw CameraException( | ||
| 'INVALID_PATH', | ||
| 'The platform did not return a path ' | ||
|
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a statement to the doc for this method that this is the expected behavior for trying to start a new recording?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a note that we silently return without doing anything if there is an active recording.