- close jws app when sharing is cancelled (not started)

This commit is contained in:
Richard Alam 2016-08-15 21:50:38 +00:00
parent 9945cb7c5b
commit 12a383cb9d
10 changed files with 15 additions and 18 deletions

View File

@ -4,12 +4,13 @@ public class StartShareRequestResponse {
public final String token;
public final String jnlp;
public final String streamId;
public final Error error;
public StartShareRequestResponse(String token, String jnlp, Error error) {
public StartShareRequestResponse(String token, String jnlp, String streamId, Error error) {
this.token = token;
this.jnlp = jnlp;
this.streamId = streamId;
this.error = error;
}
}

View File

@ -51,6 +51,7 @@ public class Red5AppHandler {
} else {
data.put("authToken", resp.token);
data.put("jnlp", resp.jnlp);
data.put("streamId", resp.streamId);
}
Map<String, Object> message = new HashMap<String, Object>();

View File

@ -93,7 +93,7 @@ class ScreenShareApplication(val bus: IEventsMessageBus, val jnlpFile: String,
val future = screenshareManager ? StartShareRequestMessage(meetingId, userId, record)
val reply = Await.result(future, timeout.duration).asInstanceOf[StartShareRequestReplyMessage]
val response = new StartShareRequestResponse(reply.token, jnlpFile, null)
val response = new StartShareRequestResponse(reply.token, jnlpFile, reply.streamId, null)
response
}

View File

@ -279,7 +279,7 @@ class Screenshare(val sessionManager: ScreenshareManager,
sessions += streamId -> session
status = START
session.actorRef ! msg
sender ! new StartShareRequestReplyMessage(token)
sender ! new StartShareRequestReplyMessage(token, streamId)
}
private def handleStartShareRequestMessage(msg: StartShareRequestMessage) {
@ -296,7 +296,7 @@ class Screenshare(val sessionManager: ScreenshareManager,
status = START
session.actorRef ! msg
sender ! new StartShareRequestReplyMessage(token)
sender ! new StartShareRequestReplyMessage(token, streamId)
}
private def handleGetSharingStatus(msg: GetSharingStatus) {

View File

@ -2,7 +2,7 @@ package org.bigbluebutton.app.screenshare.server.sessions.messages
case class StartShareRequestMessage(meetingId: String, userId: String, record: Boolean)
case class StartShareRequestReplyMessage(token: String)
case class StartShareRequestReplyMessage(token: String, streamId: String)
case class PauseShareRequestMessage(meetingId: String, userId: String, streamId: String)

View File

@ -48,7 +48,6 @@ public class NetworkHttpStreamSender {
private String meetingId;
private NetworkStreamListener listener;
private final SequenceNumberGenerator seqNumGenerator;
private volatile boolean startSendingMessage = false;
private ExecutorService executor;
private final BlockingQueue<Message> messages = new LinkedBlockingQueue<Message>();
@ -101,16 +100,11 @@ public class NetworkHttpStreamSender {
private void sendMessageToServer(Message message) {
if (message.getMessageType() == Message.MessageType.UPDATE) {
if (startSendingMessage) {
sendUpdateMessage((ShareUpdateMessage) message);
}
} else if (message.getMessageType() == Message.MessageType.STARTED) {
startSendingMessage = true;
sendStartStreamMessage((ShareStartedMessage)message);
} else if (message.getMessageType() == Message.MessageType.STOPPED) {
sendCaptureEndEvent(((ShareStoppedMessage)message).streamId);
startSendingMessage = false;
}
}
@ -254,8 +248,6 @@ public class NetworkHttpStreamSender {
System.out.println("sendUpdateMessage sharingStart = [" + sharingStatus + "]. Terminating as no streamId passed.");
notifyNetworkStreamListener(ExitCode.NORMAL, null);
}
}
}

View File

@ -8,13 +8,15 @@ package org.bigbluebutton.modules.screenshare.events
public var token: String = null;
public var jnlp: String = null;
public var streamId: String = null;
public var success: Boolean;
public function ShareStartRequestResponseEvent(token: String, jnlp: String, success: Boolean)
public function ShareStartRequestResponseEvent(token: String, jnlp: String, streamId: String, success: Boolean)
{
super(SHARE_START_REQUEST_RESPONSE, true, false);
this.token = token;
this.jnlp = jnlp;
this.streamId = streamId;
this.success = success;
}
}

View File

@ -178,6 +178,7 @@ package org.bigbluebutton.modules.screenshare.managers {
if (event.success) {
ScreenshareModel.getInstance().authToken = event.token;
ScreenshareModel.getInstance().jnlp = event.jnlp;
ScreenshareModel.getInstance().streamId = event.streamId;
dispatcher.dispatchEvent(new StartShareRequestSuccessEvent(ScreenshareModel.getInstance().authToken));
} else {
dispatcher.dispatchEvent(new StartShareRequestFailedEvent());

View File

@ -86,11 +86,11 @@ package org.bigbluebutton.modules.screenshare.services
private function handleStartShareRequestResponse(message:Object):void {
LOGGER.debug("handleStartShareRequestResponse " + message);
var map:Object = JSON.parse(message.msg);
if (map.hasOwnProperty("authToken") && map.hasOwnProperty("jnlp")) {
var shareSuccessEvent: ShareStartRequestResponseEvent = new ShareStartRequestResponseEvent(map.authToken, map.jnlp, true);
if (map.hasOwnProperty("authToken") && map.hasOwnProperty("jnlp") && map.hasOwnProperty("streamId")) {
var shareSuccessEvent: ShareStartRequestResponseEvent = new ShareStartRequestResponseEvent(map.authToken, map.jnlp, map.streamId, true);
dispatcher.dispatchEvent(shareSuccessEvent);
} else {
var shareFailedEvent: ShareStartRequestResponseEvent = new ShareStartRequestResponseEvent(null, null, false);
var shareFailedEvent: ShareStartRequestResponseEvent = new ShareStartRequestResponseEvent(null, null, null, false);
dispatcher.dispatchEvent(shareFailedEvent);
}
}