How to use External camera on andorid
Use unity version is 2019.2.9f1.
An external camera is connected to Android.
Can switch to all recognizable cameras using the following code:
void Start()
{
_andoroidInfo = _andoridInfoObj.GetComponent<AndoroidInfo>();
_selectCamera = 0;
//_webCamTexture = new WebCamTexture();
_webCamTexture = new WebCamTexture(_width[_cameraResolution], _height[_cameraResolution] , _andoroidInfo.FPS_RATE);
_webCamDevice = WebCamTexture.devices;
_rawImage.texture = _webCamTexture;
_webCamTexture.Play();
}
public void ChangeCamera()
{
int cameras = _webCamDevice.Length;
if (cameras == 1) return;
_selectCamera++;
if (_selectCamera >= cameras)
{
_selectCamera = 0;
}
_webCamTexture.Stop();
_webCamTexture = new WebCamTexture(_webCamDevice[_selectCamera].name);
_rawImage.texture = _webCamTexture;
_webCamTexture.Play();
}
However, it does not switch to an external camera.
Only the front camera and rear camera of the device can be switched.
//------------------------------------------------------------------------------------------------------------
[It might be a similar question]
https://answers.unity.com/questions/1456924/how-to-use-external-usb-camera-with-android-tablet.html
I downloaded the program from Git and applied it to Unity, but I couldn't get the camera video.
//------------------------------------------------------------------------------------------------------------
I look forward to hearing from you soon. Thank you.
Your answer
Follow this Question
Related Questions
How to change camera on Android? 1 Answer
Take screenshot with no lags Android 0 Answers
Changing Cinemachine Collider size through script 0 Answers
Can not load the next scene 0 Answers