- display status messages on desktop sharing standalone

This commit is contained in:
Richard Alam 2013-01-31 17:13:32 +00:00
parent 7bb56a2542
commit cf880ab505
3 changed files with 89 additions and 51 deletions

View File

@ -38,8 +38,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import mx.containers.Canvas;
import mx.controls.Button;
import mx.controls.Image;
import mx.core.UIComponent;
import mx.controls.Label;
import mx.core.UIComponent;
import org.bigbluebutton.common.Images;
import org.bigbluebutton.modules.deskshare.events.AppletStartedEvent;
import org.bigbluebutton.modules.deskshare.events.CursorEvent;
@ -102,51 +102,58 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
navigateToURL(url, '_self');
}
private function onDeskshareConnectionEvent(event:ConnectionEvent):void {
private function onDeskshareConnectionEvent(event:ConnectionEvent):void {
var warningText:String;
switch(event.status) {
case ConnectionEvent.SUCCESS:
progressLabel.text = "Connecting to server successful.";
warningText = "Connecting to server successful.";
break;
case ConnectionEvent.FAILED:
progressLabel.text = "Connecting to server failed.";
warningText = "Connecting to server failed.";
break;
case ConnectionEvent.CLOSED:
progressLabel.text = "Connection to server closed.";
warningText = "Connection to server closed.";
break;
case ConnectionEvent.REJECTED:
progressLabel.text = "Connection to server rejected.";
warningText = "Connection to server rejected.";
break;
case ConnectionEvent.INVALIDAPP:
progressLabel.text = "Connecting to server failed. Invalid application.";
warningText = "Connecting to server failed. Invalid application.";
break;
case ConnectionEvent.APPSHUTDOWN:
progressLabel.text = "Connection to server failed. Server shutting down.";
warningText = "Connection to server failed. Server shutting down.";
break;
case ConnectionEvent.SECURITYERROR:
progressLabel.text = "Connecting to server failed. Security error.";
warningText = "Connecting to server failed. Security error.";
break;
case ConnectionEvent.DISCONNECTED:
progressLabel.text = "Connection to server disconnected.";
warningText = "Connection to server disconnected.";
break;
case ConnectionEvent.CONNECTING:
progressLabel.text = "Connecting to server.";
warningText = "Connecting to server.";
break;
case ConnectionEvent.CONNECTING_RETRY:
progressLabel.text = "Connecting to server. Retry [" + event.retryAttempts + "]";
warningText = "Connecting to server. Retry [" + event.retryAttempts + "]";
break;
case ConnectionEvent.CONNECTING_MAX_RETRY:
progressLabel.text = "Connecting to server. Max retry reached.";
warningText = "Connecting to server. Max retry reached. Giving up.";
break;
case ConnectionEvent.CHECK_FOR_DESKSHARE_STREAM:
warningText = "Checking if desktop is being shared.";
break;
case ConnectionEvent.FAIL_CHECK_FOR_DESKSHARE_STREAM:
warningText = "Failed to check if desktop is being shared.";
break;
case ConnectionEvent.NO_DESKSHARE_STREAM:
warningText = "No desktop is being shared.";
break;
}
showStatusText(warningText, true, "0x000000");
trace("DeskshareSA::Connecting to server.");
}
private function onConnectingToServerRetry(event:ConnectionEvent):void {
progressLabel.text = "Connecting to server timedout. Retrying.";
trace("DeskshareSA::Connecting to server timedout. Retrying.");
}
private function startVideo(connection:NetConnection, stream:String, videoWidth:Number, videoHeight:Number):void{
ns = new NetStream(connection);
@ -166,18 +173,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
trace("DeskshareSA::Determine how to display video = [" + videoWidth + "x" + videoHeight + "] display=[" + this.width + "x" + this.height + "]");
determineHowToDisplayVideo();
// calculateDisplayDimensions(video, videoHolder);
// videoHolder.addChild(video);
// videoHolder.addChild(cursor);
// videoHolder.addChild(cursorImg);
// centerVideo();
ns.play(stream);
this.stream = stream;
// vbox.addChild(videoHolder);
}
private function onMetaData(info:Object):void {
@ -197,12 +195,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private function onUpdateCursorEvent(event:CursorEvent):void {
if (cursor == null) return;
// cursor.x = ((event.x/video.videoWidth)) * videoHolder.width;
// cursor.y = ((event.y/video.videoHeight)) * videoHolder.height;
cursor.x = videoHolder.x + (event.x * (videoHolder.width / videoWidth));
cursor.y = videoHolder.y + (event.y * (videoHolder.height / videoHeight));
// cursor.visible = true;
cursorImg.visible = true;
// DO NOT compute the x and y coordinate and assign directly to the cursorImg
@ -230,7 +225,11 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
trace("DeskshareSA::NetStream.Play.UnpublishNotify for broadcast stream " + stream);
stopViewing();
break;
}
default :
break;
}
showStatusText(e.info.code, true, "0x000000");
}
//----------------------------
@ -239,10 +238,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
videoHolder.height = video.height = videoHeight;
videoHolder.x = video.x = (this.width - video.width) / 4;
videoHolder.y = video.y = (this.height - video.height) / 4;
// videoHolder.x = video.x = 0;
// videoHolder.y = video.y = 0;
trace("DeskshareSA::Center video = [" + video.width + "x" + video.height
+ "] display=[" + this.width + "x" + this.height + "]"
+ "loc=[" + videoHolder.x + "," + videoHolder.y + "]");
@ -251,7 +247,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
videoHolder.addChild(cursor);
videoHolder.addChild(cursorImg);
addChild(videoHolder);
showVideoHolder();
}
private function fitVideoToWindow():void {
@ -282,7 +278,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
videoHolder.addChild(cursor);
videoHolder.addChild(cursorImg);
addChild(videoHolder);
showVideoHolder();
}
private function fitToHeightAndAdjustWidthToMaintainAspectRatio():void {
@ -307,9 +303,13 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
videoHolder.addChild(cursor);
videoHolder.addChild(cursorImg);
addChild(videoHolder);
showVideoHolder();
}
private function showVideoHolder():void {
addChild(videoHolder);
}
private function determineHowToDisplayVideo():void {
// if (videoIsSmallerThanWindow()) {
// trace("Video is smaller than window. Centering.");
@ -318,13 +318,35 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
// trace("Video is greater than window. Scaling.");
// fitVideoToWindow();
// }
}
private var hideStatusTextTimer:Timer = null;
private function showStatusText(statusText:String, autoHide:Boolean=false, color:String="0xFF0000"):void {
if (hideStatusTextTimer != null)
hideStatusTextTimer.stop();
if (autoHide) {
hideStatusTextTimer = new Timer(3000, 1);
hideStatusTextTimer.addEventListener(TimerEvent.TIMER, hideStatusText);
hideStatusTextTimer.start();
}
// bring the label to front
setChildIndex(statusTextDisplay, getChildren().length - 1);
statusTextDisplay.text = statusText;
statusTextDisplay.setStyle("color", color);
statusTextDisplay.visible = true;
}
private function hideStatusText(e:TimerEvent):void {
statusTextDisplay.visible = false;
}
]]>
</mx:Script>
<mx:Image id="cursorImg" visible="false" source="@Embed('org/bigbluebutton/modules/deskshare/assets/images/cursor4.png')"/>
<!--
<mx:Canvas id="vbox" width="100%" height="100%" backgroundColor="blue"/>
-->
<mx:Label id="progressLabel" text="FOOOOOOO!!!!!" width="100%" height="30" x="100" y="100" color="red"/>
<mx:Fade id="dissolveOut" duration="1000" alphaFrom="1.0" alphaTo="0.0"/>
<mx:Fade id="dissolveIn" duration="1000" alphaFrom="0.0" alphaTo="1.0"/>
<mx:Text id="statusTextDisplay" width="100%" fontSize="14" fontWeight="bold" textAlign="center" y="{(this.height - statusTextDisplay.height) / 2}"
visible="false" selectable="false" hideEffect="{dissolveOut}" showEffect="{dissolveIn}"/>
</mx:Application>

