# Every Camera, Every Angle on Android

DevFeed: [Every Camera, Every Angle on Android](<https://devfeed.tech/articles/every-camera-every-angle-on-android-19832.md>)

Original publisher: [Read original article](<https://tech.gc.com/every-camera-every-angle-on-android/>)

Author: GameChanger

Published: 2021-09-20T14:49:50Z

Content type: tutorial

Language: en

Sources: [GameChanger](<https://devfeed.tech/sources/gamechanger.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [API](<https://devfeed.tech/topics/api.md>), [Streaming](<https://devfeed.tech/topics/streaming.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [apis](<https://devfeed.tech/tags/apis.md>), [article](<https://devfeed.tech/tags/article.md>), [camera](<https://devfeed.tech/tags/camera.md>), [camera2](<https://devfeed.tech/tags/camera2.md>), [camerax](<https://devfeed.tech/tags/camerax.md>), [streaming](<https://devfeed.tech/tags/streaming.md>), [ultra-wide](<https://devfeed.tech/tags/ultra-wide.md>), [video](<https://devfeed.tech/tags/video.md>), [video-streaming](<https://devfeed.tech/tags/video-streaming.md>), [wide](<https://devfeed.tech/tags/wide.md>)

## AI overview

This article explains how GameChanger implemented ultrawide camera streaming on Android. It describes the differences between physical and logical camera setups and the challenges of selecting the correct camera sensor through Android's multi-camera APIs.

## Source excerpt

At GameChanger, video streaming has become a huge part of our business and thus our tech stack. But as a small company that practices shipping often, we can't ship everything feature complete from day one and thus video streaming launched with the ability to only stream from your default rear camera lens. But as we know, ultrawide lenses on phones have become common place and sure enough, customers began writing in, asking to be able to use their ultrawide cameras to stream their event. Baseball and softball fields are actually quite wide and it makes a lot of sense to be able to capture more of the field. So in time, ultrawide streaming became our priority and thus we engaged in battle with one of the most brittle Android APIs we have seen... Streaming in the olden days Well, not really in the olden days, because we are using the most up to date APIs, but before we implemented ultrawide streaming, selecting the camera we wanted to stream with was generally pretty simple: private fun CameraManager.chooseCamera(teamId: TeamId) = cameraIdList.filter { id -> val characteristics = getCameraCharacteristics(id) val capabilities = characteristics.get(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES)!! characteristics.get(CameraCharacteristics.LENS_FACING) == CameraMetadata.LENS_FACING_BACK && capabilities.contains(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE) } .mapNotNull { id -> val characteristics = getCameraCharacteristics(id) val cameraConfig = characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP)!! val (width, height) = arrayOf(1280, 720) cameraConfig.getOutputSizes(MediaRecorder::class.java) .filter { it.width <= width && it.height <= height } .maxByOrNull { it.width * it.height }?.let { id to it } } .map { (id, resolution) -> CameraArgs(cameraId = id, width = resolution.width, height = resolution.height, fps = 30) } .firstOrNull() TL;DR: Basically, get the first rear camera that supports 720p. Note the cameraId--an