[OPENMEETINGS-551] settings dialog seems to be implemented

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

Branch: refs/heads/master
Commit: 8599b3df50907a1e4e505b0ec1541d64bd7ee730
Parents: 5d85a64
Author: Maxim Solodovnik <[email protected]>
Authored: Tue Apr 11 15:52:14 2017 +0000
Committer: Maxim Solodovnik <[email protected]>
Committed: Tue Apr 11 15:52:14 2017 +0000

----------------------------------------------------------------------
 .../remote/red5/ScopeApplicationAdapter.java    |  31 +++-
 openmeetings-flash/src/main/flex/main.mxml      | 152 +++++++++----------
 .../flex/org/apache/openmeetings/OmVideo.as     | 108 +++++++------
 .../installation/ImportInitvalues.java          |   8 +
 .../util/OpenmeetingsVariables.java             |   4 +
 .../web/pages/auth/SignInDialog.html            |   5 +-
 .../web/pages/install/InstallWizardPage.html    |   7 +-
 .../apache/openmeetings/web/room/RoomPanel.java |   5 +-
 .../apache/openmeetings/web/room/SwfPanel.java  |   1 -
 .../org/apache/openmeetings/web/room/room.js    |  54 +++++--
 .../web/room/sidebar/RoomSidebar.html           |   4 +-
 .../web/room/sidebar/icon/SettingsIcon.java     |   3 +-
 12 files changed, 222 insertions(+), 160 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8599b3df/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java
 
b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java
index 2a13a47..6a44556 100644
--- 
a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java
+++ 
b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java
@@ -19,10 +19,15 @@
 package org.apache.openmeetings.core.remote.red5;
 
 import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_MP4;
+import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_FLASH_SECURE;
+import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_FLASH_SECURE_PROXY;
+import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_FLASH_VIDEO_CODEC;
 import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
 
 import java.awt.Point;
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
@@ -32,6 +37,7 @@ import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 import java.util.Set;
 import java.util.UUID;
 import java.util.concurrent.atomic.AtomicLong;
@@ -92,6 +98,8 @@ import org.red5.server.api.stream.IBroadcastStream;
 import org.slf4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import com.github.openjson.JSONObject;
+
 public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter 
implements IPendingServiceCallback {
        private static final Logger log = 
Red5LoggerFactory.getLogger(ScopeApplicationAdapter.class, webAppRootKey);
        private static final String SECURITY_CODE_PARAM = "securityCode";
@@ -108,7 +116,7 @@ public class ScopeApplicationAdapter extends 
MultiThreadedApplicationAdapter imp
        @Autowired
        private RecordingService recordingService;
        @Autowired
-       private ConfigurationDao configurationDao;
+       private ConfigurationDao cfgDao;
        @Autowired
        private AppointmentDao appointmentDao;
        @Autowired
@@ -125,6 +133,7 @@ public class ScopeApplicationAdapter extends 
MultiThreadedApplicationAdapter imp
        private RecordingDao recordingDao;
        @Autowired
        private ServerDao serverDao;
+       private JSONObject flashSettings;
 
        private static AtomicLong broadCastCounter = new AtomicLong(0);
 
@@ -147,6 +156,18 @@ public class ScopeApplicationAdapter extends 
MultiThreadedApplicationAdapter imp
                        getCryptKey();
 
                        // init your handler here
+                       Properties props = new Properties();
+                       try (InputStream is = new FileInputStream(new File(new 
File(OmFileHelper.getRootDir(), "conf"), "red5.properties"))) {
+                               props.load(is);
+                       }
+                       flashSettings = new JSONObject()
+                                       .put("secure", 
"yes".equals(cfgDao.getConfValue(CONFIG_FLASH_SECURE, String.class, "no")))
+                                       .put("proxyType", 
cfgDao.getConfValue(CONFIG_FLASH_SECURE_PROXY, String.class, "none"))
+                                       .put("rtmpPort", 
props.getProperty("rtmp.port"))
+                                       .put("rtmpsPort", 
props.getProperty("rtmps.port"))
+                                       .put("videoCodec", 
cfgDao.getConfValue(CONFIG_FLASH_VIDEO_CODEC, String.class, "h263"))
+                                       .put("fps", 
cfgDao.getConfValue(OpenmeetingsVariables.CONFIG_FLASH_VIDEO_FPS, 
Integer.class, "30"))
+                                       ;
 
                        for (String scopeName : scope.getScopeNames()) {
                                log.debug("scopeName :: " + scopeName);
@@ -1847,11 +1868,11 @@ public class ScopeApplicationAdapter extends 
MultiThreadedApplicationAdapter imp
        }
 
        private boolean getWhiteboardDrawStatus() {
-               return configurationDao.getWhiteboardDrawStatus();
+               return cfgDao.getWhiteboardDrawStatus();
        }
 
        public String getCryptKey() {
-               return configurationDao.getCryptKey();
+               return cfgDao.getCryptKey();
        }
 
        public IScope getRoomScope(String room) {
@@ -1940,4 +1961,8 @@ public class ScopeApplicationAdapter extends 
MultiThreadedApplicationAdapter imp
 
                sendMessageToCurrentScope("addNewUser", currentClient, false);
        }
+
+       public JSONObject getFlashSettings() {
+               return flashSettings;
+       }
 }

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8599b3df/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 ec3792c..1e3867b 100644
--- a/openmeetings-flash/src/main/flex/main.mxml
+++ b/openmeetings-flash/src/main/flex/main.mxml
@@ -21,8 +21,8 @@
 <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"
