I'm trying to implement the screen share functionality in Firefox.
I've tried implementing the extension as you said but that didn't work. Then I came to know that I can do that without the extension.
I wrote your code which is in "capture-screen" onclick event.
But, I can select the window(as in your demo) but then I can not see the shared screen.
if (IsAndroidChrome) {
screen_constraints = {
mandatory: {
chromeMediaSource: 'screen'
},
optional: []
};
screen_constraints = {
video: screen_constraints
};
error = null;
}
if(error == 'not-installed') {
alert('Please install Chrome extension. See the link below.');
return;
}
if(error == 'installed-disabled') {
alert('Please install or enable Chrome extension. Please check "chrome://extensions" page.');
return;
}
if(error == 'permission-denied') {
alert('Please make sure you are using HTTPs. Because HTTPs is required.');
return;
}
console.info('getScreenId callback \n(error, sourceId, screen_constraints) =>\n', error, sourceId, screen_constraints);
navigator.getUserMedia = navigator.mozGetUserMedia || navigator.webkitGetUserMedia;
navigator.getUserMedia(screen_constraints, function(stream) {
document.querySelector('video').src = URL.createObjectURL(stream);
stream.oninactive = stream.onended = function() {
document.querySelector('video').src = null;
};
}, function(error) {
console.error('getScreenId error', error);
alert('Failed to capture your screen. Please check Chrome console logs for further information.');
});
});`
I have also getScreenId.js as you stated.
Kindly tell me what I'm doing wrong.
Thank you.