Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

local stream microphone not working while share screen + system audio shared using peerjs webrtc #1065

Open
priyankgandhi0 opened this issue Jul 19, 2023 · 0 comments

Comments

@priyankgandhi0
Copy link

priyankgandhi0 commented Jul 19, 2023

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.

Screenshot 2023-07-19 182435

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)
        })
    }
@priyankgandhi0 priyankgandhi0 changed the title local stream microphone not working while share screen + system audio shared in HTML JS local stream microphone not working while share screen + system audio shared using peerjs webrtc Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant