Removing some event listeners from deskshare views

Sometimes a closed view was still listening to important events. Now we make sure that only active deskshare views react to these events.
This commit is contained in:
kreismann 2016-07-25 14:47:31 -03:00
parent 323dae6b61
commit 17255f63e4
6 changed files with 64 additions and 31 deletions

View File

@ -134,7 +134,23 @@ package org.bigbluebutton.modules.deskshare.managers
LOGGER.debug("Received start vieweing command");
viewWindowManager.startViewing(module.getRoom(), videoWidth, videoHeight);
}
public function handleStopViewStreamEvent():void{
viewWindowManager.stopViewing();
if(UsersUtil.amIPresenter())
publishWindowManager.stopSharing();
}
//Desktop Publish Events Handlers
public function handleAppletStarted(videoWidth:Number, videoHeight:Number):void{
if(UsersUtil.amIPresenter())
publishWindowManager.handleAppletStarted(videoWidth,videoHeight);
}
public function handleDeskshareAppletLaunchedEvent():void{
if(UsersUtil.amIPresenter())
publishWindowManager.handleDeskshareAppletLaunchedEvent();
}
}
}

View File

@ -77,7 +77,7 @@ package org.bigbluebutton.modules.deskshare.managers
}
public function handleShareWindowCloseEvent():void {
closeWindow(shareWindow);
closeWindow();
}
private function openWindow(window:DesktopPublishWindow):void {
@ -86,9 +86,23 @@ package org.bigbluebutton.modules.deskshare.managers
globalDispatcher.dispatchEvent(e);
}
private function closeWindow(window:DesktopPublishWindow):void {
private function closeWindow():void {
var e:ShareEvent = new ShareEvent(ShareEvent.CLEAN_DESKTOP_PUBLISH_TAB);
globalDispatcher.dispatchEvent(e);
}
public function handleAppletStarted(videoWidth:Number, videoHeight:Number):void{
if(shareWindow != null) {
LOGGER.debug("DS:PublishWindowManager: calling shareWindow.onAppletStart");
shareWindow.onAppletStart(videoWidth,videoHeight);
}
}
public function handleDeskshareAppletLaunchedEvent():void{
if(shareWindow != null) {
LOGGER.debug("DS:PublishWindowManager: calling shareWindow.handleDeskshareAppletLaunchedEvent");
shareWindow.handleDeskshareAppletLaunchedEvent();
}
}
}
}

View File

@ -44,7 +44,10 @@ package org.bigbluebutton.modules.deskshare.managers
}
public function stopViewing():void {
if (isViewing) viewWindow.stopViewing();
if (viewWindow != null) {
viewWindow.stopViewing();
viewWindow = null;
}
}
public function handleStartedViewingEvent(stream:String):void{
@ -60,11 +63,11 @@ package org.bigbluebutton.modules.deskshare.managers
public function handleViewWindowCloseEvent():void {
LOGGER.debug("ViewerWindowManager Received stop viewing command");
closeWindow(viewWindow);
closeWindow();
isViewing = false;
}
private function closeWindow(window:DesktopViewWindow):void {
private function closeWindow():void {
var e:ShareEvent = new ShareEvent(ShareEvent.CLOSE_DESKTOP_VIEW_TAB);
globalDispatcher.dispatchEvent(e);
}

View File

@ -37,6 +37,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.modules.deskshare.events.ViewStreamEvent;
import org.bigbluebutton.modules.deskshare.events.ViewWindowEvent;
import org.bigbluebutton.modules.deskshare.managers.DeskshareManager;
import org.bigbluebutton.modules.deskshare.events.AppletStartedEvent;
import org.bigbluebutton.modules.deskshare.events.DeskshareAppletLaunchedEvent;
]]>
</mx:Script>
<EventHandlers type="{FlexEvent.PREINITIALIZE}">
@ -82,6 +84,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<MethodInvoker generator="{DeskshareManager}" method="handleStreamStartEvent" arguments="{[event.videoWidth, event.videoHeight]}"/>
</EventHandlers>
<EventHandlers type="{ViewStreamEvent.STOP}">
<MethodInvoker generator="{DeskshareManager}" method="handleStopViewStreamEvent"/>
</EventHandlers>
<EventHandlers type="{ShareWindowEvent.CLOSE}">
<MethodInvoker generator="{DeskshareManager}" method="handleShareWindowCloseEvent"/>
</EventHandlers>
@ -102,5 +108,13 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<MethodInvoker generator="{DeskshareManager}" method="handleStartModuleEvent" arguments="{event.module}"/>
</EventHandlers>
<!-- Desktop Publish Events-->
<EventHandlers type="{AppletStartedEvent.APPLET_STARTED}">
<MethodInvoker generator="{DeskshareManager}" method="handleAppletStarted" arguments="{[event.videoWidth, event.videoHeight]}"/>
</EventHandlers>
<EventHandlers type="{DeskshareAppletLaunchedEvent.APPLET_LAUNCHED}">
<MethodInvoker generator="{DeskshareManager}" method="handleDeskshareAppletLaunchedEvent"/>
</EventHandlers>
</EventMap>

