From 252d7129a779f0ea1e33612e4efc95027241997d Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Thu, 19 Sep 2013 17:27:30 +0000 Subject: [PATCH] - fix race condition where video share button doesn't show up somtimes when presenterShareOnly=true --- .../videoconf/maps/VideoEventMapDelegate.as | 44 +++++++++++++------ .../videoconf/views/ToolbarButton.mxml | 7 ++- 2 files changed, 35 insertions(+), 16 deletions(-) diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/maps/VideoEventMapDelegate.as b/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/maps/VideoEventMapDelegate.as index c8f504b360..e311ab6df5 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/maps/VideoEventMapDelegate.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/maps/VideoEventMapDelegate.as @@ -62,15 +62,15 @@ package org.bigbluebutton.modules.videoconf.maps private var webcamWindows:WindowManager = new WindowManager(); - private var button:ToolbarButton; + private var button:ToolbarButton = new ToolbarButton(); private var proxy:VideoProxy; private var streamName:String; private var _dispatcher:IEventDispatcher; private var _ready:Boolean = false; private var _isPublishing:Boolean = false; - private var _isPreviewWebcamOpen:Boolean = false; - private var _isWaitingActivation:Boolean = false; + private var _isPreviewWebcamOpen:Boolean = false; + private var _isWaitingActivation:Boolean = false; public function VideoEventMapDelegate(dispatcher:IEventDispatcher) { @@ -114,10 +114,25 @@ package org.bigbluebutton.modules.videoconf.maps } } + private function displayToolbarButton():void { + button.isPresenter = true; + + if (options.presenterShareOnly) { + if (UsersUtil.amIPresenter()) { + button.isPresenter = true; + } else { + button.isPresenter = false; + } + } + + } + private function addToolbarButton():void{ - if (proxy.videoOptions.showButton || proxy.videoOptions.presenterShareOnly) { - button = new ToolbarButton(); - button.isPresenter = !options.presenterShareOnly; + LogUtil.debug("****************** Adding toolbar button. presenter?=[" + UsersUtil.amIPresenter() + "]"); + if (proxy.videoOptions.showButton) { + + displayToolbarButton(); + var event:ToolbarButtonEvent = new ToolbarButtonEvent(ToolbarButtonEvent.ADD); event.button = button; event.module="Webcam"; @@ -365,20 +380,21 @@ package org.bigbluebutton.modules.videoconf.maps public function switchToPresenter(event:MadePresenterEvent):void{ trace("VideoEventMapDelegate:: [" + me + "] Got Switch to presenter event. ready = [" + _ready + "]"); - if (!_ready) return; +// if (!_ready) return; - if (options.presenterShareOnly){ - button.isPresenter = true; - } + if (options.showButton) { + displayToolbarButton(); + } } - + public function switchToViewer(event:MadePresenterEvent):void{ trace("VideoEventMapDelegate:: [" + me + "] Got Switch to viewer event. ready = [" + _ready + "]"); - if (!_ready) return; +// if (!_ready) return; - if (options.presenterShareOnly){ - button.isPresenter = false; + if (options.showButton){ + LogUtil.debug("****************** Switching to viewer. Show video button?=[" + UsersUtil.amIPresenter() + "]"); + displayToolbarButton(); if (_isPublishing) { stopBroadcasting(); } diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/views/ToolbarButton.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/views/ToolbarButton.mxml index b4c6f03542..40688b4bed 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/views/ToolbarButton.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/views/ToolbarButton.mxml @@ -27,7 +27,7 @@ with BigBlueButton; if not, see . mouseOut = "mouseOutHandler(event)" height="24" toolTip="{this.selected ? ResourceUtil.getInstance().getString('bbb.toolbar.video.toolTip.stop') : ResourceUtil.getInstance().getString('bbb.toolbar.video.toolTip.start')}" - visible="{isPresenter}" + visible="false" implements="org.bigbluebutton.common.IBbbToolbarComponent"> @@ -46,7 +46,6 @@ with BigBlueButton; if not, see . import org.bigbluebutton.modules.videoconf.events.ShareCameraRequestEvent; import org.bigbluebutton.util.i18n.ResourceUtil; - [Bindable] public var isPresenter:Boolean; private var images:Images = new Images(); [Bindable] public var camIcon:Class = images.webcam; @@ -71,6 +70,10 @@ with BigBlueButton; if not, see . _currentState = OFF_STATE; } + public function set isPresenter(presenter:Boolean):void { + visible = presenter; + } + public function remoteClick(e:ShortcutEvent):void{ openPublishWindow(); dispatchEvent(new ShortcutEvent(ShortcutEvent.REMOTE_FOCUS_WEBCAM));