Fixed bug in Video Module where it wasn't closing properly

git-svn-id: http://bigbluebutton.googlecode.com/svn/trunk@139 af16638f-c34d-0410-8cfa-b39d5352b314
This commit is contained in:
Denis Zgonjanin 2008-07-03 14:17:06 +00:00
parent 071b55c247
commit a2e71d767e
13 changed files with 74 additions and 44 deletions

View File

@ -19,8 +19,8 @@ body { margin: 0px; overflow:hidden }
<script type="text/javascript">
var so = new SWFObject("BigBlueButton.swf", "main", "100%", "100%", "9.0.115", "#336699");
so.addVariable("red5Host", "localhost");
so.addVariable("presentationHost", "localhost");
so.addVariable("red5Host", "present.carleton.ca");
so.addVariable("presentationHost", "present.carleton.ca");
so.write("flashcontent");
</script>
<div id="phone">

View File

@ -22,11 +22,11 @@ package org.bigbluebutton.modules.presentation.view
import flash.events.Event;
import flash.geom.Point;
import mx.controls.Alert;
import mx.managers.PopUpManager;
import org.bigbluebutton.modules.presentation.PresentationFacade;
import org.bigbluebutton.modules.presentation.model.PresentationApplication;
import org.bigbluebutton.modules.presentation.model.business.PresentationDelegate;
import org.puremvc.as3.multicore.interfaces.IMediator;
import org.puremvc.as3.multicore.interfaces.INotification;
import org.puremvc.as3.multicore.patterns.mediator.Mediator;
@ -139,6 +139,7 @@ package org.bigbluebutton.modules.presentation.view
if (!presentationWindow.model.presentation.isSharing){
sendNotification(PresentationApplication.SHARE, true);
presentationWindow.uploadPres.enabled = false;
//proxy.gotoPage(1);
}
}
@ -171,6 +172,10 @@ package org.bigbluebutton.modules.presentation.view
presentationWindow.uploadWindow.y = point1.y + 25;
sendNotification(PresentationFacade.STARTUPLOADWINDOW, presentationWindow.uploadWindow);
}
public function get proxy():PresentationDelegate{
return facade.retrieveProxy(PresentationDelegate.ID) as PresentationDelegate;
}
}

View File

