Temasys / SkylinkJS

SkylinkJS Javascript WebRTC SDK
http://skylink.io/web
Other
275 stars 57 forks source link

Cannot read property 'sid' of null #147

Closed MichaelJCole closed 8 years ago

MichaelJCole commented 9 years ago

Hey there, I'm getting an error trying to turn off screen sharing.

Uncaught TypeError: Cannot read property 'sid' of null
streamEnded @ skylink.complete.js:20453

I'm using this in a Meteor application:

Template.conference.events({
  'click #toggleChat': function(e, template) {     // <----------  These are event handlers.
    template.showChat.set(!template.showChat.get());
  },
  'click #toggleShare': function(e, template) {
    if (template.shareScreen.get()) {   // <--------  This is a reactive variable.
console.log('turning off ...');
      template.skylink.stopScreen(function(err) {   // <----  This isn't throwing an error or calling the callback
        if (err) throw err;     
console.log('... off');
        template.shareScreen.set(false);
      });
    } else {
console.log('turning on ...');
      template.skylink.shareScreen(function(err) {
        if (err) throw err;
console.log('... on');
        template.shareScreen.set(true);
      });
    }
  },

Here's the full console output:

turning on ...   
... on
turning off ...
Uncaught TypeError: Cannot read property 'sid' of null
streamEnded @ skylink.complete.js:20453
  <script src="//cdn.temasys.com.sg/skylink/skylinkjs/0.6.x/skylink.complete.js"></script>

Any suggestions?

Thanks!

oooookk7 commented 9 years ago

Hi @MichaelJCole,

Thanks for raising the issue. Was this done with the Skylink Media Relay on?

MichaelJCole commented 9 years ago

Hey @letchoo I think that's on by default, but I didn't intentionally change it.

Here's the code that starts the session. I fixed a bug after I created this issue that may have been passing confId as null.

  var self = this;
  var confId = Template.instance().data.conference.id;
  self.skylink.init({
    appKey: Meteor.settings.public.skylink,
    apiKey: Meteor.settings.public.skylink,
  }, function(err) {
    if (err) console.log(err);
    // Join the room.
    self.skylink.joinRoom(
      confId,
      { audio: true },  // Video is not set here for people w/o cameras.  Audio is required or connect will fail.
      function(err) { if (err) console.log(err); }
    );
  });
oooookk7 commented 9 years ago

Hi @MichaelJCole,

Is this reproducible now for you? We are trying to reproduce this error. May we know the events used and the subsequent application logic?

ncurrier commented 9 years ago

@letchoo IIRC this was identified to be a problem on the Meteor side that was resolved, looks like we missed closing this ticket @MichaelJCole can you please confirm this so we can close this out.

MichaelJCole commented 9 years ago

Yes, I think this was because I was passing null as a room id to joinRoom().

Adding parameter checks to joinRoom() might save you some support issues in the future. I can be a crappy programmer at times, but definitely not the worst :-)

Thanks for following up :-)

oooookk7 commented 8 years ago

Added checks for skylink.joinRoom(null);. This should throw an error in the callback.

https://github.com/Temasys/SkylinkJS/releases/tag/0.6.4

oooookk7 commented 8 years ago

Hi @MichaelJCole, I would like to check if the 0.6.4 release did fix the issue you have. Does it still occur for you?

MichaelJCole commented 8 years ago

Hey Leticia, thanks for checking in. I switched to SimpleWebRTC with a Xirsys backend.

oooookk7 commented 8 years ago

Thanks for the response, we will be closing this ticket then.