Fixed issue 18 again. Please see if it works now

git-svn-id: http://bigbluebutton.googlecode.com/svn/trunk@563 af16638f-c34d-0410-8cfa-b39d5352b314
This commit is contained in:
Denis Zgonjanin 2008-10-13 08:14:05 +00:00
parent 6cf8e3d3af
commit d918d7df20
10 changed files with 96 additions and 22 deletions

View File

@ -31,13 +31,13 @@
<application path="BigBlueButton.mxml"/>
</applications>
<modules>
<module application="src/BigBlueButton.mxml" destPath="org/bigbluebutton/modules/presentation/presentation_module.swf" optimize="true" sourcePath="src/org/bigbluebutton/modules/presentation/presentation_module.mxml"/>
<module application="src/BigBlueButton.mxml" destPath="org/bigbluebutton/modules/whiteboard/whiteboard_module.swf" optimize="true" sourcePath="src/org/bigbluebutton/modules/whiteboard/whiteboard_module.mxml"/>
<module application="src/BigBlueButton.mxml" destPath="org/bigbluebutton/modules/voiceconference/voice_module.swf" optimize="true" sourcePath="src/org/bigbluebutton/modules/voiceconference/voice_module.mxml"/>
<module application="src/BigBlueButton.mxml" destPath="org/bigbluebutton/modules/chat/chat_module.swf" optimize="true" sourcePath="src/org/bigbluebutton/modules/chat/chat_module.mxml"/>
<module application="src/BigBlueButton.mxml" destPath="org/bigbluebutton/modules/video/video_module.swf" optimize="true" sourcePath="src/org/bigbluebutton/modules/video/video_module.mxml"/>
<module application="src/BigBlueButton.mxml" destPath="org/bigbluebutton/modules/playback/playback_module.swf" optimize="true" sourcePath="src/org/bigbluebutton/modules/playback/playback_module.mxml"/>
<module application="src/BigBlueButton.mxml" destPath="org/bigbluebutton/modules/sample_module/sample_module.swf" optimize="true" sourcePath="src/org/bigbluebutton/modules/sample_module/sample_module.mxml"/>
<module application="src/BigBlueButton.mxml" destPath="org/bigbluebutton/modules/video/video_module.swf" optimize="true" sourcePath="src/org/bigbluebutton/modules/video/video_module.mxml"/>
<module application="src/BigBlueButton.mxml" destPath="org/bigbluebutton/modules/presentation/presentation_module.swf" optimize="true" sourcePath="src/org/bigbluebutton/modules/presentation/presentation_module.mxml"/>
<module application="src/BigBlueButton.mxml" destPath="org/bigbluebutton/modules/voiceconference/voice_module.swf" optimize="true" sourcePath="src/org/bigbluebutton/modules/voiceconference/voice_module.mxml"/>
<module application="src/BigBlueButton.mxml" destPath="org/bigbluebutton/modules/playback/playback_module.swf" optimize="true" sourcePath="src/org/bigbluebutton/modules/playback/playback_module.mxml"/>
<module application="src/BigBlueButton.mxml" destPath="org/bigbluebutton/modules/chat/chat_module.swf" optimize="true" sourcePath="src/org/bigbluebutton/modules/chat/chat_module.mxml"/>
<module application="src/BigBlueButton.mxml" destPath="org/bigbluebutton/modules/whiteboard/whiteboard_module.swf" optimize="true" sourcePath="src/org/bigbluebutton/modules/whiteboard/whiteboard_module.mxml"/>
</modules>
<buildCSSFiles/>
</actionScriptProperties>

View File

@ -166,6 +166,15 @@ package org.bigbluebutton.common
public function getStartTime():String{
return this.startTime;
}
/**
* If a button was requested, a reference to one will be sent back here
* @param button
*
*/
public function setButton(button:Button):void{
this.button = button;
}
}
}

View File

