Embedded GeckoFx in C#.NET - WebRTC Video not working

浪尽此生 提交于 2019-12-10 23:59:18

问题


I'm just trying to embed a GeckoFX (the latest got from nuget in VS2015) engine in an Windows Forms Window (this is working) to show some WebRTC video.

To embed the GeckoFx to my WinForm Test-Application I'm using the following code:

    private void MainForm_Load(object sender, EventArgs e)
    {
        Xpcom.Initialize("Firefox");
        GeckoPreferences.User["browser.xul.error_pages.enabled"] = true;
        GeckoPreferences.User["media.navigator.enabled"] = true;
        GeckoPreferences.User["media.navigator.permission.disabled"] = true; // enable Access to video & audio
        GeckoWebBrowser browser = new GeckoWebBrowser();
        browser.Dock = DockStyle.Fill;
        this.Controls.Add(browser);
        // browser.Navigate(@"http://www.palava.tv");
        browser.Navigate(@"file:///D:/SimpleWebRTC-master/index.html");
    }

As you can see I simply set some preferences (at least important is to disable the navigator.permission request to auto-allow the access to audio and the webcam.

On the "Web" Part Side, as you can see, I'm using the SimpleWebRTC Framework, at the moment. Here, before trying the samples in the SimpleWebRTC I did wrote some own code, which should have worked, too. My own code for this was:

    $('#testbutton2').click(function() {

        alert('hurra');

        var webrtc = new SimpleWebRTC({
            // the id/element dom element that will hold "our" video
            localVideoEl: 'localVideo',
            // the id/element dom element that will hold remote videos
            remoteVideosEl: '',
            // immediately ask for camera access
            autoRequestMedia: true,
            url: 'http://192.168.91.101:8888/'
            });

        // we have to wait until it's ready
        webrtc.on('readyToCall', function () {
        // you can name it anything
        webrtc.joinRoom('Eingang');
        });

    });   

(as you can see, I also use some jquery).

Now the following is happening: If I access the samples from SimpleWebRTC or my own files I do not get a video. The javascript function is working (I get the alert, but nothing is happening while accessing the video). As far is I can see the Webcam gets accessed (the little led is getting on) but the video is not shown to the defined DOM element. But this only happens if I use the GeckoFx embeded to my application. If I'm calling the same test files from a regular FireFox browser (actual version) it is working, I can see the video.

Next thing: If I'm calling www.palava.tv from both (FireFox and embeded GeckFX) I can get the video on both(!) - seems that the embeded GeckoFx has the ability to access and work with the webcam.

Someone some idea, help or experience why the video is not shown if called from GeckoFx, but if I use the "normal" Firefox ? And why is palava.tv working in booth ?

Thanks for any comments!

来源:https://stackoverflow.com/questions/39204508/embedded-geckofx-in-c-net-webrtc-video-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!