Question

Whenever I allow webcam access in chrome as a part of setup up a multi-party or a p2p conference, I am expecting to get a streamCreated notification which is not coming through. My camera turns on and the "google chrome renderer" for the page goes to 100% CPU usage. When I pause the execution of the stream I find that the execution is somewhere deep inside TB.min.js. Here's what the relevant parts of my code look like:

void meetingInProgress(info) {
   var session = TB.initSession(info.sessionId);
   session.connect(info.apiKey, info.token);

   session.addEventListener("sessionConnected", function(e) {
      console.log("Connected to session");

      subscribeToStreams(session, e.streams);
      session.publish("selfview", { name: name });
   });

   session.addEventListener("streamCreated", function(e) {
      console.log("New stream");
      subscribeToStreams(session, e.streams);
   });
}

var subscribeToStreams = function(session, streams) {
   var selfId = session.connection.connectionId;

   console.log('Subscribing to streams, self id:', selfId);
   console.log('No. of streams:', _.size(streams));

   _.forEach(streams, function(s) {
      console.log('Stream id: ', s.connection.connectionId);
      if (s.connection.connectionId == selfId) {
         console.log('Toggling');
         $("#selfview").toggle();
      }
      else
         session.subscribe(s, addViewport(), { width: 640, height: 480 });

   });

   console.log('Done subscribing to streams...');
}

Seems to me like if the publisher div element is hidden, there's a problem with receiving the streamCreated event. I was hoping to only show the publisher div panel when the user actually approves the use of camera. When I disable this div visibility toggling, things seem to work better.

Was it helpful?

Solution

Unfortunately, with the latest release, this will happen when the publisher is hidden. If you still want to hide it, the best option for now would be to make it a 1x1 pixel and have it absolutely positioned at -1, -1 of the screen.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top