I am try to use External Webcam camera attached to android tablet via OTG cable.
External Camera is not showing in webcam array .
I have also added Permissions in Android Manifest. but still no luck
Build never asks for usb external camera permission.
// Addition in Android Manifest
//<uses-feature android:name="android.hardware.camera.external" android:required="true"/>
//<uses-feature android:name="android.hardware.usb.host" />
// Addition in Android Manifest
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class phoneCamera : MonoBehaviour
{
private bool camAvailable;
private WebCamTexture backCam;
private Texture defaultBackground;
public RawImage background;
// Use this for initialization
void Start()
{
defaultBackground = background.texture;
WebCamDevice[] devices = WebCamTexture.devices;
if (devices.Length == 0)
{
Debug.Log("No Camera Detected");
camAvailable = false;
return;
}
for (int i = 0; i < devices.Length; i++)
{
if (!devices*.isFrontFacing)*
{
backCam = new WebCamTexture(devices*.name, Screen.width, Screen.height);*
}
}
if (backCam == null)
{
Debug.Log(“Unable to Find Back Camera”);
return;
}
backCam.Play();
background.texture = backCam;
camAvailable = true;
}
}
// devices.Length is always 2, Camera 0 and Camera 1