jsfiddle / togetherjs

A service for your website that makes it surprisingly easy to collaborate in real-time.
https://togetherjs.com
Mozilla Public License 2.0
7.01k stars 849 forks source link

webrtc abstraction #1054

Open ejb1123 opened 9 years ago

ejb1123 commented 9 years ago

We can abstract the webrtc with PeerJS. This can smooth out the issues with webrtc across browsers. I do not know how to change out the current implementation to peerjs but maybe someone else can do it.

xdsp commented 9 years ago

+1

priyankgandhi0 commented 1 year ago

local stream microphone not working while share screen + system audio shared in HTML JS

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)
        })
    }

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.