[OPENMEETINGS-551] basic work on settings dialog

Project: http://git-wip-us.apache.org/repos/asf/openmeetings/repo
Commit: http://git-wip-us.apache.org/repos/asf/openmeetings/commit/5d85a641
Tree: http://git-wip-us.apache.org/repos/asf/openmeetings/tree/5d85a641
Diff: http://git-wip-us.apache.org/repos/asf/openmeetings/diff/5d85a641

Branch: refs/heads/master
Commit: 5d85a6417b89852065d8a6583de16a2681910e89
Parents: b63f9dd
Author: Maxim Solodovnik <[email protected]>
Authored: Mon Apr 10 16:58:56 2017 +0000
Committer: Maxim Solodovnik <[email protected]>
Committed: Mon Apr 10 16:58:56 2017 +0000

----------------------------------------------------------------------
 openmeetings-flash/openlaszlo.xml               |  26 +-
 openmeetings-flash/src/main/flex/main.mxml      | 399 +++++--------------
 .../apache/openmeetings/web/room/RoomPanel.java |   7 +-
 .../org/apache/openmeetings/web/room/room.js    | 113 ++++--
 .../web/room/sidebar/RoomSidebar.html           |  11 +-
 openmeetings-web/src/main/webapp/css/room.css   |   7 +
 .../main/webapp/js/openmeetings_functions.js    |  64 ---
 7 files changed, 200 insertions(+), 427 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/openmeetings/blob/5d85a641/openmeetings-flash/openlaszlo.xml
----------------------------------------------------------------------
diff --git a/openmeetings-flash/openlaszlo.xml 
b/openmeetings-flash/openlaszlo.xml
index ee8eacc..1cffc9a 100644
--- a/openmeetings-flash/openlaszlo.xml
+++ b/openmeetings-flash/openlaszlo.xml
@@ -7,9 +7,9 @@
   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
@@ -19,10 +19,10 @@
  -->
 <!DOCTYPE project>
 <project name="openmeetings" basedir="./" default="client.only"
-       xmlns="antlib:org.apache.tools.ant"
-       xmlns:rat="antlib:org.apache.rat.anttasks"
-       xmlns:ivy="antlib:org.apache.ivy.ant"
-       xmlns:artifact="antlib:org.apache.maven.artifact.ant"
+               xmlns="antlib:org.apache.tools.ant"
+               xmlns:rat="antlib:org.apache.rat.anttasks"
+               xmlns:ivy="antlib:org.apache.ivy.ant"
+               xmlns:artifact="antlib:org.apache.maven.artifact.ant"
        >
        <property name="laszlo46.home" value="${openlaszlo}/openlaszlo46" />
        <!-- LPS Properties -->
@@ -32,7 +32,7 @@
        <path id="laszlo46.lib">
                <fileset dir="${laszlo46.home}/WEB-INF/lib" includes="*.jar" />
        </path>
-       
+
        <target name="client.only" depends="compile.flex, 
compile.laszlo.networktesting" unless="client-already-built">
                <property name="client-already-built" value="true"/>
        </target>
@@ -77,19 +77,19 @@
        <condition property="isWindows">
                <os family="windows" />
        </condition>
-       
+
        <condition property="isUnix">
                <os family="unix" />
        </condition>
-       
+
        <target name="if_windows" if="isWindows">
                <property name="mxmlc_bin" value="mxmlc.bat" />
        </target>
-       
+
        <target name="if_unix" if="isUnix">
                <property name="mxmlc_bin" value="mxmlc" />
        </target>
-       
+
        <target name="-compile.flex" description="compile flash application" 
depends="if_windows, if_unix">
                <exec dir="${flex.src.dir}" 
executable="${laszlo46.home}/WEB-INF/flexsdk/4.15.0/bin/${mxmlc_bin}">
                        <arg value="main.mxml"/>
@@ -97,11 +97,11 @@
                        <env key="PLAYERGLOBAL_HOME" 
value="${laszlo46.home}/WEB-INF/flexsdk/4.15.0/frameworks/libs/player"/>
                </exec>
        </target>
-       
+
        <target name="compile.flex" depends="compile.flex.debug">
                <antcall target="-compile.flex" inheritAll="true" 
inheritRefs="true"/>
        </target>
-       
+
        <target name="compile.flex.debug">
                <!--antcall target="-compile.flex" inheritAll="true" 
inheritRefs="true"/-->
        </target>

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/5d85a641/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 9287291..ec3792c 100644
--- a/openmeetings-flash/src/main/flex/main.mxml
+++ b/openmeetings-flash/src/main/flex/main.mxml
@@ -20,25 +20,18 @@
 -->
 <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"
