I'm trying to do screen sharing using cefclient by navigating to a page that has the following javascript. I'm using release 3107 on Windows 7.
- Code: Select all
var conf = {
mandatory: {
chromeMediaSource: 'desktop',
chromeMediaSourceId: 'screen:0',
maxWidth: 1280,
maxHeight: 720
},
optional: []
};
navigator.getUserMedia({audio: false, video: conf},function(stream) {
console.log('success');
//set the URL of the video element...
},function(e){
console.log(e);
alert(e);
})
This kind of approach apparently used to work, according to this post: http://arkenthera.github.io/blog/Enabling-CEF-to-Screen-Share-using-getUserMedia-API/
However, CEF (or Chromium?) doesn't seem to like the chromeMediaSourceId that I'm passing in, and the whole app crashes when calling getUserMedia. If I pass in a random numeric value of three or more digits, it gets as far as CefBrowserHostImpl::RequestMediaAccessPermission(..) and then errors because of the invalid ID, but when I use 'screen:0' it doesn't even get that far before dying.
According to the following (NW.js rather than CEF, but a similar concept), Chromium now requires you to register the screen ID with DesktopStreamsRegistry, which will give you an encrypted string to pass into getUserMedia. This is how Chrome's desktopCapture extension works, and NW.js have fixed their issue by exposing this screen ID registering process in their API.
https://github.com/nwjs/nw.js/issues/4459
I can't see any way of doing this in CEF. Am I missing something, or am I just doing something wrong somewhere?
Thanks.