Search code examples
androidunity-game-engineodroid

Unity+Odroid: WebCamTexture black screen issue with USB Camera


I use ODROID-XU4 (Android 4.4).

WebCamTexture and WebCamDevices are working properly on mobile (Galaxy S4), but when I install my apk on ODROID-XU4, applications are working but I don't get frames on USB camera devices. Why? How to fix it?

I used the following codes in 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);
}

This code print to screen: Permission


Solution

  • Issue Solved. CM-12.1 Android 5.1.1 Lollipop for ODROID-XU3/XU4