-               preinitialize="init()" fontSize="12" 
applicationComplete="appInit()">
+               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/>
@@ -32,10 +32,7 @@
 
                import org.apache.openmeetings.OmVideo;
 
-               private var sid:String;
-               private var roomid:int;
                private var audioOnly:Boolean = false;
-               private var labels:Object = new Object();
                private var FPS:int;
                private var bandwidth:int = 0;
                private var quality:int = 100;
@@ -46,36 +43,12 @@
                private var selectedCam:int = -1;
                private var video:OmVideo;
                private var recName:String;
-               private var codec:String = OmVideo.CODEC_H264;
-               private var protocol:String;
-               private var host:String;
-               private var port:String;
-               private var app:String;
+               private var mic:Microphone = null;
                [Bindable]
                private var interview:Boolean = false;
 
-               private function init():void {
-                       trace("init()");
-                       var tla:Object = FlexGlobals.topLevelApplication;
-                       sid = tla.parameters['sid'];
-                       roomid = tla.parameters['roomid'];
-                       audioOnly = 'true' == tla.parameters['audioOnly'];
-                       interview = 'true' == tla.parameters['interview'];
-                       var _fps:int = parseInt(tla.parameters['fps']);
-                       FPS = interview ? 24 : (isNaN(_fps) || _fps < 1 ? 30 : 
_fps);
-
-                       var lbls:Array = JSON.parse(tla.parameters['labels']) 
as Array;
-                       for (var i:int = 0; i < lbls.length; ++i) {
-                               labels[lbls[i].id] = lbls[i].value;
-                       }
-                       protocol = tla.parameters['protocol'];
-                       host = tla.parameters['host'];
-                       port = tla.parameters['port'];
-                       app = tla.parameters['app'];
-               }
-
-               private function debug(str:String):void {
-                       ExternalInterface.call("console.log", str);
+               private function debug(...rest):void {
+                       ExternalInterface.call("console.log", rest);
                }
 
                private function camAvail():Boolean {
@@ -86,10 +59,15 @@
                        return Microphone.names.length > 0;
                }
 
-               private function appInit():void {
-                       video = new OmVideo(videoDisplay, codec, protocol + 
"://" + host + ":" + port + "/" + app);
-
+               private function appInit(evt:Event):void {
                        var tla:Object = FlexGlobals.topLevelApplication;
+                       debug("appInit()", tla.parameters);
+                       audioOnly = 'true' == tla.parameters['audioOnly'];
+                       interview = 'true' == tla.parameters['interview'];
+                       var _fps:int = parseInt(tla.parameters['fps']);
+                       FPS = (isNaN(_fps) || _fps < 1 ? 30 : _fps);
+                       video = new OmVideo(videoDisplay, tla.parameters);
+
                        ExternalInterface.addCallback("getDevices", function 
():Object {
                                return {
                                        cams: Camera.names
@@ -115,25 +93,34 @@
                                selectedMic = micIdx;
                                setResolution(width, height, true);
                        });
+                       ExternalInterface.addCallback("startRec", function 
():void {
+                               startTestRecording();
+                       });
+                       ExternalInterface.addCallback("play", function ():void {
+                               playTestRecording();
+                       });
                        ExternalInterface.call("VideoSettings.initSwf");
                }
 
+               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 && echoPath == 256) {
-                                       var options:MicrophoneEnhancedOptions = 
new MicrophoneEnhancedOptions();
-                                       options.mode = 
MicrophoneEnhancedMode.FULL_DUPLEX;
-                                       options.echoPath = 256;
-                                       options.nonLinearProcessing = true;
-                                       _micro.enhancedOptions = options;
-                                       debug("echoPath set to 256 " + 
_micro.enhancedOptions);
-                               }
-
                                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);
@@ -186,12 +173,13 @@
                                        video.attachCamera(cam);
                                        
cam.addEventListener(StatusEvent.STATUS, function (event:StatusEvent):void {
                                                debug("cameraStatusHandler! " + 
event);
-                                               
//cam.removeEventListener(StatusEvent.STATUS, arguments.callee);
+                                               
cam.removeEventListener(StatusEvent.STATUS, arguments.callee);
                                                switch (event.code) {
                                                        case 'Camera.Muted':
                                                                debug("Unable 
to connect to active camera.");
                                                                break;
                                                        case 'Camera.Unmuted':
+                                                               
ExternalInterface.call("VideoSettings.allowRec", true);
                                                                
_attachCamera(getCam());
                                                                break;
                                                }
@@ -200,20 +188,22 @@
                                        _attachCamera(cam);
                                }
                        } else {
-                               var mic:Microphone = getMic();
-                               if (mic != null) {
-                                       if (mic.muted) {
+                               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 {
+                                               ns.attachAudio(_mic);
+                                               
_mic.addEventListener(StatusEvent.STATUS, function (event:StatusEvent):void {
                                                        
debug("micStatusHandler! " + event);
-                                                       
mic.removeEventListener(StatusEvent.STATUS, arguments.callee);
+                                                       
_mic.removeEventListener(StatusEvent.STATUS, arguments.callee);
                                                        ns.close();
                                                        nc.close();
-                                                       if (mic.muted) {
+                                                       if (_mic.muted) {
                                                                debug("Unable 
to connect to active microphone.");
+                                                       } else {
+                                                               
ExternalInterface.call("VideoSettings.allowRec", true);
                                                        }
                                                });
                                        }
@@ -257,39 +247,39 @@
                }
 
                private function startTestRecording():void {
-                       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);
+                       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);
                                });
-                               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);
+                               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();
                                });