View File

@ -30,11 +30,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
verticalScrollPolicy="off" horizontalScrollPolicy="off"
width="365" height="350">
<mate:Listener type="{AppletStartedEvent.APPLET_STARTED}" method="onAppletStart" />
<mate:Listener type="{CursorEvent.UPDATE_CURSOR_LOC_EVENT}" method="onUpdateCursorEvent" />
<mate:Listener type="{ViewStreamEvent.STOP}" method="closePublishWindow" />
<mate:Listener type="{LocaleChangeEvent.LOCALE_CHANGED}" method="localeChanged" />
<mate:Listener type="{DeskshareAppletLaunchedEvent.APPLET_LAUNCHED}" method="handleDeskshareAppletLaunchedEvent" />
<mx:Script>
<![CDATA[
@ -53,12 +50,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.main.events.MadePresenterEvent;
import org.bigbluebutton.main.events.ShortcutEvent;
import org.bigbluebutton.main.views.MainCanvas;
import org.bigbluebutton.modules.deskshare.events.AppletStartedEvent;
import org.bigbluebutton.modules.deskshare.events.CursorEvent;
import org.bigbluebutton.modules.deskshare.events.DeskshareAppletLaunchedEvent;
import org.bigbluebutton.modules.deskshare.events.ShareWindowEvent;
import org.bigbluebutton.modules.deskshare.events.StreamEvent;
import org.bigbluebutton.modules.deskshare.events.ViewStreamEvent;
import org.bigbluebutton.modules.deskshare.model.DeskshareOptions;
import org.bigbluebutton.modules.deskshare.utils.JavaCheck;
import org.bigbluebutton.modules.deskshare.utils.BrowserCheck;
@ -223,16 +217,16 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
cursorImg.y = cursor.y;
}
private function onAppletStart(event:AppletStartedEvent):void{
if (!connection.connected || !UsersUtil.amIPresenter()) return;
public function onAppletStart(videoWidth:Number, videoHeight:Number):void{
if (!connection.connected) return;
LOGGER.debug("DeskShareWindow::onAppletStart");
clickBelowtoShareInfo.visible = false;
clickBelowtoShareInfo.includeInLayout = false;
startPreviewStream(connection, room, event.videoWidth, event.videoHeight);
startPreviewStream(connection, room, videoWidth, videoHeight);
var streamEvent:StreamEvent = new StreamEvent(StreamEvent.START);
streamEvent.videoWidth = event.videoWidth;
streamEvent.videoHeight = event.videoHeight;
streamEvent.videoWidth = videoWidth;
streamEvent.videoHeight = videoHeight;
dispatchEvent(streamEvent);
}
@ -384,7 +378,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
shareScreen(sharingFullScreen);
}
private function handleDeskshareAppletLaunchedEvent(e:DeskshareAppletLaunchedEvent):void {
public function handleDeskshareAppletLaunchedEvent():void {
if (javaTimer && javaTimer.running) {
javaTimer.stop();
}
@ -399,11 +393,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private function localeChanged(e:Event):void{
resourcesChanged();
}
private function closePublishWindow(event:ViewStreamEvent):void{
stopStream();
closeWindow();
}
public function canPublish():Boolean {
if (BrowserCheck.isUsingLessThanChrome38OnMac()) {

View File

@ -30,7 +30,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
xmlns:mate="http://mate.asfusion.com/"
backgroundColor="#C0C0C0">
<mate:Listener type="{ViewStreamEvent.STOP}" method="onStopViewStreamEvent" />
<mate:Listener type="{CursorEvent.UPDATE_CURSOR_LOC_EVENT}" method="onUpdateCursorEvent" />
<mate:Listener type="{LocaleChangeEvent.LOCALE_CHANGED}" method="localeChanged" />
@ -51,7 +50,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.main.views.MainCanvas;
import org.bigbluebutton.modules.deskshare.events.CursorEvent;
import org.bigbluebutton.modules.deskshare.events.StartedViewingEvent;
import org.bigbluebutton.modules.deskshare.events.ViewStreamEvent;
import org.bigbluebutton.modules.deskshare.events.ViewWindowEvent;
import org.bigbluebutton.modules.deskshare.model.DeskshareOptions;
import org.bigbluebutton.util.i18n.ResourceUtil;
@ -227,13 +225,12 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
public function stopViewing():void {
ns.close();
if(ns != null) {
ns.close();
ns = null;
}
closeWindow();
}
private function onStopViewStreamEvent(event:ViewStreamEvent):void {
stopViewing();
}
private function onAsyncError(e:AsyncErrorEvent):void{
LOGGER.debug("VIdeoWindow::asyncerror {0}", [e.toString()]);