@ -31,7 +31,7 @@
public var deck:SlidesDeck;
[Bindable]
private var selectedSlide:Slide;
public var selectedSlide:Slide;
private function init() : void
{

View File

@ -32,6 +32,7 @@ package org.bigbluebutton.modules.video
{
public static const NAME:String = "VideoFacade";
public static const CLOSE_RECORDING:String = "Close MyCameraWindow";
public static const CLOSE_ALL:String = "Close Video Module";
public static const STARTUP:String = "StartupVideo";
public static const SETUP_DEVICES_COMMAND : String = "PUBLISHER_SETUP_DEVICES_COMMAND";
@ -62,9 +63,9 @@ package org.bigbluebutton.modules.video
* constructors. Use the getInstance() method instead.
*
*/
public function VideoFacade()
public function VideoFacade(name:String)
{
super(NAME);
super(name);
}
/**
@ -72,9 +73,9 @@ package org.bigbluebutton.modules.video
* @return
*
*/
public static function getInstance():VideoFacade{
if (instanceMap[NAME] == null) instanceMap[NAME] = new VideoFacade();
return instanceMap[NAME] as VideoFacade;
public static function getInstance(name:String):VideoFacade{
if (instanceMap[name] == null) instanceMap[name] = new VideoFacade(name);
return instanceMap[name] as VideoFacade;
}
/**

View File

@ -57,7 +57,7 @@ package org.bigbluebutton.modules.video
public function VideoModule(user:User = null)
{
super(NAME);
facade = VideoFacade.getInstance();
if (user == null){
this.streamName = "stream" + String( Math.floor( new Date().getTime() ) );
this.type = RECORDER;
@ -66,6 +66,8 @@ package org.bigbluebutton.modules.video
this.streamName = user.streamName;
this.type = VIEWER;
}
facade = VideoFacade.getInstance(this.streamName);
this.preferedX = Capabilities.screenResolutionX - 400;
this.preferedY = 400;
@ -87,6 +89,7 @@ package org.bigbluebutton.modules.video
}
override public function logout():void{
facade.sendNotification(VideoFacade.CLOSE_ALL);
facade.removeCore(VideoFacade.NAME);
}

View File

@ -32,7 +32,7 @@ package org.bigbluebutton.modules.video.model.vo
[Bindable]
public class BroadcastMedia implements IMedia
{
private var model:PublisherModel= VideoFacade.getInstance().retrieveProxy(PublisherModel.NAME) as PublisherModel;
//private var model:PublisherModel= VideoFacade.getInstance().retrieveProxy(PublisherModel.NAME) as PublisherModel;
private static const _type : MediaType = MediaType.BROADCAST;
@ -42,7 +42,7 @@ package org.bigbluebutton.modules.video.model.vo
public var deviceStarted : Boolean = false;
public var broadcasting : Boolean = false;
public var connected : Boolean = model.connected;
//public var connected : Boolean = model.connected;
public var audio : AudioStream;
public var video : VideoStream;

View File

@ -35,15 +35,15 @@ package org.bigbluebutton.modules.video.model.vo
[Bindable]
public class PlayMedia implements IMedia
{
private var model:PublisherModel =
VideoFacade.getInstance().retrieveProxy(PublisherModel.NAME) as PublisherModel;
//private var model:PublisherModel =
// VideoFacade.getInstance().retrieveProxy(PublisherModel.NAME) as PublisherModel;
private static const _type : MediaType = MediaType.PLAY;
public var streamName : String;
public var uri : String;
public var connected : Boolean = model.connected;
//public var connected : Boolean = model.connected;
public var remoteVideo : Video;
public var defaultVideoSettings:VideoSettings = new VideoSettings();

View File

@ -26,12 +26,8 @@
import mx.containers.TitleWindow;
import flash.geom.Point;
private var publisherApp:PublisherApplicationMediator
= VideoFacade.getInstance().retrieveMediator(PublisherApplicationMediator.NAME)
as PublisherApplicationMediator
private var images:Images = new Images();
private var settingsWindow : SettingsWindow;
public var settingsWindow : SettingsWindow;
[Bindable]public var media:BroadcastMedia;
[Bindable] private var serverLogo : Class = images.red5_img;
@ -42,24 +38,15 @@
public override function close(event:MouseEvent = null):void
{
onCloseClicked();
dispatchEvent(new Event(MyCameraWindowMediator.CLOSE_CLICKED));
super.close(event);
}
private function onCloseClicked() : void
{
publisherApp.stopMicrophone(media.streamName);
publisherApp.stopCamera(media.streamName);
if (media.broadcasting) {
publisherApp.stopBroadcasting(media.streamName);
}
}
private function openSettingsWindow() : void
{
settingsWindow = SettingsWindow(PopUpManager.createPopUp( this, SettingsWindow, false));
settingsWindow.media = media;
dispatchEvent(new Event(MyCameraWindowMediator.OPEN_SETTINGS));
var point1:Point = new Point();
// Calculate position of TitleWindow in Application's coordinates.

View File

@ -6,6 +6,7 @@
<mx:Script>
<![CDATA[
import org.puremvc.as3.multicore.patterns.mediator.Mediator;
import org.bigbluebutton.modules.video.model.business.PublisherApplicationMediator;
import org.bigbluebutton.modules.video.view.mediators.SettingsWindowMediator;
import org.bigbluebutton.modules.video.model.business.PublisherModel;
@ -13,13 +14,12 @@
import org.bigbluebutton.modules.video.model.vo.BroadcastMedia;
import mx.managers.PopUpManager;
[Bindable] private var model : PublisherModel
= VideoFacade.getInstance().retrieveProxy(PublisherModel.NAME) as PublisherModel;
[Bindable] public var model : PublisherModel
[Bindable] public var media:BroadcastMedia;
private function getDevices():void{
var mediator:PublisherApplicationMediator = VideoFacade.getInstance().retrieveMediator(PublisherApplicationMediator.NAME) as PublisherApplicationMediator;
mediator.setupDevices();
dispatchEvent(new Event(SettingsWindowMediator.SETUP));
}
private function closeSettingsWindow() : void

View File

@ -14,6 +14,8 @@ package org.bigbluebutton.modules.video.view.mediators
public static const RECORD_STREAM:String = "Record Stream";
public static const START_STOP_DEVICES:String = "Start or Stop devices";
public static const CLOSE:String = "Close MyCamera Window";
public static const CLOSE_CLICKED:String = "Close Clicked";
public static const OPEN_SETTINGS:String = "Open Settings";
public function MyCameraWindowMediator(view:MyCameraWindow)
{
@ -21,14 +23,22 @@ package org.bigbluebutton.modules.video.view.mediators
view.addEventListener(RECORD_STREAM, recordStream);
view.addEventListener(START_STOP_DEVICES, startOrStopDevices);
view.addEventListener(CLOSE, closeCameraWindow);
view.addEventListener(CLOSE_CLICKED, closeClicked);
view.addEventListener(OPEN_SETTINGS, openSettings);
}
override public function listNotificationInterests():Array{
return [];
return [
VideoFacade.CLOSE_ALL
];
}
override public function handleNotification(notification:INotification):void{
switch(notification.getName()){
case VideoFacade.CLOSE_ALL:
cameraWindow.close();
break;
}
}
public function get cameraWindow():MyCameraWindow{
@ -59,9 +69,7 @@ package org.bigbluebutton.modules.video.view.mediators
private function stopDevices() : void
{
//BlindsideAppLocator.getInstance().publisherApp.stopMicrophone(media.streamName);
sendNotification(VideoFacade.STOP_MICROPHONE_COMMAND, cameraWindow.media.streamName);
//BlindsideAppLocator.getInstance().publisherApp.stopCamera(media.streamName);
sendNotification(VideoFacade.STOP_CAMERA_COMMAND, cameraWindow.media.streamName);
}
@ -76,6 +84,19 @@ package org.bigbluebutton.modules.video.view.mediators
private function closeCameraWindow(e:Event):void{
sendNotification(VideoFacade.CLOSE_RECORDING);
}
private function closeClicked(e:Event):void{
sendNotification(VideoFacade.STOP_MICROPHONE_COMMAND, cameraWindow.media.streamName);
sendNotification(VideoFacade.STOP_CAMERA_COMMAND, cameraWindow.media.streamName);
if (cameraWindow.media.broadcasting) {
sendNotification(VideoFacade.UNPUBLISH_STREAM_COMMAND, cameraWindow.media.streamName);
}
}
private function openSettings(e:Event):void{
facade.registerMediator(new SettingsWindowMediator(cameraWindow.settingsWindow));
}
}
}

View File

@ -3,6 +3,7 @@ package org.bigbluebutton.modules.video.view.mediators
import flash.events.Event;
import org.bigbluebutton.modules.video.VideoFacade;
import org.bigbluebutton.modules.video.model.business.PublisherModel;
import org.bigbluebutton.modules.video.view.SettingsWindow;
import org.puremvc.as3.multicore.interfaces.IMediator;
import org.puremvc.as3.multicore.interfaces.INotification;
@ -33,6 +34,8 @@ package org.bigbluebutton.modules.video.view.mediators
private function setupDevices(e:Event):void{
sendNotification(VideoFacade.SETUP_DEVICES_COMMAND);
var model:PublisherModel = facade.retrieveProxy(PublisherModel.NAME) as PublisherModel;
window.camera_cb.dataProvider = model.cameraNames;
}
}

View File

@ -2,8 +2,6 @@ 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;
@ -26,11 +24,17 @@ package org.bigbluebutton.modules.video.view.mediators
}
override public function listNotificationInterests():Array{
return [];
return [
VideoFacade.CLOSE_ALL
];
}
override public function handleNotification(notification:INotification):void{
switch(notification.getName()){
case VideoFacade.CLOSE_ALL:
videoWindow.close();
break;
}
}
public function get videoWindow():ViewCameraWindow{

View File

@ -4,6 +4,8 @@
<mx:Script>
<![CDATA[
import org.bigbluebutton.modules.viewers.ViewersFacade;
import org.bigbluebutton.modules.viewers.model.business.Conference;
import org.bigbluebutton.modules.viewers.model.vo.User;
import org.bigbluebutton.main.view.components.MainApplicationShell;
import org.bigbluebutton.main.MainApplicationFacade;
@ -17,7 +19,11 @@
private function viewCamera() : void
{
MainApplicationFacade.getInstance(MainApplicationShell.NAME).openViewCamera(data as User);
var conf:Conference = ViewersFacade.getInstance().retrieveMediator(Conference.NAME) as Conference;
var usr:User = data as User;
if (usr.name != conf.me.name){
MainApplicationFacade.getInstance(MainApplicationShell.NAME).openViewCamera(data as User);
}
}
[Bindable] private var webcamIcon : Object = images.webcam;