From 69224af37929756afddd283471d466f382388f83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Francisco=20Siebel?= <jfsiebel@gmail.com> Date: Fri, 29 Jun 2018 11:47:11 -0300 Subject: [PATCH] add progress bar when a screen share started --- .../air/common/views/IOSVideoView.as | 6 +- .../screenshare/views/IOSScreenshareView.as | 82 ++++++++++++++++--- 2 files changed, 77 insertions(+), 11 deletions(-) mode change 100644 => 100755 clients/flash/air-client/src/org/bigbluebutton/air/screenshare/views/IOSScreenshareView.as diff --git a/clients/flash/air-client/src/org/bigbluebutton/air/common/views/IOSVideoView.as b/clients/flash/air-client/src/org/bigbluebutton/air/common/views/IOSVideoView.as index d7f29e46f3..4054d71ce0 100755 --- a/clients/flash/air-client/src/org/bigbluebutton/air/common/views/IOSVideoView.as +++ b/clients/flash/air-client/src/org/bigbluebutton/air/common/views/IOSVideoView.as @@ -1,4 +1,6 @@ package org.bigbluebutton.air.common.views { + import mx.formatters.DateFormatter; + import spark.components.Image; import org.bigbluebutton.BBBRtmpPlayer; @@ -7,6 +9,7 @@ package org.bigbluebutton.air.common.views { public class IOSVideoView extends VideoBaseView { protected var player:BBBRtmpPlayer; + protected var dateFormat:DateFormatter = new DateFormatter("Y-MM-DD J:NN:SS:QQ"); private function get image():Image { return videoComp as Image; @@ -39,11 +42,12 @@ package org.bigbluebutton.air.common.views { } private function onConnected(e:BBBRtmpPlayerEvent):void { + trace(dateFormat.format(new Date()) + " EVENT: " + e.type + " MESSAGE: " + e.getMessage()); image.source = player.getBmpData(); } private function onConnecting(e:BBBRtmpPlayerEvent):void { - trace("EVENT: " + e.type + " MESSAGE: " + e.getMessage()); + trace(dateFormat.format(new Date()) + " EVENT: " + e.type + " MESSAGE: " + e.getMessage()); } private function onConnectionFailed(e:BBBRtmpPlayerEvent):void { diff --git a/clients/flash/air-client/src/org/bigbluebutton/air/screenshare/views/IOSScreenshareView.as b/clients/flash/air-client/src/org/bigbluebutton/air/screenshare/views/IOSScreenshareView.as old mode 100644 new mode 100755 index a7775d65ff..0897b15913 --- a/clients/flash/air-client/src/org/bigbluebutton/air/screenshare/views/IOSScreenshareView.as +++ b/clients/flash/air-client/src/org/bigbluebutton/air/screenshare/views/IOSScreenshareView.as @@ -4,12 +4,13 @@ package org.bigbluebutton.air.screenshare.views { import flash.utils.Timer; import mx.core.UIComponent; + import mx.formatters.DateFormatter; import spark.components.Image; import spark.components.ProgressBar; import org.bigbluebutton.BBBRtmpPlayer; - import org.bigbluebutton.BBBRtmpPlayerEvent; + import org.bigbluebutton.BBBRtmpPlayerEvent; // FIXME : Work in progress class, needs behave like Android screensahring display public class IOSScreenshareView extends UIComponent { @@ -22,14 +23,51 @@ package org.bigbluebutton.air.screenshare.views { protected var originalVideoHeight:Number; private var _waitingBar : ProgressBar; - + private var _waitingTimer : Timer; private const WAITING_SECONDS : int = 15; + protected var dateFormat:DateFormatter = new DateFormatter("Y-MM-DD J:NN:SS:QQ"); + private function waitingTimerProgressHandler(e:TimerEvent):void { - _waitingBar.totalProgress = (_waitingTimer.currentCount / WAITING_SECONDS) * 100; + trace("PROGRESS " + _waitingTimer.currentCount); + _waitingBar.currentProgress = _waitingTimer.currentCount; } + + public function resizeForProgressBar():void { + // if we have device where screen width less than screen height e.g. phone + if (width < height) { + // make the video width full width of the screen + _waitingBar.width = width; + // calculate height based on a video width, it order to keep the same aspect ratio + _waitingBar.height = (_waitingBar.width / originalVideoWidth) * originalVideoHeight; + // if calculated height appeared to be bigger than screen height, recalculuate the video size based on width + if (height < _waitingBar.height) { + // make the video height full height of the screen + _waitingBar.height = height; + // calculate width based on a video height, it order to keep the same aspect ratio + _waitingBar.width = ((originalVideoWidth * _waitingBar.height) / originalVideoHeight); + } + } // if we have device where screen height less than screen width e.g. tablet + else { + // make the video height full height of the screen + _waitingBar.height = height; + // calculate width based on a video height, it order to keep the same aspect ratio + _waitingBar.width = ((originalVideoWidth * _waitingBar.height) / originalVideoHeight); + // if calculated width appeared to be bigger than screen width, recalculuate the video size based on height + if (width < _waitingBar.width) { + // make the video width full width of the screen + _waitingBar.width = width; + // calculate height based on a video width, it order to keep the same aspect ratio + _waitingBar.height = (_waitingBar.width / originalVideoWidth) * originalVideoHeight; + } + } + + _waitingBar.x = width - _waitingBar.width; + _waitingBar.y = height - _waitingBar.height; + } + public function resizeForPortrait():void { // if we have device where screen width less than screen height e.g. phone @@ -70,8 +108,24 @@ package org.bigbluebutton.air.screenshare.views { public function startStream(uri:String, streamName:String, imgWidth:Number, imgHeight:Number, meetingId:String, authToken:String, externalUserId:String):void { - showProgressBar(); + _waitingBar = new ProgressBar(); + + _waitingBar.width = imgWidth; + _waitingBar.height = imgWidth; + + _waitingBar.currentProgress = 0; + _waitingBar.totalProgress = WAITING_SECONDS; + _waitingBar.percentWidth = 80; + _waitingBar.percentHeight = 100; + _waitingBar.bottom = 20; + _waitingBar.styleName = "micLevelProgressBar"; + + addChild(_waitingBar); + + _waitingTimer = new Timer(1000, WAITING_SECONDS); + _waitingTimer.addEventListener(TimerEvent.TIMER, waitingTimerProgressHandler); + if (player) { close(); } @@ -94,11 +148,12 @@ package org.bigbluebutton.air.screenshare.views { player.play(); } - private function showProgressBar() : void { +/* private function showProgressBar() : void { _waitingBar = new ProgressBar(); - _waitingBar.totalProgress = 0; + _waitingBar.currentProgress = 0; + _waitingBar.totalProgress = 100; _waitingBar.percentWidth = 80; - _waitingBar.height = 40; + _waitingBar.percentHeight = 100; _waitingBar.bottom = 20; _waitingBar.horizontalCenter = 0; _waitingBar.verticalCenter = 0; @@ -110,10 +165,12 @@ package org.bigbluebutton.air.screenshare.views { _waitingTimer.addEventListener(TimerEvent.TIMER, waitingTimerProgressHandler); _waitingTimer.start(); } - +*/ private function onConnected(e:BBBRtmpPlayerEvent):void { - trace("EVENT: " + e.type + " MESSAGE: " + e.getMessage()); + trace(dateFormat.format(new Date()) + " EVENT: " + e.type + " MESSAGE: " + e.getMessage()); if (_waitingBar && _waitingBar.parent == this) { + _waitingTimer.removeEventListener(TimerEvent.TIMER, waitingTimerProgressHandler); + _waitingBar.currentProgress = WAITING_SECONDS; removeChild(_waitingBar); } if (image) { @@ -122,7 +179,8 @@ package org.bigbluebutton.air.screenshare.views { } private function onConnecting(e:BBBRtmpPlayerEvent):void { - trace("EVENT: " + e.type + " MESSAGE: " + e.getMessage()); + trace(dateFormat.format(new Date()) + " EVENT: " + e.type + " MESSAGE: " + e.getMessage()); + _waitingTimer.start(); } private function onConnectionFailed(e:BBBRtmpPlayerEvent):void { @@ -152,6 +210,10 @@ package org.bigbluebutton.air.screenshare.views { override protected function updateDisplayList(w:Number, h:Number):void { super.updateDisplayList(w, h); + if (_waitingBar) { + resizeForProgressBar(); + } + if (player) { resizeForPortrait(); } -- GitLab