better handling of voice events in the video camera; prettier transition between visible and invisible states in the mute btn

This commit is contained in:
Felipe Cecagno 2014-03-25 14:46:19 -03:00
parent b4607f8f38
commit fc6b9ddabd

View File

@ -23,12 +23,15 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:mate="http://mate.asfusion.com/"
xmlns:views="org.bigbluebutton.modules.videoconf.views.*"
initialize="init()"
creationComplete="onCreationComplete()"
backgroundColor="white" width="320" height="240"
mouseOver="onCanvasMouseOver()" mouseOut="onCanvasMouseOut()" >
<mate:Listener type="{EventConstants.USER_TALKING}" method="handleUserTalkingEvent" />
<mate:Listener type="{PresenterStatusEvent.PRESENTER_NAME_CHANGE}" method="handlePresenterChangedEvent" />
<mate:Listener type="{BBBEvent.USER_VOICE_LEFT}" method="handleUserVoiceChangedEvent" />
<mate:Listener type="{BBBEvent.USER_VOICE_MUTED}" method="handleUserVoiceChangedEvent" />
<mx:Script>
<![CDATA[
@ -37,6 +40,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.common.Images;
import org.bigbluebutton.core.EventConstants;
import org.bigbluebutton.main.events.BBBEvent;
import org.bigbluebutton.core.events.CoreEvent;
import org.bigbluebutton.core.events.VoiceConfEvent;
import org.bigbluebutton.core.UsersUtil;
@ -60,6 +64,13 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private const TITLE_BACKGROUND_TALKING:uint = 0x20c600;
private const TITLE_BACKGROUND_NOT_TALKING:uint = 0x42444c;
private var _hideMuteBtnTimer:Timer;
protected function init():void {
_hideMuteBtnTimer = new Timer(500, 1);
_hideMuteBtnTimer.addEventListener(TimerEvent.TIMER, onHideMuteBtnTimerComplete);
}
protected function onCreationComplete():void {
}
@ -174,9 +185,11 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
if (_rolledOverCanvas || _rolledOverMuteBtn) {
muteBtnWrapper.visible = user.voiceJoined;
// muteBtnWrapper.visible = user.voiceJoined;
setMuteBtnVisibility(user.voiceJoined);
} else {
muteBtnWrapper.visible = user.voiceJoined && user.voiceMuted;
// muteBtnWrapper.visible = user.voiceJoined && user.voiceMuted;
setMuteBtnVisibility(user.voiceJoined && user.voiceMuted);
}
var userIconVisibility:Boolean;
@ -212,9 +225,40 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
}
private function handleUserVoiceChangedEvent(event:BBBEvent):void {
if (user && event.payload.userID == user.userID) {
updateButtons();
}
}
private function onHideMuteBtnTimerComplete(event:TimerEvent):void {
muteBtnWrapper.visible = false;
}
private function setMuteBtnVisibility(visible:Boolean):void {
if (visible) {
showMuteBtn();
} else {
hideMuteBtn();
}
}
private function hideMuteBtn():void {
_hideMuteBtnTimer.reset();
_hideMuteBtnTimer.start();
}
private function showMuteBtn():void {
_hideMuteBtnTimer.reset();
muteBtnWrapper.visible = true;
}
]]>
</mx:Script>
<mx:Fade id="fadeOut" duration="200" alphaFrom="1.0" alphaTo="0.0" />
<mx:Fade id="fadeIn" duration="200" alphaFrom="0.0" alphaTo="1.0" />
<mx:Canvas id="canvas" width="100%" height="100%">
<views:UserAvatar id="avatar" width="100%" height="100%" visible="false" includeInLayout="false" />
<views:UserVideo id="video" width="100%" height="100%" visible="false" includeInLayout="false" />
@ -250,7 +294,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
verticalScrollPolicy="off" >
<mx:Box
id="muteBtnWrapper"
visible="false" >
visible="false"
hideEffect="{fadeOut}" showEffect="{fadeIn}" >
<mx:Button
id="muteBtn"
styleName="talkingOverlayBtn"