View File

@ -20,20 +20,23 @@
package org.bigbluebutton.modules.deskshare.services.red5
{
import com.asfusion.mate.events.Dispatcher;
import flash.net.Responder;
import flash.net.SharedObject;
import flash.events.EventDispatcher;
import flash.events.NetStatusEvent;
import flash.events.SecurityErrorEvent;
import flash.events.TimerEvent;
import flash.net.NetConnection;
import flash.net.ObjectEncoding;
import flash.net.Responder;
import flash.net.SharedObject;
import flash.utils.Timer;
import org.bigbluebutton.modules.deskshare.events.AppletStartedEvent;
import org.bigbluebutton.modules.deskshare.events.CursorEvent;
import org.bigbluebutton.modules.deskshare.events.ViewStreamEvent;
import mx.events.MetadataEvent;
import mx.events.MetadataEvent;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.modules.deskshare.events.AppletStartedEvent;
import org.bigbluebutton.modules.deskshare.events.CursorEvent;
import org.bigbluebutton.modules.deskshare.events.ViewStreamEvent;
public class Connection {
@ -67,9 +70,15 @@ package org.bigbluebutton.modules.deskshare.services.red5
dispatcher.dispatchEvent(event);
} else {
trace("No deskshare stream being published");
var connEvent:ConnectionEvent = new ConnectionEvent();
connEvent.status = ConnectionEvent.NO_DESKSHARE_STREAM;
dispatcher.dispatchEvent(connEvent);
}
},
function(status:Object):void{
var checkFailedEvent:ConnectionEvent = new ConnectionEvent();
checkFailedEvent.status = ConnectionEvent.FAIL_CHECK_FOR_DESKSHARE_STREAM;
dispatcher.dispatchEvent(checkFailedEvent);
trace("Error while trying to call remote mathod on server");
}
);
@ -235,6 +244,10 @@ package org.bigbluebutton.modules.deskshare.services.red5
*/
private function checkIfStreamIsPublishing():void{
trace("checking if desk share stream is publishing");
var event:ConnectionEvent = new ConnectionEvent();
event.status = ConnectionEvent.CHECK_FOR_DESKSHARE_STREAM;
dispatcher.dispatchEvent(event);
nc.call("deskshare.checkIfStreamIsPublishing", responder);
}

View File

@ -35,6 +35,9 @@ package org.bigbluebutton.modules.deskshare.services.red5
public static const CONNECTING:String = "connection connecting";
public static const CONNECTING_RETRY:String = "connection retry";
public static const CONNECTING_MAX_RETRY:String = "connection max retry";
public static const CHECK_FOR_DESKSHARE_STREAM:String = "connection check deskshare publishing";
public static const NO_DESKSHARE_STREAM:String = "connection deskshare publishing";
public static const FAIL_CHECK_FOR_DESKSHARE_STREAM:String = "connection failed check deskshare publishing";
public var status:String = "";