http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-flash/src/main/swf/commonVideoViewContentSWF10.lzx ---------------------------------------------------------------------- diff --git a/openmeetings-flash/src/main/swf/commonVideoViewContentSWF10.lzx b/openmeetings-flash/src/main/swf/commonVideoViewContentSWF10.lzx index 2cc1c0f..47a9ad1 100644 --- a/openmeetings-flash/src/main/swf/commonVideoViewContentSWF10.lzx +++ b/openmeetings-flash/src/main/swf/commonVideoViewContentSWF10.lzx @@ -1,815 +1,815 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. - ---> -<library> - -<class name="commonVideoViewContentSWF10" extends="view"> - <switch> - <when property="$as3"> - <passthrough> - import flash.external.ExternalInterface; - import flash.media.Camera; - import flash.media.Microphone; - import flash.media.MicrophoneEnhancedMode; - import flash.media.MicrophoneEnhancedOptions; - import flash.media.SoundCodec; - import flash.net.SharedObject; - </passthrough> - </when> - </switch> - - <attribute name="offsetLength" type="number" value="40"/> - <attribute name="videoWidth" type="number" value="132"/> - <attribute name="videoHeight" type="number" value="132"/> - <attribute name="SIDEPANEL_WIDTH" type="number" value="270" /> - <attribute name="baseVideoStream" value="null" /> - - <method name="toggleVideo" args="value"> - if($debug) Debug.info("toggleVideo ", canvas.currentClient, value); - canvas.currentClient.canVideo = value; - </method> - - <method name="createEditRecordStream" args="isInterview"> - if($debug) Debug.info("createEditRecordStream,", isInterview); - new lz.editRecordStreamSWF10(canvas, { - isInterview: isInterview, - }); - </method> - - <method name="batchCreateVideo" args="clients"> - <![CDATA[ - if ($debug) Debug.info("batchCreateVideo: ", clients.length); - for (var i = 0; i < clients.length; ++i) { - var c = clients[i]; - if (c.streamid != canvas.streamid) { - if (c.isBroadcasting) { - createVideo(c); - } else { - createVideoObject(c.publicSID, false, c.interviewPodId, c); - } - } - } - ]]> - </method> - - <!-- - Method that creates the video views when another user enters a room and his - item in the list of participants is created. - The method to "play" the stream is invoked later, when the user - really starts to stream and not only when he just enters the room. - --> - <method name="createVideoObject" args="publicSID, isBroadcasting, interviewPodId, object"> - if($debug) Debug.info("createVideoObject, publicSID: ",publicSID, "isBroadcasting: ", isBroadcasting, "object", object); - var vidContainer = getVideoObjectByPublicSID(publicSID); - if (vidContainer == null) { - vidContainer = isBroadcasting ? this.getNewVideoObject(publicSID) : this.getNewVideoObjectByPos(publicSID); - vidContainer.publicSID = publicSID; - } - if ($debug) Debug.write("Is interview ? ", canvas.isInterview); - placeInterviewPod(vidContainer, interviewPodId); - vidContainer.clientVars = object; - vidContainer.setAttribute('visible', false); - return vidContainer; - </method> - - <method name="placeInterviewPod" args="vidContainer, interviewPodId"> - <![CDATA[ - if ($debug) Debug.write("placeInterviewPod::Is interview ", canvas.isInterview, interviewPodId); - if (canvas.isInterview && interviewPodId != null && interviewPodId > 0) { - if (interviewPodId != null) { - vidContainer.setAttribute("interviewPodId", interviewPodId); - var cont = canvas._drawarea._videoviewcontent; - var box = cont['interviewVideoBox' + interviewPodId]; - if (!!box) { - vidContainer.setAttribute("x", cont.x + box.x); - vidContainer.setAttribute("y", box.y); - } - } - vidContainer.setAttribute("width", 322); - vidContainer.setAttribute("height", 281); - } - ]]> - </method> - - <method name="setPartnerName" args="obj, first, last=null"> - if (!obj) { - return; - } - var dispName = !last ? first : first + ' ' + last; - obj.setAttribute('chatpartnername', dispName); - </method> - - <!-- - Method that creates the video views when user(self) initially entering a room. - Creates the video-view AND starts to stream/play the video - --> - <method name="createVideo" args="cl"> - <![CDATA[ - if ($debug) Debug.info("createVideo::: ", cl.publicSID, cl.broadCastID, cl.avsettings, cl.interviewPodId); - if ($debug) Debug.write(" createVideo ALL vars ", cl); - var vidContainer = getVideoObjectByPublicSID(cl.publicSID); - if (cl.avsettings != 'n') { - if (vidContainer == null) { - vidContainer = getNewVideoObjectByPos(cl.publicSID); - } - vidContainer.clientVars = cl; - setPartnerName(vidContainer, cl.firstname, cl.lastname); - switch (cl.avsettings) { - case 'a': - if ($debug) Debug.warn("start play"); - vidContainer._chatvideoinner._videostream.playStream(cl.broadCastID, -1); - break; - case 'v': - case 'av': - //this means avsettings is either: "v" or "av" - vidContainer._chatvideoinner._videostream.playStream(cl.broadCastID, -1); - break; - case 'n': - default: - break; - } - vidContainer.updateAVSettingsSymbol(cl); - if (cl.micMuted) { - vidContainer.setMicMuted(cl.micMuted); - } - if ($debug) Debug.write(" createVideo ALL vars ", vidContainer); - placeInterviewPod(vidContainer, cl.interviewPodId); - } - enableRecordingButton(); - return vidContainer; - ]]> - </method> - - <method name="getVideoObjectByPublicSID" args="publicSID"> - <![CDATA[ - //if ($debug) Debug.write("getVideoObjectByPublicSid SEARCH: ", publicSID); - for (var i = 0; i < this.subviews.length; ++i) { - //if ($debug) Debug.write("this.subviews[i].publicSID ", this.subviews[i].publicSID); - if (this.subviews[i].publicSID == publicSID) { - return this.subviews[i]; - } - } - if ($debug) Debug.warn(" - getVideoObjectByPublicSID - DID NOT FIND THE USER BY ", publicSID); - return null; - ]]> - </method> - - <method name="getNewVideoObjectByPos" args="publicSID"> - <![CDATA[ - //Get a Free VideoView Slot - var freePos = this.getVideoObjectFreePos(this.offsetLength,this.videoWidth,this.videoHeight); - - return new lz.videoObjectPlayBroadcast(this,{ - publicSID:publicSID, - width:videoWidth, - height:videoHeight, - x:freePos[0], - y:freePos[1], - isInterview:canvas.isInterview - }); - ]]> - </method> - - <method name="getNewVideoObject" args="publicSID"> - <![CDATA[ - this.broadCastViewRef = getNewVideoObjectByPos(publicSID); - this.broadCastViewRef._chatvideoinner.r.destroy(); - if ($debug) Debug.write("getNewVideoObject canvas.currentClient ",publicSID, canvas.currentClient); - setPartnerName(this.broadCastViewRef, canvas.currentClient.firstname, canvas.currentClient.lastname); - return this.broadCastViewRef; - ]]> - </method> - - <method name="enableRecordingButton"> - <![CDATA[ - var count = 0; - for (var i = 0; i < this.subviews.length; ++i) { - if (this.subviews[i].visible) { - count++; - } - } - if (canvas.isInterview) { - if (count > 0 && !canvas._drawarea._interview._stop.enabled) { - canvas._drawarea._interview._start.setAttribute('enabled', true); - } else if (count == 0 && canvas._drawarea._interview._start.enabled) { - canvas._drawarea._interview._start.setAttribute('enabled', false); - } - } - ]]> - </method> - - <method name="getVideoObjectFreePos" args="offsetLength,videoWidth,videoHeight"> - <![CDATA[ - if (canvas.isInterview) { - return [0, 0]; - } - var newx = 20; - if (canvas.currentRoomObj.hideWhiteboard) { - newx += SIDEPANEL_WIDTH; - } - var newy = 0; - var posFound = false; - if (offsetLength == undefined) { - offsetLength=10; - } - while (!posFound) { - posFound = true; - for (var i=0;i<this.subviews.length;i++){ - var subview = this.subviews[i]; - var left = subview.x; - var right = subview.x + subview.width; - var top = subview.y; - var bottom = subview.y + subview.height; - - if( !(newx > right - || (newx + videoWidth) < left - || newy > bottom - || (newy + videoHeight) < top )) - { - newx = right + offsetLength; - posFound = false; - } - if ((newx + videoWidth) >= canvas.width) { - newx = 20; - if (canvas.currentRoomObj.hideWhiteboard) { - newx += SIDEPANEL_WIDTH; - } - newy += 10; - posFound = false; - } - } - } - - if ((newy + videoHeight) >= canvas.height) { - newy = 0; - } - return [newx, newy]; - ]]> - </method> - - <method name="muteSound" args="publicSID, bool"> - <![CDATA[ - var obj = this.getVideoObjectByPublicSID(publicSID); - if (obj != null) { - obj.silenceMicrophone(bool); - } - return; - ]]> - </method> - - <method name="resetAllValues"> - for (var eg in this.subviews){ - this.subviews[eg].resetValues(); - } - return; - </method> - - <method name="closeStreamclient" args="publicSID"> - <![CDATA[ - if ($debug) Debug.write("closeStream this: ", publicSID); - var obj = this.getVideoObjectByPublicSID(publicSID); - if ($debug) Debug.write("closeStream this obj: ", obj); - if (obj != null) { - obj.resetValues(); - } - if (canvas.publicSID == publicSID && canvas.editRecordStream != null) { - canvas.editRecordStream.destroy(); - } - return obj; - ]]> - </method> - - <method name="removeVideoByUser" args="publicSID"><![CDATA[ - if ($debug) Debug.write("removeVideoByUser: ", publicSID); - var obj = closeStreamclient(publicSID); - if (obj == null) { - if ($debug) Debug.warn("Could Not find this To removeVideoByUser", publicSID); - } else { - obj.destroy(); - enableRecordingButton(); - } - ]]></method> - - <method name="updateMuteStatusVideoView" args="roomClient"> - <![CDATA[ - var obj = this.getVideoObjectByPublicSID(roomClient.publicSID); - if (obj != null) { - obj.muteMicrophone(roomClient); - } - ]]> - </method> - - <method name="setSpeakingByPos" args="publicSID,bool"> - <![CDATA[ - //if ($debug) Debug.write("setSpeakingByPos ",publicSID,bool); - var obj = this.getVideoObjectByPublicSID(publicSID); - if (obj == null) { - if ($debug) Debug.warn("Could not find user for setSpeakingByPos ",publicSID,bool); - return; - } - obj._loudness.setSpeaking(bool); - ]]> - </method> - - <method name="setAVSettingsToClient" args="rcl"> - <![CDATA[ - if ($debug) Debug.write("setAVSettingsToClient: ", rcl.publicSID, rcl); - var obj = this.getVideoObjectByPublicSID(rcl.publicSID); - if ($debug) Debug.write("setAVSettingsToClient: ", obj, rcl.avsettings); - if (obj == null) { - obj = this.getNewVideoObjectByPos(rcl.publicSID); - } - obj.thisVars = rcl; - obj.updateAVSettingsSymbol(rcl); - var v = ("a" == rcl.avsettings && obj.isInterview) || ("a" != rcl.avsettings && rcl.avsettings != "n"); - obj.setAttribute("visible", "n" != rcl.avsettings); - if ($debug) Debug.write("setAVSettingsToClient: ", v, obj.visible); - ]]> - </method> - - <method name="startStream" args="value"> - <![CDATA[ - //value.publicSID,value.broadCastID,value.firstname,value.lastname,value.interviewPodId,value.VWidth,value.VHeight - - if ($debug) Debug.write("startStream: ", value); - createVideo(value); - ]]> - </method> - - <!--- - Clear all views, probably this is called whenever a user leaves the room for example - --> - <method name="clearAll"> - <![CDATA[ - if ($debug) Debug.write("clearAll", this.subviews); - while(this.subviews.length > 0) { - if (this.subviews[0]._chatvideoinner != null) { - this.subviews[0]._chatvideoinner._videostream._stop(); - } - this.subviews[0].destroy(); - } - if (canvas.editRecordStream != null) { - canvas.editRecordStream.destroy(); - } - return; - ]]> - </method> - - <method name="setExclusiveAudioAllowStatus" args="canGiveAudio"> - <![CDATA[ - if ($debug) Debug.write("setExclusiveAudioAllowStatus :: ",canGiveAudio); - canvas.setAttribute("isAllowedToGiveExclusiveAudio",canGiveAudio); - return; - ]]> - </method> - - <method name="updateFirstLastName" args="publicSID, first, last"> - setPartnerName(getVideoObjectByPublicSID(publicSID), first, last); - </method> - - <!-- arranges video pods --> - <method name="arrangeWindows"> - <![CDATA[ - if ($debug) Debug.write("arrangeWindows"); - var windowsList = this.subviews; - - if (0 == windowsList.length) { - return; - } - - windowsList.sort(this.sortFunction); - - var offsetInPx = 40; - var initX = 20; - var initY = 20; - var xPos = initX; - var yPos = initY; - var rowHeight = windowsList[0].height; - - // arrange windows with new positions - for (var winIdx = 0; winIdx < windowsList.length; winIdx++) { - var window = windowsList[winIdx]; - if (canvas.width < xPos + window.width) { - yPos += rowHeight + offsetInPx; - xPos = initX; - rowHeight = window.height; - } - if (canvas.height < yPos) { - initX += 10; - initY += 10; - xPos = initX; - yPos = initY; - } - window.setAttribute("x", xPos); - window.setAttribute("y", yPos); - window.bringToFront(); - - xPos += window.width + offsetInPx; - } - ]]> - </method> - - <!-- @keyword private --> - <method name="sortFunction" args="el1, el2"> - <![CDATA[ - if (el1.height > el2.height) { - return -1; - } else if (el1.height < el2.height) { - return 1; - } - return 0; - ]]> - </method> - - <!--- - Initializes video playback component - and connect to RTMP - --> - <method name="connectRecordingPlayer" args="connection_url,x,y,width,height"> - if($debug) Debug.write("connectRecordingPlayer ", connection_url,x,y,width,height); - canvas.thishib.setAttribute('src',connection_url); - canvas.thishib.connect(); - this.baseVideoStream = new lz.playBackVideoStream(canvas,{ - x:x, - y:y, - width:width, - height:height - }); - </method> - - <!--- - plays a recorded stream - --> - <method name="playRecordingStream" args="streamName,delay,x,y,width,height"> - if($debug) Debug.write("playRecordingStream ",streamName,x,y,width,height); - if (this.baseVideoStream == null) { - if ($debug) Debug.warn("baseVideoStream is NULL"); - return; - } - this.baseVideoStream.setAttribute("x",x); - this.baseVideoStream.setAttribute("y",y); - this.baseVideoStream.setAttribute("width",width); - this.baseVideoStream.setAttribute("height",height); - this.baseVideoStream.setAttribute("visibility","visible"); - this.baseVideoStream.playRecordingStream(streamName,delay); - </method> - - <!--- - Updates the width/height property of the recording playback video - --> - <method name="updateRecordingVideoPosition" args="width,height"> - if (this.baseVideoStream == null) { - if ($debug) Debug.warn("baseVideoStream is NULL"); - return; - } - this.baseVideoStream.setAttribute("width",width); - this.baseVideoStream.setAttribute("height",height); - </method> - - <!--- - stops and hides the recording playback video - --> - <method name="stopRecordingStream"> - if($debug) Debug.write("stopRecordingStream "); - if (this.baseVideoStream == null) { - if ($debug) Debug.warn("baseVideoStream is NULL"); - return; - } - if($debug) Debug.write(" stopRecording "); - this.baseVideoStream.stopRecording(); - this.baseVideoStream.setAttribute("visibility","hidden"); - </method> - - <!--- - pauses the current video or continue at the same position - --> - <method name="pauseRecordingPlayback" args="pauseBool"> - if($debug) Debug.write("pauseRecordingPlayback "); - if (this.baseVideoStream == null) { - if ($debug) Debug.warn("baseVideoStream is NULL"); - return; - } - this.baseVideoStream.pause(pauseBool); - </method> - - <method name="seekRecordingPlayback" args="flvTime"> - if($debug) Debug.write("seekRecordingPlayback ",flvTime); - if (this.baseVideoStream == null) { - if ($debug) Debug.warn("baseVideoStream is NULL"); - return; - } - this.baseVideoStream.seekStream(flvTime); - </method> - - <method name="stopAndCloseRecordingConnection"> - if($debug) Debug.write("stopAndCloseRecordingConnection "); - if (this.baseVideoStream == null) { - if ($debug) Debug.warn("baseVideoStream is NULL"); - return; - } - this.baseVideoStream.stopRecording(); - this.baseVideoStream.destroy(); - this.baseVideoStream = null; - </method> - - <!--- - ################################# - Methods to handle screen sharing video playback and cursor - --> - - <!--- - Adds a new screen sharing playback video - --> - <method name="newScreenSharing" args="value"> - <![CDATA[ - if (value.streamPublishName != canvas.publicSID) { - if (canvas.screenSharingDialogContainer == null) { - canvas.screenSharingDialogContainer = new lz.screenSharingDialogContainer(canvas); - } - if ($debug) Debug.warn("New Screen Sharing", value); - new lz.screenSharingDialog(canvas.screenSharingDialogContainer, {initObject: value}); - } else { - if ($debug) Debug.warn("Self Screen Sharing"); - } - ]]> - </method> - - <!--- - Add a list of screen sharing playback videos - (initially when entering the room invoked) - --> - <method name="newScreenSharings" args="value"> - <![CDATA[ - for (var eg in value) { - this.newScreenSharing(value[eg]); - } - ]]> - </method> - - <!--- - Close a single screen sharing playback video - --> - <method name="closeScreenSharing" args="value"> - <![CDATA[ - if (canvas.screenSharingDialogContainer != null) { - var obj = canvas.screenSharingDialogContainer.searchForSession(value.streamPublishName); - if (obj) { - obj.doClose(); - } - } - ]]> - </method> - - <!--- - Closes all screen sharing playback videos, whiteboard videos, user videos - and closes the rtmp connection - --> - <method name="closeAllScreenSharings"> - <![CDATA[ - if ($debug) Debug.write("RECEIVE closeAllScreenSharings "); - if (canvas.screenSharingDialogContainer != null) { - canvas.screenSharingDialogContainer.closeAll(); - canvas.screenSharingDialogContainer.destroy(); - canvas.screenSharingDialogContainer = null; - } - canvas.commonVideoViewContent.clearAll(); - ]]> - </method> - - <!--- - Update the position of the cursor from the sharing screen - --> - <method name="updateCursorScreenSharing" args="value"> - <![CDATA[ - //if ($debug) Debug.write("updateCursorScreenSharing ", value); - if (canvas.screenSharingDialogContainer != null) { - var obj = canvas.screenSharingDialogContainer.searchForSession(value.streamPublishName); - if (obj) { - obj.updateCursor(value.cursor_x, value.cursor_y); - } - } - ]]> - </method> - - <!--- - Make regExpTest - --> - <method name="regExpTest" args="fieldValue,regExStr"> - <![CDATA[ - var re = new RegExp(regExStr); - var testResult = re.test( fieldValue ); - if ($debug) Debug.write(fieldValue, testResult); - return testResult; - ]]> - </method> - - <method name="getMic" args="valMic"> - <![CDATA[ - if ($debug) Debug.write("Entering getMic ...", valMic); - if (valMic == null) { - valMic = 0; //select first one by default - } - var _micro = canvas.echoPath == 0 ? Microphone.getMicrophone(valMic) : Microphone.getEnhancedMicrophone(valMic); - - if (_micro != null) { - if (canvas.echoPath == 256) { - var options:MicrophoneEnhancedOptions = new MicrophoneEnhancedOptions(); - options.mode = MicrophoneEnhancedMode.FULL_DUPLEX; - options.echoPath = 256; - options.nonLinearProcessing = true; - _micro.enhancedOptions = options; - if ($debug) Debug.write("echoPath set to 256"); - if ($debug) Debug.write(_micro.enhancedOptions); - } - _micro.codec = SoundCodec.NELLYMOSER; - _micro.framesPerPacket = 1; - _micro.setSilenceLevel(0, 2000); - if ($debug) Debug.write("canvas.microphoneRateBest: ", canvas.microphoneRateBest); - _micro.rate = (canvas.microphoneRateBest == 'undefined') ? 22 : canvas.microphoneRateBest; - _micro.gain = 50; - // this has no effect if enhanced microphone is obtained - //Microphone setUseEchoSupression(bool) - var enableEchoSupression = !(canvas.echoSuppression === "false"); - if ($debug) Debug.write("canvas.echoSuppression: ", canvas.echoSuppression); - _micro.setUseEchoSuppression(enableEchoSupression); - } - if ($debug) Debug.write("... getMic DONE", _micro); - return _micro; - ]]> - </method> - - <method name="getCam" args="valCam, width, height"> - <![CDATA[ - if ($debug) Debug.write("Entering getCam ...", valCam); - if (valCam == null) { - valCam = 0; //select first one by default - } - var _camera = Camera.getCamera(valCam); - if (_camera != null) { - if ($debug) Debug.write("size: ", width, height); - - if ($debug) Debug.write("_camera.setQuality BEST: ", canvas.isInterview, (canvas.bandwidthNeededBest * 2), canvas.camQualityBest); - if (canvas.isInterview) { - //we need a fixed frame rate for the videos to merge them later on - _camera.setMode(320, 260, 24, true); //FIXME TODO hardcoded in different places - if ($debug) Debug.warn("IS INTERVIEW "); - _camera.setQuality(0, 98); - } else { - if ($debug) Debug.write("_camera.setMode: ", width, height, canvas.framesPerSecond, true); - _camera.setMode(width, height, canvas.framesPerSecond, true); - if ($debug) Debug.warn("IS NO INTERVIEW "); - _camera.setQuality(canvas.bandwidthNeededBest, canvas.camQualityBest); - } - } - if ($debug) Debug.write("... getCam DONE", _camera); - return _camera; - ]]> - </method> - - <method name="syncAVsettings" args="g"> - ExternalInterface.call("avSettings", JSON.stringify(g)); - </method> - - <method name="storeAVsettings" args="cam, mic, w, h"> - <![CDATA[ - var t:SharedObject = SharedObject.getLocal('userdata'); - var g = t.data; - if (!g) g = new Array(); - g["cam"] = cam; - g["mic"] = mic; - g["width"] = w; - g["height"] = h; - t.flush(); - //if ($debug) Debug.write("sharedobject store:: ", g); - syncAVsettings(g); - ]]> - </method> - - <method name="loadAVsettings"> - <![CDATA[ - var t:SharedObject = SharedObject.getLocal('userdata'); - var g = t.data; - //if ($debug) Debug.write("loadAVsettings: ", g["cam"], g["mic"]); - - if(g["width"] > 0 && g["height"] > 0) { - return g; - } - return null; - ]]> - </method> - - <method name="ensureAVsettings" args="w, h"> - if ($debug) Debug.write("ensureAVsettings:: [width, height] : [" + w + ", " + h + "]"); - var g = loadAVsettings(); - if (!g) { - storeAVsettings(Camera.names.length > 0 ? 0 : -1, Microphone.names.length > 0 ? 0 : -1, w, h); - } else { - syncAVsettings(g); - } - </method> - - <method name="getAvSetting" args="prop, g=null, def=null"> - //Initialize and get eventually stored property - if (!g) { - g = canvas.commonVideoViewContent.loadAVsettings(); - } - var val = g != null ? g[prop] : null; - return val != null ? val : def; - </method> - - <method name="getAVmode"> - var settings = canvas.currentClient.avsettings; - return !settings ? 'n' : settings; - </method> - - <method name="_startAvBroadcast" args="restart=false"> - setUserAVSettings.updateBroadcastId = restart; - setUserAVSettings.doCall(); - </method> - - <netRemoteCallHib name="setUserAVSettings" funcname="setUserAVSettings" remotecontext="$once{ canvas.thishib }" > - <attribute name="updateBroadcastId" value="false" type="boolean" /> - <netparam><method name="getValue">return parent.updateBroadcastId;</method></netparam> - <handler name="ondata" args="value"> - if ($debug) Debug.write("setUserAVSettings:: done", value); - if (value > -1) { - canvas.currentClient.broadCastID = value; - parent.startAvBroadcast(); - } - </handler> - </netRemoteCallHib> - - <method name="videoEnabled" args="settings"> - <![CDATA[ - return settings.indexOf('v') > -1; - ]]> - </method> - - <method name="startAvBroadcast"> - <![CDATA[ - var g = canvas.commonVideoViewContent.loadAVsettings(); - var settings = getAVmode(); - if ($debug) Debug.write("startAvBroadcast::mode ", settings); - if ('n' != settings) { - var videoWindow = getVideoObjectByPublicSID(canvas.publicSID); - if (videoWindow != null && videoEnabled(settings) && videoEnabled(videoWindow.clientVars.avsettings)) { - // audio on/off with video enabled - var videoview = videoWindow._chatvideoinner._videostream; - if (settings == 'av' && videoWindow.clientVars.avsettings == 'v') { - videoview.muteMicro(false); - } else if (settings == 'v' && videoWindow.clientVars.avsettings == 'av') { - videoview.muteMicro(true); - } - videoWindow.clientVars = canvas.currentClient; - } else { - videoWindow = createVideoObject(canvas.publicSID, true, canvas.currentClient.interviewPodId, canvas.currentClient); - if ($debug) Debug.write("startAvBroadcast::doninitalize"); - - var videoview = videoWindow._chatvideoinner._videostream; - if ($debug) Debug.write("videoWindow: ", videoWindow); - videoWindow.setAttribute('isremote', false); - var _micro = getMic(getAvSetting('mic', g, 0)); - var _camera = getCam(getAvSetting('cam', g, 0), canvas.currentClient.VWidth, canvas.currentClient.VHeight); - if ($debug) Debug.write("startAvBroadcast", _camera, _micro, settings, videoview); - - if ($debug) Debug.write("BroadcastId: ", canvas.currentClient.broadCastID); - switch (settings) { - case "av": - videoview.broadcast(canvas.currentClient.broadCastID, _camera, _micro); - break; - case "a": - videoview.broadcast(canvas.currentClient.broadCastID, null, _micro); - break; - case "v": - videoview.broadcast(canvas.currentClient.broadCastID, _camera, _micro); - videoview.muteMicro(true); - break; - default: - break; - } - } - videoWindow.updateAVSettingsSymbol(canvas.currentClient); - } - enableRecordingButton(); - ]]> - </method> -</class> - -</library> +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +--> +<library> + +<class name="commonVideoViewContentSWF10" extends="view"> + <switch> + <when property="$as3"> + <passthrough> + import flash.external.ExternalInterface; + import flash.media.Camera; + import flash.media.Microphone; + import flash.media.MicrophoneEnhancedMode; + import flash.media.MicrophoneEnhancedOptions; + import flash.media.SoundCodec; + import flash.net.SharedObject; + </passthrough> + </when> + </switch> + + <attribute name="offsetLength" type="number" value="40"/> + <attribute name="videoWidth" type="number" value="132"/> + <attribute name="videoHeight" type="number" value="132"/> + <attribute name="SIDEPANEL_WIDTH" type="number" value="270" /> + <attribute name="baseVideoStream" value="null" /> + + <method name="toggleVideo" args="value"> + if($debug) Debug.info("toggleVideo ", canvas.currentClient, value); + canvas.currentClient.canVideo = value; + </method> + + <method name="createEditRecordStream" args="isInterview"> + if($debug) Debug.info("createEditRecordStream,", isInterview); + new lz.editRecordStreamSWF10(canvas, { + isInterview: isInterview, + }); + </method> + + <method name="batchCreateVideo" args="clients"> + <![CDATA[ + if ($debug) Debug.info("batchCreateVideo: ", clients.length); + for (var i = 0; i < clients.length; ++i) { + var c = clients[i]; + if (c.streamid != canvas.streamid) { + if (c.isBroadcasting) { + createVideo(c); + } else { + createVideoObject(c.publicSID, false, c.interviewPodId, c); + } + } + } + ]]> + </method> + + <!-- + Method that creates the video views when another user enters a room and his + item in the list of participants is created. + The method to "play" the stream is invoked later, when the user + really starts to stream and not only when he just enters the room. + --> + <method name="createVideoObject" args="publicSID, isBroadcasting, interviewPodId, object"> + if($debug) Debug.info("createVideoObject, publicSID: ",publicSID, "isBroadcasting: ", isBroadcasting, "object", object); + var vidContainer = getVideoObjectByPublicSID(publicSID); + if (vidContainer == null) { + vidContainer = isBroadcasting ? this.getNewVideoObject(publicSID) : this.getNewVideoObjectByPos(publicSID); + vidContainer.publicSID = publicSID; + } + if ($debug) Debug.write("Is interview ? ", canvas.isInterview); + placeInterviewPod(vidContainer, interviewPodId); + vidContainer.clientVars = object; + vidContainer.setAttribute('visible', false); + return vidContainer; + </method> + + <method name="placeInterviewPod" args="vidContainer, interviewPodId"> + <![CDATA[ + if ($debug) Debug.write("placeInterviewPod::Is interview ", canvas.isInterview, interviewPodId); + if (canvas.isInterview && interviewPodId != null && interviewPodId > 0) { + if (interviewPodId != null) { + vidContainer.setAttribute("interviewPodId", interviewPodId); + var cont = canvas._drawarea._videoviewcontent; + var box = cont['interviewVideoBox' + interviewPodId]; + if (!!box) { + vidContainer.setAttribute("x", cont.x + box.x); + vidContainer.setAttribute("y", box.y); + } + } + vidContainer.setAttribute("width", 322); + vidContainer.setAttribute("height", 281); + } + ]]> + </method> + + <method name="setPartnerName" args="obj, first, last=null"> + if (!obj) { + return; + } + var dispName = !last ? first : first + ' ' + last; + obj.setAttribute('chatpartnername', dispName); + </method> + + <!-- + Method that creates the video views when user(self) initially entering a room. + Creates the video-view AND starts to stream/play the video + --> + <method name="createVideo" args="cl"> + <![CDATA[ + if ($debug) Debug.info("createVideo::: ", cl.publicSID, cl.broadCastID, cl.avsettings, cl.interviewPodId); + if ($debug) Debug.write(" createVideo ALL vars ", cl); + var vidContainer = getVideoObjectByPublicSID(cl.publicSID); + if (cl.avsettings != 'n') { + if (vidContainer == null) { + vidContainer = getNewVideoObjectByPos(cl.publicSID); + } + vidContainer.clientVars = cl; + setPartnerName(vidContainer, cl.firstname, cl.lastname); + switch (cl.avsettings) { + case 'a': + if ($debug) Debug.warn("start play"); + vidContainer._chatvideoinner._videostream.playStream(cl.broadCastID, -1); + break; + case 'v': + case 'av': + //this means avsettings is either: "v" or "av" + vidContainer._chatvideoinner._videostream.playStream(cl.broadCastID, -1); + break; + case 'n': + default: + break; + } + vidContainer.updateAVSettingsSymbol(cl); + if (cl.micMuted) { + vidContainer.setMicMuted(cl.micMuted); + } + if ($debug) Debug.write(" createVideo ALL vars ", vidContainer); + placeInterviewPod(vidContainer, cl.interviewPodId); + } + enableRecordingButton(); + return vidContainer; + ]]> + </method> + + <method name="getVideoObjectByPublicSID" args="publicSID"> + <![CDATA[ + //if ($debug) Debug.write("getVideoObjectByPublicSid SEARCH: ", publicSID); + for (var i = 0; i < this.subviews.length; ++i) { + //if ($debug) Debug.write("this.subviews[i].publicSID ", this.subviews[i].publicSID); + if (this.subviews[i].publicSID == publicSID) { + return this.subviews[i]; + } + } + if ($debug) Debug.warn(" - getVideoObjectByPublicSID - DID NOT FIND THE USER BY ", publicSID); + return null; + ]]> + </method> + + <method name="getNewVideoObjectByPos" args="publicSID"> + <![CDATA[ + //Get a Free VideoView Slot + var freePos = this.getVideoObjectFreePos(this.offsetLength,this.videoWidth,this.videoHeight); + + return new lz.videoObjectPlayBroadcast(this,{ + publicSID:publicSID, + width:videoWidth, + height:videoHeight, + x:freePos[0], + y:freePos[1], + isInterview:canvas.isInterview + }); + ]]> + </method> + + <method name="getNewVideoObject" args="publicSID"> + <![CDATA[ + this.broadCastViewRef = getNewVideoObjectByPos(publicSID); + this.broadCastViewRef._chatvideoinner.r.destroy(); + if ($debug) Debug.write("getNewVideoObject canvas.currentClient ",publicSID, canvas.currentClient); + setPartnerName(this.broadCastViewRef, canvas.currentClient.firstname, canvas.currentClient.lastname); + return this.broadCastViewRef; + ]]> + </method> + + <method name="enableRecordingButton"> + <![CDATA[ + var count = 0; + for (var i = 0; i < this.subviews.length; ++i) { + if (this.subviews[i].visible) { + count++; + } + } + if (canvas.isInterview) { + if (count > 0 && !canvas._drawarea._interview._stop.enabled) { + canvas._drawarea._interview._start.setAttribute('enabled', true); + } else if (count == 0 && canvas._drawarea._interview._start.enabled) { + canvas._drawarea._interview._start.setAttribute('enabled', false); + } + } + ]]> + </method> + + <method name="getVideoObjectFreePos" args="offsetLength,videoWidth,videoHeight"> + <![CDATA[ + if (canvas.isInterview) { + return [0, 0]; + } + var newx = 20; + if (canvas.currentRoomObj.hideWhiteboard) { + newx += SIDEPANEL_WIDTH; + } + var newy = 0; + var posFound = false; + if (offsetLength == undefined) { + offsetLength=10; + } + while (!posFound) { + posFound = true; + for (var i=0;i<this.subviews.length;i++){ + var subview = this.subviews[i]; + var left = subview.x; + var right = subview.x + subview.width; + var top = subview.y; + var bottom = subview.y + subview.height; + + if( !(newx > right + || (newx + videoWidth) < left + || newy > bottom + || (newy + videoHeight) < top )) + { + newx = right + offsetLength; + posFound = false; + } + if ((newx + videoWidth) >= canvas.width) { + newx = 20; + if (canvas.currentRoomObj.hideWhiteboard) { + newx += SIDEPANEL_WIDTH; + } + newy += 10; + posFound = false; + } + } + } + + if ((newy + videoHeight) >= canvas.height) { + newy = 0; + } + return [newx, newy]; + ]]> + </method> + + <method name="muteSound" args="publicSID, bool"> + <![CDATA[ + var obj = this.getVideoObjectByPublicSID(publicSID); + if (obj != null) { + obj.silenceMicrophone(bool); + } + return; + ]]> + </method> + + <method name="resetAllValues"> + for (var eg in this.subviews){ + this.subviews[eg].resetValues(); + } + return; + </method> + + <method name="closeStreamclient" args="publicSID"> + <![CDATA[ + if ($debug) Debug.write("closeStream this: ", publicSID); + var obj = this.getVideoObjectByPublicSID(publicSID); + if ($debug) Debug.write("closeStream this obj: ", obj); + if (obj != null) { + obj.resetValues(); + } + if (canvas.publicSID == publicSID && canvas.editRecordStream != null) { + canvas.editRecordStream.destroy(); + } + return obj; + ]]> + </method> + + <method name="removeVideoByUser" args="publicSID"><![CDATA[ + if ($debug) Debug.write("removeVideoByUser: ", publicSID); + var obj = closeStreamclient(publicSID); + if (obj == null) { + if ($debug) Debug.warn("Could Not find this To removeVideoByUser", publicSID); + } else { + obj.destroy(); + enableRecordingButton(); + } + ]]></method> + + <method name="updateMuteStatusVideoView" args="roomClient"> + <![CDATA[ + var obj = this.getVideoObjectByPublicSID(roomClient.publicSID); + if (obj != null) { + obj.muteMicrophone(roomClient); + } + ]]> + </method> + + <method name="setSpeakingByPos" args="publicSID,bool"> + <![CDATA[ + //if ($debug) Debug.write("setSpeakingByPos ",publicSID,bool); + var obj = this.getVideoObjectByPublicSID(publicSID); + if (obj == null) { + if ($debug) Debug.warn("Could not find user for setSpeakingByPos ",publicSID,bool); + return; + } + obj._loudness.setSpeaking(bool); + ]]> + </method> + + <method name="setAVSettingsToClient" args="rcl"> + <![CDATA[ + if ($debug) Debug.write("setAVSettingsToClient: ", rcl.publicSID, rcl); + var obj = this.getVideoObjectByPublicSID(rcl.publicSID); + if ($debug) Debug.write("setAVSettingsToClient: ", obj, rcl.avsettings); + if (obj == null) { + obj = this.getNewVideoObjectByPos(rcl.publicSID); + } + obj.thisVars = rcl; + obj.updateAVSettingsSymbol(rcl); + var v = ("a" == rcl.avsettings && obj.isInterview) || ("a" != rcl.avsettings && rcl.avsettings != "n"); + obj.setAttribute("visible", "n" != rcl.avsettings); + if ($debug) Debug.write("setAVSettingsToClient: ", v, obj.visible); + ]]> + </method> + + <method name="startStream" args="value"> + <![CDATA[ + //value.publicSID,value.broadCastID,value.firstname,value.lastname,value.interviewPodId,value.VWidth,value.VHeight + + if ($debug) Debug.write("startStream: ", value); + createVideo(value); + ]]> + </method> + + <!--- + Clear all views, probably this is called whenever a user leaves the room for example + --> + <method name="clearAll"> + <![CDATA[ + if ($debug) Debug.write("clearAll", this.subviews); + while(this.subviews.length > 0) { + if (this.subviews[0]._chatvideoinner != null) { + this.subviews[0]._chatvideoinner._videostream._stop(); + } + this.subviews[0].destroy(); + } + if (canvas.editRecordStream != null) { + canvas.editRecordStream.destroy(); + } + return; + ]]> + </method> + + <method name="setExclusiveAudioAllowStatus" args="canGiveAudio"> + <![CDATA[ + if ($debug) Debug.write("setExclusiveAudioAllowStatus :: ",canGiveAudio); + canvas.setAttribute("isAllowedToGiveExclusiveAudio",canGiveAudio); + return; + ]]> + </method> + + <method name="updateFirstLastName" args="publicSID, first, last"> + setPartnerName(getVideoObjectByPublicSID(publicSID), first, last); + </method> + + <!-- arranges video pods --> + <method name="arrangeWindows"> + <![CDATA[ + if ($debug) Debug.write("arrangeWindows"); + var windowsList = this.subviews; + + if (0 == windowsList.length) { + return; + } + + windowsList.sort(this.sortFunction); + + var offsetInPx = 40; + var initX = 20; + var initY = 20; + var xPos = initX; + var yPos = initY; + var rowHeight = windowsList[0].height; + + // arrange windows with new positions + for (var winIdx = 0; winIdx < windowsList.length; winIdx++) { + var window = windowsList[winIdx]; + if (canvas.width < xPos + window.width) { + yPos += rowHeight + offsetInPx; + xPos = initX; + rowHeight = window.height; + } + if (canvas.height < yPos) { + initX += 10; + initY += 10; + xPos = initX; + yPos = initY; + } + window.setAttribute("x", xPos); + window.setAttribute("y", yPos); + window.bringToFront(); + + xPos += window.width + offsetInPx; + } + ]]> + </method> + + <!-- @keyword private --> + <method name="sortFunction" args="el1, el2"> + <![CDATA[ + if (el1.height > el2.height) { + return -1; + } else if (el1.height < el2.height) { + return 1; + } + return 0; + ]]> + </method> + + <!--- + Initializes video playback component + and connect to RTMP + --> + <method name="connectRecordingPlayer" args="connection_url,x,y,width,height"> + if($debug) Debug.write("connectRecordingPlayer ", connection_url,x,y,width,height); + canvas.thishib.setAttribute('src',connection_url); + canvas.thishib.connect(); + this.baseVideoStream = new lz.playBackVideoStream(canvas,{ + x:x, + y:y, + width:width, + height:height + }); + </method> + + <!--- + plays a recorded stream + --> + <method name="playRecordingStream" args="streamName,delay,x,y,width,height"> + if($debug) Debug.write("playRecordingStream ",streamName,x,y,width,height); + if (this.baseVideoStream == null) { + if ($debug) Debug.warn("baseVideoStream is NULL"); + return; + } + this.baseVideoStream.setAttribute("x",x); + this.baseVideoStream.setAttribute("y",y); + this.baseVideoStream.setAttribute("width",width); + this.baseVideoStream.setAttribute("height",height); + this.baseVideoStream.setAttribute("visibility","visible"); + this.baseVideoStream.playRecordingStream(streamName,delay); + </method> + + <!--- + Updates the width/height property of the recording playback video + --> + <method name="updateRecordingVideoPosition" args="width,height"> + if (this.baseVideoStream == null) { + if ($debug) Debug.warn("baseVideoStream is NULL"); + return; + } + this.baseVideoStream.setAttribute("width",width); + this.baseVideoStream.setAttribute("height",height); + </method> + + <!--- + stops and hides the recording playback video + --> + <method name="stopRecordingStream"> + if($debug) Debug.write("stopRecordingStream "); + if (this.baseVideoStream == null) { + if ($debug) Debug.warn("baseVideoStream is NULL"); + return; + } + if($debug) Debug.write(" stopRecording "); + this.baseVideoStream.stopRecording(); + this.baseVideoStream.setAttribute("visibility","hidden"); + </method> + + <!--- + pauses the current video or continue at the same position + --> + <method name="pauseRecordingPlayback" args="pauseBool"> + if($debug) Debug.write("pauseRecordingPlayback "); + if (this.baseVideoStream == null) { + if ($debug) Debug.warn("baseVideoStream is NULL"); + return; + } + this.baseVideoStream.pause(pauseBool); + </method> + + <method name="seekRecordingPlayback" args="flvTime"> + if($debug) Debug.write("seekRecordingPlayback ",flvTime); + if (this.baseVideoStream == null) { + if ($debug) Debug.warn("baseVideoStream is NULL"); + return; + } + this.baseVideoStream.seekStream(flvTime); + </method> + + <method name="stopAndCloseRecordingConnection"> + if($debug) Debug.write("stopAndCloseRecordingConnection "); + if (this.baseVideoStream == null) { + if ($debug) Debug.warn("baseVideoStream is NULL"); + return; + } + this.baseVideoStream.stopRecording(); + this.baseVideoStream.destroy(); + this.baseVideoStream = null; + </method> + + <!--- + ################################# + Methods to handle screen sharing video playback and cursor + --> + + <!--- + Adds a new screen sharing playback video + --> + <method name="newScreenSharing" args="value"> + <![CDATA[ + if (value.streamPublishName != canvas.publicSID) { + if (canvas.screenSharingDialogContainer == null) { + canvas.screenSharingDialogContainer = new lz.screenSharingDialogContainer(canvas); + } + if ($debug) Debug.warn("New Screen Sharing", value); + new lz.screenSharingDialog(canvas.screenSharingDialogContainer, {initObject: value}); + } else { + if ($debug) Debug.warn("Self Screen Sharing"); + } + ]]> + </method> + + <!--- + Add a list of screen sharing playback videos + (initially when entering the room invoked) + --> + <method name="newScreenSharings" args="value"> + <![CDATA[ + for (var eg in value) { + this.newScreenSharing(value[eg]); + } + ]]> + </method> + + <!--- + Close a single screen sharing playback video + --> + <method name="closeScreenSharing" args="value"> + <![CDATA[ + if (canvas.screenSharingDialogContainer != null) { + var obj = canvas.screenSharingDialogContainer.searchForSession(value.streamPublishName); + if (obj) { + obj.doClose(); + } + } + ]]> + </method> + + <!--- + Closes all screen sharing playback videos, whiteboard videos, user videos + and closes the rtmp connection + --> + <method name="closeAllScreenSharings"> + <![CDATA[ + if ($debug) Debug.write("RECEIVE closeAllScreenSharings "); + if (canvas.screenSharingDialogContainer != null) { + canvas.screenSharingDialogContainer.closeAll(); + canvas.screenSharingDialogContainer.destroy(); + canvas.screenSharingDialogContainer = null; + } + canvas.commonVideoViewContent.clearAll(); + ]]> + </method> + + <!--- + Update the position of the cursor from the sharing screen + --> + <method name="updateCursorScreenSharing" args="value"> + <![CDATA[ + //if ($debug) Debug.write("updateCursorScreenSharing ", value); + if (canvas.screenSharingDialogContainer != null) { + var obj = canvas.screenSharingDialogContainer.searchForSession(value.streamPublishName); + if (obj) { + obj.updateCursor(value.cursor_x, value.cursor_y); + } + } + ]]> + </method> + + <!--- + Make regExpTest + --> + <method name="regExpTest" args="fieldValue,regExStr"> + <![CDATA[ + var re = new RegExp(regExStr); + var testResult = re.test( fieldValue ); + if ($debug) Debug.write(fieldValue, testResult); + return testResult; + ]]> + </method> + + <method name="getMic" args="valMic"> + <![CDATA[ + if ($debug) Debug.write("Entering getMic ...", valMic); + if (valMic == null) { + valMic = 0; //select first one by default + } + var _micro = canvas.echoPath == 0 ? Microphone.getMicrophone(valMic) : Microphone.getEnhancedMicrophone(valMic); + + if (_micro != null) { + if (canvas.echoPath == 256) { + var options:MicrophoneEnhancedOptions = new MicrophoneEnhancedOptions(); + options.mode = MicrophoneEnhancedMode.FULL_DUPLEX; + options.echoPath = 256; + options.nonLinearProcessing = true; + _micro.enhancedOptions = options; + if ($debug) Debug.write("echoPath set to 256"); + if ($debug) Debug.write(_micro.enhancedOptions); + } + _micro.codec = SoundCodec.NELLYMOSER; + _micro.framesPerPacket = 1; + _micro.setSilenceLevel(0, 2000); + if ($debug) Debug.write("canvas.microphoneRateBest: ", canvas.microphoneRateBest); + _micro.rate = (canvas.microphoneRateBest == 'undefined') ? 22 : canvas.microphoneRateBest; + _micro.gain = 50; + // this has no effect if enhanced microphone is obtained + //Microphone setUseEchoSupression(bool) + var enableEchoSupression = !(canvas.echoSuppression === "false"); + if ($debug) Debug.write("canvas.echoSuppression: ", canvas.echoSuppression); + _micro.setUseEchoSuppression(enableEchoSupression); + } + if ($debug) Debug.write("... getMic DONE", _micro); + return _micro; + ]]> + </method> + + <method name="getCam" args="valCam, width, height"> + <![CDATA[ + if ($debug) Debug.write("Entering getCam ...", valCam); + if (valCam == null) { + valCam = 0; //select first one by default + } + var _camera = Camera.getCamera(valCam); + if (_camera != null) { + if ($debug) Debug.write("size: ", width, height); + + if ($debug) Debug.write("_camera.setQuality BEST: ", canvas.isInterview, (canvas.bandwidthNeededBest * 2), canvas.camQualityBest); + if (canvas.isInterview) { + //we need a fixed frame rate for the videos to merge them later on + _camera.setMode(320, 260, 24, true); //FIXME TODO hardcoded in different places + if ($debug) Debug.warn("IS INTERVIEW "); + _camera.setQuality(0, 98); + } else { + if ($debug) Debug.write("_camera.setMode: ", width, height, canvas.framesPerSecond, true); + _camera.setMode(width, height, canvas.framesPerSecond, true); + if ($debug) Debug.warn("IS NO INTERVIEW "); + _camera.setQuality(canvas.bandwidthNeededBest, canvas.camQualityBest); + } + } + if ($debug) Debug.write("... getCam DONE", _camera); + return _camera; + ]]> + </method> + + <method name="syncAVsettings" args="g"> + ExternalInterface.call("avSettings", JSON.stringify(g)); + </method> + + <method name="storeAVsettings" args="cam, mic, w, h"> + <![CDATA[ + var t:SharedObject = SharedObject.getLocal('userdata'); + var g = t.data; + if (!g) g = new Array(); + g["cam"] = cam; + g["mic"] = mic; + g["width"] = w; + g["height"] = h; + t.flush(); + //if ($debug) Debug.write("sharedobject store:: ", g); + syncAVsettings(g); + ]]> + </method> + + <method name="loadAVsettings"> + <![CDATA[ + var t:SharedObject = SharedObject.getLocal('userdata'); + var g = t.data; + //if ($debug) Debug.write("loadAVsettings: ", g["cam"], g["mic"]); + + if(g["width"] > 0 && g["height"] > 0) { + return g; + } + return null; + ]]> + </method> + + <method name="ensureAVsettings" args="w, h"> + if ($debug) Debug.write("ensureAVsettings:: [width, height] : [" + w + ", " + h + "]"); + var g = loadAVsettings(); + if (!g) { + storeAVsettings(Camera.names.length > 0 ? 0 : -1, Microphone.names.length > 0 ? 0 : -1, w, h); + } else { + syncAVsettings(g); + } + </method> + + <method name="getAvSetting" args="prop, g=null, def=null"> + //Initialize and get eventually stored property + if (!g) { + g = canvas.commonVideoViewContent.loadAVsettings(); + } + var val = g != null ? g[prop] : null; + return val != null ? val : def; + </method> + + <method name="getAVmode"> + var settings = canvas.currentClient.avsettings; + return !settings ? 'n' : settings; + </method> + + <method name="_startAvBroadcast" args="restart=false"> + setUserAVSettings.updateBroadcastId = restart; + setUserAVSettings.doCall(); + </method> + + <netRemoteCallHib name="setUserAVSettings" funcname="setUserAVSettings" remotecontext="$once{ canvas.thishib }" > + <attribute name="updateBroadcastId" value="false" type="boolean" /> + <netparam><method name="getValue">return parent.updateBroadcastId;</method></netparam> + <handler name="ondata" args="value"> + if ($debug) Debug.write("setUserAVSettings:: done", value); + if (value > -1) { + canvas.currentClient.broadCastID = value; + parent.startAvBroadcast(); + } + </handler> + </netRemoteCallHib> + + <method name="videoEnabled" args="settings"> + <![CDATA[ + return settings.indexOf('v') > -1; + ]]> + </method> + + <method name="startAvBroadcast"> + <![CDATA[ + var g = canvas.commonVideoViewContent.loadAVsettings(); + var settings = getAVmode(); + if ($debug) Debug.write("startAvBroadcast::mode ", settings); + if ('n' != settings) { + var videoWindow = getVideoObjectByPublicSID(canvas.publicSID); + if (videoWindow != null && videoEnabled(settings) && videoEnabled(videoWindow.clientVars.avsettings)) { + // audio on/off with video enabled + var videoview = videoWindow._chatvideoinner._videostream; + if (settings == 'av' && videoWindow.clientVars.avsettings == 'v') { + videoview.muteMicro(false); + } else if (settings == 'v' && videoWindow.clientVars.avsettings == 'av') { + videoview.muteMicro(true); + } + videoWindow.clientVars = canvas.currentClient; + } else { + videoWindow = createVideoObject(canvas.publicSID, true, canvas.currentClient.interviewPodId, canvas.currentClient); + if ($debug) Debug.write("startAvBroadcast::doninitalize"); + + var videoview = videoWindow._chatvideoinner._videostream; + if ($debug) Debug.write("videoWindow: ", videoWindow); + videoWindow.setAttribute('isremote', false); + var _micro = getMic(getAvSetting('mic', g, 0)); + var _camera = getCam(getAvSetting('cam', g, 0), canvas.currentClient.VWidth, canvas.currentClient.VHeight); + if ($debug) Debug.write("startAvBroadcast", _camera, _micro, settings, videoview); + + if ($debug) Debug.write("BroadcastId: ", canvas.currentClient.broadCastID); + switch (settings) { + case "av": + videoview.broadcast(canvas.currentClient.broadCastID, _camera, _micro); + break; + case "a": + videoview.broadcast(canvas.currentClient.broadCastID, null, _micro); + break; + case "v": + videoview.broadcast(canvas.currentClient.broadCastID, _camera, _micro); + videoview.muteMicro(true); + break; + default: + break; + } + } + videoWindow.updateAVSettingsSymbol(canvas.currentClient); + } + enableRecordingButton(); + ]]> + </method> +</class> + +</library>
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-flash/src/main/swf/dragHelper.lzx ---------------------------------------------------------------------- diff --git a/openmeetings-flash/src/main/swf/dragHelper.lzx b/openmeetings-flash/src/main/swf/dragHelper.lzx index 0d64aff..a879103 100644 --- a/openmeetings-flash/src/main/swf/dragHelper.lzx +++ b/openmeetings-flash/src/main/swf/dragHelper.lzx @@ -1,42 +1,42 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. - ---> -<library> - -<class name="dragHelper"> - - <attribute name="dragHelper" value="null" /> - - <method name="create"> - if(this.dragHelper != null ) this.dragHelper.destroy(); - this.dragHelper = new lz.view(canvas, {width:canvas.width,height:canvas.height,x:'0',y:'0', bgcolor:'0xFFFFFF', opacity:0.01,clickable:true}); - this.dragHelper.sendInFrontOf(canvas.mainComponent); - </method> - - <method name="remove"> - if (this.dragHelper) { - this.dragHelper.destroy(); - this.dragHelper = null; - } - </method> - -</class> - +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +--> +<library> + +<class name="dragHelper"> + + <attribute name="dragHelper" value="null" /> + + <method name="create"> + if(this.dragHelper != null ) this.dragHelper.destroy(); + this.dragHelper = new lz.view(canvas, {width:canvas.width,height:canvas.height,x:'0',y:'0', bgcolor:'0xFFFFFF', opacity:0.01,clickable:true}); + this.dragHelper.sendInFrontOf(canvas.mainComponent); + </method> + + <method name="remove"> + if (this.dragHelper) { + this.dragHelper.destroy(); + this.dragHelper = null; + } + </method> + +</class> + </library> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-flash/src/main/swf/lzrecorder/library.lzx ---------------------------------------------------------------------- diff --git a/openmeetings-flash/src/main/swf/lzrecorder/library.lzx b/openmeetings-flash/src/main/swf/lzrecorder/library.lzx index 6f84e4c..ecffb6c 100644 --- a/openmeetings-flash/src/main/swf/lzrecorder/library.lzx +++ b/openmeetings-flash/src/main/swf/lzrecorder/library.lzx @@ -1,25 +1,25 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. - ---> -<library> - - <include href="playBackVideoStream.lzx" /> - -</library> +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +--> +<library> + + <include href="playBackVideoStream.lzx" /> + +</library> http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-flash/src/main/swf/lzrecorder/playBackVideoStream.lzx ---------------------------------------------------------------------- diff --git a/openmeetings-flash/src/main/swf/lzrecorder/playBackVideoStream.lzx b/openmeetings-flash/src/main/swf/lzrecorder/playBackVideoStream.lzx index b7fdfd5..5d7c731 100644 --- a/openmeetings-flash/src/main/swf/lzrecorder/playBackVideoStream.lzx +++ b/openmeetings-flash/src/main/swf/lzrecorder/playBackVideoStream.lzx @@ -1,71 +1,71 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. - ---> -<library> - -<!--- - The playBackVideoStream is used in the recording playerback to show the video - --> -<class name="playBackVideoStream" extends="baseVideoStream" bgcolor="0x000000" visibility="hidden"> - - <attribute name="timerDelegate" value="null"/> - <attribute name="timerDelegateStarted" value="false" type="boolean"/> - - <handler name="oninit"> - this.timerDelegate = new LzDelegate( this, "calcProgressBar" ); - </handler> - - <handler name="onclick"> - canvas.videoComp_lc.send(canvas.videoComp_lc_name, 'togglePlayRecordingStream'); - </handler> - - <method name="playRecordingStream" args="streamName,delay"> - this.playStream(streamName,delay); - this.timerDelegateStarted = true; - lz.Timer.addTimer( this.timerDelegate , 1000 ); - </method> - - <method name="stopRecording"> - this._stop(); - lz.Timer.removeTimer(this.timerDelegate); - this.timerDelegateStarted = false; - </method> - - <handler name="onNetStatus" args="info"> - if ($debug) Debug.write("onNetStatus ",info); - if (info.code == "NetStream.Play.Stop" ) { - canvas.videoComp_lc.send(canvas.videoComp_lc_name, 'stopRecordingStream'); - } - </handler> - <handler name="onMetaDataEvent" args="info"> - if ($debug) Debug.write("onMetaData ",info); - </handler> - - <method name="calcProgressBar" args="tObjRef"> - if ($debug) Debug.write("calcProgressBar updateRecordingStreamTime",this._ns.time) - canvas.videoComp_lc.send(canvas.videoComp_lc_name, 'updateRecordingStreamTime',this._ns.time); - if (this.timerDelegateStarted) { - lz.Timer.addTimer( this.timerDelegate , 1000 ); - } - </method> - -</class> - +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +--> +<library> + +<!--- + The playBackVideoStream is used in the recording playerback to show the video + --> +<class name="playBackVideoStream" extends="baseVideoStream" bgcolor="0x000000" visibility="hidden"> + + <attribute name="timerDelegate" value="null"/> + <attribute name="timerDelegateStarted" value="false" type="boolean"/> + + <handler name="oninit"> + this.timerDelegate = new LzDelegate( this, "calcProgressBar" ); + </handler> + + <handler name="onclick"> + canvas.videoComp_lc.send(canvas.videoComp_lc_name, 'togglePlayRecordingStream'); + </handler> + + <method name="playRecordingStream" args="streamName,delay"> + this.playStream(streamName,delay); + this.timerDelegateStarted = true; + lz.Timer.addTimer( this.timerDelegate , 1000 ); + </method> + + <method name="stopRecording"> + this._stop(); + lz.Timer.removeTimer(this.timerDelegate); + this.timerDelegateStarted = false; + </method> + + <handler name="onNetStatus" args="info"> + if ($debug) Debug.write("onNetStatus ",info); + if (info.code == "NetStream.Play.Stop" ) { + canvas.videoComp_lc.send(canvas.videoComp_lc_name, 'stopRecordingStream'); + } + </handler> + <handler name="onMetaDataEvent" args="info"> + if ($debug) Debug.write("onMetaData ",info); + </handler> + + <method name="calcProgressBar" args="tObjRef"> + if ($debug) Debug.write("calcProgressBar updateRecordingStreamTime",this._ns.time) + canvas.videoComp_lc.send(canvas.videoComp_lc_name, 'updateRecordingStreamTime',this._ns.time); + if (this.timerDelegateStarted) { + lz.Timer.addTimer( this.timerDelegate , 1000 ); + } + </method> + +</class> + </library> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/whiteBoardPointer.lzx ---------------------------------------------------------------------- diff --git a/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/whiteBoardPointer.lzx b/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/whiteBoardPointer.lzx index c95beab..b6f8674 100644 --- a/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/whiteBoardPointer.lzx +++ b/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/whiteBoardPointer.lzx @@ -1,38 +1,38 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. - ---> -<library> - - <class name="whiteBoardPointer" extends="view" - resource="pointer_whiteboard_rsc" width="20" height="20" > - <attribute name="userName" value="" type="string" /> - <attribute name="fadeDelegate" value="null" /> - <labelText x="20" text="$once{ parent.userName }" /> - <handler name="oninit"> - this.play(); - this.fadeDelegate = new LzDelegate( this, "fadeText" ); - lz.Timer.addTimer( this.fadeDelegate, 5000 ); - </handler> - <method name="fadeText" args="itemObj"> - this.destroy(); - </method> - </class> - +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +--> +<library> + + <class name="whiteBoardPointer" extends="view" + resource="pointer_whiteboard_rsc" width="20" height="20" > + <attribute name="userName" value="" type="string" /> + <attribute name="fadeDelegate" value="null" /> + <labelText x="20" text="$once{ parent.userName }" /> + <handler name="oninit"> + this.play(); + this.fadeDelegate = new LzDelegate( this, "fadeText" ); + lz.Timer.addTimer( this.fadeDelegate, 5000 ); + </handler> + <method name="fadeText" args="itemObj"> + this.destroy(); + </method> + </class> + </library> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-flash/src/main/swf/modules/conference/whiteboard/panels/propertypanel/drawDocumentPanelItem.lzx ---------------------------------------------------------------------- diff --git a/openmeetings-flash/src/main/swf/modules/conference/whiteboard/panels/propertypanel/drawDocumentPanelItem.lzx b/openmeetings-flash/src/main/swf/modules/conference/whiteboard/panels/propertypanel/drawDocumentPanelItem.lzx index b18f9f5..817b0f6 100644 --- a/openmeetings-flash/src/main/swf/modules/conference/whiteboard/panels/propertypanel/drawDocumentPanelItem.lzx +++ b/openmeetings-flash/src/main/swf/modules/conference/whiteboard/panels/propertypanel/drawDocumentPanelItem.lzx @@ -1,40 +1,40 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. - ---> -<library> - <class name="drawDocumentPanelItem" extends="blueButton" width="26" height="26" - x_insetResource="2" y_insetResource="2" width_insetResource="22" height_insetResource="22"> - <attribute name="modi" value="" type="string" /> - <attribute name="labelid" value="0" type="number" /> - - <handler name="onclick"> - var docToolbar = canvas._drawarea.getDocumentToolBar(); - //if ($debug) Debug.write("docToolbar.parent.parent: ", docToolbar.parent.parent); - if (docToolbar.parent.parent.ignoreUpdates) { - return; - } - canvas._drawarea.setCurrentDocumentByToolBar(parent.parent.currentDocument.getValue()); - canvas._drawarea.doDocumentAction(this.modi); - </handler> - - <labelTooltip name="__labeltooltip" labelid="$once{ parent.labelid }" /> - </class> -</library> - +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +--> +<library> + <class name="drawDocumentPanelItem" extends="blueButton" width="26" height="26" + x_insetResource="2" y_insetResource="2" width_insetResource="22" height_insetResource="22"> + <attribute name="modi" value="" type="string" /> + <attribute name="labelid" value="0" type="number" /> + + <handler name="onclick"> + var docToolbar = canvas._drawarea.getDocumentToolBar(); + //if ($debug) Debug.write("docToolbar.parent.parent: ", docToolbar.parent.parent); + if (docToolbar.parent.parent.ignoreUpdates) { + return; + } + canvas._drawarea.setCurrentDocumentByToolBar(parent.parent.currentDocument.getValue()); + canvas._drawarea.doDocumentAction(this.modi); + </handler> + + <labelTooltip name="__labeltooltip" labelid="$once{ parent.labelid }" /> + </class> +</library> + http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-flash/src/main/swf/networkTesting/networktesting.lzx ---------------------------------------------------------------------- diff --git a/openmeetings-flash/src/main/swf/networkTesting/networktesting.lzx b/openmeetings-flash/src/main/swf/networkTesting/networktesting.lzx index af774bc..595b24f 100644 --- a/openmeetings-flash/src/main/swf/networkTesting/networktesting.lzx +++ b/openmeetings-flash/src/main/swf/networkTesting/networktesting.lzx @@ -1,147 +1,147 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. - ---> -<canvas width="100%" height="100%" title="NetworkTesting"> - - <switch> - <when property="$as3"> - <passthrough> - import flash.external.ExternalInterface; - </passthrough> - </when> - </switch> - <switch> - <when property="$debug"> - <method name="doDebugInit"> - canvas.setAttribute('debug', true); - </method> - <debug fontsize="11" oninit="Debug.showInternalProperties = true" width="40%" y="50%" x="60%" height="50%" /> - </when> - <otherwise> - <method name="doDebugInit"> - </method> - </otherwise> - </switch> - - <include href="testsView.lzx" /> - <include href="../base/remote/restCall.lzx" /> - - <handler name="oninit"><![CDATA[ - flash.external.ExternalInterface.call("loadingComplete"); - var lbls = ExternalInterface.call("getStringLabels"); - canvas.lbls = new Array(lbls.length); - for (var i = 0; i < lbls.length; ++i) { - canvas.lbls[lbls[i].id] = lbls[i].value; - } - doDebugInit(); - ]]></handler> - - <method name="lbl" args="key"> - var s = canvas.lbls['network.test.' + key]; - if ($debug) Debug.info("LBL ", key, s, canvas.lbls); - return !!s ? s : "Missing[" + key + "]"; - </method> - - <!-- - These attributes are rewritten by values from "public/config.xml" - --> - <attribute name="rtmpProtocol" type="string" value="rtmp" /> - <attribute name="rtmpHost" type="string" value="" /> - <attribute name="rtmpPort" type="number" value="1935" /> - - <attribute name="httpProtocol" type="string" value="http" /> - <attribute name="httpHost" type="string" value="" /> - <attribute name="httpPort" type="number" value="5080" /> - <attribute name="uriContext" type="string" value="/openmeetings" /> - <attribute name="rtmpUriPath" type="string" value="/openmeetings/hibernate" /> - - <method name="getBrowserHost"> - var host:String = ExternalInterface.call("window.location.host.toString()"); - // in case of IE or some other security issues we will fail ... - if (!host) { - var url:String = canvas.proxyurl; - if (url) { - if ($debug) Debug.write("url ", url); - var paramsIdx = url.indexOf("?"); - if (paramsIdx != -1) { - url = url.substr(0, paramsIdx); - } - if ($debug) Debug.write("url ", url); - url = url.substr(url.indexOf("//") + 2); - var portIdx = url.indexOf(":"); - host = url.substr(0, portIdx != -1 ? portIdx : url.indexOf("/")); - if ($debug) Debug.write("host ", host); - } - } - return host; - </method> - - <method name="getSettings"> - var settingsPtr = canvas.settings.getPointer(); - - var useSSL:Boolean = ("yes" == settingsPtr.xpathQuery("config/useSSL/text()")); - canvas.setAttribute("rtmpProtocol", useSSL ? "rtmps" : "rtmp"); - canvas.setAttribute("proxyType", settingsPtr.xpathQuery("config/proxyType/text()")); - canvas.setAttribute("rtmpHost", settingsPtr.xpathQuery("config/rtmphostlocal/text()")); - if (!canvas.rtmpHost) { - canvas.rtmpHost = getBrowserHost(); - } - canvas.setAttribute("rtmpPort", settingsPtr.xpathQuery("config/" + (useSSL ? "rtmpsslport" : "rtmpport") + "/text()")); - - canvas.setAttribute("httpProtocol", settingsPtr.xpathQuery("config/protocol/text()")); - canvas.setAttribute("httpHost", settingsPtr.xpathQuery("config/httphostlocal/text()")); - if (!canvas.httpHost) { - canvas.httpHost = rtmpHost; - } - canvas.setAttribute("httpPort", settingsPtr.xpathQuery("config/red5httpport/text()")); - - canvas.setAttribute("uriContext", settingsPtr.xpathQuery("config/httpRootKey/text()")); - canvas.setAttribute("rtmpUriPath", canvas.uriContext + "hibernate"); - </method> - - <method name="showTests"> - var tests = new lz.TestsView(canvas, {name:"testsView"}); - tests.testAll(); - </method> - - <dataset type="http" name="settings" request="false" proxied="false"> - <handler name="oninit"> - this.setAttribute("src", "config.xml"); - this.doRequest(); - </handler> - <handler name="ondata"> - if ($debug) Debug.write("Settings are retrieved"); - canvas.getSettings(); - canvas.showTests(); - </handler> - <handler name="onerror" args="e"> - if ($debug) Debug.write("Settings error [" + this.src + "]", e); - </handler> - <handler name="ontimeout" args="e"> - if ($debug) Debug.write("Settings timeout error", e); - </handler> - </dataset> - - <attribute name="busy" type="boolean" value="false"/> - <attribute name="log" type="string" value="" /> - - <attribute name="testsView" value="null"/> - -</canvas> +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +--> +<canvas width="100%" height="100%" title="NetworkTesting"> + + <switch> + <when property="$as3"> + <passthrough> + import flash.external.ExternalInterface; + </passthrough> + </when> + </switch> + <switch> + <when property="$debug"> + <method name="doDebugInit"> + canvas.setAttribute('debug', true); + </method> + <debug fontsize="11" oninit="Debug.showInternalProperties = true" width="40%" y="50%" x="60%" height="50%" /> + </when> + <otherwise> + <method name="doDebugInit"> + </method> + </otherwise> + </switch> + + <include href="testsView.lzx" /> + <include href="../base/remote/restCall.lzx" /> + + <handler name="oninit"><![CDATA[ + flash.external.ExternalInterface.call("loadingComplete"); + var lbls = ExternalInterface.call("getStringLabels"); + canvas.lbls = new Array(lbls.length); + for (var i = 0; i < lbls.length; ++i) { + canvas.lbls[lbls[i].id] = lbls[i].value; + } + doDebugInit(); + ]]></handler> + + <method name="lbl" args="key"> + var s = canvas.lbls['network.test.' + key]; + if ($debug) Debug.info("LBL ", key, s, canvas.lbls); + return !!s ? s : "Missing[" + key + "]"; + </method> + + <!-- + These attributes are rewritten by values from "public/config.xml" + --> + <attribute name="rtmpProtocol" type="string" value="rtmp" /> + <attribute name="rtmpHost" type="string" value="" /> + <attribute name="rtmpPort" type="number" value="1935" /> + + <attribute name="httpProtocol" type="string" value="http" /> + <attribute name="httpHost" type="string" value="" /> + <attribute name="httpPort" type="number" value="5080" /> + <attribute name="uriContext" type="string" value="/openmeetings" /> + <attribute name="rtmpUriPath" type="string" value="/openmeetings/hibernate" /> + + <method name="getBrowserHost"> + var host:String = ExternalInterface.call("window.location.host.toString()"); + // in case of IE or some other security issues we will fail ... + if (!host) { + var url:String = canvas.proxyurl; + if (url) { + if ($debug) Debug.write("url ", url); + var paramsIdx = url.indexOf("?"); + if (paramsIdx != -1) { + url = url.substr(0, paramsIdx); + } + if ($debug) Debug.write("url ", url); + url = url.substr(url.indexOf("//") + 2); + var portIdx = url.indexOf(":"); + host = url.substr(0, portIdx != -1 ? portIdx : url.indexOf("/")); + if ($debug) Debug.write("host ", host); + } + } + return host; + </method> + + <method name="getSettings"> + var settingsPtr = canvas.settings.getPointer(); + + var useSSL:Boolean = ("yes" == settingsPtr.xpathQuery("config/useSSL/text()")); + canvas.setAttribute("rtmpProtocol", useSSL ? "rtmps" : "rtmp"); + canvas.setAttribute("proxyType", settingsPtr.xpathQuery("config/proxyType/text()")); + canvas.setAttribute("rtmpHost", settingsPtr.xpathQuery("config/rtmphostlocal/text()")); + if (!canvas.rtmpHost) { + canvas.rtmpHost = getBrowserHost(); + } + canvas.setAttribute("rtmpPort", settingsPtr.xpathQuery("config/" + (useSSL ? "rtmpsslport" : "rtmpport") + "/text()")); + + canvas.setAttribute("httpProtocol", settingsPtr.xpathQuery("config/protocol/text()")); + canvas.setAttribute("httpHost", settingsPtr.xpathQuery("config/httphostlocal/text()")); + if (!canvas.httpHost) { + canvas.httpHost = rtmpHost; + } + canvas.setAttribute("httpPort", settingsPtr.xpathQuery("config/red5httpport/text()")); + + canvas.setAttribute("uriContext", settingsPtr.xpathQuery("config/httpRootKey/text()")); + canvas.setAttribute("rtmpUriPath", canvas.uriContext + "hibernate"); + </method> + + <method name="showTests"> + var tests = new lz.TestsView(canvas, {name:"testsView"}); + tests.testAll(); + </method> + + <dataset type="http" name="settings" request="false" proxied="false"> + <handler name="oninit"> + this.setAttribute("src", "config.xml"); + this.doRequest(); + </handler> + <handler name="ondata"> + if ($debug) Debug.write("Settings are retrieved"); + canvas.getSettings(); + canvas.showTests(); + </handler> + <handler name="onerror" args="e"> + if ($debug) Debug.write("Settings error [" + this.src + "]", e); + </handler> + <handler name="ontimeout" args="e"> + if ($debug) Debug.write("Settings timeout error", e); + </handler> + </dataset> + + <attribute name="busy" type="boolean" value="false"/> + <attribute name="log" type="string" value="" /> + + <attribute name="testsView" value="null"/> + +</canvas>
