- stop sharing from the screen share toolbar button.

This commit is contained in:
Richard Alam 2016-08-15 20:56:29 +00:00
parent 9c7759dc73
commit 9945cb7c5b
7 changed files with 63 additions and 10 deletions

View File

@ -100,12 +100,13 @@ public class Red5AppHandler {
Map<String, Object> data = new HashMap<String, Object>();
data.put("meetingId", meetingId);
data.put("streamId", streamId);
data.put("userId", userId);
Map<String, Object> message = new HashMap<String, Object>();
Gson gson = new Gson();
message.put("msg", gson.toJson(data));
BroadcastClientMessage msg = new BroadcastClientMessage(meetingId, "pauseViewingStream", message);
BroadcastClientMessage msg = new BroadcastClientMessage(meetingId, "pauseScreenSharingEvent", message);
sender.sendMessage(msg);
Map<String, Object> logData = new HashMap<String, Object>();

View File

@ -0,0 +1,19 @@
package org.bigbluebutton.modules.screenshare.events
{
import flash.events.Event;
public class ScreenSharePausedEvent extends Event
{
public static const SCREENSHARE_PAUSED:String = "screenshare share paused event";
public var streamId:String;
public function ScreenSharePausedEvent(streamId: String)
{
super(SCREENSHARE_PAUSED, true, false);
this.streamId = streamId;
}
}
}

View File

@ -168,6 +168,8 @@ package org.bigbluebutton.modules.screenshare.managers {
public function handleRequestStopSharingEvent():void {
service.requestStopSharing(ScreenshareModel.getInstance().streamId);
publishWindowManager.handleShareWindowCloseEvent();
toolbarButtonManager.stoppedSharing();
}
public function handleShareStartRequestResponseEvent(event:ShareStartRequestResponseEvent):void {
@ -196,7 +198,7 @@ package org.bigbluebutton.modules.screenshare.managers {
//toolbarButtonManager.enableToolbarButton();
publishWindowManager.handleShareWindowCloseEvent();
sharing = false;
toolbarButtonManager.stopedSharing();
toolbarButtonManager.stoppedSharing();
}
public function handleViewWindowCloseEvent():void {
@ -218,7 +220,7 @@ package org.bigbluebutton.modules.screenshare.managers {
public function handleDeskshareToolbarStopEvent():void {
JSLog.warn("ScreenshareManager::handleDeskshareToolbarStopEvent", {});
toolbarButtonManager.stopedSharing();
toolbarButtonManager.stoppedSharing();
}
}
}

View File

@ -23,7 +23,7 @@ package org.bigbluebutton.modules.screenshare.managers
import org.as3commons.logging.api.ILogger;
import org.as3commons.logging.api.getClassLogger;
import org.bigbluebutton.common.events.ToolbarButtonEvent;
import org.bigbluebutton.modules.screenshare.view.components.ToolbarButton;
import org.bigbluebutton.modules.screenshare.view.components.ToolbarButton;
public class ToolbarButtonManager {
private static const LOGGER:ILogger = getClassLogger(ToolbarButtonManager);
@ -77,7 +77,7 @@ package org.bigbluebutton.modules.screenshare.managers
button.deskshareStatus(button.START_SHARING);
}
public function stopedSharing():void {
public function stoppedSharing():void {
button.deskshareStatus(button.STOP_SHARING);
}
}

View File

@ -28,8 +28,9 @@ package org.bigbluebutton.modules.screenshare.services
import org.bigbluebutton.modules.screenshare.events.ShareStoppedEvent;
import org.bigbluebutton.modules.screenshare.events.StreamStartedEvent;
import org.bigbluebutton.modules.screenshare.events.StreamStoppedEvent;
import org.bigbluebutton.modules.screenshare.events.ScreenSharePausedEvent;
import org.bigbluebutton.modules.screenshare.services.red5.Connection;
import org.bigbluebutton.modules.screenshare.services.red5.IMessageListener;
import org.bigbluebutton.modules.screenshare.services.red5.IMessageListener;
public class MessageReceiver implements IMessageListener
{
@ -65,10 +66,22 @@ package org.bigbluebutton.modules.screenshare.services
case "screenStreamStoppedMessage":
handleScreenStreamStoppedMessage(message);
break;
case "pauseScreenSharingEvent":
handlePauseScreenSharingEvent(message);
break;
default:
// LogUtil.warn("Cannot handle message [" + messageName + "]");
}
}
private function handlePauseScreenSharingEvent(message:Object):void {
LOGGER.debug("handlePauseScreenSharingEvent " + JSON.stringify(message));
var map:Object = JSON.parse(message.msg);
if (map.hasOwnProperty("meetingId") && map.hasOwnProperty("streamId")) {
var sharePausedEvent: ScreenSharePausedEvent = new ScreenSharePausedEvent(map.streamId);
dispatcher.dispatchEvent(sharePausedEvent);
}
}
private function handleStartShareRequestResponse(message:Object):void {
LOGGER.debug("handleStartShareRequestResponse " + message);

View File

@ -34,6 +34,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
resizable="false">
<mate:Listener type="{StartShareRequestSuccessEvent.START_SHARE_REQUEST_SUCCESS}" method="handleStartShareRequestSuccessEvent" />
<mate:Listener type="{ScreenSharePausedEvent.SCREENSHARE_PAUSED}" method="handleScreenSharePausedEvent" />
<mate:Listener type="{ShareStoppedEvent.SHARE_STOPPED}" method="handleScreenShareShareStoppedEvent" />
<mate:Listener type="{ViewStreamEvent.START}" method="handleStartViewStreamEvent" />
<mate:Listener type="{MadePresenterEvent.SWITCH_TO_PRESENTER_MODE}" method="onChangedPresenter" />
<mate:Listener type="{MadePresenterEvent.SWITCH_TO_VIEWER_MODE}" method="onChangedPresenter" />
@ -59,6 +61,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.modules.screenshare.events.RequestToRestartSharing;
import org.bigbluebutton.modules.screenshare.events.RequestToPauseSharing;
import org.bigbluebutton.modules.screenshare.events.ShareWindowEvent;
import org.bigbluebutton.modules.screenshare.events.ShareStoppedEvent;
import org.bigbluebutton.modules.screenshare.events.ScreenSharePausedEvent;
import org.bigbluebutton.modules.screenshare.events.StartShareRequestSuccessEvent;
import org.bigbluebutton.modules.screenshare.events.StopSharingButtonEvent;
import org.bigbluebutton.modules.screenshare.events.StreamEvent;
@ -167,18 +171,30 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
this.uri = uri;
this.room = room;
this.autoStart = autoStart;
/*if(autoFullScreen)
shareScreen(true);*/
}
private function handleStartShareRequestSuccessEvent(event:StartShareRequestSuccessEvent):void {
}
private function handleScreenShareShareStoppedEvent(event:ShareStoppedEvent):void {
LOGGER.debug("handleScreenShareShareStoppedEvent");
//closeWindow();
}
private function handleScreenSharePausedEvent(event:ScreenSharePausedEvent):void {
LOGGER.debug("handleScreenSharePausedEvent");
}
private function handleStreamStoppedEvent(event:StreamStoppedEvent):void {
if (videoHolder != null) {
this.removeChild(videoHolder);
videoHolder = null;
if (paused) {
LOGGER.debug("handleScreenSharePausedEvent - enable push button.");
btnClosePublish.enabled = true;
}
}
showHowToHelpArea();
@ -229,10 +245,12 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
streaming = false;
btnClosePublish.toolTip = ResourceUtil.getInstance().getString('bbb.screensharePublish.restart.tooltip');
btnClosePublish.label = ResourceUtil.getInstance().getString('bbb.screensharePublish.restart.label');
btnClosePublish.enabled = false;
} else {
paused = false;
btnClosePublish.toolTip = ResourceUtil.getInstance().getString('bbb.screensharePublish.pause.tooltip');
btnClosePublish.label = ResourceUtil.getInstance().getString('bbb.screensharePublish.pause.label');
btnClosePublish.enabled = false;
var restartSharingEvent:RequestToRestartSharing = new RequestToRestartSharing();
dispatchEvent(restartSharingEvent);
}

View File

@ -49,7 +49,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
public const STOP_SHARING:Number = 0;
public const START_SHARING:Number = 1;
private var _currentState:Number = OFF_STATE;
private var _currentState:Number = OFF_STATE;
private var dispatcher:Dispatcher = new Dispatcher();
public function deskshareStatus(status:Number):void {
@ -101,7 +101,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private function mouseOverHandler(event:MouseEvent):void {
if(_currentState == ON_STATE)
styleName="deskshareOffButtonStyle"
else
else
styleName="deskshareOnButtonStyle"
}