2

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.

4

1 回答 1

2

不幸的是,在最新版本中,当发布者被隐藏时会发生这种情况。如果您仍想隐藏它,目前最好的选择是将其设置为 1x1 像素,并将其绝对定位在屏幕的 -1、-1 处。

于 2013-07-10T21:50:16.867 回答