Skip to content

Commit

Permalink
handle if current device or select resolution doesn't support 4:3 video
Browse files Browse the repository at this point in the history
If current device or selected resolution does not supported in 4:3 aspect ratio in video mode handle the exception by switching back to 16:9
  • Loading branch information
empratyush committed May 31, 2024
1 parent c446dcb commit 0409c25
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/src/main/java/app/grapheneos/camera/CamConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,14 @@ class CamConfig(private val mActivity: MainActivity) {
}
imageCapture = null

if (videoAspectRatio == AspectRatio.RATIO_4_3) {
videoAspectRatio = AspectRatio.RATIO_16_9
mActivity.showMessage(mActivity.getString(R.string.aspect_ratio_unsupported_by_selected_resolution))
startCamera(true)
mActivity.settingsDialog.showOnlyRelevantSettings()
return
}

camera = cameraProvider!!.bindToLifecycle(
mActivity, cameraSelector,
newUseCaseGroupBuilder.build()
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
<string name="unable_to_access_output_file">Unable to access output file</string>
<string name="please_wait_for_image_to_get_captured_before_opening">Please wait for the image to get captured before trying to open the gallery.</string>
<string name="please_wait_for_image_to_get_captured_before_sharing">Please wait for the image to get captured before attempting to share via long tap</string>
<string name="aspect_ratio_unsupported_by_selected_resolution">This aspect ratio is not supported by selected resolution (Video quality)</string>

<string name="file_details">File Details</string>
<string name="file_name_generic">File Name: </string>
Expand Down

0 comments on commit 0409c25

Please sign in to comment.