[camera_android]: Fixes crash when record video on Android versions lower than 12 (#4635)

The the solution of the issue flutter/flutter#109769 in the #7073 causes a crashes when the Android SDK version is lower than 31, due to EncoderProfiles not being found on these devices. This issue was solved putting the EncoderProfiles declaration after the check for SDK version.

based on https://github.com/flutter/plugins/pull/7073 by @camsim99.

Fixes https://github.com/flutter/flutter/issues/109769 in Android lower than 12.
This commit is contained in:
Raul Vilar
2023-08-21 11:42:05 -03:00
committed by GitHub
parent fe6f67efc6
commit e26f3b9374
3 changed files with 5 additions and 5 deletions

View File

@ -1,5 +1,6 @@
## NEXT
## 0.10.8+7
* Fixes video record crash on Android versions lower than 12.
* Updates minimum supported SDK version to Flutter 3.7/Dart 2.19.
## 0.10.8+6

View File

@ -256,9 +256,8 @@ class Camera
// TODO(camsim99): Revert changes that allow legacy code to be used when recordingProfile is null
// once this has largely been fixed on the Android side. https://github.com/flutter/flutter/issues/119668
EncoderProfiles recordingProfile = getRecordingProfile();
if (SdkCapabilityChecker.supportsEncoderProfiles() && recordingProfile != null) {
mediaRecorderBuilder = new MediaRecorderBuilder(recordingProfile, outputFilePath);
if (SdkCapabilityChecker.supportsEncoderProfiles() && getRecordingProfile() != null) {
mediaRecorderBuilder = new MediaRecorderBuilder(getRecordingProfile(), outputFilePath);
} else {
mediaRecorderBuilder = new MediaRecorderBuilder(getRecordingProfileLegacy(), outputFilePath);
}

View File

@ -3,7 +3,7 @@ description: Android implementation of the camera plugin.
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
version: 0.10.8+6
version: 0.10.8+7
environment:
sdk: ">=2.19.0 <4.0.0"