preview window for presenter displays the stream now
This commit is contained in:
parent
f08cd5262e
commit
8a2bc3a420
@ -20,15 +20,15 @@
|
||||
package org.bigbluebutton.modules.webrtcDeskshare.managers
|
||||
{
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
|
||||
|
||||
import org.as3commons.logging.api.ILogger;
|
||||
import org.as3commons.logging.api.getClassLogger;
|
||||
import org.bigbluebutton.core.UsersUtil;
|
||||
import org.bigbluebutton.core.managers.UserManager;
|
||||
import org.bigbluebutton.main.events.MadePresenterEvent;
|
||||
import org.bigbluebutton.modules.webrtcDeskshare.events.ViewStreamEvent;
|
||||
import org.bigbluebutton.modules.webrtcDeskshare.model.DeskshareOptions;
|
||||
import org.bigbluebutton.modules.webrtcDeskshare.services.DeskshareService;
|
||||
import org.bigbluebutton.modules.webrtcDeskshare.events.ViewStreamEvent;
|
||||
import org.bigbluebutton.main.api.JSLog;
|
||||
|
||||
public class DeskshareManager {
|
||||
private static const LOGGER:ILogger = getClassLogger(DeskshareManager);
|
||||
@ -54,10 +54,9 @@ package org.bigbluebutton.modules.webrtcDeskshare.managers
|
||||
this.module = module;
|
||||
service.handleStartModuleEvent(module);
|
||||
|
||||
if (UsersUtil.amIPresenter()) {
|
||||
initDeskshare();
|
||||
}
|
||||
|
||||
if (UsersUtil.amIPresenter()) {
|
||||
initDeskshare();
|
||||
}
|
||||
}
|
||||
|
||||
public function handleStopModuleEvent():void {
|
||||
@ -68,10 +67,10 @@ package org.bigbluebutton.modules.webrtcDeskshare.managers
|
||||
service.disconnect();
|
||||
}
|
||||
|
||||
public function handleStreamStoppedEvent():void {
|
||||
LOGGER.debug("Sending deskshare stopped command");
|
||||
service.stopSharingDesktop(module.getRoom(), module.getRoom());
|
||||
}
|
||||
public function handleStreamStoppedEvent():void {
|
||||
LOGGER.debug("Sending deskshare stopped command");
|
||||
service.stopSharingDesktop(module.getRoom(), module.getRoom());
|
||||
}
|
||||
|
||||
public function handleStreamStartedEvent(videoWidth:Number, videoHeight:Number):void {
|
||||
LOGGER.debug("Sending startViewing command");
|
||||
@ -83,21 +82,21 @@ package org.bigbluebutton.modules.webrtcDeskshare.managers
|
||||
service.sendStartedViewingNotification(stream);
|
||||
}
|
||||
|
||||
private function initDeskshare():void {
|
||||
sharing = false;
|
||||
var option:DeskshareOptions = new DeskshareOptions();
|
||||
option.parseOptions();
|
||||
if (option.autoStart) {
|
||||
handleStartSharingEvent(true);
|
||||
}
|
||||
if(option.showButton){
|
||||
toolbarButtonManager.addToolbarButton();
|
||||
}
|
||||
}
|
||||
private function initDeskshare():void {
|
||||
sharing = false;
|
||||
var option:DeskshareOptions = new DeskshareOptions();
|
||||
option.parseOptions();
|
||||
if (option.autoStart) {
|
||||
handleStartSharingEvent(true);
|
||||
}
|
||||
if(option.showButton){
|
||||
toolbarButtonManager.addToolbarButton();
|
||||
}
|
||||
}
|
||||
|
||||
public function handleMadePresenterEvent(e:MadePresenterEvent):void {
|
||||
LOGGER.debug("Got MadePresenterEvent ");
|
||||
initDeskshare();
|
||||
initDeskshare();
|
||||
}
|
||||
|
||||
public function handleMadeViewerEvent(e:MadePresenterEvent):void{
|
||||
@ -133,12 +132,16 @@ package org.bigbluebutton.modules.webrtcDeskshare.managers
|
||||
|
||||
public function handleStreamStartEvent(e:ViewStreamEvent):void{
|
||||
// if (sharing) return; //TODO must uncomment this for the non-webrtc desktop share
|
||||
LOGGER.debug("Received start vieweing command");
|
||||
var isPresenter:Boolean = UserManager.getInstance().getConference().amIPresenter;
|
||||
LOGGER.debug("Received start vieweing command when isPresenter==[{0}]",[isPresenter]);
|
||||
|
||||
if(isPresenter) {
|
||||
publishWindowManager.startViewing(e.rtmp, e.videoWidth, e.videoHeight);
|
||||
} else {
|
||||
viewWindowManager.startViewing(e.rtmp, e.videoWidth, e.videoHeight);
|
||||
}
|
||||
|
||||
var logData:Object = new Object();
|
||||
JSLog.debug("\n\n DeskshareManager::handleStreamStartEvent ", logData);
|
||||
// sharing = true; //TODO must uncomment this for the non-webrtc desktop share
|
||||
viewWindowManager.startViewing(e.rtmp, e.videoWidth, e.videoHeight); //anton (should use PublishWindowManager if I am the presenter)
|
||||
}
|
||||
|
||||
// public function handleStreamStopEvent(e:ViewStreamEvent):void{
|
||||
|
@ -20,18 +20,19 @@
|
||||
package org.bigbluebutton.modules.webrtcDeskshare.managers
|
||||
{
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
|
||||
|
||||
import flash.events.TimerEvent;
|
||||
import flash.utils.Timer;
|
||||
import flash.external.ExternalInterface;
|
||||
import flash.utils.Timer;
|
||||
|
||||
import org.as3commons.logging.api.ILogger;
|
||||
import org.as3commons.logging.api.getClassLogger;
|
||||
import org.bigbluebutton.common.IBbbModuleWindow;
|
||||
import org.bigbluebutton.common.events.CloseWindowEvent;
|
||||
import org.bigbluebutton.common.events.OpenWindowEvent;
|
||||
import org.bigbluebutton.main.api.JSLog;
|
||||
import org.bigbluebutton.modules.webrtcDeskshare.services.DeskshareService;
|
||||
import org.bigbluebutton.modules.webrtcDeskshare.view.components.DesktopPublishWindow;
|
||||
import org.bigbluebutton.main.api.JSLog;
|
||||
|
||||
public class PublishWindowManager {
|
||||
private static const LOGGER:ILogger = getClassLogger(PublishWindowManager);
|
||||
@ -70,7 +71,6 @@ package org.bigbluebutton.modules.webrtcDeskshare.managers
|
||||
|
||||
|
||||
shareWindow = new DesktopPublishWindow();
|
||||
shareWindow.initWindow(service.getConnection(), uri , useTLS , room, autoStart, autoFullScreen);
|
||||
shareWindow.visible = true;
|
||||
openWindow(shareWindow);
|
||||
// if (autoStart || autoFullScreen) {
|
||||
@ -104,5 +104,9 @@ package org.bigbluebutton.modules.webrtcDeskshare.managers
|
||||
event.window = window;
|
||||
globalDispatcher.dispatchEvent(event);
|
||||
}
|
||||
|
||||
public function startViewing(rtmp:String, videoWidth:Number, videoHeight:Number):void{
|
||||
shareWindow.coolFunction(rtmp, videoWidth, videoHeight);
|
||||
}
|
||||
}
|
||||
}
|
@ -20,20 +20,22 @@
|
||||
package org.bigbluebutton.modules.webrtcDeskshare.managers
|
||||
{
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
|
||||
|
||||
import org.as3commons.logging.api.ILogger;
|
||||
import org.as3commons.logging.api.getClassLogger;
|
||||
import org.bigbluebutton.common.IBbbModuleWindow;
|
||||
import org.bigbluebutton.common.events.CloseWindowEvent;
|
||||
import org.bigbluebutton.common.events.OpenWindowEvent;
|
||||
import org.bigbluebutton.modules.webrtcDeskshare.services.DeskshareService;
|
||||
import org.bigbluebutton.modules.webrtcDeskshare.view.components.DesktopViewWindow;
|
||||
import org.bigbluebutton.main.api.JSLog;
|
||||
import org.bigbluebutton.modules.webrtcDeskshare.services.DeskshareService;
|
||||
import org.bigbluebutton.modules.webrtcDeskshare.view.components.DesktopPublishWindow;
|
||||
import org.bigbluebutton.modules.webrtcDeskshare.view.components.DesktopViewWindow;
|
||||
|
||||
public class ViewerWindowManager {
|
||||
private static const LOGGER:ILogger = getClassLogger(ViewerWindowManager);
|
||||
|
||||
private var viewWindow:DesktopViewWindow;
|
||||
private var shareWindow:DesktopPublishWindow;
|
||||
private var service:DeskshareService;
|
||||
private var isViewing:Boolean = false;
|
||||
private var globalDispatcher:Dispatcher;
|
||||
@ -73,11 +75,8 @@ package org.bigbluebutton.modules.webrtcDeskshare.managers
|
||||
public function startViewing(rtmp:String, videoWidth:Number, videoHeight:Number):void{
|
||||
LOGGER.debug("ViewerWindowManager::startViewing");
|
||||
|
||||
var logData:Object = new Object();
|
||||
JSLog.debug("\n\n ViewerWindowManager::startViewing ", logData);
|
||||
viewWindow = new DesktopViewWindow();
|
||||
viewWindow.startVideo(rtmp, videoWidth, videoHeight);
|
||||
|
||||
openWindow(viewWindow);
|
||||
isViewing = true;
|
||||
}
|
||||
|
@ -45,9 +45,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
|
||||
|
||||
import mx.core.UIComponent;
|
||||
|
||||
|
||||
import org.as3commons.logging.api.ILogger;
|
||||
import org.as3commons.logging.api.getClassLogger;
|
||||
import org.bigbluebutton.common.IBbbModuleWindow;
|
||||
@ -63,6 +63,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
import org.bigbluebutton.modules.webrtcDeskshare.events.StreamEvent;
|
||||
import org.bigbluebutton.modules.webrtcDeskshare.events.ViewStreamEvent;
|
||||
import org.bigbluebutton.modules.webrtcDeskshare.model.DeskshareOptions;
|
||||
import org.bigbluebutton.modules.webrtcDeskshare.services.red5.ConnectionEvent;
|
||||
import org.bigbluebutton.util.i18n.ResourceUtil;
|
||||
|
||||
private static const LOGGER:ILogger = getClassLogger(DesktopPublishWindow);
|
||||
@ -208,19 +209,70 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
cursorImg.y = cursor.y;
|
||||
}
|
||||
|
||||
/*private function onAppletStart(event:AppletStartedEvent):void{ //TODO ANTON REMOVE THIS
|
||||
if (!connection.connected) return;
|
||||
// TODO make this function private and trigger it via message
|
||||
public function coolFunction(rtmp:String, videoWidth:Number, videoHeight:Number):void {
|
||||
var streamName:String = rtmp;
|
||||
var myArray :Array = streamName.split('/');
|
||||
myArray.forEach ( function ( item:*, i:int, arr:Array) : void {LOGGER.debug("^^^^[{0}]^^^^",[item]); } );
|
||||
|
||||
LOGGER.debug("DeskShareWindow::onAppletStart");
|
||||
startPreviewStream(connection, room, event.videoWidth, event.videoHeight); //anton todo
|
||||
var meetingUrl:String = streamName.substring(0, streamName.lastIndexOf('/'));
|
||||
stream = myArray[5];
|
||||
LOGGER.debug("________MEETING URL=________________ [{0}]",[meetingUrl]);
|
||||
LOGGER.debug("________stream=________________ [{0}]",[stream]);
|
||||
|
||||
var streamEvent:StreamEvent = new StreamEvent(StreamEvent.START);
|
||||
streamEvent.videoWidth = event.videoWidth;
|
||||
streamEvent.videoHeight = event.videoHeight;
|
||||
dispatchEvent(streamEvent); // anton todo
|
||||
}*/
|
||||
connection = new NetConnection();
|
||||
connection.proxyType = "best";
|
||||
connection.objectEncoding = ObjectEncoding.AMF0;
|
||||
connection.client = this;
|
||||
|
||||
connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
|
||||
connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
|
||||
connection.connect(meetingUrl);
|
||||
|
||||
private function startPreviewStream(nc:NetConnection, streamName:String, capWidth:Number, capHeight:Number):void{
|
||||
}
|
||||
|
||||
private function netStatusHandler(event:NetStatusEvent):void {
|
||||
var ce:ConnectionEvent = new ConnectionEvent();
|
||||
LOGGER.debug("__netStatusHandler [{0}]",[event.info.code]);
|
||||
switch(event.info.code){
|
||||
case "NetConnection.Connect.Failed":
|
||||
ce.status = ConnectionEvent.FAILED;
|
||||
|
||||
break;
|
||||
|
||||
case "NetConnection.Connect.Success":
|
||||
ce.status = ConnectionEvent.SUCCESS;
|
||||
startPreviewStream(stream, videoWidth, videoHeight);
|
||||
break;
|
||||
|
||||
case "NetConnection.Connect.Rejected":
|
||||
ce.status = ConnectionEvent.REJECTED;
|
||||
break;
|
||||
|
||||
case "NetConnection.Connect.Closed":
|
||||
trace("Deskshare connection closed.");
|
||||
ce.status = ConnectionEvent.CLOSED;
|
||||
break;
|
||||
|
||||
case "NetConnection.Connect.InvalidApp":
|
||||
ce.status = ConnectionEvent.INVALIDAPP;
|
||||
break;
|
||||
|
||||
case "NetConnection.Connect.AppShutdown":
|
||||
ce.status = ConnectionEvent.APPSHUTDOWN;
|
||||
break;
|
||||
|
||||
case "NetConnection.Connect.NetworkChange":
|
||||
trace("Detected network change. User might be on a wireless and temporarily dropped connection. Doing nothing. Just making a note.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private function securityErrorHandler(event:SecurityErrorEvent):void {
|
||||
LOGGER.debug("ERROR DesktopPublishWindow::securityErrorHandler ");
|
||||
}
|
||||
|
||||
private function startPreviewStream(streamName:String, capWidth:Number, capHeight:Number):void{
|
||||
streaming = true;
|
||||
|
||||
// Store capture dimensions so we can position cursor properly.
|
||||
@ -248,6 +300,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
}
|
||||
|
||||
LOGGER.debug("webrtcDeskshare preview[{0},{1}][{2},{3}]", [captureWidth, captureHeight, vidW, vidH]);
|
||||
LOGGER.debug("webrtcDeskshare previewA[{0},{1}]", [vidW, vidH]);
|
||||
video = new Video(vidW, vidH);
|
||||
video.width = vidW;
|
||||
video.height = vidH;
|
||||
@ -255,23 +308,34 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
videoHolder.height = vidH;
|
||||
video.x = videoHolder.x = (this.width - VID_WIDTH_PAD - vidW) / 2;
|
||||
video.y = videoHolder.y = (this.height - VID_HEIGHT_PAD - vidH) / 2;
|
||||
|
||||
video.y = 10;// TODO temp
|
||||
video.x = 10;// TODO temp
|
||||
|
||||
LOGGER.debug("webrtcDeskshare previewB[{0},{1}]", [videoHolder.x, videoHolder.y]);
|
||||
LOGGER.debug("webrtcDeskshare previewC[{0},{1}]", [videoHolder.width, videoHolder.height]);
|
||||
|
||||
|
||||
videoHolder.addChild(video);
|
||||
videoHolder.addChild(cursor);
|
||||
videoHolder.addChild(cursorImg);
|
||||
cursor.visible = false;
|
||||
// videoHolder.addChild(cursor);
|
||||
// videoHolder.addChild(cursorImg); //TODO anton remove
|
||||
// cursor.visible = false;
|
||||
this.addChild(videoHolder);
|
||||
|
||||
ns = new NetStream(nc);
|
||||
LOGGER.debug("webrtcDeskshare preview2 [{0},{1}][{2}]", [videoHolder, video.x, video.height]);
|
||||
|
||||
ns = new NetStream(connection);
|
||||
ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, onAsyncError);
|
||||
ns.addEventListener( NetStatusEvent.NET_STATUS, onNetStatus );
|
||||
LOGGER.debug("webrtcDeskshare preview4 [{0}]", [ns]);
|
||||
ns.client = this;
|
||||
ns.bufferTime = 0;
|
||||
ns.receiveVideo(true);
|
||||
ns.receiveAudio(false);
|
||||
video.attachNetStream(ns);
|
||||
ns.play(streamName);
|
||||
LOGGER.debug("webrtcDeskshare preview5 [{0}]", [streamName]);
|
||||
|
||||
ns.play(stream);
|
||||
|
||||
btnClosePublish.enabled = true;
|
||||
btnFSPublish.enabled = false;
|
||||
|
@ -52,11 +52,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
<property name="packetTimeout" value="10000"/>
|
||||
<property name="recordVideoStream" value="true"/>
|
||||
<property name="eventRecordingService" ref="redisRecorder"/>
|
||||
<property name="messagePublisher" ref="redisPublisher"/>
|
||||
</bean>
|
||||
|
||||
<bean id="redisPublisher" class="org.bigbluebutton.red5.pubsub.MessagePublisher">
|
||||
<property name="messageSender" ref="redisSender"/>
|
||||
</bean>
|
||||
|
||||
<bean id="redisRecorder" class="org.bigbluebutton.app.videobroadcast.EventRecordingService">
|
||||
@ -64,11 +59,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
<constructor-arg index="1" value="${redis.port}"/>
|
||||
</bean>
|
||||
|
||||
<bean id="redisSender" class="org.bigbluebutton.red5.pubsub.MessageSender"
|
||||
init-method="start" destroy-method="stop">
|
||||
<property name="redisPool"> <ref bean="redisPool"/></property>
|
||||
</bean>
|
||||
|
||||
<!-- <bean id="web.handler" class="org.red5.server.adapter.ApplicationAdapter" />
|
||||
-->
|
||||
</beans>
|
||||
|
Loading…
Reference in New Issue
Block a user