Start implement open view camera window

git-svn-id: http://bigbluebutton.googlecode.com/svn/trunk@742 af16638f-c34d-0410-8cfa-b39d5352b314
This commit is contained in:
Richard Alam 2008-11-20 01:49:04 +00:00
parent 05b9c74c2b
commit 067a39573d
12 changed files with 157 additions and 55 deletions

View File

@ -45,8 +45,10 @@ package org.bigbluebutton.modules.video
public static const STARTED_BROADCAST:String = 'STARTED_BROADCAST';
public static const STOPPED_BROADCAST:String = 'STOPPED_BROADCAST';
public static const VIEW_CAMERA:String = 'VIEW_CAMERA';
public static const START_VIEW_CAMERA:String = 'START_VIEW_CAMERA';
public static const STOP_VIEW_CAMERA:String = 'STOP_VIEW_CAMERA';
public static const PLAY_STREAM:String = 'PLAY_STREAM';
public static const STOP_STREAM:String = 'STOP_STREAM';
public static const OPEN_WINDOW:String = 'OPEN_WINDOW';
public static const CLOSE_WINDOW:String = 'CLOSE_WINDOW';

View File

@ -102,7 +102,7 @@ package org.bigbluebutton.modules.video
break;
case EndpointMessageConstants.VIEW_CAMERA:
trace('Received VIEW_CAMERA message from ' + message.getHeader().SRC);
//facade.sendNotification(ChatModuleConstants.OPEN_WINDOW);
facade.sendNotification(VideoModuleConstants.START_VIEW_CAMERA, message.getBody());
break;
}
}

View File

@ -21,7 +21,7 @@ package org.bigbluebutton.modules.video
{
import org.bigbluebutton.modules.video.model.MediaProxy;
import org.bigbluebutton.modules.video.view.ToolbarButtonMediator;
import org.bigbluebutton.modules.video.view.ViewCameraWindowMediator;
import org.puremvc.as3.multicore.interfaces.IMediator;
import org.puremvc.as3.multicore.interfaces.INotification;
import org.puremvc.as3.multicore.patterns.mediator.Mediator;
@ -53,7 +53,9 @@ package org.bigbluebutton.modules.video
override public function listNotificationInterests():Array{
return [
VideoModuleConstants.CONNECTED,
VideoModuleConstants.DISCONNECTED
VideoModuleConstants.DISCONNECTED,
VideoModuleConstants.START_VIEW_CAMERA,
VideoModuleConstants.STOP_VIEW_CAMERA
];
}
@ -69,8 +71,16 @@ package org.bigbluebutton.modules.video
case VideoModuleConstants.DISCONNECTED:
facade.sendNotification(VideoModuleConstants.STOP_ALL_STREAM);
break;
case VideoModuleConstants.START_VIEW_CAMERA:
var streamName:String = notification.getBody().streamName;
// Append the streamName to the mediator name so we can know which mediator is for which stream.
facade.registerMediator(new ViewCameraWindowMediator(ViewCameraWindowMediator.NAME + streamName, streamName));
facade.sendNotification(VideoModuleConstants.STOP_ALL_STREAM);
break;
case VideoModuleConstants.STOP_VIEW_CAMERA:
facade.sendNotification(VideoModuleConstants.STOP_ALL_STREAM);
break;
}
}
}
}

View File

