You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importPeerfrom'peerjs'exporttypePeerJsTransportServerOptions={peerConnection: Peer.DataConnection}exportclassPeerJsTransportServer{peerConnection: Peer.DataConnectionconstructor({ peerConnection }: PeerJsTransportServerOptions){this.peerConnection=peerConnection}onData(callback: (data: unknown)=>unknown){this.peerConnection.on('data',async(reqData)=>{constrespData=awaitcallback(reqData)if(!respData)return// no data means notificationthis.peerConnection.send(respData)})}}
local stream microphone not working while share screen + system audio shared in HTML JS
Here is code HTML + JS ✅
function startScreenShare() {
if (screenSharing) {
stopScreenSharing()
}
navigator.mediaDevices.getDisplayMedia(
{ video: { mediaSource: "screen" }, audio: true }
).then((stream) => {
setScreenSharingStream(stream);
screenStream = stream;
let videoTrack = screenStream.getAudioTracks()[0];
videoTrack.onended = () => {
stopScreenSharing()
}
if (peer) {
let sender = currentPeer.peerConnection.getSenders().find(function (s) {
return s.track.kind == videoTrack.kind;
})
sender.replaceTrack(videoTrack)
screenSharing = true
}
console.log(screenStream)
})
}
We have tried to share screen audio. When sharing the screen, microphone and screen-sharing audio do not work together. Mic does not work when system audio is on. System audio does not working if end mic is on. please explain me what is the about issue.
I don't have time now to put this into a proper project with autotester tests, but here's PeerJS transport adapter for anyone in need. License MIT.
PeerJsTransportClient.ts
PeerJsTransportServer.ts
Usage
server
client
The text was updated successfully, but these errors were encountered: