This repository was archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[camera]Fix CameraPreview freezes during startVideoRecording on iOS #1023
Merged
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
56e9eec
Fix CameraPreview freezes during startVideoRecording on iOS
cvolzke4 a140c07
Fix CameraPreview freezes during startVideoRecording on iOS - address…
cvolzke4 6dd5e2e
Fix CameraPreview freezes during startVideoRecording on iOS - address…
cvolzke4 8f28873
Fix CameraPreview freezes during startVideoRecording on iOS - address…
cvolzke4 b33f2af
Revert "Fix CameraPreview freezes during startVideoRecording on iOS -…
cvolzke4 98b5e39
Fix CameraPreview freezes during startVideoRecording on iOS - address…
cvolzke4 6e7e3bc
Merge branch 'master' into issue/25961-1
cvolzke4 9c346d4
version bump
bparrishMines File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix CameraPreview freezes during startVideoRecording on iOS - address…
… review comment
- Loading branch information
commit 98b5e398dfae717140f1e6930578842b375ba8b9
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is there some way we can avoid exposing this on the dart side?
Could we always call this as part of the initialization of the camera itself or is that too costly if the camera is only started much later?
It seems annoying for the user to have several initialization steps to do - and it also exposes platform specifics, so it would be nice to avoid if possible.
Uh oh!
There was an error while loading. Please reload this page.
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.
There are three use cases to consider:
Capture still image,
Switch to 'video preview' (call prepareForVideoRecording() here),
Start video+audio recording (expect no delay).
Today in flutter, use cases #2 and #3 cause a delay in the preview when startVideoRecording() is started.
Use case #3 without this delay would look like this (iPhone native camera app):
https://drive.google.com/open?id=17OAkOADgcSMgyNtg6TkN6Gj3fYkXAiye0Q
This demo doesn't show a delay when starting video capture, presumably because audio capture is initialized by the native app when the user taps the 'Video' button while fuzzing the preview view. This isn't possible in flutter without a prepareForVideoRecording(), or initializing audio early.
Initializing audio early is an option, but isn't ideal:
prepareForVideoRecording() is an optional optimization, giving the developer the option of choosing when to take on the delay in the preview view.
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.
Any more thoughts on 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.
Why not have both?
Can we manage some initialization state (presumably on iOS side?) so that if the user has not called prepareForVideoRecording(), it still works? My guess is that majority of our users won't care about that delay so forcing them to call an additional API is harsh. For the remaining users, having this fine tuned control is great.
We should also document this behavior (that this is an optional call).
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.
prepareForVideoRecording() is intended to be an optional call, it would only be required for users that care about performance in the above way.
I've added a comment to make this more clear.