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 2017/05/18 05:39:20 UTC

[20/23] openmeetings git commit: Normalize all the line endings

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8e63647c/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/FormatHelper.java
----------------------------------------------------------------------
diff --git a/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/FormatHelper.java b/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/FormatHelper.java
index c1788f7..64409b7 100644
--- a/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/FormatHelper.java
+++ b/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/FormatHelper.java
@@ -1,81 +1,81 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") +  you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.db.util;
-
-import static org.apache.commons.lang3.StringEscapeUtils.escapeHtml4;
-
-import java.util.regex.Pattern;
-
-import org.apache.openmeetings.db.entity.user.User;
-
-public class FormatHelper {
-	/**
-	 * taken from BidiUtils
-	 * 
-	 * A regular expression for matching right-to-left language codes. See
-	 * {@link #isRtlLanguage} for the design.
-	 */
-	private static final Pattern RtlLocalesRe = Pattern.compile("^(ar|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|.*[-_](Arab|Hebr|Thaa|Nkoo|Tfng))"
-					+ "(?!.*[-_](Latn|Cyrl)($|-|_))($|-|_)");
-
-	/**
-	 * Check if a BCP 47 / III language code indicates an RTL language, i.e.
-	 * either: - a language code explicitly specifying one of the right-to-left
-	 * scripts, e.g. "az-Arab", or
-	 * <p>
-	 * - a language code specifying one of the languages normally written in a
-	 * right-to-left script, e.g. "fa" (Farsi), except ones explicitly
-	 * specifying Latin or Cyrillic script (which are the usual LTR
-	 * alternatives).
-	 * <p>
-	 * The list of right-to-left scripts appears in the 100-199 range in
-	 * http://www.unicode.org/iso15924/iso15924-num.html, of which Arabic and
-	 * Hebrew are by far the most widely used. We also recognize Thaana, N'Ko,
-	 * and Tifinagh, which also have significant modern usage. The rest (Syriac,
-	 * Samaritan, Mandaic, etc.) seem to have extremely limited or no modern
-	 * usage and are not recognized. The languages usually written in a
-	 * right-to-left script are taken as those with Suppress-Script:
-	 * Hebr|Arab|Thaa|Nkoo|Tfng in
-	 * http://www.iana.org/assignments/language-subtag-registry, as well as
-	 * Sindhi (sd) and Uyghur (ug). The presence of other subtags of the
-	 * language code, e.g. regions like EG (Egypt), is ignored.
-	 */
-	public static boolean isRtlLanguage(String languageString) {
-		return languageString != null && RtlLocalesRe.matcher(languageString).find();
-	}
-
-	public static String formatUser(User u) {
-		return formatUser(u, false);
-	}
-
-	// TODO check RIGHTS here (email might need to be hidden)
-	public static String formatUser(User u, boolean isHTMLEscape) {
-		String user = "";
-		if (u != null) {
-			String email = u.getAddress() == null ? "" : u.getAddress().getEmail();
-			if (u.getFirstname() == null && u.getLastname() == null) {
-				user = email;
-			} else {
-				user = String.format("\"%s %s\" <%s>", u.getFirstname(), u.getLastname(), email);
-			}
-			user = isHTMLEscape ? escapeHtml4(user) : user;
-		}
-		return user;
-	}
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") +  you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.db.util;
+
+import static org.apache.commons.lang3.StringEscapeUtils.escapeHtml4;
+
+import java.util.regex.Pattern;
+
+import org.apache.openmeetings.db.entity.user.User;
+
+public class FormatHelper {
+	/**
+	 * taken from BidiUtils
+	 * 
+	 * A regular expression for matching right-to-left language codes. See
+	 * {@link #isRtlLanguage} for the design.
+	 */
+	private static final Pattern RtlLocalesRe = Pattern.compile("^(ar|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|.*[-_](Arab|Hebr|Thaa|Nkoo|Tfng))"
+					+ "(?!.*[-_](Latn|Cyrl)($|-|_))($|-|_)");
+
+	/**
+	 * Check if a BCP 47 / III language code indicates an RTL language, i.e.
+	 * either: - a language code explicitly specifying one of the right-to-left
+	 * scripts, e.g. "az-Arab", or
+	 * <p>
+	 * - a language code specifying one of the languages normally written in a
+	 * right-to-left script, e.g. "fa" (Farsi), except ones explicitly
+	 * specifying Latin or Cyrillic script (which are the usual LTR
+	 * alternatives).
+	 * <p>
+	 * The list of right-to-left scripts appears in the 100-199 range in
+	 * http://www.unicode.org/iso15924/iso15924-num.html, of which Arabic and
+	 * Hebrew are by far the most widely used. We also recognize Thaana, N'Ko,
+	 * and Tifinagh, which also have significant modern usage. The rest (Syriac,
+	 * Samaritan, Mandaic, etc.) seem to have extremely limited or no modern
+	 * usage and are not recognized. The languages usually written in a
+	 * right-to-left script are taken as those with Suppress-Script:
+	 * Hebr|Arab|Thaa|Nkoo|Tfng in
+	 * http://www.iana.org/assignments/language-subtag-registry, as well as
+	 * Sindhi (sd) and Uyghur (ug). The presence of other subtags of the
+	 * language code, e.g. regions like EG (Egypt), is ignored.
+	 */
+	public static boolean isRtlLanguage(String languageString) {
+		return languageString != null && RtlLocalesRe.matcher(languageString).find();
+	}
+
+	public static String formatUser(User u) {
+		return formatUser(u, false);
+	}
+
+	// TODO check RIGHTS here (email might need to be hidden)
+	public static String formatUser(User u, boolean isHTMLEscape) {
+		String user = "";
+		if (u != null) {
+			String email = u.getAddress() == null ? "" : u.getAddress().getEmail();
+			if (u.getFirstname() == null && u.getLastname() == null) {
+				user = email;
+			} else {
+				user = String.format("\"%s %s\" <%s>", u.getFirstname(), u.getLastname(), email);
+			}
+			user = isHTMLEscape ? escapeHtml4(user) : user;
+		}
+		return user;
+	}
+}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8e63647c/openmeetings-db/src/site/site.xml
----------------------------------------------------------------------
diff --git a/openmeetings-db/src/site/site.xml b/openmeetings-db/src/site/site.xml
index c26954e..0d9f35c 100644
--- a/openmeetings-db/src/site/site.xml
+++ b/openmeetings-db/src/site/site.xml
@@ -1,40 +1,40 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/DECORATION/1.7.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.7.0 http://maven.apache.org/xsd/decoration-1.7.0.xsd"
-  name="Apache OpenMeetings Project">
-
-	<body>
-		<menu ref="parent"/>
-		<menu name="Project">
-			<item name="About" href="/index.html" />
-			<item name="Info" href="/project-info.html" />
-			<item name="Summary" href="/project-summary.html" />
-			<item name="License" href="/license.html" />
-			<item name="Dependencies" href="/dependencies.html" />
-			<item name="Dependency Convergence" href="/dependency-convergence.html" />
-			<item name="RAT Report" href="/rat-report.html" />
-			<item name="JavaDoc" href="/apidocs/index.html" target="_blank" />
-		</menu>
-	</body>
-	<custom>
-		<reflowSkin>
-			<bottomNav maxSpan="12">
-				<column>Parent Project</column>
-				<column>Project</column>
-			</bottomNav>
-		</reflowSkin>
-	</custom>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+ -->
+<project xmlns="http://maven.apache.org/DECORATION/1.7.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.7.0 http://maven.apache.org/xsd/decoration-1.7.0.xsd"
+  name="Apache OpenMeetings Project">
+
+	<body>
+		<menu ref="parent"/>
+		<menu name="Project">
+			<item name="About" href="/index.html" />
+			<item name="Info" href="/project-info.html" />
+			<item name="Summary" href="/project-summary.html" />
+			<item name="License" href="/license.html" />
+			<item name="Dependencies" href="/dependencies.html" />
+			<item name="Dependency Convergence" href="/dependency-convergence.html" />
+			<item name="RAT Report" href="/rat-report.html" />
+			<item name="JavaDoc" href="/apidocs/index.html" target="_blank" />
+		</menu>
+	</body>
+	<custom>
+		<reflowSkin>
+			<bottomNav maxSpan="12">
+				<column>Parent Project</column>
+				<column>Project</column>
+			</bottomNav>
+		</reflowSkin>
+	</custom>
+</project>

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8e63647c/openmeetings-flash/src/main/flex/main.mxml
----------------------------------------------------------------------
diff --git a/openmeetings-flash/src/main/flex/main.mxml b/openmeetings-flash/src/main/flex/main.mxml
index f275526..de24955 100644
--- a/openmeetings-flash/src/main/flex/main.mxml
+++ b/openmeetings-flash/src/main/flex/main.mxml
@@ -1,321 +1,321 @@
-<?xml version="1.0"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing,
-  software distributed under the License is distributed on an
-  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  KIND, either express or implied.  See the License for the
-  specific language governing permissions and limitations
-  under the License.
-
--->
-<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
-		xmlns:s="library://ns.adobe.com/flex/spark"
-		xmlns:mx="library://ns.adobe.com/flex/mx"
-		width="570" height="900" pageTitle="Openmeetings" fontSize="12"
-		applicationComplete="appInit(event)" uncaughtError="uncaughtError(event)">
-	<fx:Declarations>
-		<!-- Place non-visual elements (e.g., services, value objects) here -->
-		<mx:TraceTarget/>
-	</fx:Declarations>
-	<fx:Script><![CDATA[
-		import mx.core.FlexGlobals;
-
-		import org.apache.openmeetings.OmVideo;
-
-		private var audioOnly:Boolean = false;
-		private var FPS:int;
-		private var bandwidth:int = 0;
-		private var quality:int = 100;
-		private var echoPath:int = 256;
-		private var echoSuppression:Boolean = true;
-		private var microphoneRateBest:int = 22;//5, 8, 11, 22, and 44
-		private var selectedMic:int = -1;
-		private var selectedCam:int = -1;
-		private var video:OmVideo;
-		private var recName:String;
-		private var mic:Microphone = null;
-		[Bindable]
-		private var interview:Boolean = false;
-
-		private function debug(...rest):void {
-			ExternalInterface.call("console.log", rest);
-		}
-
-		private function camAvail():Boolean {
-			return !audioOnly && Camera.names.length > 0;
-		}
-
-		private function micAvail():Boolean {
-			return Microphone.names.length > 0;
-		}
-
-		private function appInit(evt:Event):void {
-			var params:Object = FlexGlobals.topLevelApplication.parameters;
-			debug("appInit()", params);
-			audioOnly = 'true' == params.audioOnly;
-			interview = 'true' == params.interview;
-			var _fps:int = parseInt(params.fps);
-			FPS = (isNaN(_fps) || _fps < 1 ? 30 : _fps);
-			video = new OmVideo(videoDisplay, params);
-			switch (params.mode) {
-				case 'settings':
-				{
-					ExternalInterface.addCallback("getDevices", function ():Object {
-						return {
-							cams: Camera.names
-							, mics: Microphone.names
-						};
-					});
-					ExternalInterface.addCallback("camChanged", function (val:int):void {
-						selectedCam = val;
-						camChanged(null);
-					});
-					ExternalInterface.addCallback("micChanged", function (val:int):void {
-						selectedMic = val;
-						camChanged(null);
-					});
-					ExternalInterface.addCallback("resChanged", function (width:int, height:int):void {
-						setResolution(width, height, true);
-					});
-					ExternalInterface.addCallback("close", function ():void {
-						video.reset();
-					});
-					ExternalInterface.addCallback("init", function (camIdx:int, micIdx:int, width:int, height:int):void {
-						selectedCam = camIdx;
-						selectedMic = micIdx;
-						setResolution(width, height, true);
-					});
-					ExternalInterface.addCallback("startRec", function ():void {
-						startTestRecording();
-					});
-					ExternalInterface.addCallback("play", function ():void {
-						playTestRecording();
-					});
-					ExternalInterface.call("VideoSettings.initSwf");
-				}
-					break;
-				case OmVideo.BROADCAST:
-				{
-					selectedCam = params.cam;
-					selectedMic = params.mic;
-					video.resize(Math.max(300, params.width), Math.max(200, params.height));
-					attachCamera(function():void {
-						video.resize(params.width, params.height);
-						video.reset();
-						var cam:Camera = getCam();
-						video.attachCamera(cam);
-						video.broadcast(params.broadcastId, cam, getMic());
-						ExternalInterface.call("VideoManager.resetSize", params.uid);
-					});
-				}
-					break;
-				case OmVideo.PLAY:
-				{
-					video.resize(params.width, params.height);
-					video.play(params.broadcastId); // TODO audio/video
-				}
-					break;
-			}
-			ExternalInterface.addCallback("vidResize", function (width:int, height:int):void {
-				video.resize(width, height);
-				video.vidResize(width, height);
-			});
-		}
-
-		private function uncaughtError(e:UncaughtErrorEvent):void {
-			debug("Unexpected ERROR", e);
-		}
-
-		private function getMic():Microphone {
-			debug("Entering getMic ...");
-			var _micro:Microphone = null;
-			if (selectedMic > -1) {
-				_micro = echoPath == 0 ? Microphone.getMicrophone(selectedMic) : Microphone.getEnhancedMicrophone(selectedMic);
-
-				if (_micro != null) {
-					if (echoPath == 256) {
-						var options:MicrophoneEnhancedOptions = new MicrophoneEnhancedOptions();
-						options.mode = MicrophoneEnhancedMode.FULL_DUPLEX;
-						options.echoPath = echoPath;
-						options.nonLinearProcessing = true;
-						_micro.enhancedOptions = options;
-						debug("echoPath set to " + echoPath + ", " + _micro.enhancedOptions);
-					}
-					_micro.codec = SoundCodec.NELLYMOSER;
-					_micro.framesPerPacket = 1;
-					_micro.setSilenceLevel(0, 2000);
-					debug("canvas.microphoneRateBest: " + microphoneRateBest);
-					_micro.rate = microphoneRateBest;
-					_micro.gain = 50;
-					// this has no effect if enhanced microphone is obtained
-					//Microphone setUseEchoSupression(bool)
-					debug("canvas.echoSuppression: " + echoSuppression);
-					_micro.setUseEchoSuppression(echoSuppression);
-				}
-				debug("... getMic DONE" + _micro);
-			}
-			return _micro;
-		}
-
-		private function getCam():Camera {
-			debug("Entering getCam ...");
-			var _camera:Camera = null;
-			if (selectedCam > -1) {
-				_camera = Camera.getCamera("" + selectedCam);
-				if (_camera != null && !_camera.muted) {
-					//FIXME need to be unified
-					if (interview) {
-						//we need a fixed frame rate for the videos to merge them later on
-						_camera.setMode(video.width, video.height, 24);
-						debug("IS INTERVIEW ");
-						_camera.setQuality(0, 98);
-					} else {
-						_camera.setMode(video.width, video.height, FPS);
-						debug("IS NO INTERVIEW ");
-						_camera.setQuality(bandwidth, quality);
-					}
-				}
-				debug("... getCam DONE " + _camera);
-			}
-			return _camera;
-		}
-
-		private function attachCamera(callback:Function):void {
-			if (!camAvail()) {
-				return;
-			}
-			debug("Camera selected:: " + selectedCam);
-			var cam:Camera = getCam();
-			debug("Camera selected:: " + cam);
-			if (cam != null) {
-				if (cam.muted) {
-					debug("Camera Muted");
-					video.attachCamera(cam);
-					cam.addEventListener(StatusEvent.STATUS, function (event:StatusEvent):void {
-						debug("cameraStatusHandler! " + event);
-						cam.removeEventListener(StatusEvent.STATUS, arguments.callee);
-						switch (event.code) {
-							case 'Camera.Muted':
-								debug("Unable to connect to active camera.");
-								break;
-							case 'Camera.Unmuted':
-								callback();
-								break;
-						}
-					});
-				} else {
-					callback();
-				}
-			} else {
-				var _mic:Microphone = getMic();
-				if (_mic != null) {
-					if (_mic.muted) {
-						var nc:NetConnection = new NetConnection();
-						nc.connect(null);
-						var ns:NetStream = new NetStream(nc);
-						ns.attachAudio(_mic);
-						_mic.addEventListener(StatusEvent.STATUS, function (event:StatusEvent):void {
-							debug("micStatusHandler! " + event);
-							_mic.removeEventListener(StatusEvent.STATUS, arguments.callee);
-							ns.close();
-							nc.close();
-							if (_mic.muted) {
-								debug("Unable to connect to active microphone.");
-							} else {
-								ExternalInterface.call("VideoSettings.allowRec", true);
-							}
-						});
-					}
-				}
-			}
-		}
-
-		private function _attachCamera(cam:Camera):void {
-			debug("_attachCamera():: muted ? " + cam.muted);
-			if (cam.muted) {
-				debug("Unable to connect to active camera.");
-			} else {
-				try {
-					video.reset();
-					video.attachCamera(cam);
-					debug("_attachCamera()::done");
-				} catch (error:Error) {
-					debug("_attach:: " + error.message + "\n" + error.getStackTrace());
-				}
-			}
-		}
-
-		private function settingsCameraCallback():void {
-			ExternalInterface.call("VideoSettings.allowRec", true);
-			_attachCamera(getCam());
-		}
-
-		private function setResolution(width:int, height:int, attach:Boolean):void {
-			if (!interview) {
-				debug("onselect WxH :: " + width + "x" + height);
-
-				video.resize(width, height);
-
-				if (attach) {
-					attachCamera(settingsCameraCallback);
-				}
-			}
-		}
-
-		private function camChanged(e:Event):void {
-			attachCamera(settingsCameraCallback);
-		}
-
-		private function playTestRecording():void {
-			video.play(recName + ".flv");
-		}
-
-		private function startTestRecording():void {
-			try {
-				var counter:int = 5;
-				timerText.visible = true;
-				timerText.text = "5 sec";
-				var recTimer:Timer = new Timer(1000, counter);
-				var t:Date = new Date();
-				recName = "TEST_SETUP_" + t.getTime();
-				mic = getMic();
-				var activityTimer:Timer = new Timer(100);
-				activityTimer.addEventListener(TimerEvent.TIMER, function (event:TimerEvent):void {
-					ExternalInterface.call("VideoSettings.micActivity", mic.activityLevel);
-				});
-				video.record(recName, getCam(), mic, function ():void {
-					if (mic != null) {
-						activityTimer.start();
-					}
-					recTimer.addEventListener(TimerEvent.TIMER, function (event:TimerEvent):void {
-						timerText.text = --counter + " sec";
-						if (counter == 0) {
-							timerText.visible = false;
-							ExternalInterface.call("VideoSettings.allowPlay");
-							playTestRecording();
-							activityTimer.stop();
-							mic = null;
-						}
-					});
-					recTimer.start();
-				});
-			} catch (err:Error) {
-				debug("ERROR: " + err);
-			}
-		}
-		]]></fx:Script>
-
-	<mx:UIComponent id="videoDisplay" width="0" height="0" />
-	<s:Label id="timerText" height="20" width="45" x="20" y="5" paddingLeft="5" paddingTop="5"
-			 visible="false" backgroundColor="0xf5f5f5" fontWeight="bold"><s:text></s:text></s:Label>
-</s:Application>
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+
+-->
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+		xmlns:s="library://ns.adobe.com/flex/spark"
+		xmlns:mx="library://ns.adobe.com/flex/mx"
+		width="570" height="900" pageTitle="Openmeetings" fontSize="12"
+		applicationComplete="appInit(event)" uncaughtError="uncaughtError(event)">
+	<fx:Declarations>
+		<!-- Place non-visual elements (e.g., services, value objects) here -->
+		<mx:TraceTarget/>
+	</fx:Declarations>
+	<fx:Script><![CDATA[
+		import mx.core.FlexGlobals;
+
+		import org.apache.openmeetings.OmVideo;
+
+		private var audioOnly:Boolean = false;
+		private var FPS:int;
+		private var bandwidth:int = 0;
+		private var quality:int = 100;
+		private var echoPath:int = 256;
+		private var echoSuppression:Boolean = true;
+		private var microphoneRateBest:int = 22;//5, 8, 11, 22, and 44
+		private var selectedMic:int = -1;
+		private var selectedCam:int = -1;
+		private var video:OmVideo;
+		private var recName:String;
+		private var mic:Microphone = null;
+		[Bindable]
+		private var interview:Boolean = false;
+
+		private function debug(...rest):void {
+			ExternalInterface.call("console.log", rest);
+		}
+
+		private function camAvail():Boolean {
+			return !audioOnly && Camera.names.length > 0;
+		}
+
+		private function micAvail():Boolean {
+			return Microphone.names.length > 0;
+		}
+
+		private function appInit(evt:Event):void {
+			var params:Object = FlexGlobals.topLevelApplication.parameters;
+			debug("appInit()", params);
+			audioOnly = 'true' == params.audioOnly;
+			interview = 'true' == params.interview;
+			var _fps:int = parseInt(params.fps);
+			FPS = (isNaN(_fps) || _fps < 1 ? 30 : _fps);
+			video = new OmVideo(videoDisplay, params);
+			switch (params.mode) {
+				case 'settings':
+				{
+					ExternalInterface.addCallback("getDevices", function ():Object {
+						return {
+							cams: Camera.names
+							, mics: Microphone.names
+						};
+					});
+					ExternalInterface.addCallback("camChanged", function (val:int):void {
+						selectedCam = val;
+						camChanged(null);
+					});
+					ExternalInterface.addCallback("micChanged", function (val:int):void {
+						selectedMic = val;
+						camChanged(null);
+					});
+					ExternalInterface.addCallback("resChanged", function (width:int, height:int):void {
+						setResolution(width, height, true);
+					});
+					ExternalInterface.addCallback("close", function ():void {
+						video.reset();
+					});
+					ExternalInterface.addCallback("init", function (camIdx:int, micIdx:int, width:int, height:int):void {
+						selectedCam = camIdx;
+						selectedMic = micIdx;
+						setResolution(width, height, true);
+					});
+					ExternalInterface.addCallback("startRec", function ():void {
+						startTestRecording();
+					});
+					ExternalInterface.addCallback("play", function ():void {
+						playTestRecording();
+					});
+					ExternalInterface.call("VideoSettings.initSwf");
+				}
+					break;
+				case OmVideo.BROADCAST:
+				{
+					selectedCam = params.cam;
+					selectedMic = params.mic;
+					video.resize(Math.max(300, params.width), Math.max(200, params.height));
+					attachCamera(function():void {
+						video.resize(params.width, params.height);
+						video.reset();
+						var cam:Camera = getCam();
+						video.attachCamera(cam);
+						video.broadcast(params.broadcastId, cam, getMic());
+						ExternalInterface.call("VideoManager.resetSize", params.uid);
+					});
+				}
+					break;
+				case OmVideo.PLAY:
+				{
+					video.resize(params.width, params.height);
+					video.play(params.broadcastId); // TODO audio/video
+				}
+					break;
+			}
+			ExternalInterface.addCallback("vidResize", function (width:int, height:int):void {
+				video.resize(width, height);
+				video.vidResize(width, height);
+			});
+		}
+
+		private function uncaughtError(e:UncaughtErrorEvent):void {
+			debug("Unexpected ERROR", e);
+		}
+
+		private function getMic():Microphone {
+			debug("Entering getMic ...");
+			var _micro:Microphone = null;
+			if (selectedMic > -1) {
+				_micro = echoPath == 0 ? Microphone.getMicrophone(selectedMic) : Microphone.getEnhancedMicrophone(selectedMic);
+
+				if (_micro != null) {
+					if (echoPath == 256) {
+						var options:MicrophoneEnhancedOptions = new MicrophoneEnhancedOptions();
+						options.mode = MicrophoneEnhancedMode.FULL_DUPLEX;
+						options.echoPath = echoPath;
+						options.nonLinearProcessing = true;
+						_micro.enhancedOptions = options;
+						debug("echoPath set to " + echoPath + ", " + _micro.enhancedOptions);
+					}
+					_micro.codec = SoundCodec.NELLYMOSER;
+					_micro.framesPerPacket = 1;
+					_micro.setSilenceLevel(0, 2000);
+					debug("canvas.microphoneRateBest: " + microphoneRateBest);
+					_micro.rate = microphoneRateBest;
+					_micro.gain = 50;
+					// this has no effect if enhanced microphone is obtained
+					//Microphone setUseEchoSupression(bool)
+					debug("canvas.echoSuppression: " + echoSuppression);
+					_micro.setUseEchoSuppression(echoSuppression);
+				}
+				debug("... getMic DONE" + _micro);
+			}
+			return _micro;
+		}
+
+		private function getCam():Camera {
+			debug("Entering getCam ...");
+			var _camera:Camera = null;
+			if (selectedCam > -1) {
+				_camera = Camera.getCamera("" + selectedCam);
+				if (_camera != null && !_camera.muted) {
+					//FIXME need to be unified
+					if (interview) {
+						//we need a fixed frame rate for the videos to merge them later on
+						_camera.setMode(video.width, video.height, 24);
+						debug("IS INTERVIEW ");
+						_camera.setQuality(0, 98);
+					} else {
+						_camera.setMode(video.width, video.height, FPS);
+						debug("IS NO INTERVIEW ");
+						_camera.setQuality(bandwidth, quality);
+					}
+				}
+				debug("... getCam DONE " + _camera);
+			}
+			return _camera;
+		}
+
+		private function attachCamera(callback:Function):void {
+			if (!camAvail()) {
+				return;
+			}
+			debug("Camera selected:: " + selectedCam);
+			var cam:Camera = getCam();
+			debug("Camera selected:: " + cam);
+			if (cam != null) {
+				if (cam.muted) {
+					debug("Camera Muted");
+					video.attachCamera(cam);
+					cam.addEventListener(StatusEvent.STATUS, function (event:StatusEvent):void {
+						debug("cameraStatusHandler! " + event);
+						cam.removeEventListener(StatusEvent.STATUS, arguments.callee);
+						switch (event.code) {
+							case 'Camera.Muted':
+								debug("Unable to connect to active camera.");
+								break;
+							case 'Camera.Unmuted':
+								callback();
+								break;
+						}
+					});
+				} else {
+					callback();
+				}
+			} else {
+				var _mic:Microphone = getMic();
+				if (_mic != null) {
+					if (_mic.muted) {
+						var nc:NetConnection = new NetConnection();
+						nc.connect(null);
+						var ns:NetStream = new NetStream(nc);
+						ns.attachAudio(_mic);
+						_mic.addEventListener(StatusEvent.STATUS, function (event:StatusEvent):void {
+							debug("micStatusHandler! " + event);
+							_mic.removeEventListener(StatusEvent.STATUS, arguments.callee);
+							ns.close();
+							nc.close();
+							if (_mic.muted) {
+								debug("Unable to connect to active microphone.");
+							} else {
+								ExternalInterface.call("VideoSettings.allowRec", true);
+							}
+						});
+					}
+				}
+			}
+		}
+
+		private function _attachCamera(cam:Camera):void {
+			debug("_attachCamera():: muted ? " + cam.muted);
+			if (cam.muted) {
+				debug("Unable to connect to active camera.");
+			} else {
+				try {
+					video.reset();
+					video.attachCamera(cam);
+					debug("_attachCamera()::done");
+				} catch (error:Error) {
+					debug("_attach:: " + error.message + "\n" + error.getStackTrace());
+				}
+			}
+		}
+
+		private function settingsCameraCallback():void {
+			ExternalInterface.call("VideoSettings.allowRec", true);
+			_attachCamera(getCam());
+		}
+
+		private function setResolution(width:int, height:int, attach:Boolean):void {
+			if (!interview) {
+				debug("onselect WxH :: " + width + "x" + height);
+
+				video.resize(width, height);
+
+				if (attach) {
+					attachCamera(settingsCameraCallback);
+				}
+			}
+		}
+
+		private function camChanged(e:Event):void {
+			attachCamera(settingsCameraCallback);
+		}
+
+		private function playTestRecording():void {
+			video.play(recName + ".flv");
+		}
+
+		private function startTestRecording():void {
+			try {
+				var counter:int = 5;
+				timerText.visible = true;
+				timerText.text = "5 sec";
+				var recTimer:Timer = new Timer(1000, counter);
+				var t:Date = new Date();
+				recName = "TEST_SETUP_" + t.getTime();
+				mic = getMic();
+				var activityTimer:Timer = new Timer(100);
+				activityTimer.addEventListener(TimerEvent.TIMER, function (event:TimerEvent):void {
+					ExternalInterface.call("VideoSettings.micActivity", mic.activityLevel);
+				});
+				video.record(recName, getCam(), mic, function ():void {
+					if (mic != null) {
+						activityTimer.start();
+					}
+					recTimer.addEventListener(TimerEvent.TIMER, function (event:TimerEvent):void {
+						timerText.text = --counter + " sec";
+						if (counter == 0) {
+							timerText.visible = false;
+							ExternalInterface.call("VideoSettings.allowPlay");
+							playTestRecording();
+							activityTimer.stop();
+							mic = null;
+						}
+					});
+					recTimer.start();
+				});
+			} catch (err:Error) {
+				debug("ERROR: " + err);
+			}
+		}
+		]]></fx:Script>
+
+	<mx:UIComponent id="videoDisplay" width="0" height="0" />
+	<s:Label id="timerText" height="20" width="45" x="20" y="5" paddingLeft="5" paddingTop="5"
+			 visible="false" backgroundColor="0xf5f5f5" fontWeight="bold"><s:text></s:text></s:Label>
+</s:Application>

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8e63647c/openmeetings-flash/src/main/flex/org/apache/openmeetings/OmVideo.as
----------------------------------------------------------------------
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 c32e8a2..fbf540d 100644
--- a/openmeetings-flash/src/main/flex/org/apache/openmeetings/OmVideo.as
+++ b/openmeetings-flash/src/main/flex/org/apache/openmeetings/OmVideo.as
@@ -1,270 +1,270 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") +  you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings {
-import flash.events.AsyncErrorEvent;
-import flash.events.NetStatusEvent;
-import flash.external.ExternalInterface;
-import flash.media.Camera;
-import flash.media.H264Level;
-import flash.media.H264Profile;
-import flash.media.H264VideoStreamSettings;
-import flash.media.Microphone;
-import flash.media.Video;
-import flash.media.VideoStreamSettings;
-import flash.net.NetConnection;
-import flash.net.NetStream;
-import mx.core.UIComponent;
-
-public class OmVideo {
-	public static const CODEC_H264:String = "h264";
-	public static const PLAY:String = "play";
-	public static const BROADCAST:String = "broadcast";
-	public static const RECORD:String = "record";
-	public static const LIVE:String = "live";
-	private var vid:Video;
-	private var ui:UIComponent;
-	private var nc:NetConnection;
-	private var ns:NetStream;
-	public var width:int;
-	public var height:int;
-	private var mode:String;
-	private var params:Object;
-	private var url:String;
-	private var fallback:Boolean;
-
-	public function OmVideo(ui:UIComponent, params:Object) {
-		this.ui = ui;
-		this.params = params;
-	}
-
-	private function getVideo():Video {
-		if (vid == null) {
-			vid = new Video();
-			vid.width = width;
-			vid.height = height;
-			ui.addChild(vid);
-		}
-		return vid;
-	}
-
-	public function resize(width:int, height:int):void {
-		this.width = ui.width = width;
-		this.height = ui.height = height;
-	}
-
-	public function vidResize(width:int, height:int):void {
-		vid.width = width;
-		vid.height = height;
-		debug("OmVideo::resize", width, height);
-	}
-
-	public function attachCamera(cam:Camera):void {
-		getVideo().attachCamera(cam);
-	}
-
-	public function attachStream(ns:NetStream):void {
-		this.ns = ns;
-		getVideo().attachNetStream(ns);
-	}
-
-	private function clear():void {
-		vid.attachNetStream(null);
-		vid.attachCamera(null);
-		vid.clear();
-		ui.removeChild(vid);
-		vid = null;
-	}
-
-	private function debug(... rest):void {
-		ExternalInterface.call("console.log", rest);
-	}
-
-	private function createStream():void {
-		debug("createStream: ");
-		ns = new NetStream(nc);
-		ns.client = {
-			onMetaData: function(metadata:Object):void {
-				debug("onMetaData: ", metadata);
-			}
-			, onPlayStatus: function(metadata:Object):void {
-				debug("onPlayStatus: ", metadata);
-			}
-			, onCuePoint: function(metadata:Object):void {
-				debug("onCuePoint: ", metadata);
-			}
-			, ioError: function(error:Object):void {
-				debug("ioError: ", error);
-			}
-			, netStatus: function(status:Object):void {
-				debug("netStatus: ", status);
-			}
-			, asyncError: function(error:Object):void {
-				debug("asyncError: ", error);
-			}
-		};
-		//this is a workaround, attaching the event to the client object does not work
-		ns.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus2);
-	}
-
-	private function onNetStatus2(evt:Object):void {
-		debug("netStream_onNetStatus: ", evt.info.code, evt.target);
-	}
-
-	private function _publish(mode:String, name:String, cam:Camera, mic:Microphone, f:Function):void {
-		if (ns != null){
-			reset();
-		}
-		this.mode = mode;
-		createStream();
-
-		if (cam != null) {
-			ns.attachCamera(cam);
-			attachCamera(cam);
-
-			var videoStreamSettings:VideoStreamSettings = null;
-			debug("codec = " + params.videoCodec);
-			if (params.videoCodec === CODEC_H264) {
-				var vss:H264VideoStreamSettings = new H264VideoStreamSettings();
-				vss.setProfileLevel(H264Profile.BASELINE, H264Level.LEVEL_5_1);
-				videoStreamSettings = vss;
-			} else {
-				videoStreamSettings = new VideoStreamSettings();
-			}
-			videoStreamSettings.setQuality(cam.bandwidth, cam.quality);
-			videoStreamSettings.setKeyFrameInterval(cam.keyFrameInterval);
-			debug("::camera settings ", cam.keyFrameInterval, cam.width, cam.height, cam.fps);
-			videoStreamSettings.setMode(cam.width, cam.height, cam.fps);
-			ns.videoStreamSettings = videoStreamSettings;
-		}
-		if (mic != null) {
-			ns.attachAudio(mic);
-			//FIXME !!! no mute !!! muteMicro(this.micMuted);
-		}
-
-		ns.publish(name, (mode == BROADCAST) ? LIVE : mode);
-		if (f != null) {
-			f.call();
-		}
-	}
-
-	private function _connect(url:String):void {
-		nc.connect(url, {
-			uid: params.uid
-			, sid: params.sid
-			, nativeSsl: 'best' == params.proxyType
-		});
-	}
-
-	private function connect(callback:Function):void {
-		if (nc == null || !nc.connected) {
-			url = params.url;
-			debug("NetConnection is not connected", url);
-			nc = new NetConnection();
-			nc.addEventListener(NetStatusEvent.NET_STATUS, function onConnectionStatus(e:NetStatusEvent):void {
-				debug("ConnectionStatus: " + e.info.code);
-				switch (e.info.code) {
-					case 'NetConnection.Connect.Failed':
-						if (!fallback) {
-							fallback = true;
-							url = params.fallback;
-							_connect(url);
-						}
-						break;
-					case 'NetConnection.Connect.Success':
-						callback();
-						break;
-					//TODO other cases
-				}
-			});
-			nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR, function (event:AsyncErrorEvent):void {
-				debug("login Async error" + event);
-			});
-			nc.client = {
-				onMetaData: function (infoObject:Object):void {
-					debug("onMetaData::", infoObject);
-				}
-				, onBWDone: function(...rest):void {
-					debug("onBWDone");
-				}
-				, onBWCheck: function(...rest):Number {
-					debug("onBWCheck");
-					return 0;
-				}
-				, setId: function (id:Number):void {
-					debug("id: " + id); //TODO save connection id
-				}
-			};
-			_connect(url);
-		} else {
-			callback();
-		}
-	}
-
-	public function broadcast(name:String, cam:Camera, mic:Microphone):void {
-		connect(function():void {
-			_publish(BROADCAST, name, cam, mic, null);
-		});
-	}
-
-	public function record(name:String, cam:Camera, mic:Microphone, f:Function):void {
-		connect(function():void {
-			_publish(RECORD, name, cam, mic, f);
-		});
-	}
-
-	public function play(name:String):void {
-		connect(function():void {
-			debug("PLAY::", name);
-			if (ns != null){
-				reset();
-			}
-			mode = PLAY;
-			createStream();
-			//invokes Method in baseVideoView which shows the stream
-			getVideo().attachNetStream(ns);
-			//FIXME: Commented out, cause this leads to Buffer-Full/Buffer-Empty Events
-			//after re-syncing the stream
-			//this.setBuffer(0.1);
-			ns.play(name);
-		});
-	}
-
-	public function reset():void {
-		if (ns != null) {
-			switch (mode) {
-				case PLAY:
-					ns.pause();
-					ns.dispose();
-					clear();
-					break;
-				case BROADCAST:
-				case RECORD:
-					ns.publish(null); //false in original code
-				default:
-					clear();
-					ns.dispose();
-					break;
-			}
-		} else {
-			clear();
-		}
-		ns = null;
-	}
-}
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") +  you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings {
+import flash.events.AsyncErrorEvent;
+import flash.events.NetStatusEvent;
+import flash.external.ExternalInterface;
+import flash.media.Camera;
+import flash.media.H264Level;
+import flash.media.H264Profile;
+import flash.media.H264VideoStreamSettings;
+import flash.media.Microphone;
+import flash.media.Video;
+import flash.media.VideoStreamSettings;
+import flash.net.NetConnection;
+import flash.net.NetStream;
+import mx.core.UIComponent;
+
+public class OmVideo {
+	public static const CODEC_H264:String = "h264";
+	public static const PLAY:String = "play";
+	public static const BROADCAST:String = "broadcast";
+	public static const RECORD:String = "record";
+	public static const LIVE:String = "live";
+	private var vid:Video;
+	private var ui:UIComponent;
+	private var nc:NetConnection;
+	private var ns:NetStream;
+	public var width:int;
+	public var height:int;
+	private var mode:String;
+	private var params:Object;
+	private var url:String;
+	private var fallback:Boolean;
+
+	public function OmVideo(ui:UIComponent, params:Object) {
+		this.ui = ui;
+		this.params = params;
+	}
+
+	private function getVideo():Video {
+		if (vid == null) {
+			vid = new Video();
+			vid.width = width;
+			vid.height = height;
+			ui.addChild(vid);
+		}
+		return vid;
+	}
+
+	public function resize(width:int, height:int):void {
+		this.width = ui.width = width;
+		this.height = ui.height = height;
+	}
+
+	public function vidResize(width:int, height:int):void {
+		vid.width = width;
+		vid.height = height;
+		debug("OmVideo::resize", width, height);
+	}
+
+	public function attachCamera(cam:Camera):void {
+		getVideo().attachCamera(cam);
+	}
+
+	public function attachStream(ns:NetStream):void {
+		this.ns = ns;
+		getVideo().attachNetStream(ns);
+	}
+
+	private function clear():void {
+		vid.attachNetStream(null);
+		vid.attachCamera(null);
+		vid.clear();
+		ui.removeChild(vid);
+		vid = null;
+	}
+
+	private function debug(... rest):void {
+		ExternalInterface.call("console.log", rest);
+	}
+
+	private function createStream():void {
+		debug("createStream: ");
+		ns = new NetStream(nc);
+		ns.client = {
+			onMetaData: function(metadata:Object):void {
+				debug("onMetaData: ", metadata);
+			}
+			, onPlayStatus: function(metadata:Object):void {
+				debug("onPlayStatus: ", metadata);
+			}
+			, onCuePoint: function(metadata:Object):void {
+				debug("onCuePoint: ", metadata);
+			}
+			, ioError: function(error:Object):void {
+				debug("ioError: ", error);
+			}
+			, netStatus: function(status:Object):void {
+				debug("netStatus: ", status);
+			}
+			, asyncError: function(error:Object):void {
+				debug("asyncError: ", error);
+			}
+		};
+		//this is a workaround, attaching the event to the client object does not work
+		ns.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus2);
+	}
+
+	private function onNetStatus2(evt:Object):void {
+		debug("netStream_onNetStatus: ", evt.info.code, evt.target);
+	}
+
+	private function _publish(mode:String, name:String, cam:Camera, mic:Microphone, f:Function):void {
+		if (ns != null){
+			reset();
+		}
+		this.mode = mode;
+		createStream();
+
+		if (cam != null) {
+			ns.attachCamera(cam);
+			attachCamera(cam);
+
+			var videoStreamSettings:VideoStreamSettings = null;
+			debug("codec = " + params.videoCodec);
+			if (params.videoCodec === CODEC_H264) {
+				var vss:H264VideoStreamSettings = new H264VideoStreamSettings();
+				vss.setProfileLevel(H264Profile.BASELINE, H264Level.LEVEL_5_1);
+				videoStreamSettings = vss;
+			} else {
+				videoStreamSettings = new VideoStreamSettings();
+			}
+			videoStreamSettings.setQuality(cam.bandwidth, cam.quality);
+			videoStreamSettings.setKeyFrameInterval(cam.keyFrameInterval);
+			debug("::camera settings ", cam.keyFrameInterval, cam.width, cam.height, cam.fps);
+			videoStreamSettings.setMode(cam.width, cam.height, cam.fps);
+			ns.videoStreamSettings = videoStreamSettings;
+		}
+		if (mic != null) {
+			ns.attachAudio(mic);
+			//FIXME !!! no mute !!! muteMicro(this.micMuted);
+		}
+
+		ns.publish(name, (mode == BROADCAST) ? LIVE : mode);
+		if (f != null) {
+			f.call();
+		}
+	}
+
+	private function _connect(url:String):void {
+		nc.connect(url, {
+			uid: params.uid
+			, sid: params.sid
+			, nativeSsl: 'best' == params.proxyType
+		});
+	}
+
+	private function connect(callback:Function):void {
+		if (nc == null || !nc.connected) {
+			url = params.url;
+			debug("NetConnection is not connected", url);
+			nc = new NetConnection();
+			nc.addEventListener(NetStatusEvent.NET_STATUS, function onConnectionStatus(e:NetStatusEvent):void {
+				debug("ConnectionStatus: " + e.info.code);
+				switch (e.info.code) {
+					case 'NetConnection.Connect.Failed':
+						if (!fallback) {
+							fallback = true;
+							url = params.fallback;
+							_connect(url);
+						}
+						break;
+					case 'NetConnection.Connect.Success':
+						callback();
+						break;
+					//TODO other cases
+				}
+			});
+			nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR, function (event:AsyncErrorEvent):void {
+				debug("login Async error" + event);
+			});
+			nc.client = {
+				onMetaData: function (infoObject:Object):void {
+					debug("onMetaData::", infoObject);
+				}
+				, onBWDone: function(...rest):void {
+					debug("onBWDone");
+				}
+				, onBWCheck: function(...rest):Number {
+					debug("onBWCheck");
+					return 0;
+				}
+				, setId: function (id:Number):void {
+					debug("id: " + id); //TODO save connection id
+				}
+			};
+			_connect(url);
+		} else {
+			callback();
+		}
+	}
+
+	public function broadcast(name:String, cam:Camera, mic:Microphone):void {
+		connect(function():void {
+			_publish(BROADCAST, name, cam, mic, null);
+		});
+	}
+
+	public function record(name:String, cam:Camera, mic:Microphone, f:Function):void {
+		connect(function():void {
+			_publish(RECORD, name, cam, mic, f);
+		});
+	}
+
+	public function play(name:String):void {
+		connect(function():void {
+			debug("PLAY::", name);
+			if (ns != null){
+				reset();
+			}
+			mode = PLAY;
+			createStream();
+			//invokes Method in baseVideoView which shows the stream
+			getVideo().attachNetStream(ns);
+			//FIXME: Commented out, cause this leads to Buffer-Full/Buffer-Empty Events
+			//after re-syncing the stream
+			//this.setBuffer(0.1);
+			ns.play(name);
+		});
+	}
+
+	public function reset():void {
+		if (ns != null) {
+			switch (mode) {
+				case PLAY:
+					ns.pause();
+					ns.dispose();
+					clear();
+					break;
+				case BROADCAST:
+				case RECORD:
+					ns.publish(null); //false in original code
+				default:
+					clear();
+					ns.dispose();
+					break;
+			}
+		} else {
+			clear();
+		}
+		ns = null;
+	}
+}
+}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8e63647c/openmeetings-flash/src/main/swf10/networkTesting/networktesting.lzx
----------------------------------------------------------------------
diff --git a/openmeetings-flash/src/main/swf10/networkTesting/networktesting.lzx b/openmeetings-flash/src/main/swf10/networkTesting/networktesting.lzx
index df65c1b..da55d60 100644
--- a/openmeetings-flash/src/main/swf10/networkTesting/networktesting.lzx
+++ b/openmeetings-flash/src/main/swf10/networkTesting/networktesting.lzx
@@ -1,89 +1,89 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-  
-      http://www.apache.org/licenses/LICENSE-2.0
-  
-  Unless required by applicable law or agreed to in writing,
-  software distributed under the License is distributed on an
-  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  KIND, either express or implied.  See the License for the
-  specific language governing permissions and limitations
-  under the License.
-  
--->
-<canvas width="100%" height="100%" title="NetworkTesting">
-	<switch>
-		<when property="$as3">
-			<passthrough>
-				import flash.external.ExternalInterface;
-			</passthrough>
-		</when>
-	</switch>
-	<switch>
-		<when property="$debug">
-			<method name="doDebugInit">
-				canvas.setAttribute('debug', true);
-			</method>
-			<debug fontsize="11" oninit="Debug.showInternalProperties = true" width="40%" y="50%" x="60%" height="50%" />
-		</when>
-		<otherwise>
-			<method name="doDebugInit">
-			</method>
-		</otherwise>
-	</switch>
-	
-	<include href="testsView.lzx" />
-	<include href="restCall.lzx" />
-	
-	<handler name="oninit"><![CDATA[
-		flash.external.ExternalInterface.call("loadingComplete");
-		var lbls = ExternalInterface.call("getStringLabels");
-		canvas.lbls = new Array(lbls.length);
-		for (var i = 0; i < lbls.length; ++i) {
-			canvas.lbls[lbls[i].id] = lbls[i].value;
-		}
-		var config = ExternalInterface.call("getConfig");
-		doDebugInit();
-		getSettings(config);
-		canvas.showTests();
-	]]></handler>
-
-	<method name="lbl" args="key">
-		var s = canvas.lbls['network.test.' + key];
-		if ($debug) Debug.info("LBL ", key, s, canvas.lbls);
-		return !!s ? s : "Missing[" + key + "]";
-	</method>
-
-	<method name="getSettings" args="config">
-		if ($debug) Debug.write("getSettings:: ", config);
-		canvas.setAttribute("rtmpProtocol", config.flashProtocol);
-		canvas.setAttribute("proxyType", config.proxy);
-		canvas.setAttribute("rtmpHost", config.host);
-		canvas.setAttribute("rtmpPort", config.flashPort);
-		
-		canvas.setAttribute("httpProtocol", config.httpProtocol);
-		canvas.setAttribute("httpHost", config.host);
-		canvas.setAttribute("httpPort", config.httpPort);
-
-		canvas.setAttribute("uriContext", '/' + config.path);
-		canvas.setAttribute("rtmpUriPath", canvas.uriContext + "hibernate");
-	</method>
-
-	<method name="showTests">
-		var tests = new lz.TestsView(canvas, {name:"testsView"});
-		tests.testAll();
-	</method>
-
-	<attribute name="busy" type="boolean" value="false"/>
-	<attribute name="log" type="string" value="" />
-
-	<attribute name="testsView" value="null"/>
-
-</canvas>
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+  
+      http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+  
+-->
+<canvas width="100%" height="100%" title="NetworkTesting">
+	<switch>
+		<when property="$as3">
+			<passthrough>
+				import flash.external.ExternalInterface;
+			</passthrough>
+		</when>
+	</switch>
+	<switch>
+		<when property="$debug">
+			<method name="doDebugInit">
+				canvas.setAttribute('debug', true);
+			</method>
+			<debug fontsize="11" oninit="Debug.showInternalProperties = true" width="40%" y="50%" x="60%" height="50%" />
+		</when>
+		<otherwise>
+			<method name="doDebugInit">
+			</method>
+		</otherwise>
+	</switch>
+	
+	<include href="testsView.lzx" />
+	<include href="restCall.lzx" />
+	
+	<handler name="oninit"><![CDATA[
+		flash.external.ExternalInterface.call("loadingComplete");
+		var lbls = ExternalInterface.call("getStringLabels");
+		canvas.lbls = new Array(lbls.length);
+		for (var i = 0; i < lbls.length; ++i) {
+			canvas.lbls[lbls[i].id] = lbls[i].value;
+		}
+		var config = ExternalInterface.call("getConfig");
+		doDebugInit();
+		getSettings(config);
+		canvas.showTests();
+	]]></handler>
+
+	<method name="lbl" args="key">
+		var s = canvas.lbls['network.test.' + key];
+		if ($debug) Debug.info("LBL ", key, s, canvas.lbls);
+		return !!s ? s : "Missing[" + key + "]";
+	</method>
+
+	<method name="getSettings" args="config">
+		if ($debug) Debug.write("getSettings:: ", config);
+		canvas.setAttribute("rtmpProtocol", config.flashProtocol);
+		canvas.setAttribute("proxyType", config.proxy);
+		canvas.setAttribute("rtmpHost", config.host);
+		canvas.setAttribute("rtmpPort", config.flashPort);
+		
+		canvas.setAttribute("httpProtocol", config.httpProtocol);
+		canvas.setAttribute("httpHost", config.host);
+		canvas.setAttribute("httpPort", config.httpPort);
+
+		canvas.setAttribute("uriContext", '/' + config.path);
+		canvas.setAttribute("rtmpUriPath", canvas.uriContext + "hibernate");
+	</method>
+
+	<method name="showTests">
+		var tests = new lz.TestsView(canvas, {name:"testsView"});
+		tests.testAll();
+	</method>
+
+	<attribute name="busy" type="boolean" value="false"/>
+	<attribute name="log" type="string" value="" />
+
+	<attribute name="testsView" value="null"/>
+
+</canvas>

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8e63647c/openmeetings-flash/src/main/swf10/networkTesting/rtmpConnection.lzx
----------------------------------------------------------------------
diff --git a/openmeetings-flash/src/main/swf10/networkTesting/rtmpConnection.lzx b/openmeetings-flash/src/main/swf10/networkTesting/rtmpConnection.lzx
index ad1958f..0cb20a6 100644
--- a/openmeetings-flash/src/main/swf10/networkTesting/rtmpConnection.lzx
+++ b/openmeetings-flash/src/main/swf10/networkTesting/rtmpConnection.lzx
@@ -1,367 +1,367 @@
-<library>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-	  http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing,
-  software distributed under the License is distributed on an
-  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  KIND, either express or implied.  See the License for the
-  specific language governing permissions and limitations
-  under the License.
-
--->
-
-<class name="rtmpConnection" extends="node">
-	<switch>
-		<when property="$as3">
-			<passthrough>
-				import flash.net.NetConnection;
-				import flash.events.NetStatusEvent;
-			</passthrough>
-		</when>
-	</switch>
-
-	<attribute name="debug" value="false" type="boolean" />
-
-	<event name="onconnect"/>
-	<event name="onerror"/>
-
-	<!-- this attribute holds a reference to the current/last called netremoteCall,
-	in case of error you can debug that way which call did fail -->
-	<attribute name="lastCalled" value="null" />
-
-	<attribute name="src" value="" type="string"/>
-
-	<method name="connect">
-		this._nc = new NetConnection();
-
-		// local reference to rtmpconnection
-		//this._nc.t = this;
-
-		this._nc.proxyType = canvas.proxyType;
-
-		var ok = this._nc.connect(src == "null" ? null : src, {
-			uid: "noclient"
-		});
-		if (this.debug) {
-			if($debug) Debug.write("*** debug ***");
-		}
-
-		this._nc.addEventListener(NetStatusEvent.NET_STATUS, _onStatus);
-
-		if($debug) Debug.write("devRtmpConnection/registerMethods()");
-		var clientObj = {};
-		clientObj.setId = this.setId;
-
-		this._nc.client = clientObj;
-
-		//Register Methods
-		//this.registerMethods();
-	</method>
-
-	<method name="setId" args="tId">
-		if ($debug) Debug.write("setId ", tId);
-	</method>
-
-	<method name="_onStatus" args="stats"><![CDATA[
-		if ($debug) {
-			Debug.write("devrtmpconnection", this, "_onStatus", stats.info.code);
-		}
-
-		var msg = "";
-		var s;
-
-		switch (stats.info.code) {
-
-			case "NetConnection.Connect.Success": {
-				// The connection attempt succeeded.
-				//canvas.currentNC is the reference to the NetConnection that is used in the NetStream
-				msg = stats.info.code;
-				canvas.currentNC = this._nc;
-				s = 2;
-				break;
-			}
-
-			case "NetConnection.Connect.Closed": {
-				msg = stats.info.code;
-				this._nc = null;
-				canvas.currentNC = null;
-				s = 0;
-				break;
-			}
-
-			default: {
-				msg = stats.info.code;
-				s = 0;
-				break;
-			}
-
-		}
-
-		this.setAttribute("status", msg);
-
-		if (s == 2) {
-			this.onconnect.sendEvent();
-		} else {
-			this.onerror.sendEvent();
-		}
-
-	]]>
-	</method>
-
-	<method name="disconnect">
-		if ($debug) Debug.write(" DISCONNECT ");
-		if (this._nc != null) {
-			this._nc.close();
-		}
-	</method>
-	<!---
-		With this function all methods are registered to the NetConnection
-		A server can invoke this Method with a call for it from the Client
-		Only subnodes of rtmpconnections which are a instance of netRemoteCallHib
-		are registered, to add dynamically methods to the remotefunction you will
-		have to invoke this method once again
-		-swagner
-	 -->
-	<method name="registerMethods">
-		<![CDATA[
-			if (this.subnodes!=null){
-				var clientObj = {};
-				//Register all methods which are onstanceof netRemoteCallHib
-				for (var i=0;i<this.subnodes.length;i++){
-					//If it is of Type netRemoteCallHib then register it to the NetConnection
-					if (this.subnodes[i] instanceof lz.netRemoteCallHib){
-						clientObj[this.subnodes[i].funcname] = function( args ){
-							return canvas.thishib.remoteCallMethod(arguments.callee,arguments);
-							//return hib.remoteCallMethod(arguments.callee,args);
-						}
-					}
-				}
-				this._nc.client = clientObj;
-			}
-		]]>
-	</method>
-
-	<!--
-		Process the RemoteCall to the Right Funtion
-		-swagner
-	 -->
-	<method name="remoteCallMethod" args="callee,args">
-		<![CDATA[
-			for (var eg in this._nc){
-				if (this._nc[eg]==callee){
-					if (this.debug) {
-						//_root.Debug.write.write("DEBUG invoked a function remotely: ",eg,args);
-					}
-					if (args.length == 1) {
-						return this.callFuntion(eg,args[0]);
-					} else {
-						return this.callFuntion(eg,args);
-					}
-					//return this.callFuntion(eg,args);
-				}
-			}
-		]]>
-	</method>
-
-	<!--
-		Map the Function to a netRemoteCallHib
-		-swagner
-	 -->
-	<method name="callFuntion" args="funcname,args">
-		<![CDATA[
-			for (var i=0;i<this.subnodes.length;i++){
-				if (this.subnodes[i].funcname==funcname){
-					return this.subnodes[i].onResult(args);
-				}
-			}
-		]]>
-	</method>
-
-	<method name="callRPC" args="func, obj, params">
-		//if ($debug) Debug.write("*** call: func, obj, params",func,obj, typeof (params) ,params.length);
-		if (params.length != 0){
-			//does this really work?
-			//ASSetPropFlags(_global, null, 8, 1);
-			//setPropertyIsEnumerable(8, 1);
-			//Debug.write("does it work?",arguments);
-			<!--
-			this._nc.call.apply(this._nc,arguments);
-			 -->
-			if (params.length==1){
-				this._nc.call(func, obj,params[0]);
-			} else if (params.length==2){
-				this._nc.call(func, obj,params[0],params[1]);
-			} else if (params.length==3){
-				this._nc.call(func, obj,params[0],params[1],params[2]);
-			} else if (params.length==4){
-				this._nc.call(func, obj,params[0],params[1],params[2],params[3]);
-			} else if (params.length==5){
-				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4]);
-			} else if (params.length==6){
-				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5]);
-			} else if (params.length==7){
-				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6]);
-			} else if (params.length==8){
-				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7]);
-			} else if (params.length==9){
-				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8]);
-			} else if (params.length==10){
-				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9]);
-			} else if (params.length==11){
-				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10]);
-			} else if (params.length==12){
-				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11]);
-			} else if (params.length==13){
-				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12]);
-			} else if (params.length==14){
-				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12],params[13]);
-			} else if (params.length==15){
-				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12],params[13],params[14]);
-			} else if (params.length==16){
-				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12],params[13],params[14],params[15]);
-			} else if (params.length==17){
-				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12],params[13],params[14],params[15],params[16]);
-			} else if (params.length==18){
-				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12],params[13],params[14],params[15],params[16],params[17]);
-			} else if (params.length==19){
-				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12],params[13],params[14],params[15],params[16],params[17],params[18]);
-			} else if (params.length==20){
-				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12],params[13],params[14],params[15],params[16],params[17],params[18],params[19]);
-			}
-		} else {
-			this._nc.call(func, obj);
-		}
-	</method>
-</class>
-
-
-	<!---
-		Net remote call.
-		@todo Document netremotecall class.
-	-->
-	<class name="netremotecall" extends="node">
-		<switch>
-			<when property="$as3">
-				<passthrough>
-					import flash.net.Responder;
-				</passthrough>
-			</when>
-		</switch>
-
-		<!--- Name of the remote function. -->
-		<attribute name="funcname" value="$once{null}" type="string" />
-
-		<attribute name="remotecontext" value="null" />
-
-		<attribute name="dataobject" value="null" />
-
-		<attribute name="responder" value="null" />
-
-		<!--- Data handling event. args="value"  -->
-		<event name="ondata" />
-
-		<!--- Error handling event. -->
-		<event name="onerror"/>
-
-		<!--- Call the remote method, passing the array of params. -->
-		<method name="callRPC" args="params"><![CDATA[
-			if (this.funcname == null) {
-				//Debug.write("No funcname given");
-				if (this.onerror) this.onerror.sendEvent("No funcname given");
-				return;
-			}
-
-			if (params == null) {
-				params = new Array();
-
-				var subnodes = this.subnodes;
-				if (subnodes != null) {
-					var i;
-					var n = subnodes.length;
-					for (i = 0; i < n; i++) {
-						// If getValue method is declared in param, call that
-						// instead to get value.
-						var tsi = subnodes[i];
-						//TODO: fixme
-						//if ((tsi["getValue"] != null) && (tsi.getValue["prototype"] != null)) {
-						//	params[i] = tsi.getValue();
-						//	Debug.write("tsi.getValue():", tsi.getValue());
-						//} else {
-						//	params[i] = tsi.value;
-						//}
-						params[i] = tsi.getValue();
-					}
-				}
-
-			} else if (params.__proto__ != Array.prototype) {
-				//Debug.write(this.name, "error: first argument (params) is not an array");
-				return -1;
-			}
-
-			//if ($debug) Debug.write("call", this, this.parent, this.parent.status);
-			var rtmpObject = null;
-			if (this.parent instanceof lz.rtmpConnection){
-				rtmpObject = this.parent;
-			} else if(this.remotecontext  instanceof lz.rtmpConnection){
-				rtmpObject = this.remotecontext;
-			} else {
-				if ($debug) Debug.warn("ERROR: no remotecontext availible abort call", this.funcname, this);
-				return;
-			}
-			//Debug.write('call', this, rtmpObject, rtmpObject.status);
-			//Debug.write('call', this.remotecontext);
-			if (rtmpObject.debug) Debug.write('call', this, rtmpObject, rtmpObject.status);
-			rtmpObject.lastCalled = this;
-
-			this.responder = new Responder(onResult);
-
-			rtmpObject.callRPC(this.funcname, this.responder, params);
-
-		]]>
-		</method>
-
-		<!--- Handle the result returned from the remote method. -->
-		<method name="onResult" args="value"><![CDATA[
-			// Can be overriden.
-			// Would be great if it can be used with dataobject,
-			// but I don't know how to convert Array/primitive to LzDataset/LzDataPointer.
-			////Debug.write("netremotecall", this, "onResult", value);
-
-			if (this.dataobject!=null) {
-				if ( this.dataobject instanceof LzDataset ) {
-					//Debug.write("onResult: ",this,value,dataobject);
-					var element = LzDataElement.valueToElement(value);
-					this.dataobject.setData(element.childNodes);
-				} else if ( this.dataobject instanceof LzDataElement ) {
-					var element = LzDataElement.valueToElement(value);
-					this.dataobject.appendChild( element );
-				} else {
-					//TODO:fixme
-					//Debug.warn("dataobject is not LzDataset or LzDataElement: ",this,this.dataobject,delegate);
-				}
-			}
-			this.ondata.sendEvent(value);
-		]]>
-		</method>
-	</class>
-
-	<!---
-		Net parameter.
-		Element to use inside netremotecall.
-		@todo Document netparam class.
-	-->
-	<class name="netparam" extends="node">
-		<!--- The value of the netparam. -->
-		<attribute name="value" value="null"/>
-	</class>
-
-</library>
+<library>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+	  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+
+-->
+
+<class name="rtmpConnection" extends="node">
+	<switch>
+		<when property="$as3">
+			<passthrough>
+				import flash.net.NetConnection;
+				import flash.events.NetStatusEvent;
+			</passthrough>
+		</when>
+	</switch>
+
+	<attribute name="debug" value="false" type="boolean" />
+
+	<event name="onconnect"/>
+	<event name="onerror"/>
+
+	<!-- this attribute holds a reference to the current/last called netremoteCall,
+	in case of error you can debug that way which call did fail -->
+	<attribute name="lastCalled" value="null" />
+
+	<attribute name="src" value="" type="string"/>
+
+	<method name="connect">
+		this._nc = new NetConnection();
+
+		// local reference to rtmpconnection
+		//this._nc.t = this;
+
+		this._nc.proxyType = canvas.proxyType;
+
+		var ok = this._nc.connect(src == "null" ? null : src, {
+			uid: "noclient"
+		});
+		if (this.debug) {
+			if($debug) Debug.write("*** debug ***");
+		}
+
+		this._nc.addEventListener(NetStatusEvent.NET_STATUS, _onStatus);
+
+		if($debug) Debug.write("devRtmpConnection/registerMethods()");
+		var clientObj = {};
+		clientObj.setId = this.setId;
+
+		this._nc.client = clientObj;
+
+		//Register Methods
+		//this.registerMethods();
+	</method>
+
+	<method name="setId" args="tId">
+		if ($debug) Debug.write("setId ", tId);
+	</method>
+
+	<method name="_onStatus" args="stats"><![CDATA[
+		if ($debug) {
+			Debug.write("devrtmpconnection", this, "_onStatus", stats.info.code);
+		}
+
+		var msg = "";
+		var s;
+
+		switch (stats.info.code) {
+
+			case "NetConnection.Connect.Success": {
+				// The connection attempt succeeded.
+				//canvas.currentNC is the reference to the NetConnection that is used in the NetStream
+				msg = stats.info.code;
+				canvas.currentNC = this._nc;
+				s = 2;
+				break;
+			}
+
+			case "NetConnection.Connect.Closed": {
+				msg = stats.info.code;
+				this._nc = null;
+				canvas.currentNC = null;
+				s = 0;
+				break;
+			}
+
+			default: {
+				msg = stats.info.code;
+				s = 0;
+				break;
+			}
+
+		}
+
+		this.setAttribute("status", msg);
+
+		if (s == 2) {
+			this.onconnect.sendEvent();
+		} else {
+			this.onerror.sendEvent();
+		}
+
+	]]>
+	</method>
+
+	<method name="disconnect">
+		if ($debug) Debug.write(" DISCONNECT ");
+		if (this._nc != null) {
+			this._nc.close();
+		}
+	</method>
+	<!---
+		With this function all methods are registered to the NetConnection
+		A server can invoke this Method with a call for it from the Client
+		Only subnodes of rtmpconnections which are a instance of netRemoteCallHib
+		are registered, to add dynamically methods to the remotefunction you will
+		have to invoke this method once again
+		-swagner
+	 -->
+	<method name="registerMethods">
+		<![CDATA[
+			if (this.subnodes!=null){
+				var clientObj = {};
+				//Register all methods which are onstanceof netRemoteCallHib
+				for (var i=0;i<this.subnodes.length;i++){
+					//If it is of Type netRemoteCallHib then register it to the NetConnection
+					if (this.subnodes[i] instanceof lz.netRemoteCallHib){
+						clientObj[this.subnodes[i].funcname] = function( args ){
+							return canvas.thishib.remoteCallMethod(arguments.callee,arguments);
+							//return hib.remoteCallMethod(arguments.callee,args);
+						}
+					}
+				}
+				this._nc.client = clientObj;
+			}
+		]]>
+	</method>
+
+	<!--
+		Process the RemoteCall to the Right Funtion
+		-swagner
+	 -->
+	<method name="remoteCallMethod" args="callee,args">
+		<![CDATA[
+			for (var eg in this._nc){
+				if (this._nc[eg]==callee){
+					if (this.debug) {
+						//_root.Debug.write.write("DEBUG invoked a function remotely: ",eg,args);
+					}
+					if (args.length == 1) {
+						return this.callFuntion(eg,args[0]);
+					} else {
+						return this.callFuntion(eg,args);
+					}
+					//return this.callFuntion(eg,args);
+				}
+			}
+		]]>
+	</method>
+
+	<!--
+		Map the Function to a netRemoteCallHib
+		-swagner
+	 -->
+	<method name="callFuntion" args="funcname,args">
+		<![CDATA[
+			for (var i=0;i<this.subnodes.length;i++){
+				if (this.subnodes[i].funcname==funcname){
+					return this.subnodes[i].onResult(args);
+				}
+			}
+		]]>
+	</method>
+
+	<method name="callRPC" args="func, obj, params">
+		//if ($debug) Debug.write("*** call: func, obj, params",func,obj, typeof (params) ,params.length);
+		if (params.length != 0){
+			//does this really work?
+			//ASSetPropFlags(_global, null, 8, 1);
+			//setPropertyIsEnumerable(8, 1);
+			//Debug.write("does it work?",arguments);
+			<!--
+			this._nc.call.apply(this._nc,arguments);
+			 -->
+			if (params.length==1){
+				this._nc.call(func, obj,params[0]);
+			} else if (params.length==2){
+				this._nc.call(func, obj,params[0],params[1]);
+			} else if (params.length==3){
+				this._nc.call(func, obj,params[0],params[1],params[2]);
+			} else if (params.length==4){
+				this._nc.call(func, obj,params[0],params[1],params[2],params[3]);
+			} else if (params.length==5){
+				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4]);
+			} else if (params.length==6){
+				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5]);
+			} else if (params.length==7){
+				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6]);
+			} else if (params.length==8){
+				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7]);
+			} else if (params.length==9){
+				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8]);
+			} else if (params.length==10){
+				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9]);
+			} else if (params.length==11){
+				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10]);
+			} else if (params.length==12){
+				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11]);
+			} else if (params.length==13){
+				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12]);
+			} else if (params.length==14){
+				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12],params[13]);
+			} else if (params.length==15){
+				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12],params[13],params[14]);
+			} else if (params.length==16){
+				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12],params[13],params[14],params[15]);
+			} else if (params.length==17){
+				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12],params[13],params[14],params[15],params[16]);
+			} else if (params.length==18){
+				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12],params[13],params[14],params[15],params[16],params[17]);
+			} else if (params.length==19){
+				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12],params[13],params[14],params[15],params[16],params[17],params[18]);
+			} else if (params.length==20){
+				this._nc.call(func, obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12],params[13],params[14],params[15],params[16],params[17],params[18],params[19]);
+			}
+		} else {
+			this._nc.call(func, obj);
+		}
+	</method>
+</class>
+
+
+	<!---
+		Net remote call.
+		@todo Document netremotecall class.
+	-->
+	<class name="netremotecall" extends="node">
+		<switch>
+			<when property="$as3">
+				<passthrough>
+					import flash.net.Responder;
+				</passthrough>
+			</when>
+		</switch>
+
+		<!--- Name of the remote function. -->
+		<attribute name="funcname" value="$once{null}" type="string" />
+
+		<attribute name="remotecontext" value="null" />
+
+		<attribute name="dataobject" value="null" />
+
+		<attribute name="responder" value="null" />
+
+		<!--- Data handling event. args="value"  -->
+		<event name="ondata" />
+
+		<!--- Error handling event. -->
+		<event name="onerror"/>
+
+		<!--- Call the remote method, passing the array of params. -->
+		<method name="callRPC" args="params"><![CDATA[
+			if (this.funcname == null) {
+				//Debug.write("No funcname given");
+				if (this.onerror) this.onerror.sendEvent("No funcname given");
+				return;
+			}
+
+			if (params == null) {
+				params = new Array();
+
+				var subnodes = this.subnodes;
+				if (subnodes != null) {
+					var i;
+					var n = subnodes.length;
+					for (i = 0; i < n; i++) {
+						// If getValue method is declared in param, call that
+						// instead to get value.
+						var tsi = subnodes[i];
+						//TODO: fixme
+						//if ((tsi["getValue"] != null) && (tsi.getValue["prototype"] != null)) {
+						//	params[i] = tsi.getValue();
+						//	Debug.write("tsi.getValue():", tsi.getValue());
+						//} else {
+						//	params[i] = tsi.value;
+						//}
+						params[i] = tsi.getValue();
+					}
+				}
+
+			} else if (params.__proto__ != Array.prototype) {
+				//Debug.write(this.name, "error: first argument (params) is not an array");
+				return -1;
+			}
+
+			//if ($debug) Debug.write("call", this, this.parent, this.parent.status);
+			var rtmpObject = null;
+			if (this.parent instanceof lz.rtmpConnection){
+				rtmpObject = this.parent;
+			} else if(this.remotecontext  instanceof lz.rtmpConnection){
+				rtmpObject = this.remotecontext;
+			} else {
+				if ($debug) Debug.warn("ERROR: no remotecontext availible abort call", this.funcname, this);
+				return;
+			}
+			//Debug.write('call', this, rtmpObject, rtmpObject.status);
+			//Debug.write('call', this.remotecontext);
+			if (rtmpObject.debug) Debug.write('call', this, rtmpObject, rtmpObject.status);
+			rtmpObject.lastCalled = this;
+
+			this.responder = new Responder(onResult);
+
+			rtmpObject.callRPC(this.funcname, this.responder, params);
+
+		]]>
+		</method>
+
+		<!--- Handle the result returned from the remote method. -->
+		<method name="onResult" args="value"><![CDATA[
+			// Can be overriden.
+			// Would be great if it can be used with dataobject,
+			// but I don't know how to convert Array/primitive to LzDataset/LzDataPointer.
+			////Debug.write("netremotecall", this, "onResult", value);
+
+			if (this.dataobject!=null) {
+				if ( this.dataobject instanceof LzDataset ) {
+					//Debug.write("onResult: ",this,value,dataobject);
+					var element = LzDataElement.valueToElement(value);
+					this.dataobject.setData(element.childNodes);
+				} else if ( this.dataobject instanceof LzDataElement ) {
+					var element = LzDataElement.valueToElement(value);
+					this.dataobject.appendChild( element );
+				} else {
+					//TODO:fixme
+					//Debug.warn("dataobject is not LzDataset or LzDataElement: ",this,this.dataobject,delegate);
+				}
+			}
+			this.ondata.sendEvent(value);
+		]]>
+		</method>
+	</class>
+
+	<!---
+		Net parameter.
+		Element to use inside netremotecall.
+		@todo Document netparam class.
+	-->
+	<class name="netparam" extends="node">
+		<!--- The value of the netparam. -->
+		<attribute name="value" value="null"/>
+	</class>
+
+</library>