How to use getUserMedia with geckofx

How do I enable webrtc with geckofx ?

I 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 allow a site to use getUserMedia, but still cannot use the webrtc demo sites (e.g. https://apprtc.appspot.com )

I am using GeckoFX 29.0.10

PS I have included 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 alert.js being used to query asking which device to use for webrtc?

+3


source to share


1 answer


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 opening a dialog box.

Test code:



GeckoWebBrowser myBrowser = new GeckoWebBrowser();
this.Controls.Add(myBrowser);
myBrowser.Dock = DockStyle.Fill;

myBrowser.Navigate("http://davidwalsh.name/demo/camera.php");

      

Hello,

Daniel

+7


source







All Articles