Reputation: 505
How does one enable webrtc with geckofx?
I've tried
var perm = Xpcom.CreateInstance<nsIPermissionManager>("@mozilla.org/permissionmanager;1");
nsIURI pwcom = Xpcom.CreateInstance<nsIIOService>("@mozilla.org/network/io-service;1").NewURI(new nsAUTF8String("https://apprtc.appspot.com"), null, null);
perm.Add(pwcom, "camera", 1, 0, 0);
perm.Add(pwcom, "video-capture", 1, 0, 0);
perm.Add(pwcom, "audio-capture", 1, 0, 0);
To give permission to site to use getUserMedia, but still can't use any webrtc demo sites (such as https://apprtc.appspot.com)
I'm using GeckoFX 29.0.10
PS I've included an nsIConsoleListener which only emits
2014-11-10 214218 consoleListener.Observe: [JavaScript Error: "TypeError: window.arguments is undefined" {file: "chrome://global/content/alerts/alert.js" line: 42}]
2014-11-10 214219 consoleListener.Observe: [JavaScript Error: "NS_ERROR_NOT_IMPLEMENTED: " {file: "chrome://global/content/alerts/alert.js" line: 77}]
Is the alert.js used for the prompt requesting which device to use for webrtc?
Upvotes: 3
Views: 2143
Reputation: 188
This works for me:
Gecko.Xpcom.Initialize(@"******************");
GeckoPreferences.User["plugin.state.flash"] = true;
GeckoPreferences.User["browser.xul.error_pages.enabled"] = true;
GeckoPreferences.User["media.navigator.enabled"] = true;
/* The following line is the key: */
GeckoPreferences.User["media.navigator.permission.disabled"] = true;
By disabling the navigator permission, it automatically accepts the request, without poping up the dialog.
Test code:
GeckoWebBrowser myBrowser = new GeckoWebBrowser();
this.Controls.Add(myBrowser);
myBrowser.Dock = DockStyle.Fill;
myBrowser.Navigate("http://davidwalsh.name/demo/camera.php");
Greetings,
Daniel
Upvotes: 8