(fix) flutter: fix camera preview for YUYV-only devices - #87
Open
suhwanhwang wants to merge 2 commits into
Open
Conversation
getSupportedSizeList() returned an empty list because mSupportedSize was not populated from native before the call, and the frame format filter excluded valid sizes. Use getSupportedSize() to populate the native size data first, then query with type=-1 to retrieve all supported sizes regardless of frame format. Also add CAMERA permission to the example app AndroidManifest and guard against empty size lists with a clear error message. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
getSupportedSizeList()returning empty list during camera initialization by callinggetSupportedSize()first to populate native size data, and querying withtype=-1to include all frame formatsCAMERApermission to example appAndroidManifest.xmlsopermission_handlercan request runtime camera permissionIndexOutOfBoundsExceptionRoot Cause
camera.getSupportedSizeList()relies onmSupportedSizebeing populated from native viagetSupportedSize(), which was never called beforemCurrentFrameFormatwhich isn't set yet at that point, causing YUYV-only cameras (type:4) to be excluded<uses-permission android:name="android.permission.CAMERA" />, so the permission request silently failedTest plan
🤖 Generated with Claude Code