Merge branch '081-network-monitor' into 090-network-monitor

Conflicts:
	bigbluebutton-client/src/org/bigbluebutton/core/services/BandwidthMonitor.as
	bigbluebutton-client/src/org/bigbluebutton/main/model/users/NetConnectionDelegate.as
	bigbluebutton-client/src/org/bigbluebutton/main/views/MainApplicationShell.mxml
This commit is contained in:
Mateus Dalepiane 2014-09-11 12:26:36 -03:00
commit ba020a8e52
13 changed files with 333 additions and 220 deletions

View File

@ -320,6 +320,15 @@ bbb.settings.warning.label = Warning
bbb.settings.warning.close = Close this Warning
bbb.settings.noissues = No outstanding issues have been detected.
bbb.settings.instructions = Accept the Flash prompt that asks you for webcam permissions. If the output matches what is expected, your browser has been set up correctly. Other potentials issues are below. Examine them to find a possible solution.
bbb.bwmonitor.title = Network monitor
bbb.bwmonitor.upload = Upload
bbb.bwmonitor.upload.short = Up
bbb.bwmonitor.download = Download
bbb.bwmonitor.download.short = Down
bbb.bwmonitor.total = Total
bbb.bwmonitor.current = Current
bbb.bwmonitor.available = Available
bbb.bwmonitor.latency = Latency
ltbcustom.bbb.highlighter.toolbar.triangle = Triangle
ltbcustom.bbb.highlighter.toolbar.triangle.accessibilityName = Switch whiteboard cursor to triangle
ltbcustom.bbb.highlighter.toolbar.line = Line

View File

@ -320,6 +320,15 @@ bbb.settings.warning.label = Aviso
bbb.settings.warning.close = Fechar esse aviso
bbb.settings.noissues = Nenhum problema foi detectado.
bbb.settings.instructions = Aceite a notificação do Flash quando ele requisitar permissão para acessar sua câmera. Se você consegue ver e ouvir a si mesmo, seu navegador foi configurado corretamente. Outros erros em potencial estão indicados abaixo. Verifique cada um para encontrar uma possível solução.
bbb.bwmonitor.title = Monitor de rede
bbb.bwmonitor.upload = Upload
bbb.bwmonitor.upload.short = Up
bbb.bwmonitor.download = Download
bbb.bwmonitor.download.short = Down
bbb.bwmonitor.total = Total
bbb.bwmonitor.current = Atual
bbb.bwmonitor.available = Disponível
bbb.bwmonitor.latency = Latência
ltbcustom.bbb.highlighter.toolbar.triangle = Triângulo
ltbcustom.bbb.highlighter.toolbar.triangle.accessibilityName = Mudar o cursor do quadro branco para triângulo
ltbcustom.bbb.highlighter.toolbar.line = Linha

View File

@ -306,5 +306,8 @@ package org.bigbluebutton.common
[Embed(source="assets/images/grid_icon.png")]
public var grid_icon:Class;
[Embed(source="assets/images/arrow_refresh_small.png")]
public var refreshSmall:Class;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 B

View File

