@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 +43 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +43 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10834,7 +10834,7 @@ var useWebrtcAudioRuntime = function() {
|
|
|
10834
10834
|
}
|
|
10835
10835
|
function _initRealtimeSession() {
|
|
10836
10836
|
_initRealtimeSession = _asyncToGenerator12(function() {
|
|
10837
|
-
var peerConn, audioEl, ms, offer, searchParams, sdpResponse, answerSdp, answer, err;
|
|
10837
|
+
var iceServers, peerConn, audioEl, ms, offer, searchParams, sdpResponse, reader, decoder, answerSdp, _ref, value, done, answer, err;
|
|
10838
10838
|
return _ts_generator(this, function(_state) {
|
|
10839
10839
|
switch(_state.label){
|
|
10840
10840
|
case 0:
|
|
@@ -10845,7 +10845,30 @@ var useWebrtcAudioRuntime = function() {
|
|
|
10845
10845
|
8
|
|
10846
10846
|
]);
|
|
10847
10847
|
setUserIsPending(true);
|
|
10848
|
-
|
|
10848
|
+
iceServers = [
|
|
10849
|
+
{
|
|
10850
|
+
url: "stun:global.stun.twilio.com:3478",
|
|
10851
|
+
urls: "stun:global.stun.twilio.com:3478"
|
|
10852
|
+
},
|
|
10853
|
+
{
|
|
10854
|
+
urls: "stun:stun.l.google.com:19302"
|
|
10855
|
+
},
|
|
10856
|
+
{
|
|
10857
|
+
urls: "stun:stun1.l.google.com:19302"
|
|
10858
|
+
},
|
|
10859
|
+
{
|
|
10860
|
+
urls: "stun:stun2.l.google.com:19302"
|
|
10861
|
+
},
|
|
10862
|
+
{
|
|
10863
|
+
urls: "stun:stun4.l.google.com:19302"
|
|
10864
|
+
},
|
|
10865
|
+
{
|
|
10866
|
+
urls: "stun:stun.stunprotocol.org:3478"
|
|
10867
|
+
}
|
|
10868
|
+
];
|
|
10869
|
+
peerConn = new RTCPeerConnection({
|
|
10870
|
+
iceServers: iceServers
|
|
10871
|
+
});
|
|
10849
10872
|
pcRef.current = peerConn;
|
|
10850
10873
|
audioEl = document.createElement("audio");
|
|
10851
10874
|
audioEl.autoplay = true;
|
|
@@ -10921,12 +10944,28 @@ var useWebrtcAudioRuntime = function() {
|
|
|
10921
10944
|
];
|
|
10922
10945
|
case 4:
|
|
10923
10946
|
sdpResponse = _state.sent();
|
|
10947
|
+
if (!sdpResponse.ok) {
|
|
10948
|
+
throw new Error("Server responded with status ".concat(sdpResponse.status));
|
|
10949
|
+
}
|
|
10950
|
+
if (!sdpResponse.body) {
|
|
10951
|
+
throw new Error("ReadableStream not supported in this browser.");
|
|
10952
|
+
}
|
|
10953
|
+
reader = sdpResponse.body.getReader();
|
|
10954
|
+
decoder = new TextDecoder("utf-8");
|
|
10955
|
+
answerSdp = "";
|
|
10924
10956
|
return [
|
|
10925
10957
|
4,
|
|
10926
|
-
|
|
10958
|
+
reader.read()
|
|
10927
10959
|
];
|
|
10928
10960
|
case 5:
|
|
10929
|
-
|
|
10961
|
+
_ref = _state.sent(), value = _ref.value, done = _ref.done;
|
|
10962
|
+
if (done) {
|
|
10963
|
+
throw new Error("Stream closed before SDP was received");
|
|
10964
|
+
}
|
|
10965
|
+
answerSdp += decoder.decode(value, {
|
|
10966
|
+
stream: true
|
|
10967
|
+
});
|
|
10968
|
+
console.log("Received SDP Answer:", answerSdp);
|
|
10930
10969
|
answer = {
|
|
10931
10970
|
type: "answer",
|
|
10932
10971
|
sdp: answerSdp
|