requestingSession = true;
try {
if (videoSharingSessionObservable.getValue() != null) {
return;
}
ConnectionFactory connectionFactory = null;
StreamSession streamSession = null;
try {
if (to.isLocal()) {
connectionFactory = new ConnectionFactory();
videoSharingSessionObservable
.setValue(new VideoSharingSession(connectionFactory, to));
return;
}
try {
streamSession = streamServiceManager.createSession(
videoSharingService, to, VideoSharingInit.create(this),
null);
connectionFactory = new ConnectionFactory(streamSession,
Mode.HOST);
videoSharingSessionObservable
.setValue(new VideoSharingSession(streamSession,
connectionFactory, to));
} catch (InterruptedException e) {