+               xmlns:mx="library://ns.adobe.com/flex/mx"
+               width="570" height="900" pageTitle="Openmeetings"
                preinitialize="init()" fontSize="12" 
applicationComplete="appInit()">
        <fx:Declarations>
                <!-- Place non-visual elements (e.g., services, value objects) 
here -->
                <mx:TraceTarget/>
        </fx:Declarations>
        <fx:Script><![CDATA[
-               import mx.collections.ArrayCollection;
                import mx.core.FlexGlobals;
+
                import org.apache.openmeetings.OmVideo;
 
-               private static const MODE_N:String = "n";
-               private static const MODE_A:String = "a";
-               private static const MODE_V:String = "v";
-               private static const MODE_AV:String = "av";
-               private static const APP_WIDTH:int = 540;
-               private static const LEFT_WIDTH:int = 280;
-               private static const RIGHT_WIDTH:int = 240;
-               private var debugEnabled:Boolean = true;
                private var sid:String;
                private var roomid:int;
                private var audioOnly:Boolean = false;
@@ -49,6 +42,8 @@
                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 codec:String = OmVideo.CODEC_H264;
@@ -58,42 +53,9 @@
                private var app:String;
                [Bindable]
                private var interview:Boolean = false;
-               [Bindable]
-               private var debugStr:String = "";
-
-               private function setDimensions(width:int, height:int):void {
-                       mainSetupGroup.width = width;
-                       //mainSetupGroup.height = height;
-               }
-
-               public function debug(str:String):void {
-                       if (debugEnabled) {
-                               debugStr += str + "\n";
-                               trace(str + "\n");
-                       }
-               }
-
-               private function store():void {
-                       var t:SharedObject = SharedObject.getLocal('userdata');
-                       var g:Object = t.data ? t.data : new Object();
-                       g["cam"] = cams.selectedItem.data;
-                       g["mic"] = mics.selectedItem.data;
-                       g["avstored"] = modes.selectedItem.data;
-                       g["savecamdata"] = remember.selected;
-                       g["width"] = ress.selectedItem.width;
-                       g["height"] = ress.selectedItem.height;
-                       t.flush();
-               }
-
-               private static function getStoredProp(prop:String):String {
-                       //Initialize and get eventually stored property
-                       var t:SharedObject = SharedObject.getLocal('userdata');
-                       var g:Object = t.data;
-                       return g != null ? "" + g[prop] : null;
-               }
 
                private function init():void {
-                       debug("init()");
+                       trace("init()");
                        var tla:Object = FlexGlobals.topLevelApplication;
                        sid = tla.parameters['sid'];
                        roomid = tla.parameters['roomid'];
@@ -112,40 +74,8 @@
                        app = tla.parameters['app'];
                }
 
-               private function selectListItem(combo:ComboBox, 
selected:int):void {
-                       combo.callLater(function ():void {
-                               if (combo.dataProvider && 
combo.dataProvider.length > 0) {
-                                       combo.selectedItem = 
combo.dataProvider.getItemAt(selected < combo.dataProvider.length ? selected : 
0);
-                               }
-                       });
-               }
-
-               private function getItemIdx(combo:ComboBox, data:String):int {
-                       var idx:int = 0;
-                       for (var i:int = 0; i < combo.dataProvider.length; ++i) 
{
-                               if (combo.dataProvider[i].data == data) {
-                                       idx = i;
-                                       break;
-                               }
-                       }
-                       return idx;
-               }
-
-               private function fillDeviceList(list:Array, combo:ComboBox, 
prop:String):int {
-                       //Initialize and get eventually stored property
-                       var dev:int = parseInt(getStoredProp(prop));
-
-                       var items:ArrayCollection = new ArrayCollection();
-                       //Get all available devices
-                       var foundStoredDev:int = -1;
-                       for (var i:int = 0; i < list.length; ++i) {
-                               items.addItem({label: list[i], data: i});
-                               if (i == dev) {
-                                       foundStoredDev = i;
-                               }
-                       }
-                       combo.dataProvider = items;
-                       return foundStoredDev;
+               private function debug(str:String):void {
+                       ExternalInterface.call("console.log", str);
                }
 
                private function camAvail():Boolean {
@@ -158,101 +88,41 @@
 
                private function appInit():void {
                        video = new OmVideo(videoDisplay, codec, protocol + 
"://" + host + ":" + port + "/" + app);
-                       var modItems:ArrayCollection = new ArrayCollection();
-                       if (camAvail() && micAvail()) {
-                               modItems.addItem({label: getLabel(448), data: 
MODE_AV});
-                       }
-                       if (camAvail()) {
-                               var cameras:Array = Camera.names;
-                               var foundedCam:int = fillDeviceList(cameras, 
cams, "cam");
-                               selectListItem(cams, foundedCam);
-                               modItems.addItem({label: getLabel(450), data: 
MODE_V});
-                       }
-                       if (micAvail()) {
-                               var micros:Array = Microphone.names;
-                               var foundedMic:int = fillDeviceList(micros, 
mics, "mic");
-                               selectListItem(mics, foundedMic);
-                               modItems.addItem({label: getLabel(449), data: 
MODE_A});
-                       }
-                       modItems.addItem({label: getLabel(451), data: MODE_N});
-                       modes.dataProvider = modItems;
-
-                       var avIdx:int = getItemIdx(modes, 
getStoredProp("avstored"));
-                       debug("selected avIdx::" + avIdx);
-                       selectListItem(modes, avIdx);
 
                        var tla:Object = FlexGlobals.topLevelApplication;
-                       var resolutions:Array = 
JSON.parse(tla.parameters['resolutions']) as Array;
-                       var resItems:ArrayCollection = new ArrayCollection();
-                       var idx:int = 0;
-                       var storedWidth:int = parseInt(getStoredProp("width"));
-                       var storedHeight:int = 
parseInt(getStoredProp("height"));
-                       for (var i:int = 0; i < resolutions.length; ++i) {
-                               var r:Object = resolutions[i];
-                               resItems.addItem({label: r.width + 'x' + 
r.height + ' [' + r.label + ']', width: r.width, height: r.height});
-                               if (!isNaN(storedWidth) && storedWidth > 0 && 
!isNaN(storedHeight) && storedHeight > 0) {
-                                       if (r.width == storedWidth && r.height 
== storedHeight) {
-                                               idx = i;
-                                       }
-                               } else if (r.default) {
-                                       idx = i;
-                               }
-                       }
-                       ress.dataProvider = resItems;
-                       selectListItem(ress, idx);
-                       var resI:Object = ress.dataProvider.getItemAt(idx > -1 
? idx : 0);
-                       setResolution(resI.width, resI.height, false);
-                       setMode(modes.dataProvider.getItemAt(avIdx < 
modes.dataProvider.length ? avIdx : 0).data);
-
-                       remember.selected = true == 
getStoredProp("savecamdata");
-               }
-
-               public function getLabel(id:int):String {
-                       return labels.hasOwnProperty("" + id) ? labels[id] : 
(debugEnabled ? "[Missing " + id + "]" : "");
-               }
-
-               private function setMode(mode:String):void {
-                       var camVisible:Boolean = true;
-                       var micVisible:Boolean = true;
-                       var textVisible:Boolean = false;
-                       switch (mode) {
-                               case MODE_AV:
-                                       break;
-                               case MODE_A:
-                                       camVisible = false;
-                                       break;
-                               case MODE_V:
-                                       micVisible = false;
-                                       break;
-                               case MODE_N:
-                                       camVisible = false;
-                                       micVisible = false;
-                                       textVisible = true;
-                                       break;
-                               default:
-                                       debug("no valid device Setup chosen");
-                                       break;
-                       }
-                       camGroup.visible = camVisible;
-                       micGroup.visible = micVisible;
-                       noAv.visible = textVisible;
-                       startTest.visible = !textVisible;
-                       videoGroup.visible = !textVisible;
-                       videoScroller.visible = camVisible;
-                       playGroup.visible = !textVisible;
-                       resGroup.visible = interview ? false : camVisible;
-                       attachCamera();
-               }
-
-               private function modeChanged(e:Event):void {
-                       setMode(e.target.selectedItem.data);
+                       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.call("VideoSettings.initSwf");
                }
 
                private function getMic():Microphone {
                        debug("Entering getMic ...");
                        var _micro:Microphone = null;
-                       if (micGroup.visible) {
-                               _micro = echoPath == 0 ? 
Microphone.getMicrophone(mics.selectedItem.data) : 
Microphone.getEnhancedMicrophone(mics.selectedItem.data);
+                       if (selectedMic > -1) {
+                               _micro = echoPath == 0 ? 
Microphone.getMicrophone(selectedMic) : 
Microphone.getEnhancedMicrophone(selectedMic);
 
                                if (_micro != null && echoPath == 256) {
                                        var options:MicrophoneEnhancedOptions = 
new MicrophoneEnhancedOptions();
@@ -275,31 +145,31 @@
                                        debug("canvas.echoSuppression: " + 
echoSuppression);
                                        
_micro.setUseEchoSuppression(echoSuppression);
                                }
+                               debug("... getMic DONE" + _micro);
                        }
-                       debug("... getMic DONE" + _micro);
                        return _micro;
                }
 
                private function getCam():Camera {
                        debug("Entering getCam ...");
-                       if (!videoScroller.visible) {
-                               return null;
-                       }
-                       var _camera:Camera = 
Camera.getCamera(cams.selectedItem.data);
-                       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);
+                       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);
                        }
-                       debug("... getCam DONE " + _camera);
                        return _camera;
                }
 
@@ -307,7 +177,7 @@
                        if (!camAvail()) {
                                return;
                        }
-                       debug("Camera selected:: " + cams.selectedItem.data);
+                       debug("Camera selected:: " + selectedCam);
                        var cam:Camera = getCam();
                        debug("Camera selected:: " + cam);
                        if (cam != null) {
@@ -316,11 +186,14 @@
                                        video.attachCamera(cam);
                                        
cam.addEventListener(StatusEvent.STATUS, function (event:StatusEvent):void {
                                                debug("cameraStatusHandler! " + 
event);
-                                               
cam.removeEventListener(StatusEvent.STATUS, arguments.callee);
-                                               if (cam.muted) {
-                                                       debug("Unable to 
connect to active camera.");
-                                               } else {
-                                                       _attachCamera(cam);
+                                               
//cam.removeEventListener(StatusEvent.STATUS, arguments.callee);
+                                               switch (event.code) {
+                                                       case 'Camera.Muted':
+                                                               debug("Unable 
to connect to active camera.");
+                                                               break;
+                                                       case 'Camera.Unmuted':
+                                                               
_attachCamera(getCam());
+                                                               break;
                                                }
                                        });
                                } else {
@@ -345,7 +218,7 @@
                                                });
                                        }
                                }
-                       }
+                       }
                }
 
                private function _attachCamera(cam:Camera):void {
@@ -368,141 +241,57 @@
                                debug("onselect WxH :: " + width + "x" + 
height);
 
                                video.resize(width, height);
-                               videoScroller.width = Math.min(width, 
RIGHT_WIDTH);
-                               videoScroller.height = Math.min(height, 200);
-                               var newWidth:int = Math.max(APP_WIDTH, 
APP_WIDTH + videoScroller.width - RIGHT_WIDTH);
-                               var newHeight:int = Math.max(500, 500 + 
videoScroller.height - 180);
 
-                               var yPos:int = (startTest as 
DisplayObject).localToGlobal(new Point()).y;
-                               debug("GLOBAL Y:: " + yPos);
-                               playGroup.y = Math.max(yPos, 
videoScroller.height);
-                               setDimensions(newWidth, newHeight);
                                if (attach) {
                                        attachCamera();
                                }
                        }
                }
 
