fix: Fix CamcorderProfile
get crash on Samsung devices (#1907)
This commit is contained in:
parent
1cdc3d1d9c
commit
83c0cdb030
@ -6,6 +6,7 @@ import android.os.Build
|
||||
import android.util.Size
|
||||
|
||||
private fun getMaximumVideoSize(cameraId: String): Size? {
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
val profiles = CamcorderProfile.getAll(cameraId, CamcorderProfile.QUALITY_HIGH)
|
||||
if (profiles != null) {
|
||||
@ -23,6 +24,10 @@ private fun getMaximumVideoSize(cameraId: String): Size? {
|
||||
}
|
||||
|
||||
return null
|
||||
} catch (e: Throwable) {
|
||||
// some Samsung phones just crash when trying to get the CamcorderProfile. Only god knows why.
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
fun CameraCharacteristics.getVideoSizes(cameraId: String, format: Int): List<Size> {
|
||||
|
Loading…
Reference in New Issue
Block a user