- Home /
WebCamDevice.name is empty
(Cross-posted from forums: https://forum.unity.com/threads/webcamtexture-webcamdevice-name-is-empty.1155482/)
I basically have the same problem as this unresolved thread: https://forum.unity.com/threads/webcamtexture-and-device-without-name.532439/
I only have one webcam: the built-in laptop camera. The name is empty:
and then creating the WebCamTexture fails: ERROR - Could not find specified video device
Using the default constructor (new WebCamTexture()) yields the same result.
Note that the simple VideoCapture api can record a video to a file just fine, but for my purposes, I need the frame-by-frame capabilities of WebCamTexture.
Sample code:
public class StreamingVideoCapture : MonoBehaviour
{
private WebCamTexture m_webCamTexture;
public void Start()
{
WebCamDevice[] devices = WebCamTexture.devices;
if (devices == null || devices.Length == 0)
{
return;
}
WebCamDevice device = devices[0];
m_webCamTexture = new WebCamTexture(device.name);
m_webCamTexture.Play();
}
}
If I use an external USB camera, it works fine, so it seems to be specific to my laptop camera. I came across this old bug regarding the camera name: https://issuetracker.unity3d.com/issues/webcamtexture-dot-devices-returns-empty-name-string-when-webcam-name-contains-special-characters, so I tried editing the camera name in the registry to remove any special characters (It's just "HP HD Camera"), but got the same result.
Any solutions here would be greatly appreciated.
Your answer
Follow this Question
Related Questions
Mediatek MTK6516 ARM9 With Unity? 1 Answer
Optimizing coroutines? 2 Answers
Why my app supports fewer devices? 1 Answer
Compass with vertical device 1 Answer
How to check iOS Device Generation ? 0 Answers