using a bigger image for the download test; providing immediate feedback about the download speed for the user, with incremental changes; reduced the precision of the ping test; set the mail button to open the client e-mail on a blank page

This commit is contained in:
Felipe Cecagno 2014-11-14 14:29:05 -02:00
parent 8c2908b1b2
commit 89d79201c9
5 changed files with 136 additions and 113 deletions

View File

@ -9,7 +9,11 @@
value="${basedir}"/>
<property name="SRC_DIR"
value="${BASE_DIR}/src"/>
<property name="TEST_IMAGE_URL" value="http://upload.wikimedia.org/wikipedia/commons/a/a2/Polycyclic_Aromatic_Hydrocarbons_In_Space.jpg" />
<property name="TEST_IMAGE_URL" value="http://upload.wikimedia.org/wikipedia/commons/0/0a/Keswick,_Cumbria_Panorama_1_-_June_2009.jpg" />
<property name="OUTPUT_DIR"
value="check"/>
<property name="TEST_IMAGE_PATH"
value="${OUTPUT_DIR}/test_image.jpg"/>
<taskdef resource="flexTasks.tasks"
classpath="${FLEX_HOME}/ant/lib/flexTasks.jar"/>
<macrodef name="create-rsl">
@ -91,7 +95,7 @@
</mxmlc>
<antcall target="Resolve-Dependency">
<param name="html.output"
value="check"/>
value="${OUTPUT_DIR}"/>
</antcall>
</target>
<target name="Build-Release">
@ -117,26 +121,28 @@
</copy>
</target>
<target name="build"
depends="Create-Config, Extract-rsls, Build-Release"
depends="gen-config-xml, Extract-rsls, Build-Release"
description="Launcher for building whole release process"/>
<target name="Get-IP">
<target name="get-local-ip">
<exec executable="bash" outputproperty="IP">
<arg value="-c"/>
<arg value="ifconfig | grep -v '127.0.0.1' | grep -E '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*' | tail -1 | cut -d: -f2 | awk '{ print $1}'"/>
</exec>
</target>
<target name="Init" depends="Get-IP">
<target name="init">
<available file="conf/config.xml" property="config.xml.exists" />
<available file="${TEST_IMAGE_PATH}" property="test_image.exists" />
</target>
<target name="Create-Config" depends="Init" unless="${config.xml.exists}">
<target name="gen-config-xml" depends="init, get-local-ip" unless="${config.xml.exists}">
<copy file="resources/config.xml.template" tofile="conf/config.xml" />
<exec executable="sed">
<arg value="-i"/>
<arg value="s:HOST:${IP}:g"/>
<arg value="conf/config.xml"/>
</exec>
<echo message="config.xml generated" />
</target>
</project>

View File

@ -1,25 +1,26 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2014 BigBlueButton Inc. and by respective authors (see below).
*
* This program is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 3.0 of the License, or (at your option) any later
* version.
*
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2014 BigBlueButton Inc. and by respective authors (see below).
*
* This program is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 3.0 of the License, or (at your option) any later
* version.
*
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
*
*/
package org.bigbluebutton.clientcheck.command
{
import flash.net.URLRequest;
import flash.utils.getTimer;
import mx.core.FlexGlobals;
import mx.utils.URLUtil;
@ -60,7 +61,7 @@ package org.bigbluebutton.clientcheck.command
var protocol:String=URLUtil.getProtocol(swfPath);
systemConfiguration.serverName=URLUtil.getServerNameWithPort(swfPath);
return protocol + "://" + systemConfiguration.serverName + "/" + CONFIG_XML;
return protocol + "://" + systemConfiguration.serverName + "/" + CONFIG_XML + "?t=" + getTimer().toString();
}
private function fail(reason:String):void

View File