@ -22,7 +22,6 @@ package org.bigbluebutton.main.view
import flash.events.Event;
import flash.events.MouseEvent;
import mx.controls.Alert;
import mx.controls.Button;
import org.bigbluebutton.common.BigBlueButtonModule;
@ -205,9 +204,10 @@ package org.bigbluebutton.main.view
* @param module
*
*/
private function addButton(module:BigBlueButtonModule):void{
private function addButton(module:BigBlueButtonModule):Button{
var button:Button = mshell.toolbar.addButton(module.getDisplayName());
button.addEventListener(MouseEvent.CLICK, openModule);
//button.addEventListener(MouseEvent.CLICK, openModule);
return button;
}
private function openModule(e:MouseEvent):void{
@ -280,7 +280,12 @@ package org.bigbluebutton.main.view
case MainApplicationFacade.ADD_MODULE:
var moduleNote:BigBlueButtonModule = notification.getBody() as BigBlueButtonModule;
addModule(moduleNote);
if (moduleNote.hasButton()) addButton(moduleNote);
if (moduleNote.hasButton()) {
//If the module has a button, pass it all it needs to start itself whenever it wants
moduleNote.setButton(addButton(moduleNote));
moduleNote._router = this.router;
moduleNote.mshell = this.mshell;
}
break;
case MainApplicationFacade.MODULES_STARTED:
runAddedModules(BigBlueButtonModule.START_ON_LOGIN);

View File

@ -19,10 +19,15 @@
*/
package org.bigbluebutton.modules.video
{
import flash.system.Capabilities;
import flash.events.MouseEvent;
import flash.events.TimerEvent;
import flash.media.Camera;
import flash.utils.Timer;
import flexlib.mdi.containers.MDIWindow;
import mx.controls.Button;
import org.bigbluebutton.common.BigBlueButtonModule;
import org.bigbluebutton.common.IRouterAware;
import org.bigbluebutton.common.Router;
@ -97,6 +102,31 @@ package org.bigbluebutton.modules.video
facade.sendNotification(VideoFacade.CLOSE_ALL);
facade.removeCore(this.streamName);
}
override public function setButton(button:Button):void{
super.setButton(button);
listenToCameras();
this.button.addEventListener(MouseEvent.CLICK, buttonClicked);
}
private function buttonClicked(e:MouseEvent):void{
this.acceptRouter(this.router, this.mshell);
}
private function listenToCameras():void{
onTimer(new TimerEvent("test"));
var timer:Timer = new Timer(5000);
timer.addEventListener(TimerEvent.TIMER, onTimer);
timer.start();
}
private function onTimer(e:TimerEvent):void{
if (Camera.getCamera() == null){
this.button.enabled = false;
} else if (Camera.getCamera() != null){
this.button.enabled = true;
}
}
}
}

View File

@ -23,6 +23,7 @@ package org.bigbluebutton.modules.video
import org.bigbluebutton.common.OutputPipe;
import org.bigbluebutton.common.Router;
import org.bigbluebutton.main.MainApplicationConstants;
import org.bigbluebutton.modules.video.control.notifiers.PlayStreamNotifier;
import org.bigbluebutton.modules.video.model.business.PublisherApplicationMediator;
import org.bigbluebutton.modules.video.model.vo.BroadcastMedia;
import org.bigbluebutton.modules.video.model.vo.PlayMedia;
@ -107,6 +108,7 @@ package org.bigbluebutton.modules.video
msg.setBody(viewComponent as VideoModule);
outpipe.write(msg);
startDevice();
}
public function addViewWindow():void{
@ -173,6 +175,15 @@ package org.bigbluebutton.modules.video
break;
}
}
/**
* Starts the camera on startup if one is available
*
*/
private function startDevice():void{
sendNotification(VideoFacade.SETUP_DEVICES_COMMAND);
sendNotification(VideoFacade.ENABLE_CAMERA);
}
}
}

View File