-               private function resChanged(e:Event):void {
-                       setResolution(e.target.selectedItem.width, 
e.target.selectedItem.height, true);
-               }
-
                private function camChanged(e:Event):void {
                        attachCamera();
                }
 
-               private function startConf(e:Event):void {
-                       store();
-               }
-
                private function playTestRecording():void {
                        video.play(recName);
                }
 
                private function startTestRecording():void {
-                       if (!noAv.visible) {
-                               startTest.enabled = false;
-                               play.enabled = false;
-                               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();
-                               var mic:Microphone = getMic();
-                               video.record(recName, getCam(), mic, function 
():void {
-                                       
mic.addEventListener(ActivityEvent.ACTIVITY, micActivityHandler);
-                                       //mic.onA
-                                       var micTimer:Timer = new Timer(100, 0);
-                                       
micTimer.addEventListener(TimerEvent.TIMER, function (event:TimerEvent):void {
-                                               fill.width =  mic.activityLevel 
* RIGHT_WIDTH / 100;
-                                               trace("activity: " + 
mic.activityLevel);
-                                       });
-                                       
recTimer.addEventListener(TimerEvent.TIMER, function (event:TimerEvent):void {
-                                               timerText.text = --counter + " 
sec";
-                                               if (counter == 0) {
-                                                       timerText.visible = 
false;
-                                                       startTest.enabled = 
true;
-                                                       play.enabled = true;
-                                                       playTestRecording();
-                                                       micTimer.stop();
-                                                       
mic.removeEventListener(ActivityEvent.ACTIVITY, micActivityHandler);
-                                               }
-                                       });
-                                       recTimer.start();
-                                       micTimer.start();
+                       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();
+                       var mic:Microphone = getMic();
+                       video.record(recName, getCam(), mic, function ():void {
+                               mic.addEventListener(ActivityEvent.ACTIVITY, 
micActivityHandler);
+                               //mic.onA
+                               var micTimer:Timer = new Timer(100, 0);
+                               micTimer.addEventListener(TimerEvent.TIMER, 
function (event:TimerEvent):void {
+                                       //FIXME TODO fill.width = 
mic.activityLevel * RIGHT_WIDTH / 100;
+                                       debug("activity: " + mic.activityLevel);
                                });
-                       }
+                               recTimer.addEventListener(TimerEvent.TIMER, 
function (event:TimerEvent):void {
+                                       timerText.text = --counter + " sec";
+                                       if (counter == 0) {
+                                               timerText.visible = false;
+                                               playTestRecording();
+                                               micTimer.stop();
+                                               
mic.removeEventListener(ActivityEvent.ACTIVITY, micActivityHandler);
+                                       }
+                               });
+                               recTimer.start();
+                               micTimer.start();
+                       });
                }
 
-               function micActivityHandler(event:ActivityEvent):void{
+               private function micActivityHandler(event:ActivityEvent):void {
                        //Do nothing, it just need to be there.
                }
-       ]]>
-       </fx:Script>
+       ]]></fx:Script>
 
