versatica / JsSIP

JsSIP, the JavaScript SIP library
https://jssip.net
Other
2.4k stars 739 forks source link

On iOS, navigator.mediaDevices is `undefined` unless page is served in a secure context, but Errors are swallowed #861

Open pjkundert opened 2 months ago

pjkundert commented 2 months ago

OK, so part one of the issue was this:

iOS will refuse to allow Javascript code to access navigator. In RTCSession.js, when we call

return navigator.mediaDevices.getUserMedia(mediaConstraints)

the navigator.mediaDevices is undefined -- unless you're accessing the code in a "secure context": via https://... or file:///

This is not checked, causing an exception -- except since the exception is not thrown by the call itself, but by the code, it trickles down to the final .catch((error) =>, which neither logs nor re-throws the Error, it just swallows it.

I'll submit an Issue and a Pull for this, of course, but there are a couple of other things, too...

Originally posted by @pjkundert in https://github.com/versatica/JsSIP/discussions/860#discussioncomment-9843435