Add forceTurn to rooms for debugging

This commit is contained in:
Jannis Mattheis
2020-10-23 12:24:08 +02:00
parent 0ed8911632
commit c895c8750b
+5 -2
View File
@@ -33,6 +33,9 @@ export interface UseRoom {
stopShare: () => void;
}
const relayConfig: Partial<RTCConfiguration> =
window.location.search.indexOf('forceTurn=true') !== -1 ? {iceTransportPolicy: 'relay'} : {};
const hostSession = async ({
sid,
ice,
@@ -46,7 +49,7 @@ const hostSession = async ({
done: () => void;
stream: MediaStream;
}): Promise<RTCPeerConnection> => {
const peer = new RTCPeerConnection({iceServers: ice});
const peer = new RTCPeerConnection({...relayConfig, iceServers: ice});
peer.onicecandidate = (event) => {
if (!event.candidate) {
return;
@@ -89,7 +92,7 @@ const clientSession = async ({
done: () => void;
}): Promise<RTCPeerConnection> => {
console.log('ice', ice);
const peer = new RTCPeerConnection({iceServers: ice});
const peer = new RTCPeerConnection({...relayConfig, iceServers: ice});
peer.onicecandidate = (event) => {
if (!event.candidate) {
return;