- fix issue where main view is duplicated

This commit is contained in:
Richard Alam 2018-03-20 15:03:17 -07:00
parent 826de08e2e
commit 2f0d250a5d
4 changed files with 46 additions and 16 deletions

View File

@ -8,11 +8,11 @@ package org.bigbluebutton.air.main.views {
override public function initialize():void {
trace("************ MainViewMediator:: INIT **************");
}
override public function destroy():void {
trace("************ MainViewMediator:: destroy **************");
}
}
}

View File

@ -94,6 +94,7 @@ package org.bigbluebutton.air.main.views {
} else if (uiSession && uiSession.currentPage.indexOf("Settings") > 0) {
uiSession.popPage();
} else {
trace("***** TopToolbarMediator:: Switching to MAIN PAGE");
uiSession.pushPage(PageEnum.MAIN);
}
}

View File

@ -1,6 +1,7 @@
package org.bigbluebutton.air.screenshare.views
{
import flash.events.AsyncErrorEvent;
import flash.events.Event;
import flash.events.NetStatusEvent;
import flash.events.StageVideoAvailabilityEvent;
import flash.media.StageVideoAvailability;
@ -18,32 +19,41 @@ package org.bigbluebutton.air.screenshare.views
private var _video:Video;
private var connection:NetConnection;
private var userId:String;
private var userName:String;
private var streamName:String;
private var originalVideoWidth:Number;
private var originalVideoHeight:Number;
public function ScreenshareView():void {
// Constructor for SimpleStageVideo class
// Make sure the app is visible and stage available
trace("************ ScreenshareView: constructor");
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
_video = new Video();
addChild(_video);
}
private function onAddedToStage(event:Event):void
{
// Video Events
// the StageVideoEvent.STAGE_VIDEO_STATE informs you whether
// StageVideo is available
trace("************ ScreenshareView: STAGE VIDEO onAddedToStage ");
stage.addEventListener(StageVideoAvailabilityEvent.STAGE_VIDEO_AVAILABILITY, onStageVideoState);
}
private function onStageVideoState(event:StageVideoAvailabilityEvent):void
{
var available:Boolean = (event.availability == StageVideoAvailability.AVAILABLE);
trace("STAGE VIDEO available=" + available);
trace("************ ScreenshareView: STAGE VIDEO available=" + available);
}
public function viewStream(conn:NetConnection, streamId:String, width:int, height:int):void {
trace("TODO: Need to implement viewing of screenshare stream");
// stage.addEventListener(StageVideoAvailabilityEvent.STAGE_VIDEO_AVAILABILITY, onStageVideoState);
trace("************ ScreenshareView: viewing of screenshare streamId=" + streamId + " w=" + width + " h=" + height);
if (stage == null) {
trace("************ ScreenshareView: STAGE IS NULL!!!!!!!!");
}
ns = new NetStream(conn);
ns.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, onAsyncError);
@ -67,7 +77,7 @@ package org.bigbluebutton.air.screenshare.views
private function onNetStatus(e:NetStatusEvent):void {
switch (e.info.code) {
case "NetStream.Publish.Start":
trace("NetStream.Publish.Start for broadcast stream " + streamName);
// trace("NetStream.Publish.Start for broadcast stream " + streamName);
break;
case "NetStream.Play.UnpublishNotify":
// close();
@ -92,5 +102,15 @@ package org.bigbluebutton.air.screenshare.views
public function onMetaData(info:Object):void {
trace("ScreenshareView::ScreenshareView width={0} height={1}", [info.width, info.height]);
}
public function dispose():void {
trace("************ ScreenshareView: dispose *********************");
if (stage != null) {
trace("************ ScreenshareView::dispose - remove listener ****************");
stage.removeEventListener(StageVideoAvailabilityEvent.STAGE_VIDEO_AVAILABILITY, onStageVideoState);
}
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage)
}
}
}

View File

@ -18,6 +18,7 @@ package org.bigbluebutton.air.screenshare.views
public var model:IScreenshareModel;
override public function initialize():void {
trace("************ ScreenshareViewMediator:: INIT **************");
model.screenshareStreamStartedSignal.add(viewStream);
model.screenshareStreamStoppedSignal.add(streamStopped);
}
@ -29,5 +30,13 @@ package org.bigbluebutton.air.screenshare.views
public function streamStopped(session:String, reason:String):void {
view.streamStopped(session, reason);
}
override public function destroy():void {
trace("************ ScreenshareViewMediator:: destroy **************");
model.screenshareStreamStartedSignal.remove(viewStream);
model.screenshareStreamStoppedSignal.remove(streamStopped);
view.dispose();
view = null;
}
}
}