Fixes https://github.com/vector-im/riot-web/issues/10898
In some restricted modes of Firefox, the WebRTC classes aren't super available: accessing them can cause SecurityErrors to be raised. In these conditions, we should just disable WebRTC support instead of falling apart.
This changes the ICE server fallback to be disabled by default. The SDK consumer
will receive a new event in case the homeserver has no ICE servers of its own,
and can prompt the user to agree to the fallback if desired.
Part of https://github.com/vector-im/riot-web/issues/10173
We were using 'exact' which means we fail outright if the device
we wanted isn't available. This means if a user selects a specific
device then later unplugs it, we fail to open a capture device
the next time they make a call even if there's one available.
Using 'ideal' uses the chosen device in preference, but something
else if it isn't available.
Also log the name of the exception when we fail to open a capture
device to give us more of an idea of what's gone wrong.
Should help fix https://github.com/vector-im/riot-web/issues/8993
Option needed to be passed in when creating a webrtc call, but for
incoming calls the js-sdk creates the call itself, so the app never
gets a chance to set the option.
* Store the answer we generate so if we fail to send it, we can
try to send it again (doing the same again doesn't work as
webrtc is in the wrong state).
* Don't send ICE candidates if the call is ringing: queue them up
so we can send them later if we manage to actually send the
answer.
We won't have sent the invite anyway. Also termainate before we
fire the error event so the call is 'ended' when the event handlers
fire (which means if they try to hang up it's also ignored)
* If we can't send an invite due to unknown devices, abort the
call.
* Don't transition to the `invite_sent` state until the invite
has actually sent.
* Add a specific error code for failure due to unknown devices.
* Don't send ICE candidate messages if the call has ended.
* Add an `event` property to errors from `sendEvent` so that the
caller can resend or cancel the event.
Reverts https://github.com/matrix-org/matrix-js-sdk/pull/378
This swallowed all errors from sendEvent, breaking the ICE candidate
retrying. react-sdk no longer listens for send_event_error so I
think it's best to just remove this.
FF is uber nice that it lets us select the display
does not seem to allow the composite ALL displays though
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
video.src = URL.createObjectURL(stream) is on the way out. Firefox will
complain with errors about not being able to play media of type
"text/html" for example.