Get OverconstainedError in Azure
When I deploy my app to an Azure Web App (Linux), I receive the following error when launching the camera:
Uncaught (in promise) OverconstrainedError Promise.then (async) start @ CameraStreamer.js:60 (anonymous) @ blazor.server.js:1 beginInvokeJSFromDotNet @ blazor.server.js:1 _invokeClientMethod @ blazor.server.js:1 _processIncomingData @ blazor.server.js:1 Ft.connection.onreceive @ blazor.server.js:1 i.onmessage @ blazor.server.js:1 InstrumentHooks.js:97
I have the framework set as .NET 7, and everything works well locally. Could this be an issue running Linux?
I noticed in Azure deviceId from 'this._constraints' object is null, where locally, it's populated.
navigator.mediaDevices.getUserMedia(this._constraints).then(mediaStream => {
Issue is now resolved.
By default, I have the camera off when the page is loaded. When a user clicks an icon, I load the camera and I need to load it up like this:
private async void Start()
{
await JSRuntime.InvokeVoidAsync("toggleModal", "modal-id");
isHidden = !isHidden;
if (await CameraStreamerReference.GetCameraAccessAsync())
{
await CameraStreamerReference.ReloadAsync();
await CameraStreamerReference.StartAsync();
}
}