@ -1,11 +1,14 @@
package org.bigbluebutton.modules.video.view.mediators
package org.bigbluebutton.modules.video.view
{
import flash.events.Event;
import org.bigbluebutton.modules.video.VideoModuleConstants;
import org.bigbluebutton.modules.video.control.notifiers.PlayStreamNotifier;
import org.bigbluebutton.modules.video.model.vo.PlaybackState;
import org.bigbluebutton.modules.video.view.ViewCameraWindow;
import org.bigbluebutton.modules.video.model.MediaProxy;
import org.bigbluebutton.modules.video.model.vo.PlayMedia;
import org.bigbluebutton.modules.video.view.components.ViewCameraWindow;
import org.bigbluebutton.modules.video.view.events.CloseViewCameraWindowEvent;
import org.bigbluebutton.modules.video.view.events.StartPlayStreamEvent;
import org.bigbluebutton.modules.video.view.events.StopPlayStreamEvent;
import org.puremvc.as3.multicore.interfaces.IMediator;
import org.puremvc.as3.multicore.interfaces.INotification;
import org.puremvc.as3.multicore.patterns.mediator.Mediator;
@ -13,36 +16,46 @@ package org.bigbluebutton.modules.video.view.mediators
public class ViewCameraWindowMediator extends Mediator implements IMediator
{
public static const NAME:String = "ViewCameraWindowMediator";
public static const VIEW_STREAM:String = "ViewStreamDispatch";
public static const STOP_STREAM:String = "StopStreamDispatch";
private var _viewCamWindow:ViewCameraWindow;
private var _stream:String;
public function ViewCameraWindowMediator(view:ViewCameraWindow)
public function ViewCameraWindowMediator(name:String, streamName:String)
{
super(NAME, view);
view.addEventListener(VIEW_STREAM, viewStream);
view.addEventListener(STOP_STREAM, stopStream);
super(name);
_stream = streamName;
_viewCamWindow = new ViewCameraWindow();
_viewCamWindow.streamName = _stream;
_viewCamWindow.addEventListener(CloseViewCameraWindowEvent.CLOSE_VIEW_CAMERA_WINDOW_EVENT, onCloseViewCameraWindowEvent);
_viewCamWindow.addEventListener(StartPlayStreamEvent.START_PLAY_STREAM_EVENT, onStartPlayStreamEvent);
_viewCamWindow.addEventListener(StopPlayStreamEvent.STOP_PLAY_STREAM_EVENT, onStopPlayStreamEvent);
}
private function onStartPlayStreamEvent(e:StartPlayStreamEvent):void {
_viewCamWindow.media = proxy.getPlayMedia(e.streamName) as PlayMedia;
}
private function onStopPlayStreamEvent(e:StopPlayStreamEvent):void {
}
override public function listNotificationInterests():Array{
return [
VideoModuleConstants.CLOSE_ALL
VideoModuleConstants.PLAY_STREAM,
VideoModuleConstants.STOP_STREAM
];
}
override public function handleNotification(notification:INotification):void{
switch(notification.getName()){
case VideoModuleConstants.CLOSE_ALL:
videoWindow.close();
// videoWindow.close();
break;
}
}
public function get videoWindow():ViewCameraWindow{
return viewComponent as ViewCameraWindow;
}
private function viewStream(e:Event):void{
private function onCloseViewCameraWindowEvent(e:CloseViewCameraWindowEvent):void{
/*
if ( videoWindow.media.playState == PlaybackState.PLAYING )
{
//mainApp.publisherApp.pauseStream(media.streamName);
@ -50,22 +63,22 @@ package org.bigbluebutton.modules.video.view.mediators
}
else if ( videoWindow.media.playState == PlaybackState.STOPPED )
{
// Start playback from beginning.
//mainApp.publisherApp.playStream(media.streamName, true /*enableVideoCb.selected*/, false /*enableAudioCb.selected*/ );
sendNotification(VideoModuleConstants.PLAY_STREAM_COMMAND, new PlayStreamNotifier(videoWindow.media.streamName,true, false));
}
else if ( videoWindow.media.playState == PlaybackState.PAUSED )
{
// Resume playback.
//mainApp.publisherApp.resumeStream(media.streamName);
sendNotification(VideoModuleConstants.RESUME_STREAM_COMMAND, videoWindow.media.streamName);
}
*/
}
private function stopStream(e:Event):void{
//mainApp.publisherApp.stopStream(media.streamName);
sendNotification(VideoModuleConstants.STOP_STREAM_COMMAND, videoWindow.media.streamName);
// sendNotification(VideoModuleConstants.STOP_STREAM_COMMAND, videoWindow.media.streamName);
}
private function get proxy():MediaProxy {
return facade.retrieveProxy(MediaProxy.NAME) as MediaProxy;
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 721 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 717 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 695 B

View File

@ -9,5 +9,15 @@ package org.bigbluebutton.modules.video.view.components
[Embed(source="../assets/images/red5.png")]
public var red5_img:Class;
[Embed(source="../assets/images/control_play_blue.png")]
public var play_blue_img:Class;
[Embed(source="../assets/images/control_pause_blue.png")]
public var pause_blue_img:Class;
[Embed(source="../assets/images/control_stop_blue.png")]
public var stop_blue_img:Class;
}
}

View File