@ -19,6 +19,7 @@
package org.bigbluebutton.core.services
{
import flash.events.AsyncErrorEvent;
import flash.events.IOErrorEvent;
import flash.events.NetStatusEvent;
import flash.events.TimerEvent;
import flash.net.NetConnection;
@ -34,43 +35,137 @@ package org.bigbluebutton.core.services
import org.red5.flash.bwcheck.events.BandwidthDetectEvent;
public class BandwidthMonitor {
public static const INTERVAL_BETWEEN_CHECKS:int = 30000; // in ms
private static var _instance:BandwidthMonitor = null;
private var _serverURL:String = "localhost";
private var _serverApplication:String = "video";
private var _clientServerService:String = "checkBandwidthUp";
private var _serverClientService:String = "checkBandwidth";
private var nc:NetConnection;
private var _pendingClientToServer:Boolean;
private var _pendingServerToClient:Boolean;
private var _lastClientToServerCheck:Date;
private var _lastServerToClientCheck:Date;
private var _runningMeasurement:Boolean;
private var _connecting:Boolean;
private var _nc:NetConnection;
private var bwTestTimer:Timer;
public function BandwidthMonitor() {
/**
* This class is a singleton. Please initialize it using the getInstance() method.
*/
public function BandwidthMonitor(enforcer:SingletonEnforcer) {
if (enforcer == null) {
throw new Error("There can only be one instance of this class");
}
initialize();
}
private function initialize():void {
_pendingClientToServer = false;
_pendingServerToClient = false;
_runningMeasurement = false;
_connecting = false;
_lastClientToServerCheck = null;
_lastServerToClientCheck = null;
_nc = new NetConnection();
_nc.objectEncoding = flash.net.ObjectEncoding.AMF0;
_nc.client = this;
_nc.addEventListener(NetStatusEvent.NET_STATUS, onStatus);
_nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR, onAsyncError);
_nc.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
}
/**
* Return the single instance of this class
*/
public static function getInstance():BandwidthMonitor {
if (_instance == null) {
_instance = new BandwidthMonitor(new SingletonEnforcer());
}
return _instance;
}
public function set serverURL(url:String):void {
_serverURL = url;
if (_nc.connected)
_nc.close();
_serverURL = url;
}
public function set serverApplication(app:String):void {
_serverApplication = app;
if (_nc.connected)
_nc.close();
_serverApplication = app;
}
public function start():void {
connect();
}
private function connect():void {
nc = new NetConnection();
nc.objectEncoding = flash.net.ObjectEncoding.AMF0;
nc.proxyType = "best";
nc.client = this;
nc.addEventListener(NetStatusEvent.NET_STATUS, onStatus);
nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR, onAsyncError);
nc.connect("rtmp://" + _serverURL + "/" + _serverApplication);
if (!_nc.connected && !_connecting) {
_nc.connect("rtmp://" + _serverURL + "/" + _serverApplication);
_connecting = true;
}
}
private function onAsyncError(event:AsyncErrorEvent):void
{
LogUtil.debug(event.error.toString());
public function checkClientToServer():void {
if (_lastClientToServerCheck != null && _lastClientToServerCheck.getTime() + INTERVAL_BETWEEN_CHECKS > new Date().getTime())
return;
if (!_nc.connected) {
_pendingClientToServer = true;
connect();
} if (_runningMeasurement) {
_pendingClientToServer = true;
} else {
_pendingClientToServer = false;
_runningMeasurement = true;
_lastClientToServerCheck = new Date();
LogUtil.debug("Start client-server bandwidth detection");
var clientServer:ClientServerBandwidth = new ClientServerBandwidth();
clientServer.connection = _nc;
clientServer.service = _clientServerService;
clientServer.addEventListener(BandwidthDetectEvent.DETECT_COMPLETE,onClientServerComplete);
clientServer.addEventListener(BandwidthDetectEvent.DETECT_STATUS,onClientServerStatus);
clientServer.addEventListener(BandwidthDetectEvent.DETECT_FAILED,onDetectFailed);
clientServer.start();
}
}
public function checkServerToClient():void {
if (_lastServerToClientCheck != null && _lastServerToClientCheck.getTime() + INTERVAL_BETWEEN_CHECKS > new Date().getTime())
return;
if (!_nc.connected) {
_pendingServerToClient = true;
connect();
} if (_runningMeasurement) {
_pendingServerToClient = true;
} else {
_pendingServerToClient = false;
_runningMeasurement = true;
_lastServerToClientCheck = new Date();
LogUtil.debug("Start server-client bandwidth detection");
var serverClient:ServerClientBandwidth = new ServerClientBandwidth();
serverClient.connection = _nc;
serverClient.service = _serverClientService;
serverClient.addEventListener(BandwidthDetectEvent.DETECT_COMPLETE,onServerClientComplete);
serverClient.addEventListener(BandwidthDetectEvent.DETECT_STATUS,onServerClientStatus);
serverClient.addEventListener(BandwidthDetectEvent.DETECT_FAILED,onDetectFailed);
serverClient.start();
}
}
private function checkPendingOperations():void {
if (_pendingClientToServer) checkClientToServer();
if (_pendingServerToClient) checkServerToClient();
}
private function onAsyncError(event:AsyncErrorEvent):void {
LogUtil.debug(event.error.toString());
}
private function onIOError(event:IOErrorEvent):void {
LogUtil.debug(event.text);
}
private function onStatus(event:NetStatusEvent):void
@ -79,86 +174,47 @@ package org.bigbluebutton.core.services
{
case "NetConnection.Connect.Success":
LogUtil.debug("Starting to monitor bandwidth between client and server");
// monitor();
break;
default:
LogUtil.debug("Cannot establish the connection to measure bandwidth");
break;
}
}
_connecting = false;
checkPendingOperations();
}
private function monitor():void {
LogUtil.debug("Starting to monitor bandwidth");
bwTestTimer = new Timer(30000);
bwTestTimer.addEventListener(TimerEvent.TIMER, rtmptRetryTimerHandler);
bwTestTimer.start();
}
private function rtmptRetryTimerHandler(event:TimerEvent):void {
LogUtil.debug("Starting to detect bandwidth from server to client");
ServerClient();
}
public function ClientServer():void
{
var clientServer:ClientServerBandwidth = new ClientServerBandwidth();
//connect();
clientServer.connection = nc;
clientServer.service = _clientServerService;
clientServer.addEventListener(BandwidthDetectEvent.DETECT_COMPLETE,onClientServerComplete);
clientServer.addEventListener(BandwidthDetectEvent.DETECT_STATUS,onClientServerStatus);
clientServer.addEventListener(BandwidthDetectEvent.DETECT_FAILED,onDetectFailed);
clientServer.start();
}
public function ServerClient():void
{
var serverClient:ServerClientBandwidth = new ServerClientBandwidth();
//connect();
serverClient.connection = nc;
serverClient.service = _serverClientService;
serverClient.addEventListener(BandwidthDetectEvent.DETECT_COMPLETE,onServerClientComplete);
serverClient.addEventListener(BandwidthDetectEvent.DETECT_STATUS,onServerClientStatus);
serverClient.addEventListener(BandwidthDetectEvent.DETECT_FAILED,onDetectFailed);
serverClient.start();
}
public function onDetectFailed(event:BandwidthDetectEvent):void
{
public function onDetectFailed(event:BandwidthDetectEvent):void {
LogUtil.debug("Detection failed with error: " + event.info.application + " " + event.info.description);
_runningMeasurement = false;
}
public function onClientServerComplete(event:BandwidthDetectEvent):void
{
// LogUtil.debug("Client-slient bandwidth detect complete");
public function onClientServerComplete(event:BandwidthDetectEvent):void {
LogUtil.debug("Client-server bandwidth detection complete");
// LogUtil.debug(ObjectUtil.toString(event.info));
NetworkStatsData.getInstance().setUploadMeasuredBW(event.info);
_runningMeasurement = false;
checkPendingOperations();
}
public function onClientServerStatus(event:BandwidthDetectEvent):void
{
if (event.info) {
public function onClientServerStatus(event:BandwidthDetectEvent):void {
// if (event.info) {
// LogUtil.debug("\n count: "+event.info.count+ " sent: "+event.info.sent+" timePassed: "+event.info.timePassed+" latency: "+event.info.latency+" overhead: "+event.info.overhead+" packet interval: " + event.info.pakInterval + " cumLatency: " + event.info.cumLatency);
}
// }
}
public function onServerClientComplete(event:BandwidthDetectEvent):void
{
// LogUtil.debug("Server-client bandwidth detect complete");
public function onServerClientComplete(event:BandwidthDetectEvent):void {
LogUtil.debug("Server-client bandwidth detection complete");
// LogUtil.debug(ObjectUtil.toString(event.info));
NetworkStatsData.getInstance().setDownloadMeasuredBW(event.info);
// LogUtil.debug("Detecting Client Server Bandwidth");
ClientServer();
_runningMeasurement = false;
checkPendingOperations();
}
public function onServerClientStatus(event:BandwidthDetectEvent):void
{
if (event.info) {
public function onServerClientStatus(event:BandwidthDetectEvent):void {
// if (event.info) {
// LogUtil.debug("\n count: "+event.info.count+ " sent: "+event.info.sent+" timePassed: "+event.info.timePassed+" latency: "+event.info.latency+" cumLatency: " + event.info.cumLatency);
}
// }
}
}
}
class SingletonEnforcer{}

View File

@ -130,6 +130,9 @@ package org.bigbluebutton.core.services
var download:Dictionary = new Dictionary();
var upload:Dictionary = new Dictionary();
download["byteCount"] = upload["byteCount"]
= download["currentBytesPerSecond"] = upload["currentBytesPerSecond"] = 0;
for (var i:int = 0; i < streams.length; i++) {
if (streams[i] == null || streams[i].info == null) {
@ -137,13 +140,13 @@ package org.bigbluebutton.core.services
continue;
}
// log("Heartbeat on " + streams[i].info);
//log("Heartbeat on " + streams[i].info);
var remote:Boolean = isRemoteStream(streams[i]);
var ref:Dictionary = (remote? download: upload);
if (streams[i].info.uri == null) {
log("Stream URI is null, returning");
//log("Stream URI is null, returning");
continue;
}
var uri:String = streams[i].info.uri.toLowerCase();
@ -174,7 +177,7 @@ package org.bigbluebutton.core.services
var property:String = s.@name;
var num:Number = 0;
if (ref.hasOwnProperty(property))
num = ref[property] as Number;
num = (ref[property] as Number);
num += (streams[i].info[property] as Number);
ref[property] = num;
}
@ -206,11 +209,6 @@ package org.bigbluebutton.core.services
//log(value.streamName + ": " + value.byteCount);
}
// var netstatsEvent:NetworkStatsEvent = new NetworkStatsEvent();
// netstatsEvent.downloadStats = download;
// netstatsEvent.uploadStats = upload;
// _globalDispatcher.dispatchEvent(netstatsEvent);
NetworkStatsData.getInstance().updateConsumedBW(download["currentBytesPerSecond"],
upload["currentBytesPerSecond"],
download["byteCount"],
@ -224,8 +222,7 @@ package org.bigbluebutton.core.services
}
private function log(s:String):void {
//LogUtil.debug("[StreamMonitor] " + s);
trace("[StreamMonitor] " + s);
LogUtil.debug("[StreamMonitor] " + s);
}
}
}