-                               recTimer.start();
-                               micTimer.start();
-                       });
-               }
-
-               private function micActivityHandler(event:ActivityEvent):void {
-                       //Do nothing, it just need to be there.
+                       } catch (err:Error) {
+                               debug("ERROR: " + err);
+                       }
                }
-       ]]></fx:Script>
+               ]]></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"

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8599b3df/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 229911c..23eabbe 100644
--- a/openmeetings-flash/src/main/flex/org/apache/openmeetings/OmVideo.as
+++ b/openmeetings-flash/src/main/flex/org/apache/openmeetings/OmVideo.as
@@ -19,6 +19,7 @@
 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;
@@ -43,13 +44,12 @@ public class OmVideo {
        public var width:int;
        public var height:int;
        private var mode:String;
-       private var codec:String;
-       private var url:String;
+       private var params:Object;
+       private var fallback:Boolean;
 
-       public function OmVideo(ui:UIComponent, codec:String, url:String) {
+       public function OmVideo(ui:UIComponent, params:Object) {
                this.ui = ui;
-               this.codec = codec;
-               this.url = url;
+               this.params = params;
        }
 
        private function getVideo():Video {
@@ -84,44 +84,42 @@ public class OmVideo {
                vid = null;
        }
 
+       private function debug(... rest):void {
+               ExternalInterface.call("console.log", rest);
+       }
+
        private function createStream():void {
+               debug("createStream: ");
                ns = new NetStream(nc);
                //see: 
http://livedocs.adobe.com/flash/9.0_de/ActionScriptLangRefV3/flash/net/NetStream.html
                //according to the docs the construct to catch event has to be 
implemented like this.
                //var t = this;
-               var clientObject:Object = new Object();
-               clientObject.onMetaData = function(metadata:Object):void {
-                       //t.onMetaData(metadata);
-                       trace("onMetaData: ", metadata);
-               };
-               clientObject.onPlayStatus = function(metadata:Object):void {
-                       //t.onPlayStatus(metadata);
-                       trace("onPlayStatus: ", metadata);
-               };
-               clientObject.onCuePoint = function(metadata:Object):void {
-                       //t.onCuePoint(metadata);
-                       trace("onCuePoint: ", metadata);
-               };
-               clientObject.ioError = function(error:Object):void {
-                       //t.ioError(error);
-                       trace("ioError: ", error);
-               };
-               clientObject.netStatus = function(status:Object):void {
-                       //t.netStatus(status);
-                       trace("netStatus: ", status);
-               };
-               clientObject.asyncError = function(error:Object):void {
-                       //t.asyncError(error);
-                       trace("asyncError: ", error);
+               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);
+                       }
                };
-               ns.client = clientObject;
                //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 {
-               trace("netStream_onNetStatus: ", evt.info.code, evt.target);
-               //this.onNetStatus.sendEvent(evt.info);
+               debug("netStream_onNetStatus: ", evt.info.code, evt.target);
        }
 
        private function _publish(mode:String, name:String, cam:Camera, 
mic:Microphone, f:Function):void {
@@ -137,8 +135,8 @@ public class OmVideo {
                        attachCamera(cam);
 
                        var videoStreamSettings:VideoStreamSettings = null;
-                       trace("codec = " + codec);
-                       if (codec === CODEC_H264) {
+                       debug("codec = " + params.videoCodec);
+                       if (params.videoCodec === CODEC_H264) {
                                var vss:H264VideoStreamSettings = new 
H264VideoStreamSettings();
                                vss.setProfileLevel(H264Profile.BASELINE, 
H264Level.LEVEL_5_1);
                                videoStreamSettings = vss;
@@ -147,7 +145,7 @@ public class OmVideo {
                        }
                        videoStreamSettings.setQuality(cam.bandwidth, 
cam.quality);
                        
videoStreamSettings.setKeyFrameInterval(cam.keyFrameInterval);
-                       trace("::keyFrameInterval " + cam.keyFrameInterval);
+                       debug("::keyFrameInterval " + cam.keyFrameInterval);
                        videoStreamSettings.setMode(cam.width, cam.height, 
cam.fps);
                        ns.videoStreamSettings = videoStreamSettings;
                }
@@ -162,12 +160,22 @@ public class OmVideo {
                }
        }
 
+       private function getUrl():String {
+               var secure:Boolean = ('true' === params.secure);
+               var url:String = (secure ? "rtmps" : "rtmp") + "://"
+                               + params.host + ":" + (secure ? 
params.rtmpsPort : params.rtmpPort)
+                               + "/" + params.app;
+               //TODO fallback
+               return url;
+       }
+
        private function publish(mode:String, name:String, cam:Camera, 
mic:Microphone, f:Function):void {
                if (nc == null || !nc.connected) {
-                       trace("NetConnection is not connected");
+                       var url:String = getUrl();
+                       debug("NetConnection is not connected", url);
                        nc = new NetConnection();
                        nc.addEventListener(NetStatusEvent.NET_STATUS, function 
onConnectionStatus(e:NetStatusEvent):void {
-                               trace("ConnectionStatus: " + e.info.code);
+                               debug("ConnectionStatus: " + e.info.code);
                                if (e.info.code == 
"NetConnection.Connect.Success") {
                                        _publish(mode, name, cam, mic, f);
                                } else {
@@ -175,26 +183,28 @@ public class OmVideo {
                                }
                        });
                        nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR, 
function (event:AsyncErrorEvent):void {
-                               trace("login Async error" + event);
+                               debug("login Async error" + event);
                        });
                        nc.client = {
                                onMetaData: function (infoObject:Object):void {
-                                       for (var propName:String in infoObject) 
{
-                                               trace(propName + " = " + 
infoObject[propName]);
-                                       }
+                                       debug("onMetaData::", infoObject);
                                }
                                , onBWDone: function(...rest):void {
-                                       trace("onBWDone");
+                                       debug("onBWDone");
                                }
                                , onBWCheck: function(...rest):Number {
-                                       trace("onBWCheck");
+                                       debug("onBWCheck");
                                        return 0;
                                }
                                , setId: function (id:Number):void {
-                                       trace("id: " + id); //TODO save 
connection id
+                                       debug("id: " + id); //TODO save 
connection id
                                }
                        };
-                       nc.connect(url);
+                       nc.connect(url, {
+                               uid: params.uid
+                               , sid: params.sid
+                               , nativeSsl: 'best' == params.proxyType
+                       });
                } else {
                        _publish(mode, name, cam, mic, f);
                }
@@ -205,6 +215,7 @@ public class OmVideo {
        }
 
        public function play(name:String):void {
+               debug("PLAY::", name);
                if (ns != null){
                        reset();
                }
@@ -215,16 +226,15 @@ public class OmVideo {
                //FIXME: Commented out, cause this leads to 
Buffer-Full/Buffer-Empty Events
                //after re-syncing the stream
                //this.setBuffer(0.1);
-               ns.play(name);
+               ns.play(name + ".flv");
        }
 
        public function reset():void {
-               var vid:Video = getVideo();
                if (ns != null) {
                        switch (mode) {
                                case PLAY:
                                        ns.pause();
-                                       ns.close();
+                                       ns.dispose();
                                        clear();
                                        break;
                                case BROADCAST:
@@ -232,7 +242,7 @@ public class OmVideo {
                                        ns.publish(null); //false in original 
code
                                default:
                                        clear();
-                                       ns.close();
+                                       ns.dispose();
                                        break;
                        }
                } else {

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8599b3df/openmeetings-install/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-install/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java
 
b/openmeetings-install/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java
index 1ceabe0..8ec1230 100644
--- 
a/openmeetings-install/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java
+++ 
b/openmeetings-install/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java
@@ -34,6 +34,10 @@ import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_DEFAULT_
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_DEFAULT_LDAP_ID;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_DOCUMENT_DPI;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_DOCUMENT_QUALITY;
+import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_FLASH_SECURE;
+import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_FLASH_SECURE_PROXY;
+import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_FLASH_VIDEO_CODEC;
+import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_FLASH_VIDEO_FPS;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_FRONTEND_REGISTER_KEY;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_GOOGLE_ANALYTICS_CODE;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_IGNORE_BAD_SSL;
@@ -352,6 +356,10 @@ public class ImportInitvalues {
                                "Users entered the room via invitationHash or 
secureHash will be redirected to this URL on connection lost");
                cfgDao.add(CONFIG_CALENDAR_FIRST_DAY, "0", null, "The day that 
each week begins. The value must be a number that represents the day of the 
week. Sunday=0, Monday=1, Tuesday=2, etc.");
                cfgDao.add(CONFIG_GOOGLE_ANALYTICS_CODE, null, null, "Code for 
Google Analytics");
+               cfgDao.add(CONFIG_FLASH_SECURE, "no", null, "Wether it should 
try to connect to rtmps first or not\nValid values: yes / no");
+               cfgDao.add(CONFIG_FLASH_SECURE_PROXY, "none", null, "The 
setting for the NetConnection default settings is 'none'\n set to value 'best' 
if you are trying to use rtmp over native SSL");
+               cfgDao.add(CONFIG_FLASH_VIDEO_CODEC, "h263", null, "Camera 
codecType, possible values: 'h263', 'h264'");
+               cfgDao.add(CONFIG_FLASH_VIDEO_FPS, "30", null, "Camera FPS, 
should be positive number in range (0, 60]");
 
                log.debug("Configurations ADDED");
        }

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8599b3df/openmeetings-util/src/main/java/org/apache/openmeetings/util/OpenmeetingsVariables.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-util/src/main/java/org/apache/openmeetings/util/OpenmeetingsVariables.java
 
b/openmeetings-util/src/main/java/org/apache/openmeetings/util/OpenmeetingsVariables.java
index 314bd51..f7b6c35 100644
--- 
a/openmeetings-util/src/main/java/org/apache/openmeetings/util/OpenmeetingsVariables.java
+++ 
b/openmeetings-util/src/main/java/org/apache/openmeetings/util/OpenmeetingsVariables.java
@@ -51,6 +51,10 @@ public class OpenmeetingsVariables {
        public static final String CONFIG_IMAGEMAGIC_PATH = "imagemagick_path";
        public static final String CONFIG_DOCUMENT_DPI = "document.dpi";
        public static final String CONFIG_DOCUMENT_QUALITY = "document.quality";
+       public static final String CONFIG_FLASH_SECURE = "flash.secure";
+       public static final String CONFIG_FLASH_SECURE_PROXY = 
"flash.secure.proxy";
+       public static final String CONFIG_FLASH_VIDEO_CODEC = 
"flash.video.codec";
+       public static final String CONFIG_FLASH_VIDEO_FPS = "flash.video.fps";
        public static final String MENU_ROOMS_NAME = "Conference Rooms";
        public static final int RECENT_ROOMS_COUNT = 5;
        public static final int LEVEL_USER = 1;

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8599b3df/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/auth/SignInDialog.html
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/auth/SignInDialog.html
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/auth/SignInDialog.html
index d1e8471..cbd175c 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/auth/SignInDialog.html
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/auth/SignInDialog.html
@@ -16,12 +16,9 @@
   KIND, either express or implied.  See the License for the
   specific language governing permissions and limitations
   under the License.
-  
+
 -->
 <html xmlns:wicket="http://wicket.apache.org";>
-<wicket:head>
-       <script type="text/javascript" 
src="js/openmeetings_functions.js"></script>
-</wicket:head>
 <wicket:panel>
        <form wicket:id="signin" class="signin">
                <table>

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8599b3df/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/install/InstallWizardPage.html
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/install/InstallWizardPage.html
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/install/InstallWizardPage.html
index df874bf..1a9041b 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/install/InstallWizardPage.html
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/install/InstallWizardPage.html
@@ -7,20 +7,19 @@
   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.
-  
+
 -->
 <html xmlns:wicket="http://wicket.apache.org";>
 <wicket:head>
-       <script type="text/javascript" src="js/openmeetings_functions.js" 
></script>
        <style type="text/css">
                .abstractWizard .adminForm div.formelement {
                        max-width: 600px;

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8599b3df/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 a479791..b05150f 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
@@ -36,6 +36,7 @@ import java.util.Set;
 import java.util.UUID;
 
 import org.apache.directory.api.util.Strings;
+import org.apache.openmeetings.core.remote.red5.ScopeApplicationAdapter;
 import org.apache.openmeetings.core.util.WebSocketHelper;
 import org.apache.openmeetings.db.dao.calendar.AppointmentDao;
 import org.apache.openmeetings.db.dao.log.ConferenceLogDao;
@@ -123,14 +124,12 @@ public class RoomPanel extends BasePanel {
                                String path = url.getPath();
                                path = path.substring(1, path.indexOf('/', 2) + 
1);
                                ClientProperties cp = 
WebSession.get().getClientInfo().getProperties();
-                               
target.appendJavaScript(String.format("VideoSettings.init(%s);", new 
JSONObject()
+                               
target.appendJavaScript(String.format("VideoSettings.init(%s);", new 
JSONObject(getBean(ScopeApplicationAdapter.class).getFlashSettings().toString())
                                                .put("uid", 
getClient().getUid())
                                                .put("audioOnly", 
r.isAudioOnly())
                                                .put("SID", WebSession.getSid())
                                                .put("interview", 
Room.Type.interview == r.getType())
-                                               //.put("protocol", 
cfgDao.getConfValue(CONFIG_FLASH_PROTOCOL, String.class, ""))
                                                .put("host", url.getHost())
-                                               //.put("port", 
cfgDao.getConfValue(CONFIG_FLASH_PORT, String.class, ""))
                                                .put("app", path + r.getId())
                                                .put("wmode", 
cp.isBrowserInternetExplorer() && cp.getBrowserVersionMajor() == 11 ? "opaque" 
: "direct")
                                                .toString()

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8599b3df/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/SwfPanel.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/SwfPanel.java 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/SwfPanel.java
index 255040c..d98dd4b 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/SwfPanel.java
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/SwfPanel.java
@@ -79,7 +79,6 @@ public class SwfPanel extends BasePanel {
        public void renderHead(IHeaderResponse response) {
                super.renderHead(response);
                response.render(new 
PriorityHeaderItem(JavaScriptHeaderItem.forReference(newResourceReference())));
-               response.render(new 
PriorityHeaderItem(JavaScriptHeaderItem.forUrl("js/openmeetings_functions.js")));
                
response.render(OnDomReadyHeaderItem.forScript(panelLoaded.getCallbackScript()));
        }
 

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8599b3df/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 c9109a2..1e2c563 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
@@ -93,7 +93,8 @@ function startPrivateChat(el) {
        $('#chatMessage .wysiwyg-editor').click();
 }
 var VideoSettings = (function() {
-       var self = {}, vs, lm, swf, s, cam, mic, res, inited = false;
+       var self = {}, vs, lm, swf, s, cam, mic, res,
+               vidScroll, recBtn, playBtn, inited = false, recAllowed = false;
        function _load() {
                s = {};
                try {
@@ -112,6 +113,14 @@ var VideoSettings = (function() {
                cam = vs.find('select.cam');
                mic = vs.find('select.mic');
                res = vs.find('select.cam-resolution');
+               vidScroll = vs.find('.vid-block .video-conainer');
+               recBtn = vs.find('.rec-start').click(function() {
+                       recBtn.prop('disabled', true).button('refresh'); //TODO 
disable drop-downs
+                       swf.startRec();
+               });
+               playBtn = vs.find('.play').click(function() {
+                       swf.play();
+               });
                vs.dialog({
                        classes: {
                                'ui-dialog': 'ui-corner-all video'
@@ -140,18 +149,43 @@ 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];
+               swf = initVideo(vidScroll, 'video-settings-swf', options)[0];
                vs.find('input, button').prop('disabled', true);
                vs.find('button').button();
+               var rr = vs.find('.cam-resolution').parent('.sett-row');
+               if (!!options.interview) {
+                       rr.show();
+               } else {
+                       rr.hide();
+               }
                _load();
        }
+       function _updateRec() {
+               recBtn.prop('disabled', !recAllowed && (s.video.cam > -1 || 
s.video.mic > -1)).button('refresh');
+       }
        function _readValues() {
-               s.video.cam = cam.val();
-               s.video.mic = mic.val();
+               s.video.cam = 1 * cam.val();
+               s.video.mic = 1 * 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));
+               vidScroll.scrollLeft(Math.max(0, s.video.width / 2 - 150))
+                       .scrollTop(Math.max(0, s.video.height / 2 - 110));
+               _updateRec();
+       }
+       
+       function _allowRec(allow) {
+               recAllowed = allow;
+               _updateRec();
+       }
+       function _allowPlay() {
+               _updateRec();
+               playBtn.prop('disabled', false).button('refresh');
+       }
+       function _micActivity(level) {
+               console.log("activity: ", level)
+               lm.progressbar("value", Math.max(0, level));
        }
        function _initSwf() {
                if (!inited) {
@@ -193,19 +227,17 @@ var VideoSettings = (function() {
                _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');
-               if (interview) {
-                       rr.show();
-               } else {
-                       rr.hide();
-               }
+       function _open() {
+               recAllowed = false;
                vs.dialog('open');
        }
        return {
                init: _init
                , initSwf: _initSwf
                , open: _open
+               , allowRec: _allowRec
+               , allowPlay: _allowPlay
+               , micActivity: _micActivity
                , close: function() { vs.dialog('close'); }
        };
 })();

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8599b3df/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 56a41c1..5809dcd 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
@@ -88,14 +88,14 @@
                                        </div>
                                </div>
                                <div class="sett-row right">
-                                       <div><button><wicket:message 
key="775"/></button></div>
+                                       <div><button 
class="rec-start"><wicket:message key="775"/></button></div>
                                </div>
                        </div>
                        <div class="vid-block">
                                <div class="video-conainer"></div>
                                <div class="level-meter"></div>
                                <div class="sett-row right">
-                                       <div><button><wicket:message 
key="764"/></button></div>
+                                       <div><button 
class="play"><wicket:message key="764"/></button></div>
                                </div>
                        </div>
                </div>

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/8599b3df/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/SettingsIcon.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/SettingsIcon.java
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/SettingsIcon.java
index 0c9f020..ab60687 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/SettingsIcon.java
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/SettingsIcon.java
@@ -19,7 +19,6 @@
 package org.apache.openmeetings.web.room.sidebar.icon;
 
 import org.apache.openmeetings.db.entity.basic.Client;
-import org.apache.openmeetings.db.entity.room.Room;
 import org.apache.openmeetings.web.room.RoomPanel;
 
 public class SettingsIcon extends ClientIcon {
@@ -42,6 +41,6 @@ public class SettingsIcon extends ClientIcon {
 
        @Override
        protected String getScript() {
-               return String.format("VideoSettings.open(%s);", 
Room.Type.interview == room.getRoom().getType());
+               return String.format("VideoSettings.open();");
        }
 }

Reply via email to