You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2018/07/19 05:04:24 UTC

[openmeetings] branch 4.0.x updated: [OPENMEETINGS-1142] video is centered after aspect ratio is applied

This is an automated email from the ASF dual-hosted git repository.

solomax pushed a commit to branch 4.0.x
in repository https://gitbox.apache.org/repos/asf/openmeetings.git


The following commit(s) were added to refs/heads/4.0.x by this push:
     new 0f88823  [OPENMEETINGS-1142] video is centered after aspect ratio is applied
0f88823 is described below

commit 0f8882380b2532b458457615208f6da84ca64e5e
Author: Maxim Solodovnik <so...@gmail.com>
AuthorDate: Thu Jul 19 12:04:14 2018 +0700

    [OPENMEETINGS-1142] video is centered after aspect ratio is applied
---
 openmeetings-flash/src/main/flex/main.mxml         |  2 +-
 .../main/flex/org/apache/openmeetings/OmVideo.as   | 28 ++++++++++++++++++++--
 2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/openmeetings-flash/src/main/flex/main.mxml b/openmeetings-flash/src/main/flex/main.mxml
index 97d0517..53c6432 100644
--- a/openmeetings-flash/src/main/flex/main.mxml
+++ b/openmeetings-flash/src/main/flex/main.mxml
@@ -407,7 +407,7 @@
 				}
 				debug("vidResize:: " + _width + "x" + _height + "->" + w + "x" + h);
 			}
-			_resize(w, h);
+			_resize(_width, _height);
 			video.vidResize(w, h);
 		}
 
diff --git a/openmeetings-flash/src/main/flex/org/apache/openmeetings/OmVideo.as b/openmeetings-flash/src/main/flex/org/apache/openmeetings/OmVideo.as
index 01aa560..dd04138 100644
--- a/openmeetings-flash/src/main/flex/org/apache/openmeetings/OmVideo.as
+++ b/openmeetings-flash/src/main/flex/org/apache/openmeetings/OmVideo.as
@@ -17,6 +17,7 @@
  * under the License.
  */
 package org.apache.openmeetings {
+import flash.display.Graphics;
 import flash.events.AsyncErrorEvent;
 import flash.events.NetStatusEvent;
 import flash.events.IOErrorEvent;
@@ -46,6 +47,7 @@ public class OmVideo {
 	private var nc:NetConnection;
 	private var ns:NetStream;
 	private var mic:Microphone;
+	private var cam:Camera;
 	public var width:int;
 	public var height:int;
 	private var mode:String;
@@ -80,16 +82,35 @@ public class OmVideo {
 		debug("resize:: " + _width + "x" + _height);
 		this.width = ui.width = _width;
 		this.height = ui.height = _height;
+		var g:Graphics = ui.graphics;
+		if (!!cam && !cam.muted) {
+			g.beginFill(0x000000, 1);
+			g.drawRect(0, 0, _width, _height);
+			g.endFill();
+		} else {
+			g.clear();
+		}
 	}
 
 	public function vidResize(_width:int, _height:int):void {
 		debug("vidResize:: " + _width + "x" + _height);
 		vid.width = _width;
 		vid.height = _height;
+		if (_width < this.width) {
+			vid.x = (this.width - _width) / 2;
+		} else {
+			vid.x = 0;
+		}
+		if (_height < this.height) {
+			vid.y = (this.height - _height) / 2;
+		} else {
+			vid.y = 0;
+		}
 	}
 
-	public function attachCamera(cam:Camera):void {
-		getVideo().attachCamera(cam);
+	public function attachCamera(_cam:Camera):void {
+		this.cam = _cam;
+		getVideo().attachCamera(_cam);
 	}
 
 	public function attachStream(_ns:NetStream):void {
@@ -105,7 +126,10 @@ public class OmVideo {
 		vid.attachCamera(null);
 		vid.clear();
 		ui.removeChild(vid);
+		ui.graphics.clear();
 		vid = null;
+		cam = null;
+		mic = null;
 	}
 
 	public function setVolume(vol:int):void {