- auto publish deskshare

- fix autopublishing when switching presenter
This commit is contained in:
Richard Alam 2011-11-07 14:46:44 -05:00
parent 97ffdd67f3
commit dabe4b37cf
7 changed files with 45 additions and 75 deletions

View File

@ -19,15 +19,13 @@
package org.bigbluebutton.modules.deskshare.managers
{
import com.asfusion.mate.events.Dispatcher;
import com.asfusion.mate.events.Dispatcher;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.main.events.MadePresenterEvent;
import org.bigbluebutton.modules.deskshare.model.DeskshareOptions;
import org.bigbluebutton.modules.deskshare.services.DeskshareService;
public class DeskshareManager
{
public class DeskshareManager {
private var publishWindowManager:PublishWindowManager;
private var viewWindowManager:ViewerWindowManager;
private var toolbarButtonManager:ToolbarButtonManager;
@ -36,8 +34,7 @@ package org.bigbluebutton.modules.deskshare.managers
private var globalDispatcher:Dispatcher;
private var sharing:Boolean = false;
public function DeskshareManager()
{
public function DeskshareManager() {
service = new DeskshareService();
globalDispatcher = new Dispatcher();
publishWindowManager = new PublishWindowManager(service);
@ -58,25 +55,17 @@ package org.bigbluebutton.modules.deskshare.managers
service.disconnect();
}
public function handleStreamStartedEvent(videoWidth:Number, videoHeight:Number):void{
public function handleStreamStartedEvent(videoWidth:Number, videoHeight:Number):void {
LogUtil.debug("Sending startViewing command");
service.sendStartViewingNotification(videoWidth, videoHeight);
}
public function handleStartedViewingEvent():void{
public function handleStartedViewingEvent():void {
LogUtil.debug("handleStartedViewingEvent");
service.sendStartedViewingNotification();
}
public function handleStreamStoppedEvent():void {
notifyOthersToStopViewing();
}
private function notifyOthersToStopViewing():void {
LogUtil.debug("notifyOthersToStopViewing()");
}
public function handleMadePresenterEvent(e:MadePresenterEvent):void{
public function handleMadePresenterEvent(e:MadePresenterEvent):void {
LogUtil.debug("Got MadePresenterEvent ");
toolbarButtonManager.addToolbarButton();
sharing = false;

View File

@ -21,6 +21,9 @@ package org.bigbluebutton.modules.deskshare.managers
{
import com.asfusion.mate.events.Dispatcher;
import flash.events.TimerEvent;
import flash.utils.Timer;
import org.bigbluebutton.common.IBbbModuleWindow;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.common.events.CloseWindowEvent;
@ -30,11 +33,16 @@ package org.bigbluebutton.modules.deskshare.managers
public class PublishWindowManager {
private var shareWindow:DesktopPublishWindow;
private var isSharing:Boolean = false;
private var globalDispatcher:Dispatcher;
private var service:DeskshareService;
private var buttonShownOnToolbar:Boolean = false;
// Timer to auto-publish webcam. We need this timer to delay
// the auto-publishing until after the Viewers's window has loaded
// to receive the publishing events. Otherwise, the user joining next
// won't be able to view the webcam.
private var autoPublishTimer:Timer;
public function PublishWindowManager(service:DeskshareService) {
LogUtil.debug("PublishWindowManager init");
globalDispatcher = new Dispatcher();
@ -42,7 +50,7 @@ package org.bigbluebutton.modules.deskshare.managers
}
public function stopSharing():void {
if (isSharing) shareWindow.stopSharing();
shareWindow.stopSharing();
}
public function startSharing(uri:String, room:String, autoStart:Boolean):void {
@ -51,13 +59,27 @@ package org.bigbluebutton.modules.deskshare.managers
shareWindow.initWindow(service.getConnection(), uri, room, autoStart);
shareWindow.visible = true;
openWindow(shareWindow);
if (autoStart) {
/*
* Need to have a timer to trigger auto-publishing of deskshare.
*/
shareWindow.btnFSPublish.enabled = false;
shareWindow.btnRegionPublish.enabled = false;
autoPublishTimer = new Timer(3000, 1);
autoPublishTimer.addEventListener(TimerEvent.TIMER, autopublishTimerHandler);
autoPublishTimer.start();
}
}
private function autopublishTimerHandler(event:TimerEvent):void {
shareWindow.shareScreen(true);
}
public function handleShareWindowCloseEvent():void {
closeWindow(shareWindow);
}
private function openWindow(window:IBbbModuleWindow):void{
private function openWindow(window:IBbbModuleWindow):void {
var event:OpenWindowEvent = new OpenWindowEvent(OpenWindowEvent.OPEN_WINDOW_EVENT);
event.window = window;
globalDispatcher.dispatchEvent(event);

View File

@ -62,8 +62,7 @@
</EventHandlers>
<EventHandlers type="{StreamEvent.START}">
<MethodInvoker generator="{DeskshareManager}"
method="handleStreamStartedEvent" arguments="{[event.videoWidth, event.videoHeight]}"/>
<MethodInvoker generator="{DeskshareManager}" method="handleStreamStartedEvent" arguments="{[event.videoWidth, event.videoHeight]}"/>
</EventHandlers>
<EventHandlers type="{StreamEvent.STOP}" >
@ -71,8 +70,7 @@
</EventHandlers>
<EventHandlers type="{ViewStreamEvent.START}">
<MethodInvoker generator="{DeskshareManager}"
method="handleStreamStartEvent" arguments="{[event.videoWidth, event.videoHeight]}"/>
<MethodInvoker generator="{DeskshareManager}" method="handleStreamStartEvent" arguments="{[event.videoWidth, event.videoHeight]}"/>
</EventHandlers>
<EventHandlers type="{ShareWindowEvent.CLOSE}">

View File

@ -18,12 +18,10 @@
*/
package org.bigbluebutton.modules.deskshare.services
{
import com.asfusion.mate.events.Dispatcher;
import com.asfusion.mate.events.Dispatcher;
import flash.net.NetConnection;
import flash.net.Responder;
import flash.net.SharedObject;
import flash.net.SharedObject;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.main.events.RecordStatusEvent;
import org.bigbluebutton.modules.deskshare.events.AppletStartedEvent;
@ -72,7 +70,7 @@ package org.bigbluebutton.modules.deskshare.services
conn.connect();
responder = new Responder(
function(result:Object):void{
function(result:Object):void {
if (result != null && (result.publishing as Boolean)){
width = result.width as Number;
height = result.height as Number;

View File

@ -1,28 +0,0 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2010 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 2.1 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.modules.deskshare.services
{
public class SharedObjectCallbackHandler
{
public function SharedObjectCallbackHandler()
{
}
}
}

View File

@ -26,6 +26,7 @@
xmlns:mate="http://mate.asfusion.com/"
xmlns:dspub="flexlib.mdi.containers.*"
creationComplete="onCreationComplete()"
verticalScrollPolicy="off" horizontalScrollPolicy="off"
width="320" height="240"
title="{ResourceUtil.getInstance().getString('bbb.desktopPublish.title')}"
@ -40,13 +41,10 @@
<mx:Script>
<![CDATA[
import com.asfusion.mate.events.Dispatcher;
import com.asfusion.mate.events.Dispatcher;
import flexlib.mdi.events.MDIWindowEvent;
import flexlib.scheduling.scheduleClasses.BackgroundItem;
import mx.core.UIComponent;
import flexlib.scheduling.scheduleClasses.BackgroundItem;
import mx.core.UIComponent;
import org.bigbluebutton.common.Images;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.common.events.LocaleChangeEvent;
@ -96,10 +94,7 @@
cursor = new Sprite();
cursor.graphics.lineStyle(6, 0xFF0000, 0.6);
cursor.graphics.drawCircle(0,0,3);
if (autoStart) {
shareScreen(true);
}
setCurrentState("dispFullRegionControlBar");
}
@ -135,19 +130,15 @@
this.autoStart = autoStart;
}
private function shareScreen(fullScreen:Boolean):void {
public function shareScreen(fullScreen:Boolean):void {
LogUtil.debug("Calling shareScreen");
startSharing(connection, uri, room, fullScreen);
}
private function startSharing(connection:NetConnection, uri:String, room:String, fullScreen:Boolean):void {
LogUtil.debug("Calling startSharing");
var captureX:Number = 0;
var captureY:Number = 0;
var captureY:Number = 0;
sharingFullScreen = fullScreen;
LogUtil.debug("Calling startSharing1");
// setCurrentState("dispQuitControlBar");
LogUtil.debug("Calling startApplet");
ExternalInterface.call("startApplet", uri, room, fullScreen);
}

View File

@ -104,7 +104,7 @@
/*
* Need to have a timer to trigger auto-publishing of webcam.
*/
autoPublishTimer = new Timer(3000);
autoPublishTimer = new Timer(3000, 1);
autoPublishTimer.addEventListener(TimerEvent.TIMER, autopublishTimerHandler);
autoPublishTimer.start();
}