fixing state when cant connect to media

This commit is contained in:
Roland Osborne 2023-03-28 16:19:47 -07:00
parent 00f4769505
commit d6b642d6a2

View File

@ -323,6 +323,7 @@ export function useRingContext() {
videoTrack.current = false;
audioTrack.current = false;
accessVideo.current = false;
try {
const stream = await navigator.mediaDevices.getUserMedia({
video: false,
audio: true,
@ -338,6 +339,10 @@ export function useRingContext() {
}
pc.current.addTrack(track);
}
}
catch (err) {
console.log(err);
}
const protocol = window.location.protocol === 'http:' ? 'ws://' : 'wss://';
ws.current = createWebsocket(`${protocol}${window.location.host}/signal`);