mirror of
https://github.com/balzack/databag.git
synced 2025-02-14 12:39:17 +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;
|
||||
audioTrack.current = false;
|
||||
accessVideo.current = false;
|
||||
const stream = await navigator.mediaDevices.getUserMedia({
|
||||
video: false,
|
||||
audio: true,
|
||||
});
|
||||
accessAudio.current = true;
|
||||
updateState({ localVideo: false, localAudio: true, localStream: stream });
|
||||
for (const track of stream.getTracks()) {
|
||||
if (track.kind === 'audio') {
|
||||
audioTrack.current = track;
|
||||
try {
|
||||
const stream = await navigator.mediaDevices.getUserMedia({
|
||||
video: false,
|
||||
audio: true,
|
||||
});
|
||||
accessAudio.current = true;
|
||||
updateState({ localVideo: false, localAudio: true, localStream: stream });
|
||||
for (const track of stream.getTracks()) {
|
||||
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;
|
||||
}
|
||||
pc.current.addTrack(track);
|
||||
}
|
||||
catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
const protocol = window.location.protocol === 'http:' ? 'ws://' : 'wss://';
|
||||
|
Loading…
Reference in New Issue
Block a user