mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-05-24 23:55:50 +00:00
android, desktop: workaround of missing stuns support in calls (#4033)
* android, desktop: workaround of missing stuns support in calls * const
This commit is contained in:
committed by
GitHub
parent
c2169f7813
commit
5e71d00ace
@@ -111,7 +111,17 @@ const processCommand = (function () {
|
||||
});
|
||||
}
|
||||
async function initializeCall(config, mediaType, aesKey) {
|
||||
const pc = new RTCPeerConnection(config.peerConnectionConfig);
|
||||
var _a;
|
||||
let pc;
|
||||
try {
|
||||
pc = new RTCPeerConnection(config.peerConnectionConfig);
|
||||
}
|
||||
catch (e) {
|
||||
console.log("Error while constructing RTCPeerConnection, will try without 'stuns' specified: " + e);
|
||||
const withoutStuns = (_a = config.peerConnectionConfig.iceServers) === null || _a === void 0 ? void 0 : _a.filter((elem) => typeof elem.urls === "string" ? !elem.urls.startsWith("stuns:") : !elem.urls.some((url) => url.startsWith("stuns:")));
|
||||
config.peerConnectionConfig.iceServers = withoutStuns;
|
||||
pc = new RTCPeerConnection(config.peerConnectionConfig);
|
||||
}
|
||||
const remoteStream = new MediaStream();
|
||||
const localCamera = VideoCamera.User;
|
||||
const localStream = await getLocalMediaStream(mediaType, localCamera);
|
||||
|
||||
@@ -321,7 +321,17 @@ const processCommand = (function () {
|
||||
}
|
||||
|
||||
async function initializeCall(config: CallConfig, mediaType: CallMediaType, aesKey?: string): Promise<Call> {
|
||||
const pc = new RTCPeerConnection(config.peerConnectionConfig)
|
||||
let pc: RTCPeerConnection
|
||||
try {
|
||||
pc = new RTCPeerConnection(config.peerConnectionConfig)
|
||||
} catch (e) {
|
||||
console.log("Error while constructing RTCPeerConnection, will try without 'stuns' specified: " + e)
|
||||
const withoutStuns = config.peerConnectionConfig.iceServers?.filter((elem) =>
|
||||
typeof elem.urls === "string" ? !elem.urls.startsWith("stuns:") : !elem.urls.some((url) => url.startsWith("stuns:"))
|
||||
)
|
||||
config.peerConnectionConfig.iceServers = withoutStuns
|
||||
pc = new RTCPeerConnection(config.peerConnectionConfig)
|
||||
}
|
||||
const remoteStream = new MediaStream()
|
||||
const localCamera = VideoCamera.User
|
||||
const localStream = await getLocalMediaStream(mediaType, localCamera)
|
||||
|
||||
Reference in New Issue
Block a user