M
M
Mikhail Smirnov2020-04-24 14:43:46
JavaScript
Mikhail Smirnov, 2020-04-24 14:43:46

Why is chrome screencast not streaming?

I make a video chat with the ability to share the computer screen using the chrome extension, the
result of the screencast is displayed in the #my-screen block - no problem, but not transmitted via webrtc stream

Video from webcams is transmitted in both directions without problems

, the function for streaming the screen is used the same as for stream from camera pc.addStream(stream);

var pc = new webkitRTCPeerConnection({
               "iceServers": [
                   {"url": "stun:provserver.televolution.net"},
                   {"url": "stun:stun.ekiga.net"}
               ]
            });


chrome.runtime.sendMessage(extensionId, {type: "getSourceId"}, function (response) {

                    navigator.mediaDevices
                        .getUserMedia({
                            audio: false,
                            video: {
                                mandatory: {
                                    chromeMediaSource: 'desktop',
                                    chromeMediaSourceId: response.sourceId,
                                    maxWidth: 1920,
                                    maxHeight: 1080
                                }
                            }
                        })
                        .then(stream => {
                            var videoElement = document.getElementById('my-screen');
                            videoElement.srcObject = stream;

                            pc.addStream(stream);
                            setupClient();
                        })
                        .catch(console.error);

                });


What could be the problem?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question