The video link is up and running. You can disable / enable video / audio for yourself, and through the socket this state is updated for other participants in the video meeting. But I can’t share the host’s screen, the host itself shows that the screen is being broadcast, but the other participants continue to broadcast the webcam.
when evaluating, screen sharing is allowed for all participants in the video chat, I get an error:
TypeError: videoStream.replaceTrack is not a function
const screenShare = () => {
console.log('use!')
if (!screenShareStatus) {
// @ts-ignore
navigator.mediaDevices.getDisplayMedia({cursor: true})
.then((currentStream) => {
const screenTrack = currentStream.getTracks()[0];
// const screenTrack = currentStream.getVideoTracks()[0];
const videoStream = localMediaStream.current.getTracks().find((track) => track.kind === 'video'); // camera
console.log('videoStream: ', videoStream);
videoStream.replaceTrack(screenTrack);
setScreenShareStatus(true);
}).catch((error) => {
console.log('error: ', error)
});
} else {
// @ts-ignore
screenTrackRef.current.onended();
}
};
And I don't actually find this method on the MediaStreamTrack object, how do I change the video source then? In all examples, people have no problem with this