@ -1,14 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<cam:MDIWindow xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:cam="flexlib.mdi.containers.*"
xmlns:util="org.bigbluebutton.modules.video.model.ui.*"
xmlns:monitor="org.bigbluebutton.modules.video.view.monitor.*"
creationComplete="init()" height="330" width="330" resizable="false">
xmlns:util="org.bigbluebutton.modules.video.view.components.*"
implements="org.bigbluebutton.common.IBbbModuleWindow"
creationComplete="startPlaying()" height="330" width="330" resizable="false">
<mx:Script>
<![CDATA[
import org.bigbluebutton.modules.video.view.events.StartPlayStreamEvent;
import org.bigbluebutton.modules.video.view.events.CloseViewCameraWindowEvent;
import org.bigbluebutton.modules.video.view.events.StopPlayStreamEvent;
import org.bigbluebutton.modules.video.model.vo.PlayMedia;
import org.bigbluebutton.modules.video.view.general.Images;
import org.bigbluebutton.modules.video.view.mediators.ViewCameraWindowMediator;
import org.bigbluebutton.modules.video.model.vo.PlaybackState;
import mx.binding.utils.BindingUtils;
@ -22,27 +23,46 @@
import flash.geom.Point;
public static const TITLE:String = "Video Presentation";
public var streamName:String;
private var _xPosition:int;
private var _yPosition:int;
private var images:Images = new Images();
[Bindable] private var red5Icon : Class = images.red5_img;
[Bindable] private var stopIcon : Class = images.stop_blue_img;
[Bindable] private var playIcon : Class = images.play_blue_img;
[Bindable] private var pauseIcon : Class = images.pause_blue_img;
[Bindable] private var red5Icon:Class = images.red5_img;
[Bindable] private var stopIcon:Class = images.stop_blue_img;
[Bindable] private var playIcon:Class = images.play_blue_img;
[Bindable] private var pauseIcon:Class = images.pause_blue_img;
[Bindable] public var media:PlayMedia;
private function init() : void
private function startPlaying():void
{
BindingUtils.bindSetter(handlePlaybackState, media, "playState");
dispatchEvent(new StartPlayStreamEvent(streamName));
}
private function handlePlaybackState(playState:PlaybackState) : void
{
if (playState == PlaybackState.PLAYING) {
playButton.toolTip = "Pause";
} else {
playButton.toolTip = "Play";
}
public override function close(event:MouseEvent = null):void
{
trace('closing view camera window');
dispatchEvent(new StopPlayStreamEvent(streamName));
dispatchEvent(new CloseViewCameraWindowEvent(streamName));
}
public function get xPosition():int {
return _xPosition;
}
public function get yPosition():int {
return _yPosition;
}
public function set xPosition(x:int):void {
_xPosition = x;
}
public function set yPosition(y:int):void {
_yPosition = y;
}
]]>
</mx:Script>
<mx:VBox label="Video" id="videoPart" width="100%">
@ -52,18 +72,12 @@
<util:VideoContainer video="{ media.remoteVideo }" height="100%" width="100%"/>
</mx:Canvas>
<mx:ControlBar width="100%">
<!--mx:Label text="Enable:"/>
<mx:Spacer width="2"/>
<mx:CheckBox label="Audio" id="enableAudioCb"
click="this.toggleAudio()" selected="true"/>
<mx:CheckBox id="enableVideoCb" label="Video"
click="this.toggleVideo()" width="60" selected="true"/-->
<!--mx:ControlBar width="100%">
<mx:Spacer width="100%"/>
<mx:Button id="stopButton" icon="{stopIcon}"
click="dispatchEvent(new Event(ViewCameraWindowMediator.STOP_STREAM))" toolTip="Stop"/>
<mx:Button id="playButton" click="dispatchEvent(new Event(ViewCameraWindowMediator.VIEW_STREAM))"
icon="{media.playState == PlaybackState.PLAYING ? pauseIcon : playIcon}"/>
</mx:ControlBar>
</mx:ControlBar-->
</mx:VBox>
</cam:MDIWindow>

View File

@ -0,0 +1,17 @@
package org.bigbluebutton.modules.video.view.events
{
import flash.events.Event;
public class CloseViewCameraWindowEvent extends Event
{
public static const CLOSE_VIEW_CAMERA_WINDOW_EVENT:String = "CLOSE_VIEW_CAMERA_WINDOW_EVENT";
public var streamName:String;
public function CloseViewCameraWindowEvent(streamName:String)
{
super(CLOSE_VIEW_CAMERA_WINDOW_EVENT);
this.streamName = streamName;
}
}
}

View File

@ -0,0 +1,18 @@
package org.bigbluebutton.modules.video.view.events
{
import flash.events.Event;
public class StartPlayStreamEvent extends Event
{
public static const START_PLAY_STREAM_EVENT:String = "START_PLAY_STREAM_EVENT";
public var streamName:String;
public function StartPlayStreamEvent(streamName:String)
{
super(START_PLAY_STREAM_EVENT);
this.streamName = streamName;
}
}
}

View File

@ -0,0 +1,18 @@
package org.bigbluebutton.modules.video.view.events
{
import flash.events.Event;
public class StopPlayStreamEvent extends Event
{
public static const STOP_PLAY_STREAM_EVENT:String = "STOP_PLAY_STREAM_EVENT";
public var streamName:String;
public function StopPlayStreamEvent(streamName:String)
{
super(STOP_PLAY_STREAM_EVENT);
this.streamName = streamName;
}
}
}