ObserveRTC / client-monitor-js

Javascript library to monitor browser-side webrtc app
https://observertc.org/docs/api/client-monitor-js-v2/
Apache License 2.0
23 stars 2 forks source link

Upgrading to version 3.9.0 is breaking next js app #32

Closed AkMo3 closed 1 week ago

AkMo3 commented 4 months ago

Problem: We are using client-monitor-js in our internal observer package. Recently, we upgrade this package to use the 3.9.0 version.

This interval package is used in our next web app. After the upgrade we are facing error with message TypeError: Cannot read properties of undefined (reading 'getUserMedia'). Ref:

image

On reading docs, we added the parameter integrateNavigatorMediaDevices: false to config and everything works well. But, on doing this I loose use media error events.

Expected: I can use the package without providing the extra configuration.

balazskreith commented 4 months ago

Thanks for the detailed description.

At any time you can integrate browser mediaDevices to an instantiated monitor by calling ClientMonitor.integrateNavigatorMediaDevices(monitor), where monitor is a ClientMonitor instance. Just make sure you call in an app running in the browser.

As for the error, that probably means that the mediaDevices property of the navigator is not the one browser should provide.

From 3.9.1 there is a check if getUserMedia is a function so it fails at creation time if not. But it's not gonna solve your problem. The proper solution is to figure out what's going on next.js, which requires some work to setup a project.

balazskreith commented 2 weeks ago

@AkMo3 if the issue is resolved, pls close this Issue