@ -49,6 +49,8 @@ package org.bigbluebutton.modules.video.model.business
public class PublisherApplicationMediator extends Mediator implements IMediator
{
public static const NAME:String = "PublisherApplicationMediator";
private var streamName:String;
/**
* Creates a new PublisherApplicationMediator
@ -291,6 +293,7 @@ package org.bigbluebutton.modules.video.model.business
public function startCamera(streamName : String) : void
{
var camera : Camera;
this.streamName = streamName;
var media : BroadcastMedia = model.getBroadcastMedia(streamName) as BroadcastMedia;
var selectedCamIndex : int = media.video.settings.cameraIndex;
@ -330,9 +333,17 @@ package org.bigbluebutton.modules.video.model.business
{
// log.debug( "StartCameraCommand::activityEventHandler: " + event );
}
/**
* Once the camera is ready, start broadcasting over the red5 server
* @param event
*
*/
private function statusEventHandler( event : StatusEvent ) : void
{
var media : BroadcastMedia = model.getBroadcastMedia(streamName) as BroadcastMedia;
sendNotification(VideoFacade.PUBLISH_STREAM_COMMAND, new PublishNotifier("live", media.streamName));
//Alert.show(event.code);
// log.debug( "StartCameraCommand::statusEventHandler: " + event );
}

View File

@ -4,7 +4,7 @@
xmlns:util="org.bigbluebutton.modules.video.model.ui.*"
xmlns:monitor="org.bigbluebutton.modules.video.view.monitor.*"
close="dispatchEvent(new Event(MyCameraWindowMediator.CLOSE))"
resizable="false" width="326" height="312" >
resizable="false" width="326" height="271" creationComplete="init()" >
<mx:Script>
<![CDATA[
import org.bigbluebutton.modules.viewers.model.services.SharedObjectConferenceDelegate;
@ -36,6 +36,11 @@
[Bindable] private var transmitIcon : Class = images.start_transmit_img;
[Bindable] private var stopIcon : Class = images.stop_dev_img;
private function init():void{
BindingUtils.bindSetter(handleBroadcasting, media, "broadcasting");
BindingUtils.bindSetter(handleDeviceStarted, media, "deviceStarted");
}
public override function close(event:MouseEvent = null):void
{
dispatchEvent(new Event(MyCameraWindowMediator.CLOSE_CLICKED));
@ -55,15 +60,12 @@
point1 = monDisplay.localToGlobal(point1);
settingsWindow.x = point1.x + 25;
settingsWindow.y = point1.y + 25;
BindingUtils.bindSetter(handleBroadcasting, media, "broadcasting");
BindingUtils.bindSetter(handleDeviceStarted, media, "deviceStarted");
}
private function handleDeviceStarted(deviceStarted : Boolean) : void
{
if (deviceStarted) {
settingsBtn.visible = false;
//settingsBtn.visible = false;
}
}
@ -73,9 +75,9 @@
ViewersFacade.getInstance().retrieveProxy(SharedObjectConferenceDelegate.NAME) as SharedObjectConferenceDelegate;
delegate.sendBroadcastStream(broadcasting, media.streamName);
if (broadcasting) {
transmitBtn.toolTip = "Stop broadcasting";
//transmitBtn.toolTip = "Stop broadcasting";
} else {
transmitBtn.toolTip = "Start broadcasting";
//transmitBtn.toolTip = "Start broadcasting";
}
}
@ -90,7 +92,7 @@
backgroundImage="{ serverLogo }" paddingBottom="0" cornerRadius="2">
<util:VideoContainer video="{ media.video.localVideo }" height="100%" width="100%"/>
</mx:Canvas>
<mx:ControlBar width="100%">
<!--<mx:ControlBar width="100%">
<mx:Button id="settingsBtn" icon="{settingsIcon}" visible="{ ! media.deviceStarted}"
width="20" height="20" click="openSettingsWindow()"
toolTip="Settings"/>
@ -106,5 +108,5 @@
visible="{ media.deviceStarted }"
width="20" height="20"
toolTip="Start broadcasting"/>
</mx:ControlBar>
</mx:ControlBar> -->
</cam:MDIWindow>

View File

@ -25,6 +25,7 @@ package org.bigbluebutton.modules.video.view.mediators
view.addEventListener(CLOSE, closeCameraWindow);
view.addEventListener(CLOSE_CLICKED, closeClicked);
view.addEventListener(OPEN_SETTINGS, openSettings);
//view.media.video.settings.cameraIndex = 1;
}
override public function listNotificationInterests():Array{
@ -40,6 +41,7 @@ package org.bigbluebutton.modules.video.view.mediators
cameraWindow.close();
break;
case VideoFacade.ENABLE_CAMERA:
cameraWindow.media.video.settings.cameraIndex = 1;
startOrStopDevices(new Event(VideoFacade.ENABLE_CAMERA));
break;
}

View File

@ -2,6 +2,7 @@ package org.bigbluebutton.modules.video.view.mediators
{
import flash.events.Event;
import mx.controls.Alert;
import mx.managers.PopUpManager;
import org.bigbluebutton.modules.video.VideoFacade;
@ -51,6 +52,7 @@ package org.bigbluebutton.modules.video.view.mediators
private function closeSettings(e:Event):void{
window.media.video.settings.cameraIndex = window.camera_cb.selectedIndex;
//Alert.show(String(window.camera_cb.selectedIndex));
PopUpManager.removePopUp(window);
sendNotification(VideoFacade.ENABLE_CAMERA);

View File

@ -2,6 +2,8 @@ package org.bigbluebutton.modules.video.view.mediators
{
import flash.events.Event;
import mx.controls.Alert;
import org.bigbluebutton.modules.video.VideoFacade;
import org.bigbluebutton.modules.video.control.notifiers.PlayStreamNotifier;
import org.bigbluebutton.modules.video.model.vo.PlaybackState;
@ -42,7 +44,7 @@ package org.bigbluebutton.modules.video.view.mediators
}
private function viewStream(e:Event):void{
//Alert.show(videoWindow.media.playState.name);
if ( videoWindow.media.playState == PlaybackState.PLAYING )
{
//mainApp.publisherApp.pauseStream(media.streamName);