0

I added CefSharp to a brand new winforms app (.net 4.6 I believe).

The only code necessary to reproduce this is below:

cefSettings = new CefSettings();
cefSettings.CefCommandLineArgs.Add("enable-media-stream", "1");
Cef.Initialize(cefSettings);
browser = new ChromiumWebBrowser("voice.google.com");
this.Controls.Add(browser);

That code will add the CefSharp browser control to the From, the cefSettings and browser variables are private class variables but that shouldn't matter for this.

The issue I am having is that despite using the "enable-media-stream" param, the google voice site still thinks the browser hasn't allowed microphone access. To make things worse, the microphone actually works in the app and I can make and take calls (had to hack some html by injecting JS though) but when I open the audio settings, it still shows the warning "give Google Voice permission to use your microphone" and the device selection dropdowns are disabled even though you can see in the screenshot that my audio devices show up.

As I mentioned, the microphone is actually working and google voice has access to it but it thinks it doesn't. My theory is that google is using a combination of media related JS to determine the level of access that the browser is allowing it when accessing the media devices. Any ideas as to what google might using that isn't compatible with CEF and how to resolve it?

screenshot of Google Voice audio settings

  • You can try adding https://github.com/cefsharp/CefSharp.MinimalExample/blob/master/CefSharp.MinimalExample.WinForms/Program.cs#L40 to your command line args. Does Google voice require authentication? If yes then you might have trouble logging in to your Google account as they are blocking CEF based browsers for which CefSharp is one of many. https://security.googleblog.com/2019/04/better-protection-against-man-in-middle.html?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:+GoogleOnlineSecurityBlog+(Google+Online+Security+Blog)&m=1 – amaitland Feb 22 '21 at 20:45
  • I've gone through many different command line args including the "use-fake-ui-for-media-stream" which I believe does nothing unless paired with "use-fake-device-for-media-stream" which doesn't fix my problem but changes the device names to something like "fake-device". The device dropdowns in GV are still disabled and that warning text is still present. – JohnnyCTS Feb 23 '21 at 13:53
  • Also, I mentioned in the original post that I had to inject JS to get things to work at all, that was due to an overlay that would appear, when a call came in, asking to give google access to the microphone, which it already had. The JS I injected was to continuously search for that overlay when it appears and delete it so you can click the answer call button behind the overlay to take the call. Everything works....except google still thinks it doesn't have access to the audio devices. – JohnnyCTS Feb 23 '21 at 13:54
  • It could be related to that google security blog link but I doubt it since that link mentions authentication which works fine in my app as I am able to log in without any issues. – JohnnyCTS Feb 23 '21 at 13:55
  • I'm grasping at straws here but if I could find a way to tap into those permission requests, I might be able to figure out whats going on. Does anyone have an example of how I might do that? – JohnnyCTS Feb 23 '21 at 13:57
  • CEF has very limited support currently, only those command line args. There is an open PR https://bitbucket.org/chromiumembedded/cef/pull-requests/323 You can search on https://magpcss.org/ceforum/index.php as CefSharp is just one of many chromium embedded framework wrappers. – amaitland Feb 23 '21 at 19:17
  • https://www.magpcss.org/ceforum/viewtopic.php?f=6&t=15794 – amaitland Feb 23 '21 at 19:18

0 Answers0