Dear All,
I am using demo “openvidu-getaroom” code to share screen along with video. It works fine but the problem is that whenever I stop screen sharing, the screen view in remote user freezes. It seems layout is not updating at remote end but how I can detect at remote end that screen sharing has been stopped.
function shareMyScreen(){
OV = new OpenVidu();
sessionScreen = OV.initSession();
getToken(sessionId).then((token) => {
sessionScreen.connect(token).then(() => {
var publisher1 = OV.initPublisher(“videos”, {videoSource: “screen”});
publisher1.once(‘accessAllowed’, (event) => {
publisher1.stream.getMediaStream().getVideoTracks()[0].addEventListener(‘ended’, () => {
console.log(‘User pressed the “Stop sharing” button’);
numOfVideos–;
updateLayout();
});
sessionScreen.publish(publisher1);
});
publisher1.once(‘accessDenied’, (event) => {
console.warn(‘ScreenShare: Access Denied’);
});
}).catch((error => {
console.warn(‘There was an error connecting to the session:’, error.code, error.message);
}));
});
}