-       <s:Group id="mainSetupGroup" width="{APP_WIDTH}">
-               <s:layout>
-                       <s:VerticalLayout paddingLeft="5" paddingRight="5"/>
-               </s:layout>
-               <mx:Text width="100%" fontWeight="bold" text="{getLabel(758)}"/>
-               <s:HGroup>
-                       <s:VGroup width="{LEFT_WIDTH}">
-                               <mx:Text text="{getLabel(447)}"/>
-                               <mx:ComboBox id="modes" width="{LEFT_WIDTH}" 
change="modeChanged(event)"/>
-                               <s:VGroup id="av">
-                                       <s:VGroup id="camGroup">
-                                               <mx:Text text="{getLabel(52)}"/>
-                                               <mx:ComboBox id="cams" 
width="{LEFT_WIDTH}" change="camChanged(event)"/>
-                                       </s:VGroup>
-                                       <s:VGroup id="micGroup">
-                                               <mx:Text text="{getLabel(53)}"/>
-                                               <mx:ComboBox id="mics" 
width="{LEFT_WIDTH}"/>
-                                       </s:VGroup>
-                                       <s:VGroup id="resGroup">
-                                               <s:Group><mx:Text 
text="{getLabel(1429)}"/><mx:Image x="260" source="../images/error.png" 
toolTip="{getLabel(1430)}"/></s:Group>
-                                               <mx:ComboBox id="ress" 
width="{LEFT_WIDTH}" change="resChanged(event)"/>
-                                       </s:VGroup>
-                                       <s:Group width="100%">
-                                               <s:layout><s:HorizontalLayout 
horizontalAlign="right"/></s:layout>
-                                               <s:Button id="startTest" 
label="{getLabel(775)}" click="startTestRecording()"/><!--FIXME should be 
disabled until stream is attached-->
-                                       </s:Group>
-                               </s:VGroup>
-                               <mx:Text text="{getLabel(452)}" id="noAv" 
visible="false"/>
-                       </s:VGroup>
-                       <s:Group id="videoGroup">
-                               <s:Scroller id="videoScroller">
-                                       <s:Group id="videoScrollGroup">
-                                               <mx:UIComponent 
id="videoDisplay" width="0" height="0" />
-                                       </s:Group>
-                               </s:Scroller>
-                               <s:Label id="timerText" height="20" width="45" 
x="{videoGroup.width - 60}" y="5" paddingLeft="5" paddingTop="5"
-                                               visible="false" 
backgroundColor="0xf5f5f5" fontWeight="bold"><s:text></s:text></s:Label>
-                               <s:VGroup id="playGroup">
-                                       <s:Group>
-                                               <s:Graphic x="0" z="1">
-                                                       <s:Rect 
width="{RIGHT_WIDTH}" height="20">
-                                                               
<s:fill><s:SolidColor color="white"/></s:fill>
-                                                               
<s:stroke><s:SolidColorStroke color="black" weight="2"/></s:stroke>
-                                                       </s:Rect>
-                                               </s:Graphic>
-                                               <mx:Image id="fill" 
source="../images/level_meter.png" x="2" y="1" z="3" width="0"/>
-                                               <mx:Text text="{getLabel(767)}" 
x="0" z="5"/>
-                                       </s:Group>
-                                       <s:Group width="100%">
-                                               <s:layout><s:HorizontalLayout 
horizontalAlign="right"/></s:layout>
-                                               <s:Button id="play" 
label="{getLabel(764)}" enabled="false" click="playTestRecording()"/>
-                                       </s:Group>
-                               </s:VGroup>
-                       </s:Group>
-               </s:HGroup>
-               <s:HGroup><mx:Image source="../images/info.png"/><mx:Text 
text="{getLabel(765)}" width="{APP_WIDTH - 70}"/></s:HGroup>
-               <s:Group width="100%">
-                       <s:layout><s:HorizontalLayout 
horizontalAlign="right"/></s:layout>
-                       <s:Button id="cancel" label="{getLabel(918)}"/>
-                       <s:Button id="start" label="{getLabel(interview ? 54 : 
761)}" click="startConf(event)"/>
-               </s:Group>
-               <s:CheckBox id="remember" label="{getLabel(762)}" />
-       </s:Group>
-       <s:TextArea id="traceArea" y="460" width="400" height="400" 
text="{debugStr}"/>
+       <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/5d85a641/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java
index a40e518..a479791 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java
@@ -76,6 +76,7 @@ import org.apache.wicket.markup.head.JavaScriptHeaderItem;
 import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
 import org.apache.wicket.markup.head.PriorityHeaderItem;
 import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.protocol.http.ClientProperties;
 import org.apache.wicket.protocol.ws.api.event.WebSocketPushPayload;
 import org.apache.wicket.request.resource.JavaScriptResourceReference;
 import org.apache.wicket.request.resource.ResourceReference;
