Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Safari Error calling method on NPObject #190

Open
zaigham-mt opened this issue Apr 8, 2016 · 7 comments
Open

On Safari Error calling method on NPObject #190

zaigham-mt opened this issue Apr 8, 2016 · 7 comments

Comments

@zaigham-mt
Copy link

Error: Error calling method on NPObject.
348
          function (sessionDescription) {
Its occurring on following scripts

function answer(data) {
var pc = peerDatabase[getPeerIndex(data)].pc;

    toggleLocalStream(pc,data.videoChatId);

    pc.createAnswer(
        function (sessionDescription) {



            pc.setLocalDescription(sessionDescription);


            send('answer', data, sessionDescription);



        },
        function (error) {
            console.log(error);
        },
        config.mediaConstraints
    );
}

Its working fine for firefox. But due to plugin load not working for Safari and IE.

GetMediaStream and attachMediaStream seems to be working fine. But issue is when generating answer.

Here is attachment.

screen shot 2016-04-08 at 7 15 47 am

Any help will be appreciated.

@johache
Copy link
Contributor

johache commented Apr 11, 2016

Hi,

that all looks pretty good.
Can you check that config.mediaConstraints is a dictionary ?
Can you also check without constraints to see what happens ?

Finally, can you check that you are using the latest version of the plugin ? It should be 0.8.869.

Thanks,
J-O

@zaigham-mt
Copy link
Author

Here is the config file.

config = {
peerConnectionConfig: {
iceServers: [
{"url": "stun:23.21.150.121"},
{"url": "stun:stun.l.google.com:19302"}
]
},
peerConnectionConstraints: {
optional: [
{"DtlsSrtpKeyAgreement": true}
// (browser === 'firefox')
]
},

        mediaConstraints: {

            'mandatory': {

                'OfferToReceiveAudio': {

                    echoCancellation: true,
                    googEchoCancellation: true,
                    googAutoGainControl: true,
                    googAutoGainControl2: true,
                    googNoiseSuppression: true,
                    googHighpassFilter: true,
                    googTypingNoiseDetection: false,
                    googAudioMirroring: true // For some reason setting googAudioMirroring causes a navigator.getUserMedia error:  NavigatorUserMediaError

                },
                'OfferToReceiveAudio': audioConstraints,
                'OfferToReceiveVideo': true

            }
        }

    }

How would it work without constraints as there are few mandatory fields required.

I am using latest version of TemSys , its not showing version number.

screen shot 2016-04-11 at 1 10 52 am

@johache
Copy link
Contributor

johache commented Apr 11, 2016

I find it weird that you have 2 OfferToReceiveAudio fields in mandatory.
Can you fix that first and try again ?

@zaigham-mt
Copy link
Author

I have used following now. Still same scenario.

        mediaConstraints: {

            'mandatory': {

                'OfferToReceiveAudio': {

                    echoCancellation: true,
                    googEchoCancellation: true,
                    googAutoGainControl: true,
                    googAutoGainControl2: true,
                    googNoiseSuppression: true,
                    googHighpassFilter: true,
                    googTypingNoiseDetection: false,
                    googAudioMirroring: true // For some reason setting googAudioMirroring causes a navigator.getUserMedia error:  NavigatorUserMediaError

                },

                'OfferToReceiveVideo': true

            }
        }

    }

@zaigham-mt
Copy link
Author

@johache I have even tried to create following answer.

function answer(data) {
var pc = peerDatabase[getPeerIndex(data)].pc;

    toggleLocalStream(pc,data.videoChatId);

    pc.createAnswer(
        function (sessionDescription) {
            pc.setLocalDescription(sessionDescription);
            send('answer', data, sessionDescription);
        },
        function (error) {
            console.log(error);
        }
    );
}

I go through adapter.debug.js file and its not using third parameter that is media constraints. So does not matter whatever the media constraints are.

window.RTCPeerConnection.prototype.createAnswer = function() {
var self = this;
var answerOptions;
if (arguments.length === 1 && typeof arguments[0] !== 'function') {
answerOptions = arguments[0];
} else if (arguments.length === 3) {
answerOptions = arguments[2];
}

    var sdp = SDPUtils.writeSessionBoilerplate();
    this.transceivers.forEach(function(transceiver) {
      // Calculate intersection of capabilities.
      var commonCapabilities = self._getCommonCapabilities(
          transceiver.localCapabilities,
          transceiver.remoteCapabilities);

      sdp += SDPUtils.writeMediaSection(transceiver, commonCapabilities,
          'answer', self.localStreams[0]);
    });

    var desc = new RTCSessionDescription({
      type: 'answer',
      sdp: sdp
    });
    if (arguments.length && typeof arguments[0] === 'function') {
      window.setTimeout(arguments[0], 0, desc);
    }
    return Promise.resolve(desc);
  };

@johache
Copy link
Contributor

johache commented Apr 12, 2016

It does, this is exactly what the first part of the function is doing.
It split the cases where the options are provided as first argument and as third.

Do you have a live version of you app to test against ?

@zaigham-mt
Copy link
Author

Ok Finally it worked using correct constraints parameters on offer packet.Its working fine for Safari now.

But when I am trying it for firefox , on IOS device I am getting video stream and also audio. But on browser there was no video on browser. I get adapter.js from somewhere else and combined and it worked. Change was attachmediastream and reattachmediastream functions.

One last thing is when I do have video call for 3-4 times on same page session IE crash due to plugin.
Thanks for your cooperation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants