Temasys/AdapterJS

getUserMedia undefined into adapter.js

Opened this issue · 3 comments

Hi, I'm trying to test the adapter.js in order to make WebRTC video calls through IE11.
I have the following problem:

into the method getUserMeda is called the method AdapterJS.WebRTCPlugin.plugin.getUserMedia. The problem is that the latest getUserMedia is undefined!.
During the debug, I've seen that into AdapterJS.WebRTCPlugin.plugin it's not defined any getUserMedia method.

The piece of code that it's not working is:

getUserMedia = function (constraints, successCallback, failureCallback) {
      var cc = {};
      cc.audio = constraints.audio ?
        constraintsToPlugin(constraints.audio) : false;
      cc.video = constraints.video ?
        constraintsToPlugin(constraints.video) : false;

      AdapterJS.WebRTCPlugin.callWhenPluginReady(function() {
        AdapterJS.WebRTCPlugin.plugin.
          getUserMedia(cc, successCallback, failureCallback);
      });
    };
    window.navigator.getUserMedia = getUserMedia;

UPDATE:

Using adapter.screenshare.js, AdapterJS.WebRTCPlugin.plugin.getUserMedia now it's defined, but in my wrapper, when i try to invoke callback functions, I have the error Member not found.
This is the piece of code of my wrapper:

getUserMedia(this.offer_constraints, function (stream) {
	gotDevice(stream);
}, function (err) {
	failDevice(err);
});

Any idea? Thanks for the help.

What is the member that is not being found ?
You call looks good to me, except that the guM constraints are different from the offer constraints.
See an example here : https://plugin.temasys.io/demo/src/content/peerconnection/constraints/

Hi @johache, the problem is on IE 11 and the error is not specific.
As I wrote before, I'm using adapter.screenshare.js and a custom wrapper.
Into the custom wrapper I have:

var constraints = this.offer_constraints;
AdapterJS.webRTCReady(function (isUsingPlugin) {
	if (isUsingPlugin) {
		getUserMedia(constraints, function (stream) {
			gotDevice(stream);
		}, function (err) {
		        failDevice(err);
		});
	}
});

This is written into: https://confluence.temasys.com.sg/display/TWPP/How+to+integrate+the+Temasys+WebRTC+Plugin+into+your+website

The problem seems to be into the code written before or into this piece of code of adapter.screenshare.js:

getUserMedia = function (constraints, successCallback, failureCallback) {
      var cc = {};
      cc.audio = constraints.audio ?
        constraintsToPlugin(constraints.audio) : false;
      cc.video = constraints.video ?
        constraintsToPlugin(constraints.video) : false;

      AdapterJS.WebRTCPlugin.plugin.
      AdapterJS.WebRTCPlugin.callWhenPluginReady(function () {
        getUserMedia(cc, successCallback, failureCallback);
      });
    };
    window.navigator.getUserMedia = getUserMedia;

Into the debugging mode, I have seen that cc, successCallback and failureCallback are instantiated, the flow enters into callWhenPluginReady and than there is the problem (it's invoked into my wrapper, under:

...

		getUserMedia(constraints, function (stream) {
			gotDevice(stream);
		}, function (err) {
		        failDevice(err);
		});
	}
});

).
Any idea? Thanks

Alright, a few more question:
"the flow enters into callWhenPluginReady ": does that mean that you can breakpoint inside the callback function ?
"than there is the problem" meaning AdapterJS.WebRTCPlugin.plugin.getUserMedia is undefined ?

Is it a free plugin that you have installed ?
What do AdapterJS.WebRTCPlugin.plugin.valid and AdapterJS.WebRTCPlugin.plugin.VERSION return ?
Is the plugin enabled in IE's "manage add-ons" panel ?