Skip to content

Commit

Permalink
[camera_android]: Fixes crash when record video on Android versions l…
Browse files Browse the repository at this point in the history
…ower than 12 (flutter#4635)

The the solution of the issue flutter/flutter#109769 in the flutter#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 flutter/plugins#7073 by @camsim99.

Fixes flutter/flutter#109769 in Android lower than 12.
  • Loading branch information
raulsvilar authored Aug 21, 2023
1 parent fe6f67e commit e26f3b9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
3 changes: 2 additions & 1 deletion packages/camera/camera_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,8 @@ private void prepareMediaRecorder(String outputFilePath) throws IOException {

// 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);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera_android/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit e26f3b9

Please sign in to comment.