@@ -121,7 +122,8 @@ public class RoomPanel extends BasePanel {
                                URL url = new 
URL(WebSession.get().getExtendedProperties().getCodebase());
                                String path = url.getPath();
                                path = path.substring(1, path.indexOf('/', 2) + 
1);
-                               
target.appendJavaScript(String.format("initVideo(%s);", new JSONObject()
+                               ClientProperties cp = 
WebSession.get().getClientInfo().getProperties();
+                               
target.appendJavaScript(String.format("VideoSettings.init(%s);", new 
JSONObject()
                                                .put("uid", 
getClient().getUid())
                                                .put("audioOnly", 
r.isAudioOnly())
                                                .put("SID", WebSession.getSid())
@@ -130,8 +132,7 @@ public class RoomPanel extends BasePanel {
                                                .put("host", url.getHost())
                                                //.put("port", 
cfgDao.getConfValue(CONFIG_FLASH_PORT, String.class, ""))
                                                .put("app", path + r.getId())
-                                               .put("labels", 
SwfPanel.getStringLabels("448", "449", "450", "451", "758", "447", "52", "53"
-                                                               , "1429", 
"1430", "775", "452", "767", "764", "765", "918", "54", "761", "762"))
+                                               .put("wmode", 
cp.isBrowserInternetExplorer() && cp.getBrowserVersionMajor() == 11 ? "opaque" 
: "direct")
                                                .toString()
                                                ));
                        } catch (NullPointerException|MalformedURLException e) {

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/5d85a641/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/room.js
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/room.js 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/room.js
index 1fb06cc..c9109a2 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/room.js
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/room.js
@@ -16,45 +16,17 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-function initVideo(_options) {
-       return; //commented until video is implemented
-       var options = $.extend({bgcolor: "#ffffff"
-               , resolutions: JSON.stringify([{label: "4:3 (~6 KByte/sec)", 
width: 40, height: 30}
-                       , {label: "4:3 (~12 KByte/sec)", width: 80, height: 60}
-                       , {label: "4:3 (~20 KByte/sec)", width: 120, height: 
90, "default": true}
-                       , {label: "QQVGA 4:3 (~36 KByte/sec)", width: 160, 
height: 120}
-                       , {label: "4:3 (~40 KByte/sec)", width: 240, height: 
180}
-                       , {label: "HVGA 4:3 (~56 KByte/sec)", width: 320, 
height: 240}
-                       , {label: "4:3  (~60 KByte/sec)", width: 480, height: 
360}
-                       , {label: "4:3 (~68 KByte/sec)", width: 640, height: 
480}
-                       , {label: "XGA 4:3", width: 1024, height: 768}
-                       , {label: "16:9", width: 256, height: 150}
-                       , {label: "WQVGA 9:5", width: 432, height: 240}
-                       , {label: "pseudo 16:9", width: 480, height: 234}
-                       , {label: "16:9", width: 512, height: 300}
-                       , {label: "nHD 16:9", width: 640, height: 360}
-                       , {label: "16:9", width: 1024, height: 600}])
-               }, _options);
+function initVideo(el, id, options) {
        var type = 'application/x-shockwave-flash';
        var src = 'public/main.swf?cache' + new Date().getTime();
-       var r = $('<div class="room video">').attr("id", "video" + options.uid);
-       var o = $('<object>').attr('type', type).attr('data', 
src).attr('width', 640).attr('height', 480);
+       var o = $('<object>').attr('id', id).attr('type', type).attr('data', 
src).attr('width', options.width).attr('height', options.height);
        o.append($('<param>').attr('name', 'quality').attr('value', 'best'))
-               .append($('<param>').attr('name', 'wmode').attr('value', 
'transparent'))
+               .append($('<param>').attr('name', 'wmode').attr('value', 
options.wmode))
                .append($('<param>').attr('name', 
'allowscriptaccess').attr('value', 'sameDomain'))
                .append($('<param>').attr('name', 
'allowfullscreen').attr('value', 'false'))
                .append($('<param>').attr('name', 'flashvars').attr('value', 
$.param(options)));
-       $('#roomMenu').parent().append(r.append(o));
-       /*
-                       .attr('wmode', 'window').attr('allowfullscreen', true)
-                       .attr('width', options.width).attr('height', 
options.height)
-                       .attr('id', 'lzapp').attr('name', 'lzapp')
-                       .attr('flashvars', escape($.param(options)))
-                       .attr('swliveconnect', true).attr('align', 'middle')
-                       .attr('allowscriptaccess', 'sameDomain').attr('type', 
'application/x-shockwave-flash')
-                       .attr('pluginspage', 
'http://www.macromedia.com/go/getflashplayer')
-       */
-       r.dialog({dialogClass: "video"});
+       el.append(o);
+       return o;
 }
 
 function setRoomSizes() {
@@ -105,7 +77,6 @@ function roomLoad() {
                        setRoomSizes();
                }
        });
-       VideoSettings.init();
        Wicket.Event.subscribe("/websocket/closed", roomClosed);
 }
 function roomUnload() {
@@ -122,10 +93,25 @@ function startPrivateChat(el) {
        $('#chatMessage .wysiwyg-editor').click();
 }
 var VideoSettings = (function() {
-       var self = {}, vs, lm;
-       function _init() {
+       var self = {}, vs, lm, swf, s, cam, mic, res, inited = false;
+       function _load() {
+               s = {};
+               try {
+                       s = JSON.parse(localStorage.getItem('openmeetings')) || 
s;
+               } catch (e) {}
+               if (!s.video) {
+                       s.video = {};
+               }
+       }
+       function _save() {
+               localStorage.setItem('openmeetings', JSON.stringify(s));
+       }
+       function _init(options) {
                vs = $('#video-settings');
                lm = vs.find('.level-meter');
+               cam = vs.find('select.cam');
+               mic = vs.find('select.mic');
+               res = vs.find('select.cam-resolution');
                vs.dialog({
                        classes: {
                                'ui-dialog': 'ui-corner-all video'
@@ -139,6 +125,7 @@ var VideoSettings = (function() {
                                                primary: "ui-icon-disk"
                                        }
                                        , click: function() {
+                                               _save();
                                                vs.dialog("close");
                                        }
                                }
@@ -151,7 +138,60 @@ var VideoSettings = (function() {
                        ]
                });
                lm.progressbar({ value: 0 });
+               options.width = 300;
+               options.height = 200;
+               swf = initVideo(vs.find('.vid-block .video-conainer'), 
'video-settings-swf', options)[0];
+               vs.find('input, button').prop('disabled', true);
                vs.find('button').button();
+               _load();
+       }
+       function _readValues() {
+               s.video.cam = cam.val();
+               s.video.mic = mic.val();
+               var o = res.find('option:selected').data();
+               s.video.width = o.width;
+               s.video.height = o.height;
+               $(swf).attr('width', Math.max(300, 
s.video.width)).attr('height', Math.max(200, s.video.height));
+       }
+       function _initSwf() {
+               if (!inited) {
+                       var obj = swf.getDevices();
+                       for (var i = 0; i < obj.cams.length; ++i) {
+                               var o = $('<option></option>').attr('value', 
i).text(obj.cams[i]);
+                               if (i == s.video.cam) {
+                                       o.prop('selected', true);
+                               }
+                               cam.append(o);
+                       }
+                       cam.prop('disabled', false).change(function() {
+                               _readValues();
+                               swf.camChanged(s.video.cam);
+                       });
+                       for (var i = 0; i < obj.mics.length; ++i) {
+                               var o = $('<option></option>').attr('value', 
i).text(obj.mics[i]);
+                               if (i == s.video.mic) {
+                                       o.prop('selected', true);
+                               }
+                               mic.append(o);
+                       }
+                       mic.prop('disabled', false).change(function() {
+                               _readValues();
+                               swf.micChanged(s.video.mic);
+                       });
+                       res.change(function() {
+                               _readValues();
+                               swf.resChanged(s.video.width, s.video.height);
+                       });
+                       res.find('option').each(function(idx) {
+                               var o = $(this).data();
+                               if (o.width == s.video.width && o.height == 
s.video.height) {
+                                       $(this).prop('selected', true);
+                                       return false;
+                               }
+                       });
+               }
+               _readValues();
+               swf.init(s.video.cam, s.video.mic, s.video.width, 
s.video.height);
        }
        function _open(interview) {
                var rr = vs.find('.cam-resolution').parent('.sett-row');
@@ -164,6 +204,7 @@ var VideoSettings = (function() {
        }
        return {
                init: _init
+               , initSwf: _initSwf
                , open: _open
                , close: function() { vs.dialog('close'); }
        };

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/5d85a641/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/RoomSidebar.html
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/RoomSidebar.html
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/RoomSidebar.html
index 9e5b7ac..56a41c1 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/RoomSidebar.html
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/RoomSidebar.html
@@ -87,16 +87,15 @@
                                                </select>
                                        </div>
                                </div>
-                               <div class="sett-row">
-                                       <div 
class="align-right"><button><wicket:message key="775"/></button></div>
+                               <div class="sett-row right">
+                                       <div><button><wicket:message 
key="775"/></button></div>
                                </div>
                        </div>
                        <div class="vid-block">
-                               <div>
-                               </div>
+                               <div class="video-conainer"></div>
                                <div class="level-meter"></div>
-                               <div class="sett-row">
-                                       <div 
class="align-right"><button><wicket:message key="764"/></button></div>
+                               <div class="sett-row right">
+                                       <div><button><wicket:message 
key="764"/></button></div>
                                </div>
                        </div>
                </div>

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/5d85a641/openmeetings-web/src/main/webapp/css/room.css
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/main/webapp/css/room.css 
b/openmeetings-web/src/main/webapp/css/room.css
index 18f6f4c..36fab21 100644
--- a/openmeetings-web/src/main/webapp/css/room.css
+++ b/openmeetings-web/src/main/webapp/css/room.css
@@ -390,6 +390,13 @@
 .ui-dialog.video .sett-row {
        padding-top: 10px;
 }
+.ui-dialog.video .sett-row.right {
+       text-align: right;
+}
+.ui-dialog.video .vid-block .video-conainer {
+       overflow: auto;
+       max-height: 300px;
+}
 .ui-dialog.video .sett-row select, .ui-dialog.video .level-meter {
        width: 250px;
 }

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/5d85a641/openmeetings-web/src/main/webapp/js/openmeetings_functions.js
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/main/webapp/js/openmeetings_functions.js 
b/openmeetings-web/src/main/webapp/js/openmeetings_functions.js
deleted file mode 100644
index 53c3d3a..0000000
--- a/openmeetings-web/src/main/webapp/js/openmeetings_functions.js
+++ /dev/null
@@ -1,64 +0,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.
-  
-*/
-/*
- * Functions to be included in the HTML wrapper,
- * see the templates dir (*.vm) for the include statements
- *  
- */ 
-
-function getBrowserInfo() {
-       //alert(navigator.userAgent);
-       
document.getElementById("lzapp").getBrowserInfoCallback(navigator.userAgent);
-}
-
-function getBrowserLang() {
-       //alert(navigator.userAgent);
-       
document.getElementById("lzapp").getBrowserLangCallback(navigator.language);
-}
-
-function redirectToUrl(url) {
-       //alert(navigator.userAgent);
-       window.location = url;
-       
-       document.getElementById("lzapp").redirectToUrlCallback("ok");
-}
-
-function loadingComplete() {
-       document.getElementById("swfloading").style.display = 'none';
-       var lzApp = document.getElementById("lzappContainer");
-       lzApp.style.width = '100%';
-       lzApp.style.height = '100%';
-}
-
-function getTimeZoneOffsetMinutes() {
-       var rightNow = new Date(), std_time_offset = 
-rightNow.getTimezoneOffset();
-       for (var i = 0; i < 12; ++i) {
-               var d = new Date(rightNow.getFullYear(), i, 1, 0, 0, 0, 0), 
offset = -d.getTimezoneOffset();
-               if (offset < std_time_offset) {
-                       std_time_offset = offset;
-                       break;
-               }
-       }
-       return std_time_offset;
-}
-
-function getTimeZoneOffset() {
-       
document.getElementById("lzapp").getTimeZoneOffsetCallback(getTimeZoneOffsetMinutes()/60);
-}

Reply via email to