mirror of
https://github.com/balzack/databag.git
synced 2025-02-14 20:49:16 +00:00
fixing state when cant connect to media
This commit is contained in:
parent
00f4769505
commit
d6b642d6a2
@ -323,20 +323,25 @@ export function useRingContext() {
|
|||||||
videoTrack.current = false;
|
videoTrack.current = false;
|
||||||
audioTrack.current = false;
|
audioTrack.current = false;
|
||||||
accessVideo.current = false;
|
accessVideo.current = false;
|
||||||
const stream = await navigator.mediaDevices.getUserMedia({
|
try {
|
||||||
video: false,
|
const stream = await navigator.mediaDevices.getUserMedia({
|
||||||
audio: true,
|
video: false,
|
||||||
});
|
audio: true,
|
||||||
accessAudio.current = true;
|
});
|
||||||
updateState({ localVideo: false, localAudio: true, localStream: stream });
|
accessAudio.current = true;
|
||||||
for (const track of stream.getTracks()) {
|
updateState({ localVideo: false, localAudio: true, localStream: stream });
|
||||||
if (track.kind === 'audio') {
|
for (const track of stream.getTracks()) {
|
||||||
audioTrack.current = track;
|
if (track.kind === 'audio') {
|
||||||
|
audioTrack.current = track;
|
||||||
|
}
|
||||||
|
if (track.kind === 'video') {
|
||||||
|
videoTrack.current = track;
|
||||||
|
}
|
||||||
|
pc.current.addTrack(track);
|
||||||
}
|
}
|
||||||
if (track.kind === 'video') {
|
}
|
||||||
videoTrack.current = track;
|
catch (err) {
|
||||||
}
|
console.log(err);
|
||||||
pc.current.addTrack(track);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const protocol = window.location.protocol === 'http:' ? 'ws://' : 'wss://';
|
const protocol = window.location.protocol === 'http:' ? 'ws://' : 'wss://';
|
||||||
|
Loading…
Reference in New Issue
Block a user