Hi all,
I'm very new to WebRTC so any help would be greatly appreciated.
I have a basic peer to peer video call set up and working fine, but my main goal is for each user to be able to add two audio inputs to the connection (usb microphone, guitar signal from audio interface). So far I've been able to get either one or the other signal working fine, I've also tried using .getMediaDisplay so that both microphone and screen audio can be heard as a work around, but again only one audio track will be heard.
Is WebRTC even capable of having two tracks of audio, or must I find a way to first merge the audio inputs then add the single track to the connection? Thanks in advanced, code snipped for setting up sources below.
//Get user's camera and audioconst localStream = await navigator.mediaDevices.getUserMedia({video: true,audio: true,});const remoteStream = new MediaStream();//Add the local tracks to the WebRTC peer connectionlocalStream.getTracks().forEach((track) => {pc.addTrack(track, localStream);});//Get desktop tracksconst desktopStream = await navigator.mediaDevices.getDisplayMedia({video: true,audio: true,});//Add the desktop tracks to the local WebRTC peer connectiondesktopStream.getTracks().forEach((track) => {pc.addTrack(track, localStream);});//Listen to the onTrack even on the peer conneciton, add tracks to the remote streampc.ontrack = (event) => {event.streams[0].getTracks().forEach((track) => {remoteStream.addTrack(track);});};localRef.current.srcObject = localStream;remoteRef.current.srcObject = remoteStream;setWebcamActive(true);
--
---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/fe479c1b-e973-4d8b-b342-89080b08e963n%40googlegroups.com.