Last active
February 22, 2022 22:36
-
-
Save ggfan/46ac5a9289fc33f465f050f61095c561 to your computer and use it in GitHub Desktop.
This file contains 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
fun getResolutions(selector:CameraSelector, | |
provider:ProcessCameraProvider | |
): Map<Quality, Size> { | |
return selector.filter(provider.availableCameraInfos).firstOrNull() | |
?.let { camInfo -> | |
QualitySelector.getSupportedQualities(camInfo) | |
.associateWith { quality -> | |
QualitySelector.getResolution(camInfo, quality)!! | |
} | |
} ?: emptyMap() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment