@superinterface/react 3.12.0 → 3.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -11005,7 +11005,7 @@ var useWebrtcAudioRuntime = function() {
11005
11005
  }
11006
11006
  function _initRealtimeSession() {
11007
11007
  _initRealtimeSession = _asyncToGenerator12(function() {
11008
- var peerConn, audioEl, ms, offer, searchParams, sdpResponse, answerSdp, answer, err;
11008
+ var iceServers, peerConn, audioEl, ms, offer, searchParams, sdpResponse, reader, decoder, answerSdp, _ref, value, done, answer, err;
11009
11009
  return _ts_generator(this, function(_state) {
11010
11010
  switch(_state.label){
11011
11011
  case 0:
@@ -11016,7 +11016,30 @@ var useWebrtcAudioRuntime = function() {
11016
11016
  8
11017
11017
  ]);
11018
11018
  setUserIsPending(true);
11019
- peerConn = new RTCPeerConnection();
11019
+ iceServers = [
11020
+ {
11021
+ url: "stun:global.stun.twilio.com:3478",
11022
+ urls: "stun:global.stun.twilio.com:3478"
11023
+ },
11024
+ {
11025
+ urls: "stun:stun.l.google.com:19302"
11026
+ },
11027
+ {
11028
+ urls: "stun:stun1.l.google.com:19302"
11029
+ },
11030
+ {
11031
+ urls: "stun:stun2.l.google.com:19302"
11032
+ },
11033
+ {
11034
+ urls: "stun:stun4.l.google.com:19302"
11035
+ },
11036
+ {
11037
+ urls: "stun:stun.stunprotocol.org:3478"
11038
+ }
11039
+ ];
11040
+ peerConn = new RTCPeerConnection({
11041
+ iceServers: iceServers
11042
+ });
11020
11043
  pcRef.current = peerConn;
11021
11044
  audioEl = document.createElement("audio");
11022
11045
  audioEl.autoplay = true;
@@ -11092,12 +11115,28 @@ var useWebrtcAudioRuntime = function() {
11092
11115
  ];
11093
11116
  case 4:
11094
11117
  sdpResponse = _state.sent();
11118
+ if (!sdpResponse.ok) {
11119
+ throw new Error("Server responded with status ".concat(sdpResponse.status));
11120
+ }
11121
+ if (!sdpResponse.body) {
11122
+ throw new Error("ReadableStream not supported in this browser.");
11123
+ }
11124
+ reader = sdpResponse.body.getReader();
11125
+ decoder = new TextDecoder("utf-8");
11126
+ answerSdp = "";
11095
11127
  return [
11096
11128
  4,
11097
- sdpResponse.text()
11129
+ reader.read()
11098
11130
  ];
11099
11131
  case 5:
11100
- answerSdp = _state.sent();
11132
+ _ref = _state.sent(), value = _ref.value, done = _ref.done;
11133
+ if (done) {
11134
+ throw new Error("Stream closed before SDP was received");
11135
+ }
11136
+ answerSdp += decoder.decode(value, {
11137
+ stream: true
11138
+ });
11139
+ console.log("Received SDP Answer:", answerSdp);
11101
11140
  answer = {
11102
11141
  type: "answer",
11103
11142
  sdp: answerSdp