@ -1,32 +1,34 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2014 BigBlueButton Inc. and by respective authors (see below).
*
* This program is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 3.0 of the License, or (at your option) any later
* version.
*
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2014 BigBlueButton Inc. and by respective authors (see below).
*
* This program is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 3.0 of the License, or (at your option) any later
* version.
*
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
*
*/
package org.bigbluebutton.clientcheck.service
{
import flash.display.Loader;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.ProgressEvent;
import flash.events.TimerEvent;
import flash.net.URLRequest;
import flash.system.ApplicationDomain;
import flash.system.LoaderContext;
import flash.utils.getTimer;
import flash.utils.Timer;
import mx.formatters.NumberBaseRoundType;
import mx.formatters.NumberFormatter;
@ -38,82 +40,96 @@ package org.bigbluebutton.clientcheck.service
[Inject]
public var systemConfiguration:ISystemConfiguration;
private static var NUM_OF_TESTS:Number=5;
private static var BYTES_IN_MBIT:Number=131072;
private static const NUM_OF_SECONDS:Number = 10;
private static const BYTES_IN_MBIT:Number=Math.pow(2, 17);
private static const BYTES_IN_MBYTE:Number=Math.pow(2, 20);
private var _imageLoader:Loader;
private static var _initiated:Boolean;
private var _initiated:Boolean = false;
private var _loading:Boolean = false;
private var _ignoreBytes:int = 0;
private var _startTime:int;
private var _endTime:int;
private var _timer:Timer;
private var _secondsCounter:int = 0;
public function init():void
{
_initiated=false;
_timer = new Timer(1000, NUM_OF_SECONDS);
_timer.addEventListener(TimerEvent.TIMER, onTimerListener)
_timer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerCompleted);
_timer.reset();
_timer.start();
_imageLoader=new Loader;
_imageLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, contentLoaderProgressHandler);
_imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, contentLoaderCompleteHandler, false, 0, true);
_imageLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, contentLoaderIoErrorHandler, false, 0, true);
_imageLoader.load(new URLRequest(systemConfiguration.downloadFilePath + "?t=" + Math.random().toString()));
_loading = true;
_imageLoader.load(new URLRequest(systemConfiguration.downloadFilePath + "?t=" + getTimer().toString()));
}
protected function onTimerListener(event:TimerEvent):void {
step();
}
protected function step():void {
if (_initiated) {
_secondsCounter = Math.min(_secondsCounter + 1, NUM_OF_SECONDS);
updateData(_secondsCounter == NUM_OF_SECONDS);
}
}
protected function updateData(lastUpdate:Boolean = false):void {
var now:int = getTimer();
var duration:Number = ((now - _startTime) / 1000)
var loadedSoFar:int = _imageLoader.contentLoaderInfo.bytesLoaded - _ignoreBytes;
var loadedInMB:Number = loadedSoFar / BYTES_IN_MBYTE;
var loadedInMb:Number = loadedSoFar / BYTES_IN_MBIT;
var speed:Number = loadedInMb / duration;
var dataFormatter:NumberFormatter=new NumberFormatter();
dataFormatter.precision=3;
dataFormatter.rounding=NumberBaseRoundType.NEAREST;
var msg:String;
if (lastUpdate) {
msg = dataFormatter.format(speed) + " Mbps (" + dataFormatter.format(loadedInMB) + " MB in " + _secondsCounter + " seconds)";
} else {
msg = dataFormatter.format(speed) + " Mbps (" + dataFormatter.format(loadedInMB) + " MB, " + (NUM_OF_SECONDS - _secondsCounter) + " seconds remaining)";
}
systemConfiguration.downloadBandwidthTest.testResult=msg;
systemConfiguration.downloadBandwidthTest.testSuccessfull=true;
}
protected function onTimerCompleted(event:TimerEvent):void {
_imageLoader.close();
step();
}
protected function contentLoaderProgressHandler(event:ProgressEvent):void
{
if (!_initiated)
{
systemConfiguration.downloadBandwidthTest.startTime=getTimer();
_startTime = getTimer();
_ignoreBytes = event.bytesLoaded;
_initiated=true;
}
}
protected function contentLoaderIoErrorHandler(event:IOErrorEvent):void
{
systemConfiguration.downloadBandwidthTest.testResult="undefined";
systemConfiguration.downloadBandwidthTest.testResult=event.text;
systemConfiguration.downloadBandwidthTest.testSuccessfull=false;
}
protected function contentLoaderCompleteHandler(event:Event):void
{
systemConfiguration.downloadBandwidthTest.endTime=getTimer();
// convert to seconds
var totalDownloadTime:Number=((systemConfiguration.downloadBandwidthTest.endTime - systemConfiguration.downloadBandwidthTest.startTime) / 1000);
// convert to megabits
var totalMB:Number=(event.currentTarget.bytesLoaded / BYTES_IN_MBIT);
// calculate download speed
var downloadSpeed:Number=totalMB / totalDownloadTime;
// add to array of test results, as we want to continiously make certain amount of tests and then get the range value
systemConfiguration.downloadBandwidthTest.testResultArray.push(downloadSpeed);
if (systemConfiguration.downloadBandwidthTest.testResultArray.length >= NUM_OF_TESTS)
{
calculateTestResult();
}
else
{
init();
}
}
private function calculateTestResult():void
{
var totalResult:Number=0;
for (var i:int=0; i < systemConfiguration.downloadBandwidthTest.testResultArray.length; i++)
{
totalResult+=systemConfiguration.downloadBandwidthTest.testResultArray[i];
}
var formatter:NumberFormatter=new NumberFormatter();
formatter.precision=3;
formatter.rounding=NumberBaseRoundType.NEAREST;
var result:String=formatter.format(totalResult / systemConfiguration.downloadBandwidthTest.testResultArray.length);
systemConfiguration.downloadBandwidthTest.testResult=result + " Mbps";
systemConfiguration.downloadBandwidthTest.testSuccessfull=true;
_timer.stop();
updateData(true);
}
}
}

View File

@ -1,22 +1,22 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2014 BigBlueButton Inc. and by respective authors (see below).
*
* This program is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 3.0 of the License, or (at your option) any later
* version.
*
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2014 BigBlueButton Inc. and by respective authors (see below).
*
* This program is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 3.0 of the License, or (at your option) any later
* version.
*
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
*
*/
package org.bigbluebutton.clientcheck.service
{
import flash.events.Event;
@ -95,7 +95,7 @@ package org.bigbluebutton.clientcheck.service
}
var formatter:NumberFormatter=new NumberFormatter();
formatter.precision=3;
formatter.precision=1;
formatter.rounding=NumberBaseRoundType.NEAREST;
var result:String=formatter.format(totalResult / systemConfiguration.pingTest.testResultArray.length);

View File

@ -60,7 +60,7 @@ package org.bigbluebutton.clientcheck.view.mainview
variables.body = dp.getAllDataAsString();
mailMsg.data = variables;
mailMsg.method = URLRequestMethod.GET;
navigateToURL(mailMsg, "_self");
navigateToURL(mailMsg, "_blank");
}
}
}