add missing part for adding webrtc support to module screenshare

This commit is contained in:
Anton Georgiev 2016-07-29 18:51:08 +00:00
parent 2ae55432fd
commit 89e48ebd48
6 changed files with 213 additions and 46 deletions

View File

@ -23,7 +23,7 @@
<property name="BROADCAST" value="BroadcastModule" />
<property name="CHAT" value="ChatModule" />
<property name="PRESENT" value="PresentModule" />
<property name="DESKSHARE" value="DeskShareModule" />
<!-- <property name="DESKSHARE" value="DeskShareModule" /> -->
<property name="DESKSHARE_SA" value="DeskshareStandalone" />
<property name="SCREENSHARE" value="ScreenshareModule" />
<property name="SCREENSHARE_SA" value="ScreenshareStandalone" />

View File

@ -40,10 +40,10 @@ package org.bigbluebutton.modules.screenshare.managers
public class WebRTCDeskshareManager {
private static const LOGGER:ILogger = getClassLogger(WebRTCDeskshareManager);
/*private var publishWindowManager:WebRTCPublishWindowManager;*/
/*private var viewWindowManager:WebRTCViewerWindowManager;*/
private var publishWindowManager:WebRTCPublishWindowManager;
private var viewWindowManager:WebRTCViewerWindowManager;
private var toolbarButtonManager:ToolbarButtonManager;
private var module:DeskShareModule;
private var module:ScreenshareModule;
private var service:WebRTCDeskshareService;
private var globalDispatcher:Dispatcher;
private var sharing:Boolean = false;
@ -55,15 +55,15 @@ package org.bigbluebutton.modules.screenshare.managers
JSLog.warn("WebRTCDeskshareManager::WebRTCDeskshareManager", {});
service = new WebRTCDeskshareService();
globalDispatcher = new Dispatcher();
/*publishWindowManager = new WebRTCPublishWindowManager(service);*/
/*viewWindowManager = new WebRTCViewerWindowManager(service);*/
publishWindowManager = new WebRTCPublishWindowManager(service);
viewWindowManager = new WebRTCViewerWindowManager(service);
}
public function handleStartModuleEvent(module:DeskShareModule):void {
LOGGER.debug("WebRTC Deskshare Module starting");
public function handleStartModuleEvent(module:ScreenshareModule):void {
LOGGER.debug("WebRTC Screenshare Module starting");
JSLog.warn("WebRTCDeskshareManager::handleStartModuleEvent", {});
this.module = module;
/*service.handleStartModuleEvent(module);*/
service.handleStartModuleEvent(module);
if (UsersUtil.amIPresenter()) {
initDeskshare();
@ -73,9 +73,9 @@ package org.bigbluebutton.modules.screenshare.managers
public function handleStopModuleEvent():void {
LOGGER.debug("WebRTC Deskshare Module stopping");
/*publishWindowManager.stopSharing();*/
/*viewWindowManager.stopViewing();*/
/*service.disconnect();*/
publishWindowManager.stopSharing();
viewWindowManager.stopViewing();
service.disconnect();
}
/*presenter stopped their program stream*/
@ -89,7 +89,7 @@ package org.bigbluebutton.modules.screenshare.managers
public function handleStreamStopEvent(args:Object):void {
LOGGER.debug("WebRTCDeskshareManager::handleStreamStopEvent");
JSLog.warn("WebRTCDeskshareManager::handleStreamStopEvent", {});
/*viewWindowManager.handleViewWindowCloseEvent();*/
viewWindowManager.handleViewWindowCloseEvent();
}
public function handleRequestStopSharingEvent():void {
@ -102,7 +102,7 @@ package org.bigbluebutton.modules.screenshare.managers
private function stopWebRTCDeskshare():void {
LOGGER.debug("WebRTCDeskshareManager::stopWebRTCDeskshare");
JSLog.warn("WebRTCDeskshareManager::stopWebRTCDeskshare", {});
/*viewWindowManager.stopViewing();*/
viewWindowManager.stopViewing();
globalDispatcher.dispatchEvent(new ShareWindowEvent(ShareWindowEvent.CLOSE));
@ -181,7 +181,7 @@ package org.bigbluebutton.modules.screenshare.managers
public function handleMadeViewerEvent(e:MadePresenterEvent):void{
LOGGER.debug("Got MadeViewerEvent ");
if (sharing) {
/*publishWindowManager.stopSharing();*/
publishWindowManager.stopSharing();
stopWebRTCDeskshare();
}
sharing = false;
@ -252,7 +252,7 @@ package org.bigbluebutton.modules.screenshare.managers
}
public function handleShareWindowCloseEvent():void {
/*publishWindowManager.handleShareWindowCloseEvent();*/
publishWindowManager.handleShareWindowCloseEvent();
sharing = false;
stopWebRTCDeskshare();
}
@ -260,20 +260,21 @@ package org.bigbluebutton.modules.screenshare.managers
public function handleViewWindowCloseEvent():void {
LOGGER.debug("Received stop viewing command");
JSLog.warn("WebRTCDeskshareManager::handleViewWindowCloseEvent", {});
/*viewWindowManager.handleViewWindowCloseEvent();*/
viewWindowManager.handleViewWindowCloseEvent();
}
public function handleStreamStartEvent(e:WebRTCViewStreamEvent):void{
JSLog.warn("WebRTCDeskshareManager::handleUseJavaModeCommand", {});
JSLog.warn("WebRTCDeskshareManager::handleStreamStartEvent rtmp=", e.rtmp);
// if (!usingWebRTC) { return; } //TODO this was causing issues
if (sharing) return; //TODO must uncomment this for the non-webrtc desktop share
var isPresenter:Boolean = UserManager.getInstance().getConference().amIPresenter;
JSLog.warn("WebRTCDeskshareManager::handleStreamStartEvent isPresenter=", isPresenter);
LOGGER.debug("Received start viewing command when isPresenter==[{0}]",[isPresenter]);
if(isPresenter) {
/*publishWindowManager.startViewing(e.rtmp, e.videoWidth, e.videoHeight);*/
publishWindowManager.startViewing(e.rtmp, e.videoWidth, e.videoHeight);
} else {
/*viewWindowManager.startViewing(e.rtmp, e.videoWidth, e.videoHeight);*/
viewWindowManager.startViewing(e.rtmp, e.videoWidth, e.videoHeight);
}
sharing = true; //TODO must uncomment this for the non-webrtc desktop share

View File

@ -0,0 +1,86 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2015 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 3.0 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.screenshare.managers
{
import com.asfusion.mate.events.Dispatcher;
import flash.events.TimerEvent;
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.modules.screenshare.services.WebRTCDeskshareService;
import org.bigbluebutton.modules.screenshare.view.components.WebRTCDesktopPublishWindow;
public class WebRTCPublishWindowManager {
private static const LOGGER:ILogger = getClassLogger(PublishWindowManager);
private var shareWindow:WebRTCDesktopPublishWindow;
private var globalDispatcher:Dispatcher;
private var service:WebRTCDeskshareService;
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 WebRTCPublishWindowManager(service:WebRTCDeskshareService) {
LOGGER.debug("PublishWindowManager init");
globalDispatcher = new Dispatcher();
this.service = service;
}
public function stopSharing():void {
if (shareWindow != null) shareWindow.stopSharing();
}
private function autopublishTimerHandler(event:TimerEvent):void {
shareWindow.shareScreen(true);
}
public function handleShareWindowCloseEvent():void {
closeWindow(shareWindow);
}
private function openWindow(window:IBbbModuleWindow):void {
var event:OpenWindowEvent = new OpenWindowEvent(OpenWindowEvent.OPEN_WINDOW_EVENT);
event.window = window;
globalDispatcher.dispatchEvent(event);
}
private function closeWindow(window:IBbbModuleWindow):void {
var event:CloseWindowEvent = new CloseWindowEvent(CloseWindowEvent.CLOSE_WINDOW_EVENT);
event.window = window;
globalDispatcher.dispatchEvent(event);
}
public function startViewing(rtmp:String, videoWidth:Number, videoHeight:Number):void{
shareWindow = new WebRTCDesktopPublishWindow();
shareWindow.visible = true;
openWindow(shareWindow);
shareWindow.startVideo(rtmp, videoWidth, videoHeight);
}
}
}

View File

@ -0,0 +1,78 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2015 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 3.0 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.screenshare.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.screenshare.services.WebRTCDeskshareService;
import org.bigbluebutton.modules.screenshare.view.components.WebRTCDesktopPublishWindow;
import org.bigbluebutton.modules.screenshare.view.components.WebRTCDesktopViewWindow;
public class WebRTCViewerWindowManager {
private static const LOGGER:ILogger = getClassLogger(ViewerWindowManager);
private var viewWindow:WebRTCDesktopViewWindow;
private var shareWindow:WebRTCDesktopPublishWindow;
private var service:WebRTCDeskshareService;
private var isViewing:Boolean = false;
private var globalDispatcher:Dispatcher;
public function WebRTCViewerWindowManager(service:WebRTCDeskshareService) {
this.service = service;
globalDispatcher = new Dispatcher();
}
public function stopViewing():void {
if (isViewing) viewWindow.stopViewing();
}
private function openWindow(window:IBbbModuleWindow):void{
var event:OpenWindowEvent = new OpenWindowEvent(OpenWindowEvent.OPEN_WINDOW_EVENT);
event.window = window;
globalDispatcher.dispatchEvent(event);
}
public function handleViewWindowCloseEvent():void {
LOGGER.debug("ViewerWindowManager Received stop viewing command");
closeWindow(viewWindow);
isViewing = false;
}
private function closeWindow(window:IBbbModuleWindow):void {
var event:CloseWindowEvent = new CloseWindowEvent(CloseWindowEvent.CLOSE_WINDOW_EVENT);
event.window = window;
globalDispatcher.dispatchEvent(event);
}
public function startViewing(rtmp:String, videoWidth:Number, videoHeight:Number):void{
LOGGER.debug("ViewerWindowManager::startViewing");
viewWindow = new WebRTCDesktopViewWindow();
viewWindow.startVideo(rtmp, videoWidth, videoHeight);
openWindow(viewWindow);
isViewing = true;
}
}
}

View File

@ -61,11 +61,11 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.modules.screenshare.events.WebRTCStreamEvent;
import org.bigbluebutton.modules.screenshare.events.WebRTCViewStreamEvent;
import org.bigbluebutton.modules.screenshare.model.ScreenshareOptions;
import org.bigbluebutton.modules.screenshare.services.red5.ConnectionEvent;
import org.bigbluebutton.modules.screenshare.services.red5.WebRTCConnectionEvent;
import org.bigbluebutton.util.i18n.ResourceUtil;
import org.bigbluebutton.main.api.JSLog;
<!-- private static const LOGGER:ILogger = getClassLogger(DesktopPublishWindow); -->
private static const LOGGER:ILogger = getClassLogger(WebRTCDesktopPublishWindow);
public static const SCALE:Number = 5;
private static const VID_HEIGHT_PAD:Number = 73;
@ -91,10 +91,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private var autoStart:Boolean = false;
private var globalDispatcher:Dispatcher = new Dispatcher();
[Bindable] private var dsOptions:DeskshareOptions;
[Bindable] private var dsOptions:ScreenshareOptions;
private function init():void {
dsOptions = new DeskshareOptions();
dsOptions = new ScreenshareOptions();
}
private function onCreationComplete():void {
@ -154,6 +154,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private function startSharing(connection:NetConnection, uri:String , useTLS:Boolean , room:String, fullScreen:Boolean):void {
var captureX:Number = 0;
var captureY:Number = 0;
}
public function stopSharing():void{
@ -176,10 +177,11 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
var myArray :Array = rtmp.split('/');
var meetingUrl:String = rtmp.substring(0, rtmp.lastIndexOf('/'));
stream = rtmp.substring(rtmp.lastIndexOf('/')+1, rtmp.length);
LOGGER.debug("DesktopPublishWindow::startVideo meetingurl=[{0}] and stream=[{1}]",[meetingUrl, stream]);
LOGGER.debug("WebRTCDesktopPublishWindow::startVideo meetingurl=[{0}] and stream=[{1}]",[meetingUrl, stream]);
JSLog.warn("WebRTCDesktopPublishWindow::startVideo meetingurl= ",meetingUrl);
JSLog.warn("WebRTCDesktopPublishWindow::startVideo stream=", stream);
JSLog.warn("DesktopPublishWindow::startVideo meetingurl= ",meetingUrl);
JSLog.warn("DesktopPublishWindow::startVideo stream=", stream);
connection = new NetConnection();
connection.proxyType = "best";
@ -192,34 +194,34 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
private function netStatusHandler(event:NetStatusEvent):void {
var ce:ConnectionEvent = new ConnectionEvent();
var ce:WebRTCConnectionEvent = new WebRTCConnectionEvent();
LOGGER.debug("netStatusHandler [{0}]",[event.info.code]);
switch(event.info.code){
case "NetConnection.Connect.Failed":
ce.status = ConnectionEvent.FAILED;
ce.status = WebRTCConnectionEvent.FAILED;
break;
case "NetConnection.Connect.Success":
ce.status = ConnectionEvent.SUCCESS;
ce.status = WebRTCConnectionEvent.SUCCESS;
startPreviewStream(stream, videoWidth, videoHeight);
break;
case "NetConnection.Connect.Rejected":
ce.status = ConnectionEvent.REJECTED;
ce.status = WebRTCConnectionEvent.REJECTED;
break;
case "NetConnection.Connect.Closed":
trace("Deskshare connection closed.");
ce.status = ConnectionEvent.CLOSED;
ce.status = WebRTCConnectionEvent.CLOSED;
break;
case "NetConnection.Connect.InvalidApp":
ce.status = ConnectionEvent.INVALIDAPP;
ce.status = WebRTCConnectionEvent.INVALIDAPP;
break;
case "NetConnection.Connect.AppShutdown":
ce.status = ConnectionEvent.APPSHUTDOWN;
ce.status = WebRTCConnectionEvent.APPSHUTDOWN;
break;
case "NetConnection.Connect.NetworkChange":
@ -230,7 +232,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
private function securityErrorHandler(event:SecurityErrorEvent):void {
LOGGER.debug("ERROR DesktopPublishWindow::securityErrorHandler ");
LOGGER.debug("ERROR WebRTCDesktopPublishWindow::securityErrorHandler ");
}
private function startPreviewStream(streamName:String, capWidth:Number, capHeight:Number):void{

View File

@ -50,7 +50,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.modules.screenshare.events.ViewWindowEvent;
import org.bigbluebutton.modules.screenshare.model.ScreenshareOptions;
import org.bigbluebutton.util.i18n.ResourceUtil;
import org.bigbluebutton.modules.screenshare.services.red5.ConnectionEvent;
import org.bigbluebutton.modules.screenshare.services.red5.WebRTCConnectionEvent;
public static const LOG:String = "Deskshare::DesktopViewWindow - ";
private var screenHeight:Number = Capabilities.screenResolutionY;
@ -67,7 +67,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private var videoHeight:Number;
private var videoWidth:Number;
<!-- private static const LOGGER:ILogger = getClassLogger(DesktopViewWindow); -->
private static const LOGGER:ILogger = getClassLogger(WebRTCDesktopViewWindow);
private static const VIDEO_WIDTH_PADDING:int = 7;
private static const VIDEO_HEIGHT_PADDING:int = 65;
@ -84,10 +84,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
[Bindable] private var baseIndex:int;
[Bindable] private var dsOptions:DeskshareOptions;
[Bindable] private var dsOptions:ScreenshareOptions;
private function init():void{
dsOptions = new DeskshareOptions();
dsOptions = new ScreenshareOptions();
}
private function displayVideo():void{
@ -163,34 +163,34 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private function netStatusHandler(event:NetStatusEvent):void {
// trace(LOG + "Connected to [" + getURI() + "]. [" + event.info.code + "]");
var ce:ConnectionEvent = new ConnectionEvent();
var ce:WebRTCConnectionEvent = new WebRTCConnectionEvent();
switch(event.info.code){
case "NetConnection.Connect.Failed":
ce.status = ConnectionEvent.FAILED;
ce.status = WebRTCConnectionEvent.FAILED;
break;
case "NetConnection.Connect.Success":
ce.status = ConnectionEvent.SUCCESS;
ce.status = WebRTCConnectionEvent.SUCCESS;
connectionSuccessHandler();
break;
case "NetConnection.Connect.Rejected":
ce.status = ConnectionEvent.REJECTED;
ce.status = WebRTCConnectionEvent.REJECTED;
break;
case "NetConnection.Connect.Closed":
trace(LOG + "Deskshare connection closed.");
ce.status = ConnectionEvent.CLOSED;
ce.status = WebRTCConnectionEvent.CLOSED;
break;
case "NetConnection.Connect.InvalidApp":
ce.status = ConnectionEvent.INVALIDAPP;
ce.status = WebRTCConnectionEvent.INVALIDAPP;
break;
case "NetConnection.Connect.AppShutdown":
ce.status = ConnectionEvent.APPSHUTDOWN;
ce.status = WebRTCConnectionEvent.APPSHUTDOWN;
break;
case "NetConnection.Connect.NetworkChange":