View File

@ -20,7 +20,7 @@ package org.bigbluebutton.main.events
{
import flash.events.Event;
import flash.utils.Dictionary;
public class NetworkStatsEvent extends Event
{
public static const NETWORK_STATS_EVENTS:String = "NETWORK_STATS_EVENTS";

View File

@ -30,10 +30,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
-->
<ObjectBuilder generator="{ModulesProxy}" cache="global" />
<ObjectBuilder generator="{ConfigManager}" cache="global" />
<!--
Disabling temporarily the stream monitor
-->
<!--ObjectBuilder generator="{StreamMonitor}" cache="global" /-->
<ObjectBuilder generator="{StreamMonitor}" cache="global" />
</EventHandlers>
<EventHandlers type="{PortTestEvent.TEST_RTMP}" >

View File

@ -21,6 +21,8 @@ package org.bigbluebutton.main.model
import com.asfusion.mate.events.Dispatcher;
import mx.formatters.NumberFormatter;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.main.events.NetworkStatsEvent;
@ -31,12 +33,15 @@ package org.bigbluebutton.main.model
private static var _instance:NetworkStatsData = null;
private var _currentConsumedDownBW:Number = 0; // Kb
private var _currentConsumedUpBW:Number = 0; // Kb
private var _totalConsumedDownBW:Number = 0; // MB
private var _totalConsumedUpBW:Number = 0; // MB
private var _measuredDownBW:int = 0; // Mb
private var _totalConsumedDownBW:Number = 0; // KB
private var _totalConsumedUpBW:Number = 0; // KB
private var _measuredDownBWCheck:Boolean = false;
private var _measuredDownBW:Number = 0; // Kb
private var _measuredDownLatency:int = 0; // ms
private var _measuredUpBW:int = 0; // Mb
private var _measuredUpBWCheck:Boolean = false;
private var _measuredUpBW:Number = 0; // Kb
private var _measuredUpLatency:int = 0; // ms
private var _numberFormatter:NumberFormatter = new NumberFormatter();
/**
* This class is a singleton. Please initialize it using the getInstance() method.
@ -49,6 +54,8 @@ package org.bigbluebutton.main.model
}
private function initialize():void {
_numberFormatter.precision = 1;
_numberFormatter.useThousandsSeparator = true;
}
/**
@ -63,10 +70,10 @@ package org.bigbluebutton.main.model
// all the numbers are in bytes
public function updateConsumedBW(down:Number, up:Number, downTotal:Number, upTotal:Number):void {
_currentConsumedDownBW = (down * 8)/1024;
_currentConsumedUpBW = (up * 8)/1024;
_totalConsumedDownBW = downTotal / 1048576;
_totalConsumedUpBW = upTotal / 1048576;
_currentConsumedDownBW = (down * 8) / 1024;
_currentConsumedUpBW = (up * 8) / 1024;
_totalConsumedDownBW = downTotal / 1024;
_totalConsumedUpBW = upTotal / 1024;
}
/*
@ -77,7 +84,8 @@ package org.bigbluebutton.main.model
[latency] 10
*/
public function setDownloadMeasuredBW(info:Object):void {
_measuredDownBW = info["kbitDown"] / 1000;
_measuredDownBWCheck = true;
_measuredDownBW = info["kbitDown"];
_measuredDownLatency = info["latency"];
}
@ -90,40 +98,84 @@ package org.bigbluebutton.main.model
latency = 11
*/
public function setUploadMeasuredBW(info:Object):void {
_measuredUpBW = info.kbitUp / 1000;
_measuredUpBWCheck = true;
_measuredUpBW = info.kbitUp;
_measuredUpLatency = info.latency;
}
public function get currentConsumedDownBW():Number {
return _currentConsumedDownBW;
private function format_KB(n:Number):String {
var unit:String = "KB";
if (n >= 1073741824) {
unit = "TB";
n /= 1073741824;
} else if (n >= 1048576) {
unit = "GB";
n /= 1048576;
} else if (n >= 1024) {
unit = "MB";
n /= 1024;
}
return _numberFormatter.format(n) + " " + unit;
}
private function format_Kbps(n:Number):String {
var unit:String = "Kbps";
if (n >= 1000000000) {
unit = "Tbps";
n /= 1000000000;
} else if (n >= 1000000) {
unit = "Gbps";
n /= 1000000;
} else if (n >= 1000) {
unit = "Mbps";
n /= 1000;
}
return _numberFormatter.format(n) + " " + unit;
}
public function get formattedCurrentConsumedDownBW():String {
return format_Kbps(_currentConsumedDownBW);
}
public function get currentConsumedUpBW():Number {
return _currentConsumedUpBW;
public function get formattedCurrentConsumedUpBW():String {
return format_Kbps(_currentConsumedUpBW);
}
public function get totalConsumedDownBW():Number {
return _totalConsumedDownBW;
public function get formattedTotalConsumedDownBW():String {
return format_KB(_totalConsumedDownBW);
}
public function get totalConsumedUpBW():Number {
return _totalConsumedUpBW;
public function get formattedTotalConsumedUpBW():String {
return format_KB(_totalConsumedUpBW);
}
public function get measuredDownBW():int {
return _measuredDownBW;
public function get formattedMeasuredDownBW():String {
if (_measuredDownBWCheck)
return format_Kbps(_measuredDownBW);
else
return "-";
}
public function get measuredDownLatency():int {
return _measuredDownLatency;
public function get formattedMeasuredDownLatency():String {
if (_measuredDownBWCheck)
return _measuredDownLatency + " ms";
else
return "-";
}
public function get measuredUpBW():int {
return _measuredUpBW;
public function get formattedMeasuredUpBW():String {
if (_measuredUpBWCheck)
return format_Kbps(_measuredUpBW);
else
return "-";
}
public function get measuredUpLatency():int {
return _measuredUpLatency;
public function get formattedMeasuredUpLatency():String {
if (_measuredUpBWCheck)
return _measuredUpLatency + " ms";
else
return "-";
}
}
}

View File

@ -72,11 +72,14 @@ package org.bigbluebutton.main.model.users
_netConnection.addEventListener( IOErrorEvent.IO_ERROR, netIOError );
}
public function setUri(uri:String):void {
_applicationURI = uri;
}
public function setUri(uri:String):void {
_applicationURI = uri;
var pattern:RegExp = /(?P<protocol>.+):\/\/(?P<server>.+)\/(?P<app>.+)/;
var result:Array = pattern.exec(uri);
BandwidthMonitor.getInstance().serverURL = result.server;
}
public function get connection():NetConnection {
return _netConnection;
}
@ -246,19 +249,8 @@ package org.bigbluebutton.main.model.users
handleResult( event );
}
private var _bwMon:BandwidthMonitor = new BandwidthMonitor();
private function startMonitoringBandwidth():void {
trace("Start monitoring bandwidth.");
var pattern:RegExp = /(?P<protocol>.+):\/\/(?P<server>.+)\/(?P<app>.+)/;
var result:Array = pattern.exec(_applicationURI);
_bwMon.serverURL = result.server;
_bwMon.serverApplication = "video";
_bwMon.start();
}
private var autoReconnectTimer:Timer = new Timer(1000, 1);
private var autoReconnectTimer:Timer = new Timer(1000, 1);
public function handleResult(event:Object):void {
var info : Object = event.info;
var statusCode : String = info.code;
@ -266,11 +258,8 @@ package org.bigbluebutton.main.model.users
switch (statusCode) {
case "NetConnection.Connect.Success":
trace(LOG + ":Connection to viewers application succeeded.");
// uncomment this to turn on the bandwidth check
// startMonitoringBandwidth();
validateToken();
break;
case "NetConnection.Connect.Failed":

View File

@ -100,6 +100,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.main.events.SuccessfulLoginEvent;
import org.bigbluebutton.main.model.LayoutOptions;
import org.bigbluebutton.main.model.users.Conference;
import org.bigbluebutton.main.model.NetworkStatsData;
import org.bigbluebutton.main.model.users.events.ConnectionFailedEvent;
import org.bigbluebutton.modules.phone.events.AudioSelectionWindowEvent;
import org.bigbluebutton.modules.phone.events.FlashMicSettingsEvent;
@ -154,6 +155,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
[Bindable] private var isTunneling:Boolean = false;
[Bindable] private var _bandwidthConsumedUp:String = "-";
[Bindable] private var _bandwidthConsumedDown:String = "-";
private var _updateBandwidthTimer:Timer = new Timer(1000);
private var confirmingLogout:Boolean = false;
public function initOptions(e:Event):void {
@ -175,6 +179,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
if (!showFooterOpt) {
footerHeight = 0;
}
_updateBandwidthTimer.addEventListener(TimerEvent.TIMER, updateBandwidthTimerHandler);
_updateBandwidthTimer.start();
}
protected function initializeShell():void {
@ -526,24 +533,21 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
addedBtns.removeChild(event.button as UIComponent);
}
private var networkStatsWindow:NetworkStatsWindow = new NetworkStatsWindow();
private var networkStatsWindow:NetworkStatsWindow = null;
private function openNetworkStatsWindow(e:Event = null):void {
/*var btnPosition:Point = new Point(btnNetwork.x, btnNetwork.y);
var btnPositionOnGlobal:Point = btnNetwork.localToGlobal(btnPosition);
var windowPosition:Point = networkStatsWindow.globalToLocal(btnPositionOnGlobal);
windowPosition.x += btnNetwork.width + 10;
windowPosition.y -= networkStatsWindow.height - 10;
private function openNetworkStatsWindow():void {
if (networkStatsWindow == null) {
networkStatsWindow = new NetworkStatsWindow();
}
networkStatsWindow.x = windowPosition.x;
networkStatsWindow.y = windowPosition.y;*/
networkStatsWindow.appear();
mdiCanvas.windowManager.add(networkStatsWindow);
mdiCanvas.windowManager.absPos(networkStatsWindow, mdiCanvas.width - networkStatsWindow.width, mdiCanvas.height - networkStatsWindow.height);
mdiCanvas.windowManager.bringToFront(networkStatsWindow);
}
private function closeNetworkStatsWindow(e:Event = null):void {
networkStatsWindow.disappear();
private function updateBandwidthTimerHandler(e:TimerEvent):void {
_bandwidthConsumedDown = NetworkStatsData.getInstance().formattedCurrentConsumedDownBW;
_bandwidthConsumedUp = NetworkStatsData.getInstance().formattedCurrentConsumedUpBW;
}
private function openLockSettingsWindow(event:LockControlEvent):void {
@ -620,6 +624,17 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
icon="{logs_icon}"
click="openLogWindow()"
tabIndex="{baseIndex}"/>
<mx:Label
text="[{ResourceUtil.getInstance().getString('bbb.bwmonitor.upload.short')}: {_bandwidthConsumedUp} | {ResourceUtil.getInstance().getString('bbb.bwmonitor.download.short')}: {_bandwidthConsumedDown}]"
id="lblNetworkStats"
visible="{layoutOptions.showNetworkMonitor}" />
<mx:Button
id="btnNetwork"
icon="{statsIcon}"
width="20"
height="20"
click="openNetworkStatsWindow()"
visible="{layoutOptions.showNetworkMonitor}" />
<mx:HBox id="addedBtns" />
</mx:ControlBar>
</mx:VBox>

View File

@ -23,14 +23,13 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<MDIWindow xmlns="flexlib.mdi.containers.*"
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:mate="http://mate.asfusion.com/"
title="Network monitor"
title="{ResourceUtil.getInstance().getString('bbb.bwmonitor.title')}"
creationComplete="onCreationComplete()"
resizable="false"
showCloseButton="false"
showCloseButton="true"
implements="org.bigbluebutton.common.IBbbModuleWindow"
width="210" height="261" minHeight="0" minWidth="0"
width="210" minWidth="0"
resize="onResize()">
<mx:Script>
<![CDATA[
@ -40,41 +39,43 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.common.events.CloseWindowEvent;
import org.bigbluebutton.common.events.OpenWindowEvent;
import org.bigbluebutton.common.Images;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.core.services.BandwidthMonitor;
import org.bigbluebutton.main.model.NetworkStatsData;
import org.bigbluebutton.util.i18n.ResourceUtil;
import mx.core.IFlexDisplayObject;
import mx.effects.Fade;
import mx.events.EffectEvent;
import mx.formatters.NumberFormatter;
import mx.managers.PopUpManager;
private var _globalDispatcher:Dispatcher = new Dispatcher();
private var _updateTimer:Timer = new Timer(1000);
private var _numberFormatter:NumberFormatter = new NumberFormatter();
private var _images:Images = new Images();
[Bindable] private var _refreshIcon:Class = _images.refreshSmall;
private function onCreationComplete():void {
this.windowControls.maximizeRestoreBtn.visible = false;
this.windowControls.minimizeBtn.visible = false;
this.x = parent.width - this.width;
this.y = parent.height - this.height;
_numberFormatter.precision = 2;
_numberFormatter.useThousandsSeparator = true;
_updateTimer.addEventListener(TimerEvent.TIMER, timerHandler);
_updateTimer.start();
height = panel.measuredHeight + borderMetrics.top + borderMetrics.bottom;
}
private function timerHandler(e:TimerEvent):void {
labelCurrentDownload.text = _numberFormatter.format(NetworkStatsData.getInstance().currentConsumedDownBW);
labelTotalDownload.text = _numberFormatter.format(NetworkStatsData.getInstance().totalConsumedDownBW);
labelAvailableDownload.text = _numberFormatter.format(NetworkStatsData.getInstance().measuredDownBW);
labelDownloadLatency.text = String(NetworkStatsData.getInstance().measuredDownLatency);
labelCurrentDownload.text = NetworkStatsData.getInstance().formattedCurrentConsumedDownBW;
labelTotalDownload.text = NetworkStatsData.getInstance().formattedTotalConsumedDownBW;
labelAvailableDownload.text = NetworkStatsData.getInstance().formattedMeasuredDownBW;
labelDownloadLatency.text = NetworkStatsData.getInstance().formattedMeasuredDownLatency;
labelCurrentUpload.text = _numberFormatter.format(NetworkStatsData.getInstance().currentConsumedUpBW);
labelTotalUpload.text = _numberFormatter.format(NetworkStatsData.getInstance().totalConsumedUpBW);
labelAvailableUpload.text = _numberFormatter.format(NetworkStatsData.getInstance().measuredUpBW);
labelUploadLatency.text = String(NetworkStatsData.getInstance().measuredUpLatency);
labelCurrentUpload.text = NetworkStatsData.getInstance().formattedCurrentConsumedUpBW;
labelTotalUpload.text = NetworkStatsData.getInstance().formattedTotalConsumedUpBW;
labelAvailableUpload.text = NetworkStatsData.getInstance().formattedMeasuredUpBW;
labelUploadLatency.text = NetworkStatsData.getInstance().formattedMeasuredUpLatency;
}
public function getPrefferedPosition():String {
@ -82,57 +83,32 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
private function onResize():void {
LogUtil.debug("width=" + width + " height=" + height);
//LogUtil.debug("width=" + width + " height=" + height);
}
public function appear():void {
var fader:Fade = new Fade();
fader.alphaFrom = 0;
fader.alphaTo = 1;
fader.duration = 500;
fader.target = this;
// fader.addEventListener(EffectEvent.EFFECT_START, function(e:EffectEvent):void {
// var windowEvent:OpenWindowEvent = new OpenWindowEvent(OpenWindowEvent.OPEN_WINDOW_EVENT);
// windowEvent.window = e.currentTarget as IBbbModuleWindow;
// _globalDispatcher.dispatchEvent(windowEvent);
// });
fader.play();
var windowEvent:OpenWindowEvent = new OpenWindowEvent(OpenWindowEvent.OPEN_WINDOW_EVENT);
windowEvent.window = this;
_globalDispatcher.dispatchEvent(windowEvent);
this.windowManager.bringToFront(this);
}
public function disappear():void {
var fader:Fade = new Fade();
fader.alphaFrom = 1;
fader.alphaTo = 0;
fader.duration = 500;
fader.target = this;
fader.addEventListener(EffectEvent.EFFECT_END, function(e:EffectEvent):void {
var windowEvent:CloseWindowEvent = new CloseWindowEvent(CloseWindowEvent.CLOSE_WINDOW_EVENT);
windowEvent.window = e.target as IBbbModuleWindow;
_globalDispatcher.dispatchEvent(windowEvent);
});
fader.play();
private function runBandwidthMeasurement():void {
BandwidthMonitor.getInstance().checkClientToServer();
BandwidthMonitor.getInstance().checkServerToClient();
}
]]>
</mx:Script>
<mx:Panel width="100%" height="100%"
<mx:Panel id="panel" width="100%"
paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10" headerHeight="10">
<mx:VBox verticalGap="0" width="100%" height="100%">
<mx:HBox backgroundColor="haloOrange" width="100%" horizontalAlign="center"><mx:Label fontWeight="bold" text="Upload"/></mx:HBox>
<mx:HBox horizontalGap="0"><mx:Label text="Total: "/><mx:Label id="labelTotalUpload" fontWeight="bold" text="-"/><mx:Label text="MB"/></mx:HBox>
<mx:HBox horizontalGap="0"><mx:Label text="Current: "/><mx:Label id="labelCurrentUpload" fontWeight="bold" text="-"/><mx:Label text="Kb/s"/></mx:HBox>
<mx:HBox horizontalGap="0"><mx:Label text="Available: "/><mx:Label id="labelAvailableUpload" fontWeight="bold" text="-"/><mx:Label text="Mb/s"/></mx:HBox>
<mx:HBox horizontalGap="0"><mx:Label text="Latency: "/><mx:Label id="labelUploadLatency" fontWeight="bold" text="-"/><mx:Label text="ms"/></mx:HBox>
<mx:HBox backgroundColor="haloOrange" width="100%" horizontalAlign="center"><mx:Label fontWeight="bold" text="Download"/></mx:HBox>
<mx:HBox horizontalGap="0"><mx:Label text="Total: "/><mx:Label id="labelTotalDownload" fontWeight="bold" text="-"/><mx:Label text="MB"/></mx:HBox>
<mx:HBox horizontalGap="0"><mx:Label text="Current: "/><mx:Label id="labelCurrentDownload" fontWeight="bold" text="-"/><mx:Label text="Kb/s"/></mx:HBox>
<mx:HBox horizontalGap="0"><mx:Label text="Available: "/><mx:Label id="labelAvailableDownload" fontWeight="bold" text="-"/><mx:Label text="Mb/s"/></mx:HBox>
<mx:HBox horizontalGap="0"><mx:Label text="Latency: "/><mx:Label id="labelDownloadLatency" fontWeight="bold" text="-"/><mx:Label text="ms"/></mx:HBox>
<mx:HBox backgroundColor="haloOrange" width="100%" horizontalAlign="center"><mx:Label fontWeight="bold" text="{ResourceUtil.getInstance().getString('bbb.bwmonitor.upload')}"/></mx:HBox>
<mx:HBox visible="false" includeInLayout="false" horizontalGap="0"><mx:Label text="{ResourceUtil.getInstance().getString('bbb.bwmonitor.total')}: "/><mx:Label id="labelTotalUpload" fontWeight="bold" text="-"/></mx:HBox>
<mx:HBox horizontalGap="0"><mx:Label text="{ResourceUtil.getInstance().getString('bbb.bwmonitor.current')}: "/><mx:Label id="labelCurrentUpload" fontWeight="bold" text="-"/></mx:HBox>
<mx:HBox visible="false" includeInLayout="false" horizontalGap="0"><mx:Label text="{ResourceUtil.getInstance().getString('bbb.bwmonitor.available')}: "/><mx:Label id="labelAvailableUpload" fontWeight="bold" text="-"/></mx:HBox>
<mx:HBox horizontalGap="0"><mx:Label text="{ResourceUtil.getInstance().getString('bbb.bwmonitor.latency')}: "/><mx:Label id="labelUploadLatency" fontWeight="bold" text="-"/></mx:HBox>
<mx:HBox backgroundColor="haloOrange" width="100%" horizontalAlign="center"><mx:Label fontWeight="bold" text="{ResourceUtil.getInstance().getString('bbb.bwmonitor.download')}"/></mx:HBox>
<mx:HBox visible="false" includeInLayout="false" horizontalGap="0"><mx:Label text="{ResourceUtil.getInstance().getString('bbb.bwmonitor.total')}: "/><mx:Label id="labelTotalDownload" fontWeight="bold" text="-"/></mx:HBox>
<mx:HBox horizontalGap="0"><mx:Label text="{ResourceUtil.getInstance().getString('bbb.bwmonitor.current')}: "/><mx:Label id="labelCurrentDownload" fontWeight="bold" text="-"/></mx:HBox>
<mx:HBox visible="false" includeInLayout="false" horizontalGap="0"><mx:Label text="{ResourceUtil.getInstance().getString('bbb.bwmonitor.available')}: "/><mx:Label id="labelAvailableDownload" fontWeight="bold" text="-"/></mx:HBox>
<mx:HBox horizontalGap="0"><mx:Label text="{ResourceUtil.getInstance().getString('bbb.bwmonitor.latency')}: "/><mx:Label id="labelDownloadLatency" fontWeight="bold" text="-"/></mx:HBox>
<mx:HBox horizontalGap="0" width="100%" ><mx:Spacer width="100%"/><mx:Button id="labelRefresh" icon="{_refreshIcon}" width="16" height="16" click="runBandwidthMeasurement()" /></mx:HBox>
</mx:VBox>
</mx:Panel>

View File

@ -139,5 +139,15 @@ package org.red5.flash.bwcheck
break;
}
}
public function onBWCheck(obj:Object):void
{
// dispatchStatus(obj);
}
public function onBWDone(obj:Object):void
{
// dispatchComplete(obj);
}
}
}