我使用ODROID-XU4(Android 4.4)。
WebCamTexture
和WebCamDevices
在移动设备上正常工作(Galaxy S4),但是当我在ODROID-XU4上安装我的apk时,应用程序正在运行但我没有在USB摄像头上获取帧设备。为什么?如何解决?
我在C#中使用了以下代码
WebCamDevice[] devices;
string resultString;
string deviceName;
WebCamTexture wbTxt;
// Use this for initialization
IEnumerator Start()
{
resultString = "Start.";
yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);
if (Application.HasUserAuthorization(UserAuthorization.WebCam))
{
resultString = "Permission";
devices = WebCamTexture.devices;
if (devices.Length >= 0)
{
deviceName = devices[0].name;
wbTxt = new WebCamTexture(deviceName, 640, 480, 30);
GetComponent<Renderer>().material.mainTexture = wbTxt;
wbTxt.Play();
resultString = "No Problem";
}
else
{
resultString = "WebCam not Found";
}
}
else
{
resultString = "No permission!";
}
}
void OnGUI()
{
for (var i = 0; i < devices.Length; i++)
{
GUI.Box(new Rect(100, 100 + (i * 25), 300, 25), devices[i].name);
}
GUI.Box(new Rect(100, 100 + 100, 300, 25), resultString);
}
此代码打印到屏幕:权限