Add close function,
Bug: When Closing one windows sometimes all windows are closed
This commit is contained in:
parent
53dd085410
commit
36b2214f4a
@ -74,6 +74,7 @@ package org.bigbluebutton.modules.videoconf.maps
|
||||
private var _isWaitingActivation:Boolean = false;
|
||||
private var streamList:ArrayList = new ArrayList();
|
||||
private var numberOfWindows:Object = new Object();
|
||||
|
||||
|
||||
public function VideoEventMapDelegate(dispatcher:IEventDispatcher)
|
||||
{
|
||||
@ -242,6 +243,26 @@ package org.bigbluebutton.modules.videoconf.maps
|
||||
trace("VideoEventMapDelegate:: [" + me + "] closeWindow:: Not Closing. No window for [" + userID + "] [" + UsersUtil.getUserName(userID) + "]");
|
||||
}
|
||||
}
|
||||
|
||||
private function closeWindowWithStream(userID:String, stream:String):int {
|
||||
var camIndex:int = -1;
|
||||
var listOfWindows:ArrayList = webcamWindows.getAllWindow(userID);
|
||||
for(var i:int = 0; i < listOfWindows.length; i++) {
|
||||
var win:VideoWindowItf = VideoWindowItf(listOfWindows.getItemAt(i));
|
||||
if(win != null) {
|
||||
if(PublishWindow(win).getStreamName() == stream) {
|
||||
camIndex = PublishWindow(win).camIndex;
|
||||
webcamWindows.removeWin(win);
|
||||
trace("VideoEventMapDelegate:: [" + me + "] closeWindow:: Closing [" + win.getWindowType() + "] for [" + userID + "] [" + UsersUtil.getUserName(userID) + "]");
|
||||
win.close();
|
||||
var cwe:CloseWindowEvent = new CloseWindowEvent();
|
||||
cwe.window = win;
|
||||
_dispatcher.dispatchEvent(cwe);
|
||||
}
|
||||
}
|
||||
}
|
||||
return camIndex;
|
||||
}
|
||||
|
||||
private function openViewWindowFor(userID:String):void {
|
||||
trace("VideoEventMapDelegate:: [" + me + "] openViewWindowFor:: Opening VIEW window for [" + userID + "] [" + UsersUtil.getUserName(userID) + "]");
|
||||
@ -295,7 +316,6 @@ package org.bigbluebutton.modules.videoconf.maps
|
||||
UsersUtil.setIAmPublishing(true);
|
||||
|
||||
var broadcastEvent:BroadcastStartedEvent = new BroadcastStartedEvent();
|
||||
//broadcastEvent.stream = e.stream;
|
||||
if(streamList.length == 0) {
|
||||
streamList.addItem(e.stream);
|
||||
broadcastEvent.stream = e.stream;
|
||||
@ -316,9 +336,12 @@ package org.bigbluebutton.modules.videoconf.maps
|
||||
}
|
||||
|
||||
public function stopPublishing(e:StopBroadcastEvent):void{
|
||||
LogUtil.debug("FECHANDO UMA PUBLISH WINDOW 2");
|
||||
trace("VideoEventMapDelegate:: [" + me + "] Stop publishing. ready = [" + _ready + "]");
|
||||
stopBroadcasting(e.stream);
|
||||
|
||||
if(streamList.length <= 1) {
|
||||
stopBroadcasting(e.stream);
|
||||
setStopAllBroadcasting();
|
||||
streamList.removeItem(e.stream);
|
||||
var broadcastEvent:BroadcastStoppedEvent = new BroadcastStoppedEvent();
|
||||
broadcastEvent.stream = e.stream;
|
||||
@ -326,22 +349,46 @@ package org.bigbluebutton.modules.videoconf.maps
|
||||
_dispatcher.dispatchEvent(broadcastEvent);
|
||||
}
|
||||
else {
|
||||
stopOneStreamBroadCasting(e.stream);
|
||||
streamList.removeItem(e.stream);
|
||||
var broadcastStartEvent:BroadcastStartedEvent = new BroadcastStartedEvent();
|
||||
var myPattern:RegExp = /,/g;
|
||||
broadcastStartEvent.stream = streamList.toString().replace(myPattern, "|");
|
||||
broadcastStartEvent.userid = UsersUtil.getMyUserID();
|
||||
broadcastStartEvent.isPresenter = UsersUtil.amIPresenter();
|
||||
UsersUtil.setIAmPublishing(true);
|
||||
broadcastStartEvent.camSettings = UsersUtil.amIPublishing();
|
||||
_dispatcher.dispatchEvent(broadcastStartEvent);
|
||||
}
|
||||
}
|
||||
|
||||
private function setStopAllBroadcasting():void {
|
||||
_isPublishing = false;
|
||||
UsersUtil.setIAmPublishing(false);
|
||||
}
|
||||
|
||||
private function stopOneStreamBroadCasting(stream:String):void {
|
||||
proxy.stopBroadcasting(stream);
|
||||
var camId:int = closeWindowWithStream(UsersUtil.getMyUserID(), streamName);
|
||||
|
||||
if (proxy.videoOptions.showButton) {
|
||||
//Make toolbar button enabled again
|
||||
button.publishingStatus(button.STOP_PUBLISHING, camId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (options.displayAvatar) {
|
||||
trace("VideoEventMapDelegate:: [" + me + "] Opening avatar");
|
||||
openAvatarWindowFor(UsersUtil.getMyUserID());
|
||||
}
|
||||
}
|
||||
|
||||
private function stopBroadcasting(stream:String):void {
|
||||
trace("Stopping broadcast of webcam");
|
||||
|
||||
proxy.stopBroadcasting(stream);
|
||||
|
||||
_isPublishing = false;
|
||||
UsersUtil.setIAmPublishing(false);
|
||||
var broadcastEvent:BroadcastStoppedEvent = new BroadcastStoppedEvent();
|
||||
broadcastEvent.stream = streamName;
|
||||
broadcastEvent.userid = UsersUtil.getMyUserID();
|
||||
@ -349,13 +396,14 @@ package org.bigbluebutton.modules.videoconf.maps
|
||||
_dispatcher.dispatchEvent(broadcastEvent);
|
||||
|
||||
|
||||
|
||||
var camId:int = closeWindowWithStream(UsersUtil.getMyUserID(), streamName);
|
||||
|
||||
if (proxy.videoOptions.showButton) {
|
||||
//Make toolbar button enabled again
|
||||
button.publishingStatus(button.STOP_PUBLISHING);
|
||||
button.publishingStatus(button.STOP_PUBLISHING, camId);
|
||||
}
|
||||
|
||||
closeWindow(UsersUtil.getMyUserID());
|
||||
|
||||
|
||||
if (options.displayAvatar) {
|
||||
trace("VideoEventMapDelegate:: [" + me + "] Opening avatar");
|
||||
@ -367,6 +415,7 @@ package org.bigbluebutton.modules.videoconf.maps
|
||||
//if (_isPublishing) {
|
||||
// stopBroadcasting();
|
||||
//}
|
||||
LogUtil.debug("FECHANDO UMA PUBLISH WINDOW");
|
||||
}
|
||||
|
||||
public function handleShareCameraRequestEvent(event:ShareCameraRequestEvent):void {
|
||||
|
@ -77,7 +77,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
[Bindable] private var defaultHeight:Number = 240;
|
||||
|
||||
|
||||
public var camIndex:int = 0;
|
||||
public var camIndex:int = -5;
|
||||
private var camWidth:Number = 320;
|
||||
private var camHeight:Number = 240;
|
||||
private var _camera:Camera = null;
|
||||
@ -178,6 +178,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
private function handleNewRoleEvent(event:Event):void {
|
||||
updateControlButtons();
|
||||
}
|
||||
|
||||
public function getStreamName():String {
|
||||
return this.streamName;
|
||||
}
|
||||
|
||||
private function handleUserVoiceMutedEvent(event:BBBEvent):void {
|
||||
if (event.payload.userID == userID) {
|
||||
@ -367,7 +371,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
super.onResize();
|
||||
|
||||
if (_videoHolder != null) {
|
||||
if (_videoHolder != null && _video != null) {
|
||||
|
||||
fitVideoToWindow();
|
||||
|
||||
@ -378,10 +382,12 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
}
|
||||
|
||||
private function fitVideoToWindow():void {
|
||||
if (_videoHolder.width - PADDING_HORIZONTAL < _videoHolder.height - PADDING_VERTICAL) {
|
||||
fitToHeightAndAdjustWidthToMaintainAspectRatio();
|
||||
} else {
|
||||
fitToWidthAndAdjustHeightToMaintainAspectRatio();
|
||||
if (_video != null || _videoHolder != null) {
|
||||
if (_videoHolder.width - PADDING_HORIZONTAL < _videoHolder.height - PADDING_VERTICAL) {
|
||||
fitToHeightAndAdjustWidthToMaintainAspectRatio();
|
||||
} else {
|
||||
fitToWidthAndAdjustHeightToMaintainAspectRatio();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,8 +94,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
dispatchEvent(new ShortcutEvent(ShortcutEvent.REMOTE_FOCUS_WEBCAM));
|
||||
}
|
||||
|
||||
public function publishingStatus(status:Number):void {
|
||||
if(status == START_PUBLISHING) {
|
||||
public function publishingStatus(status:Number, camID:Number = -1):void {
|
||||
if(status == START_PUBLISHING) {
|
||||
this.enabled = true;
|
||||
_currentState = ON_STATE;
|
||||
//this.toolTip = ResourceUtil.getInstance().getString('bbb.toolbar.video.toolTip.stop');
|
||||
camIcon = images.webcamOn;
|
||||
@ -104,17 +105,14 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
//dp[cameraId].icon = images.webcamOn;
|
||||
//dp[cameraId].status = ON_STATE;
|
||||
//dp[cameraId].publishWindowIndex = publishWindowIndex;
|
||||
numberOfCamerasOff = numberOfCamerasOff - 1;
|
||||
numberOfCamerasOff--;
|
||||
}
|
||||
else {
|
||||
//if(cameraId != null) {
|
||||
// dp[cameraId].icon = images.webcam;
|
||||
// dp[cameraId].status = OFF_STATE;
|
||||
// if(cameraIsOff[cameraId] == false) {
|
||||
// cameraIsOff[cameraId] = true;
|
||||
// numberOfCamerasOff = numberOfCamerasOff + 1;
|
||||
// }
|
||||
//}
|
||||
if(camID != -1) {
|
||||
dp[camID].icon = images.webcam;
|
||||
dp[camID].status = OFF_STATE;
|
||||
numberOfCamerasOff++;
|
||||
}
|
||||
if(numberOfCamerasOff == Camera.names.length) {
|
||||
_currentState = OFF_STATE;
|
||||
//this.toolTip = ResourceUtil.getInstance().getString('bbb.toolbar.video.toolTip.start');
|
||||
@ -142,6 +140,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
//this.toolTip = ResourceUtil.getInstance().getString('bbb.toolbar.video.toolTip.stop');
|
||||
camIcon = images.webcamOn;
|
||||
this.selected = true;
|
||||
this.enabled = false;
|
||||
var shareCameraRequestEvent:ShareCameraRequestEvent = new ShareCameraRequestEvent();
|
||||
dispatchEvent(shareCameraRequestEvent);
|
||||
}
|
||||
@ -180,6 +179,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
}
|
||||
|
||||
private function changeHandler(event:MenuEvent):void {
|
||||
this.enabled = false;
|
||||
if(dp[event.index].status == ON_STATE) {
|
||||
/*var close_evt:ClosePublishWindowEvent = new ClosePublishWindowEvent();
|
||||
close_evt.cameraId = String(event.index);
|
||||
@ -193,7 +193,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
evt.defaultCamera = String(event.index);
|
||||
dispatchEvent(evt);
|
||||
this.enabled = false;*/
|
||||
|
||||
|
||||
var shareCameraRequestEvent:ShareCameraRequestEvent = new ShareCameraRequestEvent();
|
||||
shareCameraRequestEvent.defaultCamera = String(event.index);
|
||||
shareCameraRequestEvent.camerasArray = dp;
|
||||
|
Loading…
Reference in New Issue
Block a user