Search Issue Tracker
Won't Fix
Votes
1
Found in
2017.4.0f1
2018.3.0a1
2018.3.5f1
2019.1.0a1
2019.2.0a1
Issue ID
1127675
Regression
No
UWP player fails to play WebCamTexture when using specific webcam
Steps to reproduce:
1. Download attached project
2. Build project for UWP with IL2CPP or .NET backend
3. Launch UWP player
Actual results: UWP player fails to play WebCamTexture
Exception thrown at 0x00007FFB828FA388 in WebcamText.exe: Microsoft C++ exception: detail::system_hresult_exception at memory location 0x0000000E0C3FE0A8.
Error: Operation has failed with error 0x80028019: Old format or invalid type library.
(C:/buildslave/unity/build/PlatformDependent/MetroPlayer/MetroWebCamTexture.cpp:WebCamTexture::Play at 452)
UnityEngine.WebCamTexture:INTERNAL_CALL_Play(WebCamTexture)
UnityEngine.WebCamTexture:Play()
WebCamInit:Start()
Reproduced with: 2019.2.0a6, 2019.1.0b3, 2018.3.6f1, 2017.4.20f1
Note:
- Issue reproducible with Logitech HD Webcam C270, Logitech HD Webcam 525 and QuickCam Orbit/Sphere AF.
- Not reproducible with Logitech HD Webcam 615 and Surface Pro 4 build in camera
- Reproducible with x64 and x86 architecture
- Reproducible with .NET 3.5 and .NET 4.x runtime
- Not reproducible on Standalone player (mono and IL2CPP)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Incorrect Shader keyword activation for Shadows when no Light is present in URP
- Editor freezes when loading a specific AssetBundle
- WebGPU builds with Multithreading enabled crash on Safari
- Set as Value in UI Builder doesn't work across all properties.
- Calculating time durations in RenderDoc with DX12 causes 'Device Lost error' popup
Resolution Note (2019.3.X):
I don't have one of the specific webcams available and so wasn't able to repro the issue. However, by reviewing the code I believe I found the error case this scenario is hitting.
The UWP player does not support video streams that utilize "temporal compression", such as MPEG. Only video streams that contain the MediaFoundation attribute MF_MT_ALL_SAMPLES_INDEPENDENT will be opened for WebCamTexture, which includes YUY2, NV12, and MJPEG formats.
My guess for this case is: the script is initializing WebCamTexture with the first available webcam, which happens to default to an unsupported video stream for these specific cameras, whereas most other cameras default to a supported stream. Instead, the script should initialize WebCamTexture with a specific video device name.
Unfortunately, the Unity scripting API doesn't expose this level of detail for the video devices WebCamTexture returns, and instead the Windows.Media.Capture.MediaCapture API needs to be directly invoked to enumerate devices and find a compatible one (https://docs.microsoft.com/en-us/windows/uwp/audio-video-camera/camera-profiles).