Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion webclient/src/components/Call/Call.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ onMounted(async () => {
watch(localStream, (stream) => {
if (localVideo.value && stream) {
localVideo.value.srcObject = stream;
const videoTrack = stream.getVideoTracks()[0];
if (videoTrack) {
videoTrack.enabled = false;
}
}
});

Expand All @@ -46,7 +50,7 @@ onUnmounted(() => {
});

const isMicMuted = ref(false);
const isVideoOff = ref(false);
const isVideoOff = ref(true);
const isRemoteMuted = ref(false);

function toggleMic() {
Expand Down
23 changes: 19 additions & 4 deletions webclient/src/helpers/webrtc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,25 @@ export async function initPeerConnection(
}

// ✅ Add local media
localStream.value = await navigator.mediaDevices.getUserMedia({
audio: true,
video: true,
});
try {
localStream.value = await navigator.mediaDevices.getUserMedia({
audio: true,
video: true,
});
} catch (error) {
console.warn("Error accessing media devices:", error);
try {
localStream.value = await navigator.mediaDevices.getUserMedia({
audio: true,
});
} catch (error) {
console.error("Error accessing audio devices:", error);
alert(
"Unable to access audio devices. Please check your microphone settings."
);
return;
}
}

localStream.value.getTracks().forEach((track) => {
peerConnection.value?.addTrack(track, localStream.value!);
Expand Down