Tokbox screenshare issue

2019-08-01 12:22发布

问题:

I am using session.unpublish(Publisher) to stop screen share and then republish video stream publisher to start video publisher, but next time when I start screen share it creates problems.

In tokbox js what is the best way to stop screen share.

Actually I have two publisher when screenshare is on AudioVideoPublisher and ScreenPublisher both in different container as screenshare does not publish Audio with screen so I have also need AudioVideoPublisher in that case.

回答1:

The best way to stop the publishing is to call unpublish like you're doing but then it's best to wait for the streamDestroyed event before you publish again. eg.

publisher.on('streamDestroyed', function(event) {
  // publish again
  var publisher = OT.initPublisher();
  session.publish(publisher);
});
session.unpublish(publisher);