I'm trying to implement screen sharing using WebRTC and Kurento. According to the Chrome documentation, this now has to be done in a Chrome Extension using the chrome.desktopCapture.chooseDesktopMedia API.
I've implemented code that uses this API to connect to WebRTC and Kurento. It calls kurentoUtils.WebRtcPeer passing it the user media constraint as follows:
userMediaConstraints =
{
audio:false,
video: { mandatory: { chromeMediaSource: "desktop",
chromeMediaSourceId: id }
}
};
if (xhr.status == 200) {
webRtcPeer = kurentoUtils.WebRtcPeer.startSendOnly(screenShare, onOffer, onError, userMediaConstraints);
}
The problem is that this encounters a problem in kurento-utils.js. Specifically, getUserMedia used in the WebRtcPeer.start is not defined:
WebRtcPeer.start = function(mode, localVideo, remoteVideo, onSdp, onerror,
mediaConstraints, videoStream, audioStream, server, options) {
var wp = new WebRtcPeer(mode, localVideo, remoteVideo, onSdp, onerror,
videoStream, audioStream);
if (wp.mode !== 'recv' && !wp.stream) {
var constraints = mediaConstraints ? mediaConstraints
: wp.userMediaConstraints;
getUserMedia(constraints, function(userStream) {
wp.stream = userStream;
wp.start(server, options);
}, wp.onerror);
} else {
wp.start(server, options);
}
return wp;
};
Any ideas on how to work around this? According to the Chrome documentation, getUserMedia has been superseded by the chrome.desktopCapture API, so probably the code has to be updated. Perhaps kurento-utils.js, as written, won't work inside a Chrome extension. I wonder if anyone has already fixed this.
-- J