-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[camera] Interface method to allow concurrent recording and streaming of video #6550
[camera] Interface method to allow concurrent recording and streaming of video #6550
Conversation
…ideo This has been factored out of flutter#6290 to isolate the interface changes. They are not wired up yet, as per the instructions at https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-platform-interface-method-parameters. I created a separate options object to make the interface easier to work with. I chose `startVideoCapturing` as a more generic method name that can be applied to both recording and streaming.
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
packages/camera/camera_platform_interface/lib/src/types/video_capture_options.dart
Show resolved
Hide resolved
packages/camera/camera_platform_interface/lib/src/types/video_capture_options.dart
Show resolved
Hide resolved
Change tense of CHANGELOG update Co-authored-by: Maurice Parrish <[email protected]>
packages/camera/camera_platform_interface/lib/src/types/video_capture_options.dart
Show resolved
Hide resolved
packages/camera/camera_platform_interface/lib/src/types/video_capture_options.dart
Show resolved
Hide resolved
final Function(CameraImageData image)? streamCallback; | ||
|
||
/// Configuration options for streaming. | ||
/// Should only be set if a streamCallback is also present. |
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.
If this is true, can you add an assertion to the constructor that verifies this?
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.
Sure, done.
…if no streamCallback
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.
LGTM with a nit
cc @stuartmorgan or @camsim99 for secondary review
this.streamCallback, | ||
this.streamOptions, | ||
}) { | ||
if (streamOptions != null && streamCallback == null) { |
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.
nit: I think the preferred way would be to just use an assert. e.g:
VideoCaptureOptions(
this.cameraId, {
this.maxDuration,
this.streamCallback,
this.streamOptions,
}) : assert(
streamOptions == null || streamCallback != null,
'Must specify streamCallback if providing streamOptions.',
);
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.
Thanks, I've made this change.
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.
LGTM!
Great thanks, is that all the approvals required @camsim99 @bparrishMines ? If so, could someone please merge it? |
… streaming of video (flutter/plugins#6550)
… streaming of video (flutter/plugins#6550)
This should have been done in flutter#6550 but was missed.
This has been factored out of #6290 to isolate the interface changes. They are not wired up yet, as per the instructions at https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-platform-interface-method-parameters. I created a separate options object to make the interface easier to work with. I chose
startVideoCapturing
as a more generic method name that can be applied to both recording and streaming.Related to flutter/flutter#83634
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the [pub versioning philosophy], or this PR is [exempt from version changes].CHANGELOG.md
to add a description of the change, [following repository CHANGELOG style].///
).If you need help, consider asking for advice on the #hackers-new channel on [Discord].