Greetings all,
I’m new to OpenVidu and I can tell it’s amazing.
Unfortunately, I’m unable to Share Screen using OpenVidu Get a Room after following this link.
function shareMyScreen() {
OV = new OpenVidu();
var sessionScreen = OV.initSession();
console.log("ENTERED SHARE SCREEN FUNCTION")
getToken((token) => {
sessionScreen.connect(token).then(() => {
console.log('COMES TO TO THEN FUNCTION');
var publisher = OV.initPublisher("html-element-id", {videoSource: "screen"});
publisher.once('accessAllowed', (event) => {
publisher.stream.getMediaStream().getVideoTracks()[0].addEventListener('ended', () => {
console.log('User pressed the "Stop sharing" button');
});
sessionScreen.publish(publisher);
});
publisher.once('accessDenied', (event) => {
console.warn('ScreenShare: Access Denied');
});
}).catch((error => {
console.warn('There was an error connecting to the session:', error.code, error.message);
}));
});
console.log("FINISHED SHARE SCREEN FUNCTION")
}
I think it might be skipping the getToken because I don’t know how to pass the token.
Thanks in advance.