Merge pull request #675 from ritzalam/reconnect-to-bbb-video
Reconnect to bbb video
This commit is contained in:
commit
fb94468edf
@ -24,28 +24,26 @@ package org.bigbluebutton.modules.videoconf.business
|
||||
import flash.events.IOErrorEvent;
|
||||
import flash.events.NetStatusEvent;
|
||||
import flash.events.SecurityErrorEvent;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.media.H264Level;
|
||||
import flash.media.H264Profile;
|
||||
import flash.media.H264VideoStreamSettings;
|
||||
import flash.net.NetConnection;
|
||||
import flash.net.NetStream;
|
||||
import flash.system.Capabilities;
|
||||
|
||||
import mx.collections.ArrayCollection;
|
||||
import flash.utils.Timer;
|
||||
|
||||
import org.bigbluebutton.common.LogUtil;
|
||||
import org.bigbluebutton.core.BBB;
|
||||
import org.bigbluebutton.core.UsersUtil;
|
||||
import org.bigbluebutton.core.managers.UserManager;
|
||||
import org.bigbluebutton.main.model.users.BBBUser;
|
||||
import org.bigbluebutton.main.model.users.events.StreamStartedEvent;
|
||||
import org.bigbluebutton.modules.videoconf.events.ConnectedEvent;
|
||||
import org.bigbluebutton.modules.videoconf.events.StartBroadcastEvent;
|
||||
import org.bigbluebutton.modules.videoconf.model.VideoConfOptions;
|
||||
|
||||
|
||||
public class VideoProxy
|
||||
{
|
||||
{
|
||||
public static const LOG:String = "VideoProxy - ";
|
||||
|
||||
public var videoOptions:VideoConfOptions;
|
||||
|
||||
private var nc:NetConnection;
|
||||
@ -53,7 +51,11 @@ package org.bigbluebutton.modules.videoconf.business
|
||||
private var _url:String;
|
||||
private var camerasPublishing:Object = new Object();
|
||||
private var connected:Boolean = false;
|
||||
|
||||
private var reconnect:Boolean = false;
|
||||
private var reconnecting:Boolean = false;
|
||||
|
||||
private var autoReconnectTimer:Timer = new Timer(1000, 1);
|
||||
|
||||
private function parseOptions():void {
|
||||
videoOptions = new VideoConfOptions();
|
||||
videoOptions.parseOptions();
|
||||
@ -61,7 +63,7 @@ package org.bigbluebutton.modules.videoconf.business
|
||||
|
||||
public function VideoProxy(url:String)
|
||||
{
|
||||
_url = url;
|
||||
_url = url;
|
||||
parseOptions();
|
||||
nc = new NetConnection();
|
||||
nc.proxyType = "best";
|
||||
@ -69,34 +71,51 @@ package org.bigbluebutton.modules.videoconf.business
|
||||
nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR, onAsyncError);
|
||||
nc.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
|
||||
nc.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
|
||||
nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError);
|
||||
|
||||
nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError);
|
||||
}
|
||||
|
||||
public function connect():void {
|
||||
nc.connect(_url, UsersUtil.getInternalMeetingID(), UsersUtil.getMyUserID());
|
||||
}
|
||||
|
||||
public function reconnectWhenDisconnected(connect:Boolean):void {
|
||||
reconnect = connect;
|
||||
}
|
||||
|
||||
public function connect():void {
|
||||
nc.connect(_url, UsersUtil.getInternalMeetingID(), UsersUtil.getMyUserID());
|
||||
}
|
||||
|
||||
private function onAsyncError(event:AsyncErrorEvent):void{
|
||||
trace("VIDEO WEBCAM onAsyncError");
|
||||
}
|
||||
|
||||
private function onIOError(event:NetStatusEvent):void{
|
||||
trace("VIDEO WEBCAM onIOError");
|
||||
}
|
||||
|
||||
private function onConnectedToVideoApp():void{
|
||||
var dispatcher:Dispatcher = new Dispatcher();
|
||||
dispatcher.dispatchEvent(new ConnectedEvent(ConnectedEvent.VIDEO_CONNECTED));
|
||||
dispatcher.dispatchEvent(new ConnectedEvent(reconnecting));
|
||||
reconnecting = false;
|
||||
}
|
||||
|
||||
private function onNetStatus(event:NetStatusEvent):void{
|
||||
trace("[" + event.info.code + "] for [" + _url + "]");
|
||||
switch(event.info.code){
|
||||
case "NetConnection.Connect.Success":
|
||||
connected = true;
|
||||
//ns = new NetStream(nc);
|
||||
onConnectedToVideoApp();
|
||||
onConnectedToVideoApp();
|
||||
break;
|
||||
default:
|
||||
case "NetStream.Play.Failed":
|
||||
disconnect();
|
||||
break;
|
||||
case "NetStream.Play.Stop":
|
||||
disconnect();
|
||||
break;
|
||||
case "NetConnection.Connect.Closed":
|
||||
disconnect();
|
||||
break;
|
||||
default:
|
||||
LogUtil.debug("[" + event.info.code + "] for [" + _url + "]");
|
||||
trace("[" + event.info.code + "] for [" + _url + "]");
|
||||
connected = false;
|
||||
break;
|
||||
}
|
||||
@ -110,7 +129,7 @@ package org.bigbluebutton.modules.videoconf.business
|
||||
}
|
||||
|
||||
public function startPublishing(e:StartBroadcastEvent):void{
|
||||
var ns:NetStream = new NetStream(nc);
|
||||
ns = new NetStream(nc);
|
||||
ns.addEventListener( NetStatusEvent.NET_STATUS, onNetStatus );
|
||||
ns.addEventListener( IOErrorEvent.IO_ERROR, onIOError );
|
||||
ns.addEventListener( AsyncErrorEvent.ASYNC_ERROR, onAsyncError );
|
||||
@ -178,9 +197,21 @@ package org.bigbluebutton.modules.videoconf.business
|
||||
}
|
||||
|
||||
public function disconnect():void {
|
||||
trace("VideoProxy:: disconnecting from Video application");
|
||||
stopAllBroadcasting();
|
||||
trace("VideoProxy:: disconnecting from Video application");
|
||||
stopAllBroadcasting();
|
||||
if (nc != null) nc.close();
|
||||
|
||||
if (reconnect) {
|
||||
var reconnectTimer:Timer = new Timer(1000, 1);
|
||||
reconnectTimer.addEventListener("timer", reconnectTimerHandler);
|
||||
reconnectTimer.start();
|
||||
}
|
||||
}
|
||||
|
||||
private function reconnectTimerHandler(event:TimerEvent):void {
|
||||
trace(LOG + "rtmptRetryTimerHandler: " + event);
|
||||
reconnecting = true;
|
||||
connect();
|
||||
}
|
||||
|
||||
public function onBWCheck(... rest):Number {
|
||||
|
@ -24,9 +24,12 @@ package org.bigbluebutton.modules.videoconf.events
|
||||
{
|
||||
public static const VIDEO_CONNECTED:String = "connected to video app event";
|
||||
|
||||
public function ConnectedEvent(type:String, bubbles:Boolean=true, cancelable:Boolean=false)
|
||||
public var reconnection:Boolean = false;
|
||||
|
||||
public function ConnectedEvent(reconnection:Boolean)
|
||||
{
|
||||
super(type, bubbles, cancelable);
|
||||
super(VIDEO_CONNECTED, true, false);
|
||||
this.reconnection = reconnection;
|
||||
}
|
||||
}
|
||||
}
|
@ -38,8 +38,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
import org.bigbluebutton.modules.videoconf.events.StopBroadcastEvent;
|
||||
import org.bigbluebutton.modules.videoconf.events.StopShareCameraRequestEvent;
|
||||
import org.bigbluebutton.modules.videoconf.events.VideoModuleStartEvent;
|
||||
import org.bigbluebutton.modules.videoconf.events.VideoModuleStopEvent;
|
||||
import org.bigbluebutton.modules.videoconf.events.WebRTCWebcamRequestEvent;
|
||||
import org.bigbluebutton.modules.videoconf.events.VideoModuleStopEvent;
|
||||
]]>
|
||||
</mx:Script>
|
||||
|
||||
@ -58,7 +57,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{ConnectAppEvent.CONNECT_VIDEO_APP}">
|
||||
<MethodInvoker generator="{VideoEventMapDelegate}" method="connectToVideoApp" />
|
||||
<MethodInvoker generator="{VideoEventMapDelegate}" method="connectToVideoApp"/>
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{ShareCameraRequestEvent.SHARE_CAMERA_REQUEST}">
|
||||
@ -111,7 +110,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{ConnectedEvent.VIDEO_CONNECTED}">
|
||||
<MethodInvoker generator="{VideoEventMapDelegate}" method="connectedToVideoApp" />
|
||||
<MethodInvoker generator="{VideoEventMapDelegate}" method="connectedToVideoApp" arguments="{event}"/>
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{ClosePublishWindowEvent.CLOSE_PUBLISH_WINDOW}">
|
||||
|
18
bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/maps/VideoEventMapDelegate.as
Normal file → Executable file
18
bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/maps/VideoEventMapDelegate.as
Normal file → Executable file
@ -153,14 +153,13 @@ package org.bigbluebutton.modules.videoconf.maps
|
||||
}
|
||||
|
||||
private function addToolbarButton():void{
|
||||
LogUtil.debug("****************** Adding toolbar button. presenter?=[" + UsersUtil.amIPresenter() + "]");
|
||||
if (proxy.videoOptions.showButton) {
|
||||
|
||||
if (proxy.videoOptions.showButton) {
|
||||
displayToolbarButton();
|
||||
|
||||
var event:ToolbarButtonEvent = new ToolbarButtonEvent(ToolbarButtonEvent.ADD);
|
||||
event.button = button;
|
||||
event.module="Webcam";
|
||||
event.module="Webcam";
|
||||
_dispatcher.dispatchEvent(event);
|
||||
}
|
||||
}
|
||||
@ -284,6 +283,7 @@ package org.bigbluebutton.modules.videoconf.maps
|
||||
|
||||
public function connectToVideoApp():void {
|
||||
proxy = new VideoProxy(uri);
|
||||
proxy.reconnectWhenDisconnected(true);
|
||||
proxy.connect();
|
||||
}
|
||||
|
||||
@ -423,6 +423,7 @@ package org.bigbluebutton.modules.videoconf.maps
|
||||
public function stopModule():void {
|
||||
trace("VideoEventMapDelegate:: stopping video module");
|
||||
closeAllWindows();
|
||||
proxy.reconnectWhenDisconnected(false);
|
||||
proxy.disconnect();
|
||||
}
|
||||
|
||||
@ -455,11 +456,16 @@ package org.bigbluebutton.modules.videoconf.maps
|
||||
}
|
||||
}
|
||||
|
||||
public function connectedToVideoApp():void{
|
||||
public function connectedToVideoApp(event: ConnectedEvent):void{
|
||||
trace("VideoEventMapDelegate:: [" + me + "] Connected to video application.");
|
||||
_ready = true;
|
||||
addToolbarButton();
|
||||
openWebcamWindows();
|
||||
if (event.reconnection) {
|
||||
closeAllWindows()
|
||||
} else {
|
||||
addToolbarButton();
|
||||
openWebcamWindows();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function handleCameraSetting(event:BBBEvent):void {
|
||||
|
@ -39,14 +39,11 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
import mx.controls.Menu;
|
||||
import mx.events.MenuEvent;
|
||||
import mx.styles.StyleManager;
|
||||
import mx.styles.IStyleManager2;
|
||||
|
||||
import org.bigbluebutton.common.Images;
|
||||
import mx.styles.IStyleManager2;
|
||||
import org.bigbluebutton.core.events.LockControlEvent;
|
||||
import org.bigbluebutton.core.managers.UserManager;
|
||||
import org.bigbluebutton.main.events.BBBEvent;
|
||||
@ -54,9 +51,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
import org.bigbluebutton.main.model.users.BBBUser;
|
||||
import org.bigbluebutton.main.model.users.Conference;
|
||||
import org.bigbluebutton.main.views.MainToolbar;
|
||||
import org.bigbluebutton.modules.videoconf.events.ClosePublishWindowEvent;
|
||||
import org.bigbluebutton.modules.videoconf.events.ShareCameraRequestEvent;
|
||||
import org.bigbluebutton.modules.videoconf.events.StopBroadcastEvent;
|
||||
import org.bigbluebutton.modules.videoconf.events.StopShareCameraRequestEvent;
|
||||
import org.bigbluebutton.util.i18n.ResourceUtil;
|
||||
|
||||
|
@ -50,11 +50,11 @@ class UrlMappings {
|
||||
}
|
||||
|
||||
"/api/getMeetings"(controller:"api") {
|
||||
action = [GET:'getMeetingsHandler']
|
||||
action = [GET:'getMeetingsHandler', POST:'getMeetingsHandler']
|
||||
}
|
||||
|
||||
"/api/getRecordings"(controller:"api") {
|
||||
action = [GET:'getRecordingsHandler']
|
||||
action = [GET:'getRecordingsHandler', POST:'getRecordingsHandler']
|
||||
}
|
||||
|
||||
"/$controller/$action?/$id?(.${format})?"{
|
||||
|
Loading…
Reference in New Issue
Block a user