http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-flash/src/main/swf/video/baseVideoObject.lzx ---------------------------------------------------------------------- diff --git a/openmeetings-flash/src/main/swf/video/baseVideoObject.lzx b/openmeetings-flash/src/main/swf/video/baseVideoObject.lzx index 676f9cf..d58daa5 100644 --- a/openmeetings-flash/src/main/swf/video/baseVideoObject.lzx +++ b/openmeetings-flash/src/main/swf/video/baseVideoObject.lzx @@ -1,721 +1,721 @@ -<?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> - - - <!--- Base container for a client, can be either: a remote-video (subscribing/playing a video) or a self-video (broadcasting - a cam/mic) --> - <class name="baseVideoObject" extends="view" bgcolor="0x000000" width="122" height="101"> - - <switch> - <when property="$as3"> - <passthrough> - import flash.filters.DropShadowFilter; - import flash.media.* - import flash.net.SharedObject; - </passthrough> - </when> - </switch> - - <!--- @keywords private --> - <attribute name="chatpartnername" value="" type="string" /> - <!--- @keywords private --> - <attribute name="showUserProfilePic" type="boolean" value="false" /> - - <!--- color of this user, this is the color the user will also use for his chat-color --> - <attribute name="usercolor" value="0" type="number" /> - - <!--- publicSID is a hash-value to identify a user --> - <attribute name="publicSID" value="" type="string" /> - - <!--- micMuted indicates if the microphone is currently turned sound or gain to 0 --> - <attribute name="micMuted" value="false" type="boolean" /> - - <!--- @keywords private --> - <attribute name="isremote" value="true" type="boolean" /> - - <!--- @keywords private --> - <attribute name="clientVars" value="null" /> - - <!--- @keywords private --> - <attribute name="isResizing" value="false" type="boolean" /> - - <!--- @keywords private --> - <attribute name="isInterview" value="false" type="boolean" /> - - <attribute name="respectRatio" value="true" type="boolean" /> - - <attribute name="minimized" value="false" type="boolean" /> - - <attribute name="custom" value="false" type="boolean" /> - - <attribute name="initH" value="40" type="number" /> - <attribute name="initW" value="40" type="number" /> - - <attribute name="isShowMicMute" value="false" type="boolean" /> - - <attribute name="isMutedByModerator" value="false" type="boolean" /> - - <attribute name="isMicrophonesRoom" value="false" type="boolean" /> - - <attribute name="lastPositiveVolume" type="number" value="50" /> - - <!-- Initial stream ratio: width / height --> - <attribute name="initRatio" type="number" value="null" /> - <attribute name="initialHeight" value="$once{ this.height }" type="number" /> - - <handler name="onisremote" args="r"> - this.isremote = r; - </handler> - - <handler name="oninit"> - <![CDATA[ - this.clientVars = new Array(); - this.clientVars['User']='No User Connected'; - - if (this.isInterview) { - this._toolbar._minimize.setAttribute("visibility","hidden"); - this._resizeview.setAttribute("visibility","hidden"); - this._innerbottom.setAttribute("visibility","hidden"); - return; - } - - if (this.custom) { - this._toolbar._minimize.setAttribute("visibility","hidden"); - this._resizeview.setAttribute("visibility","hidden"); - this._toolbar.setAttribute("visibility","hidden"); - this._resizeview.setAttribute("visibility","hidden"); - this._loudness.setAttribute("visibility","hidden"); - this._innertop.setAttribute("visibility","hidden"); - this._innerbottom.setAttribute("visibility","hidden"); - } - this.setShadow(); - - if (this.publicSID == canvas.publicSID) { - this._toolbar._resync._tip.setAttribute("labelid",610); - } - this._giveExclusiveAudioView.bringToFront(); - - this.isMicrophonesRoom = canvas.currentRoomObj.showMicrophoneStatus; - if (isMicrophonesRoom) { - this._innertop.setAttribute("bgcolor", "0xFF6600"); - this._innerbottom.setAttribute("bgcolor", "0xFF6600"); - } else { - this._innerbottom.setAttribute("visibility", "hidden"); - } - ]]> - </handler> - - <handler name="ony"> - <![CDATA[ - if (this.isInterview || this.custom || canvas.currentRoomObj.hideWhiteboard) { - return; - } - var bounds = this.getBounds(); - var parentBounds = canvas.getBounds(); - if (bounds.y < 0) { - this.setAttribute('y',0); - } - if (bounds.y > (parentBounds.height - bounds.height)) { - this.setAttribute('y', parentBounds.height - bounds.height ); - } - ]]> - </handler> - - <handler name="onx"> - <![CDATA[ - if (this.isInterview || this.custom) { - return; - } - - var bounds = this.getBounds(); - var parentBounds = canvas.getBounds(); - if (bounds.x < 0) { - this.setAttribute('x',0); - } - - if (bounds.x > (parentBounds.width - bounds.width)) { - this.setAttribute('x', parentBounds.width - bounds.width ); - } - ]]> - </handler> - - <method name="setShadow"> - <![CDATA[ - if (this.isinited){ - this.normalMC = this.getDisplayObject(); - //if($debug) Debug.write(this.normalMC); - //if($debug) Debug.write("this.normalMC: ",this.normalMC); - //if($debug) Debug.write("this: ",this); - this.displacementMap = new flash.filters.DropShadowFilter(); - this.normalMC.filters = [this.displacementMap]; - } - ]]> - </method> - - <!-- respect ratio and keep minimum width / height --> - <method name="setItemContraintsWidth" args="unused"> - <![CDATA[ - if (!this.respectRatio) { - return; - } - var h=this.width * this.initH/this.initW; - h=((h < this.initH ) ? initH : h); - - if ($debug) Debug.write("setItemContraintsWidth",this.respectRatio,'orig',this.height,this.width,'new h',h); - - this.setAttribute("height",h); - ]]> - </method> - - <method name="setItemContraintsHeight" args="unused"> - <![CDATA[ - if (!this.respectRatio) { - return; - } - var w=this.height * this.initW/this.initH; - w=((w < this.initW ) ? initW : w); - - if ($debug) Debug.write("setItemContraintsHeight",this.respectRatio,'orig',this.height,this.width,'new w',w); - - this.setAttribute("width",w); - ]]> - </method> - - <method name="updateAVSettingsSymbol" args="rcl"> - <![CDATA[ - //FIXME: Set a Symbol whereve this Client is Audio(only)/Video(only), both or Profile Picture - if ($debug) Debug.warn("updateAVSettingsSymbol TODO ", rcl, this); - switch (rcl.avsettings) { - case "av": - this.setDefaultVideoSize(rcl.VWidth, rcl.VHeight); - this.setAttribute("visible", true); - this._toolbar._mute.setAttribute("visible", true); - this._toolbar._volume.setAttribute("visible", true); - if(!canvas.isInterview && this.minimized) { - this.reminimize(); - } - this.deleteVideoConfProfilePic(); - break; - case "a": - this.setAttribute("visible", true); - this._toolbar._mute.setAttribute("visible", true); - this._toolbar._volume.setAttribute("visible", true); - if(!canvas.isInterview && this.minimized) { - this.reminimize(); - } - this.setVideouserProfilePic(rcl); - break; - case "v": - this.setDefaultVideoSize(rcl.VWidth, rcl.VHeight); - this.setAttribute("visible", true); - this._toolbar._mute.setAttribute("visible", false); - this._toolbar._volume.setAttribute("visible", false); - if(!canvas.isInterview && this.minimized) { - this.reminimize(); - } - this.deleteVideoConfProfilePic(); - break; - case "n": - if ($debug) Debug.write("Do not Publish A/V"); - //Prevent from Hiding the Box in Event Modus - if (canvas.thishib.modus == "conference") { - this.setAttribute("visible", false); - } - break; - default: - if ($debug) Debug.warn("no valid device Setup chosen"); - break; - } - ]]> - </method> - - <method name="doResize" args="bool"> - if ($debug) Debug.write("doResize",bool); - if(bool) { - dragHelper.create(); - } else { - dragHelper.remove(); - } - if (this.isInterview || this.custom) { - return; - } - - if (bool) { - this.isResizing = true; - this.rs.apply(); - } else { - this.isResizing = false; - this.rs.remove(); - } - </method> - - <!--- resets all values and stops the streaming --> - <method name="resetValues"> - <![CDATA[ - if ($debug) Debug.write("resetValues: ", this.isremote); - this.clientVars = null; - if (this.isremote) { - this._chatvideoinner._videostream.restart(); - } else { - deleteVideoConfProfilePic(); - this._chatvideoinner._videostream._stop(); - } - ]]> - </method> - - <method name="setVideouserProfilePic" args="value"> - if ($debug) Debug.write("### setVideouserProfilePic ",value); - this.deleteVideoConfProfilePic(); - new lz.videoUserProfilePicSWF10(this._chatvideoinner,{name:'userProfilePic',value:value}); - this.showUserProfilePic = true; - </method> - - <method name="deleteVideoConfProfilePic"> - if ($debug) Debug.write("### deleteVideoConfProfilePic ###"); - if ($debug) Debug.write("delete ",this.showUserProfilePic); - if (this.showUserProfilePic) { - this._chatvideoinner.userProfilePic.destroy(); - this.showUserProfilePic = false; - } - </method> - - <!--- @keywords private --> - <method name="_startDragState" args="obj"> - if (this.isInterview || this.custom) { - return; - } - - dragHelper.create(); - - this.bringToFront(); - parent.bringToFront(); - this.dragger.apply(); - </method> - - <!--- @keywords private --> - <method name="_removeDragState" args="obj"> - <![CDATA[ - lz.Cursor.unlock(); - - if (this.x < 0) { - this.setAttribute("x",20); - } - - if (this.y < 0) { - this.setAttribute("y",20); - } - - if (this.x+this.width > parent.width) { - this.setAttribute("x",parent.width - this.width - 20); - } - - if (this.y+this.height > parent.height) { - this.setAttribute("y",parent.height - this.height - 20); - } - dragHelper.remove(); - this.dragger.remove(); - ]]> - </method> - - <method name="minimize"> - <![CDATA[ - this.respectRatio = false; - - this.setAttribute("minimized",true); - - this._toolbar._minimize.setAttribute("visibility","hidden"); - this._toolbar._maximize2.setAttribute("visibility","visible"); - - for (var eg in this.subviews) { - if (this.subviews[eg].name != "_toolbar" - && this.subviews[eg].name != "_innertop" - && this.subviews[eg].name != "_loudness") { - this.subviews[eg].setAttribute("visibility","hidden"); - } - } - - this._loudness.setAttribute("x",this.width - 84 - (this.isShowMicMute ? 20 : 0)); - this._loudness.bringToFront(); - - this.initialHeight = this.height; - //this.setAttribute("height",20); - this._minimizeZoom.setAttribute("to",20); - this._minimizeZoom.setAttribute('started', true); - ]]> - </method> - - <method name="reminimize"> - <![CDATA[ - this.setAttribute("minimized",false); - - this._toolbar._minimize.setAttribute("visibility","visible"); - this._toolbar._maximize2.setAttribute("visibility","hidden"); - - this._loudness.setAttribute("x",1); - - //this.setAttribute("height",this.initialHeight); - if ($debug) Debug.write("this.initialHeight ",this.initialHeight); - this._minimizeZoom.setAttribute("to",this.initialHeight); - this._minimizeZoom.setAttribute('started', true); - ]]> - </method> - - <method name="reminimizeComplete"> - <![CDATA[ - if (!this.minimized) { - for (var eg in this.subviews) { - if (this.subviews[eg].name != "_toolbar" - && this.subviews[eg].name != "_innertop" - && this.subviews[eg].name != "_loudness" - && this.subviews[eg].name != "_innerbottom") { - this.subviews[eg].setAttribute("visibility","visible"); - } - } - if (isMicrophonesRoom) { - this._innerbottom.setAttribute("visibility", "visible"); - } - this.respectRatio = true; - } - ]]> - </method> - - <view name="_innertop" width="${parent.width-2 }" height="18" x="1" y="1" - bgcolor="$once{ canvas.getThemeColor('basebgcolorizer') }"> - <text text="${ parent.parent.chatpartnername }" onmousedown="parent.parent._startDragState(this)" - onmouseup="parent.parent._removeDragState(this)" - width="${ parent.width-2 }" fgcolor="white" fontsize="9"> - <handler name="onmouseover"> - //cursor="arrow_draw_panel_cursor" - lz.Cursor.setCursorGlobal("arrow_draw_panel_cursor"); - </handler> - - <handler name="onmouseout"> - lz.Cursor.unlock(); - </handler> - </text> - </view> - - <view name="_innerbottom" width="${parent.width - 2}" x="1" y="${parent.height - 19}" height="18" - bgcolor="$once{ canvas.getThemeColor('basebgcolorizer') }"> - <text text="${canvas.getLabelName(1434)}" width="${ parent.width-2 }" fgcolor="white" name="title" fontsize="9" /> - </view> - - <view name="_loudness" x="1" visible="${parent.isremote}" y="${parent.height - 20 - ((parent._innerbottom.visible) ? 18 : 0) }"> - <method name="setSpeaking" args="bool"> - this.loudness.setAttribute('opacity', bool ? 1 : 0.2); - </method> - <view x="2" y="2" name="loudness" resource="speaking" opacity="0.2" onmouseover="" onmouseout=""> - <handler name="onclick"> - <![CDATA[ - if (canvas.ismoderator || canvas.isAllowedToGiveExclusiveAudio) { - parent.parent.confirmExclusiveAudio(); - } else { - new lz.labelerrorPopup(canvas,{errorlabelid:1478}); - } - ]]> - </handler> - <labelTooltip inittwice="true" labelid="372" /> - </view> - </view> - - <view name="_resizeview" x="${ this.parent.width - 16 }" valign="bottom" resource="explorer_resize_rsc" cursor="explorer_resizemouse_rsc" - onmousedown="this.parent.doResize(true)" onmouseup="this.parent.doResize(false)"> - <handler name="oninit"> - //if ($debug) Debug.write("setTint"); - //TODO: Fix this, does not work at the moment - //canvas.protocol + '://code.google.com/p/openmeetings/issues/detail?id=470 - this.setAttribute("color", canvas.getThemeColor('baseMousecolorizer')); - </handler> - </view> - - <method name="resync"> - resetValues(); - if (!isremote) { - canvas.commonVideoViewContent.removeVideoByUser(this.publicSID); - canvas.commonVideoViewContent._startAvBroadcast(true); - } - </method> - - <view name="_toolbar" x="${ parent.width-this.width-2 }" layout="axis:x;spacing:0" y="2"> - <attribute name="isload" value="true" type="boolean" /> - - <miniIconsPresenter name="_resync" iconRessourceName="resyncuser_rsc"> - <handler name="onclick"> - parent.parent.resync(); - </handler> - <labelTooltip name="_tip" labelid="540" /> - </miniIconsPresenter> - - <miniIconsPresenter name="_mute" width="16" height="16" iconRessourceName="mute_micro_btn_rsc"> - <handler name="onclick"> - parent.parent.silenceMicrophone(!parent.parent.micMuted); - </handler> - <labelTooltip name="_tip" labelid="1405" /> - </miniIconsPresenter> - - <miniIconsPresenter x="0" y="0" name="_volume" width="16" height="16" iconRessourceName="volume"> - <handler name="oninit"> - _tip.setAttribute("labelid", parent.parent.isremote ? 1511 : 1512); - </handler> - <handler name="onclick"> - var volume = parent.parent.getStreamVolume(); - - var sliderHeight = 120; - var sliderX = this.getAttributeRelative('x',canvas) - 2; - var pick = new lz.VolumeSlider(canvas, { - height:sliderHeight, - x:sliderX, - y:(parent.getAttributeRelative('y',canvas) - sliderHeight/2), - initialNumber:volume, - videoObject:parent.parent - }); - lz.ModeManager.makeModal(pick); - </handler> - <labelTooltip name="_tip" /> - </miniIconsPresenter> - - <miniIconsPresenter name="_minimize" iconRessourceName="btn_presenter_minimize"> - <handler name="onclick"> - this.parent.parent.minimize(); - </handler> - <labelTooltip labelid="856" /> - </miniIconsPresenter> - - <miniIconsPresenter name="_maximize2" visibility="hidden" iconRessourceName="btn_presenter_maximize"> - <handler name="onclick"> - this.parent.parent.reminimize(); - </handler> - <labelTooltip labelid="857" /> - </miniIconsPresenter> - - </view> - - <view name="_giveExclusiveAudioView" valign="middle" align="center" visible="false"> - <view name="_micButton" width="40" height="40" resource="mic_rsc" showhandcursor="true"> - <labelTooltip name="_toolTipTextExclusiveAudio" labelid="1386" /> - </view> - </view> - - <method name="allowedExclusiveAudio"> - <![CDATA[ - return (canvas.ismoderator || canvas.isAllowedToGiveExclusiveAudio) - && this.clientVars.avsettings.indexOf('a') > -1; - ]]> - </method> - - <handler name="onmouseover"> - <![CDATA[ - if (this.isInterview || this.minimized) { - return; - } - if (allowedExclusiveAudio()) { - this._giveExclusiveAudioView._micButton._toolTipTextExclusiveAudio.doonmouseover(); - this._giveExclusiveAudioView.setAttribute("visible", true); - } - ]]> - </handler> - - <handler name="onmouseout"> - <![CDATA[ - if (this.isInterview || this.minimized) { - return; - } - if (allowedExclusiveAudio()) { - this._giveExclusiveAudioView._micButton._toolTipTextExclusiveAudio.cleanHolder(); - this._giveExclusiveAudioView.setAttribute("visible", false); - } - ]]> - </handler> - - <handler name="onclick"> - <![CDATA[ - if (allowedExclusiveAudio()) { - this._giveExclusiveAudioView._micButton._toolTipTextExclusiveAudio.cleanHolder(); - this.confirmExclusiveAudio(); - } - ]]> - </handler> - - <dragstate name="dragger" /> - <resizestatemin name="rs" resize_min_width="70" resize_min_height="70" /> - <dragHelper name="dragHelper" /> - - <animator name="_minimizeZoom" attribute="height" duration="750" to="20" started="false"> - <handler name="onstop" args="s"> - parent.reminimizeComplete(); - </handler> - </animator> - - <handler name="onismoderator" reference="canvas" args="m"> - <![CDATA[ - if ($debug) Debug.write("###### ismoderator ", m); - - if (this.minimized) { - this._loudness.setAttribute("x",this.width - 84 - (this.isShowMicMute ? 20 : 0)); - this._loudness.bringToFront(); - } - ]]> - </handler> - - <method name="confirmExclusiveAudio"> - var so:SharedObject = SharedObject.getLocal('userdata'); - var userData = so.data; - var dontShowExclusiveAudioConfirmation = userData["dontShowExclusiveAudioConfirmation"]; - var exclusiveAudioListener = new Object(); - exclusiveAudioListener.sendNoConfirmation = function(none) {}; - exclusiveAudioListener.sendConfirmation = function(answer, remember) { - if (answer) { - canvas.thishib.giveExclusiveAudio(this.publicSID); - if (remember) { - userData["dontShowExclusiveAudioConfirmation"] = true; - so.flush(); - } - } - }; - if (dontShowExclusiveAudioConfirmation == true) { - exclusiveAudioListener.sendConfirmation(true, true); - } else { - new lz.confirmationSingle(canvas,{ - labelid:1428, - labeliderror:1539, - refObj:exclusiveAudioListener, - showCheckBox:true}); - } - </method> - - <!-- This will mute the Microphone only to the person that is speaking if the gain is set to zero NOBODY will hear 'em --> - <method name="muteMicrophone" args="roomClientObj"> - <![CDATA[ - if ($debug) Debug.write("############ muteMicrophone ", roomClientObj.micMuted, roomClientObj.publicSID, this.publicSID); - - if (roomClientObj.publicSID == this.publicSID) { - if ($debug) Debug.write("Set Mute for Client :: ", roomClientObj); - if ($debug) Debug.write("############ SET GAIN " + roomClientObj.micMuted); - this._chatvideoinner._videostream.muteMicro(roomClientObj.micMuted); - this.isMutedByModerator = roomClientObj.micMuted; - this.setMicMuted(roomClientObj.micMuted); - } - ]]> - </method> - - <!-- This will mute it only locally, that means on other screens the user might be still online and loud --> - <method name="silenceMicrophone" args="mute"> - <![CDATA[ - if ($debug) Debug.write("############ silenceMicrophone ", this.publicSID); - if (this.publicSID == canvas.publicSID) { - //self sound turned off - canvas.thishib.switchMicMuted.publicSID = this.publicSID; - canvas.thishib.switchMicMuted.mute = mute; - canvas.thishib.switchMicMuted.doCall(); - if (!mute) { - this._chatvideoinner._videostream.muteMicro(false); - } - } else { - //disable this action for now - if (!canvas.ismoderator) { - new lz.labelerrorPopup(canvas,{errorlabelid:1409}); - return; - } - //you can not unmute it locally by putting sound to 100 cause the gain is set to zero globally in the micro of the sender! - //so setting the sound/volume on the other remote clients has zero effect - if (this.isMutedByModerator && !canvas.ismoderator) { - //FIXME: That is not true, you could restart audio/video ... - var errorlabelid = this.publicSID == canvas.publicSID ? 1387 : 1402; - new lz.labelerrorPopup(canvas,{errorlabelid:errorlabelid}); - return; - } - if (canvas.ismoderator) { - canvas.thishib.switchMicMuted.publicSID = this.publicSID; - canvas.thishib.switchMicMuted.mute = mute; - canvas.thishib.switchMicMuted.doCall(); - } else { - this._chatvideoinner._videostream.setSoundVolume(mute ? 0 : 100); - } - } - this.setMicMuted(mute); - ]]> - </method> - - <method name="setMicMuted" args="micMuted"> - <![CDATA[ - this.micMuted = micMuted; - this._toolbar._mute._tip.setAttribute("labelid", micMuted ? "1406" : "1405"); - this._toolbar._mute._itemRsc.setAttribute('frame', micMuted ? 2 : 1); - if (isMicrophonesRoom) { - var label = canvas.getLabelName(micMuted ? 1435 : 1434); - var color = micMuted ? canvas.getThemeColor('basebgcolorizer') : "0xFF6600"; - this._innertop.setAttribute('bgcolor', color); - this._innerbottom.setAttribute('bgcolor', color); - this._innerbottom.title.setAttribute('text', label); - } - ]]> - </method> - - <method name="setStreamVolume" args="v"> - if ($debug) Debug.write("############ setStreamVolume ", v, this.publicSID); - var stream = this._chatvideoinner._videostream; - if (this.isremote) { - stream.setSoundVolume(v); - } else { - stream.setAttribute('micGain', v); - stream.micro.gain = v; - if (0 == v) { - this.setMicMuted(true); - canvas.thishib.switchMicMuted.publicSID = this.publicSID; - canvas.thishib.switchMicMuted.mute = true; - canvas.thishib.switchMicMuted.doCall(); - } else if (micMuted) { - this.silenceMicrophone(false); - } - } - </method> - - <method name="getStreamVolume"> - var stream = this._chatvideoinner._videostream; - return this.isremote ? Number(stream._ns.soundTransform.volume * 100) : stream.micro.gain; - </method> - - <handler name="onheight" args="value"> - if (null == initRatio || !respectRatio) { - return; - } - var videoHeight = value - this.videoInsetY - this.bottomBarHeight; - var expectedVideoWidth = videoHeight * initRatio; - var expectedPodWidth = expectedVideoWidth + this.videoInsetX; - if (this.width != expectedPodWidth) { - this.setAttribute("width", expectedPodWidth); - } - </handler> - - <handler name="onwidth" args="value"> - if (null == initRatio || !respectRatio) { - return; - } - var videoWidth = value - this.videoInsetX; - var expectedVideoHeight = videoWidth / initRatio; - var expectedPodHeight = expectedVideoHeight + this.videoInsetY + this.bottomBarHeight; - if (this.height != expectedPodHeight) { - this.setAttribute("height", expectedPodHeight); - } - </handler> - </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> + + + <!--- Base container for a client, can be either: a remote-video (subscribing/playing a video) or a self-video (broadcasting + a cam/mic) --> + <class name="baseVideoObject" extends="view" bgcolor="0x000000" width="122" height="101"> + + <switch> + <when property="$as3"> + <passthrough> + import flash.filters.DropShadowFilter; + import flash.media.* + import flash.net.SharedObject; + </passthrough> + </when> + </switch> + + <!--- @keywords private --> + <attribute name="chatpartnername" value="" type="string" /> + <!--- @keywords private --> + <attribute name="showUserProfilePic" type="boolean" value="false" /> + + <!--- color of this user, this is the color the user will also use for his chat-color --> + <attribute name="usercolor" value="0" type="number" /> + + <!--- publicSID is a hash-value to identify a user --> + <attribute name="publicSID" value="" type="string" /> + + <!--- micMuted indicates if the microphone is currently turned sound or gain to 0 --> + <attribute name="micMuted" value="false" type="boolean" /> + + <!--- @keywords private --> + <attribute name="isremote" value="true" type="boolean" /> + + <!--- @keywords private --> + <attribute name="clientVars" value="null" /> + + <!--- @keywords private --> + <attribute name="isResizing" value="false" type="boolean" /> + + <!--- @keywords private --> + <attribute name="isInterview" value="false" type="boolean" /> + + <attribute name="respectRatio" value="true" type="boolean" /> + + <attribute name="minimized" value="false" type="boolean" /> + + <attribute name="custom" value="false" type="boolean" /> + + <attribute name="initH" value="40" type="number" /> + <attribute name="initW" value="40" type="number" /> + + <attribute name="isShowMicMute" value="false" type="boolean" /> + + <attribute name="isMutedByModerator" value="false" type="boolean" /> + + <attribute name="isMicrophonesRoom" value="false" type="boolean" /> + + <attribute name="lastPositiveVolume" type="number" value="50" /> + + <!-- Initial stream ratio: width / height --> + <attribute name="initRatio" type="number" value="null" /> + <attribute name="initialHeight" value="$once{ this.height }" type="number" /> + + <handler name="onisremote" args="r"> + this.isremote = r; + </handler> + + <handler name="oninit"> + <![CDATA[ + this.clientVars = new Array(); + this.clientVars['User']='No User Connected'; + + if (this.isInterview) { + this._toolbar._minimize.setAttribute("visibility","hidden"); + this._resizeview.setAttribute("visibility","hidden"); + this._innerbottom.setAttribute("visibility","hidden"); + return; + } + + if (this.custom) { + this._toolbar._minimize.setAttribute("visibility","hidden"); + this._resizeview.setAttribute("visibility","hidden"); + this._toolbar.setAttribute("visibility","hidden"); + this._resizeview.setAttribute("visibility","hidden"); + this._loudness.setAttribute("visibility","hidden"); + this._innertop.setAttribute("visibility","hidden"); + this._innerbottom.setAttribute("visibility","hidden"); + } + this.setShadow(); + + if (this.publicSID == canvas.publicSID) { + this._toolbar._resync._tip.setAttribute("labelid",610); + } + this._giveExclusiveAudioView.bringToFront(); + + this.isMicrophonesRoom = canvas.currentRoomObj.showMicrophoneStatus; + if (isMicrophonesRoom) { + this._innertop.setAttribute("bgcolor", "0xFF6600"); + this._innerbottom.setAttribute("bgcolor", "0xFF6600"); + } else { + this._innerbottom.setAttribute("visibility", "hidden"); + } + ]]> + </handler> + + <handler name="ony"> + <![CDATA[ + if (this.isInterview || this.custom || canvas.currentRoomObj.hideWhiteboard) { + return; + } + var bounds = this.getBounds(); + var parentBounds = canvas.getBounds(); + if (bounds.y < 0) { + this.setAttribute('y',0); + } + if (bounds.y > (parentBounds.height - bounds.height)) { + this.setAttribute('y', parentBounds.height - bounds.height ); + } + ]]> + </handler> + + <handler name="onx"> + <![CDATA[ + if (this.isInterview || this.custom) { + return; + } + + var bounds = this.getBounds(); + var parentBounds = canvas.getBounds(); + if (bounds.x < 0) { + this.setAttribute('x',0); + } + + if (bounds.x > (parentBounds.width - bounds.width)) { + this.setAttribute('x', parentBounds.width - bounds.width ); + } + ]]> + </handler> + + <method name="setShadow"> + <![CDATA[ + if (this.isinited){ + this.normalMC = this.getDisplayObject(); + //if($debug) Debug.write(this.normalMC); + //if($debug) Debug.write("this.normalMC: ",this.normalMC); + //if($debug) Debug.write("this: ",this); + this.displacementMap = new flash.filters.DropShadowFilter(); + this.normalMC.filters = [this.displacementMap]; + } + ]]> + </method> + + <!-- respect ratio and keep minimum width / height --> + <method name="setItemContraintsWidth" args="unused"> + <![CDATA[ + if (!this.respectRatio) { + return; + } + var h=this.width * this.initH/this.initW; + h=((h < this.initH ) ? initH : h); + + if ($debug) Debug.write("setItemContraintsWidth",this.respectRatio,'orig',this.height,this.width,'new h',h); + + this.setAttribute("height",h); + ]]> + </method> + + <method name="setItemContraintsHeight" args="unused"> + <![CDATA[ + if (!this.respectRatio) { + return; + } + var w=this.height * this.initW/this.initH; + w=((w < this.initW ) ? initW : w); + + if ($debug) Debug.write("setItemContraintsHeight",this.respectRatio,'orig',this.height,this.width,'new w',w); + + this.setAttribute("width",w); + ]]> + </method> + + <method name="updateAVSettingsSymbol" args="rcl"> + <![CDATA[ + //FIXME: Set a Symbol whereve this Client is Audio(only)/Video(only), both or Profile Picture + if ($debug) Debug.warn("updateAVSettingsSymbol TODO ", rcl, this); + switch (rcl.avsettings) { + case "av": + this.setDefaultVideoSize(rcl.VWidth, rcl.VHeight); + this.setAttribute("visible", true); + this._toolbar._mute.setAttribute("visible", true); + this._toolbar._volume.setAttribute("visible", true); + if(!canvas.isInterview && this.minimized) { + this.reminimize(); + } + this.deleteVideoConfProfilePic(); + break; + case "a": + this.setAttribute("visible", true); + this._toolbar._mute.setAttribute("visible", true); + this._toolbar._volume.setAttribute("visible", true); + if(!canvas.isInterview && this.minimized) { + this.reminimize(); + } + this.setVideouserProfilePic(rcl); + break; + case "v": + this.setDefaultVideoSize(rcl.VWidth, rcl.VHeight); + this.setAttribute("visible", true); + this._toolbar._mute.setAttribute("visible", false); + this._toolbar._volume.setAttribute("visible", false); + if(!canvas.isInterview && this.minimized) { + this.reminimize(); + } + this.deleteVideoConfProfilePic(); + break; + case "n": + if ($debug) Debug.write("Do not Publish A/V"); + //Prevent from Hiding the Box in Event Modus + if (canvas.thishib.modus == "conference") { + this.setAttribute("visible", false); + } + break; + default: + if ($debug) Debug.warn("no valid device Setup chosen"); + break; + } + ]]> + </method> + + <method name="doResize" args="bool"> + if ($debug) Debug.write("doResize",bool); + if(bool) { + dragHelper.create(); + } else { + dragHelper.remove(); + } + if (this.isInterview || this.custom) { + return; + } + + if (bool) { + this.isResizing = true; + this.rs.apply(); + } else { + this.isResizing = false; + this.rs.remove(); + } + </method> + + <!--- resets all values and stops the streaming --> + <method name="resetValues"> + <![CDATA[ + if ($debug) Debug.write("resetValues: ", this.isremote); + this.clientVars = null; + if (this.isremote) { + this._chatvideoinner._videostream.restart(); + } else { + deleteVideoConfProfilePic(); + this._chatvideoinner._videostream._stop(); + } + ]]> + </method> + + <method name="setVideouserProfilePic" args="value"> + if ($debug) Debug.write("### setVideouserProfilePic ",value); + this.deleteVideoConfProfilePic(); + new lz.videoUserProfilePicSWF10(this._chatvideoinner,{name:'userProfilePic',value:value}); + this.showUserProfilePic = true; + </method> + + <method name="deleteVideoConfProfilePic"> + if ($debug) Debug.write("### deleteVideoConfProfilePic ###"); + if ($debug) Debug.write("delete ",this.showUserProfilePic); + if (this.showUserProfilePic) { + this._chatvideoinner.userProfilePic.destroy(); + this.showUserProfilePic = false; + } + </method> + + <!--- @keywords private --> + <method name="_startDragState" args="obj"> + if (this.isInterview || this.custom) { + return; + } + + dragHelper.create(); + + this.bringToFront(); + parent.bringToFront(); + this.dragger.apply(); + </method> + + <!--- @keywords private --> + <method name="_removeDragState" args="obj"> + <![CDATA[ + lz.Cursor.unlock(); + + if (this.x < 0) { + this.setAttribute("x",20); + } + + if (this.y < 0) { + this.setAttribute("y",20); + } + + if (this.x+this.width > parent.width) { + this.setAttribute("x",parent.width - this.width - 20); + } + + if (this.y+this.height > parent.height) { + this.setAttribute("y",parent.height - this.height - 20); + } + dragHelper.remove(); + this.dragger.remove(); + ]]> + </method> + + <method name="minimize"> + <![CDATA[ + this.respectRatio = false; + + this.setAttribute("minimized",true); + + this._toolbar._minimize.setAttribute("visibility","hidden"); + this._toolbar._maximize2.setAttribute("visibility","visible"); + + for (var eg in this.subviews) { + if (this.subviews[eg].name != "_toolbar" + && this.subviews[eg].name != "_innertop" + && this.subviews[eg].name != "_loudness") { + this.subviews[eg].setAttribute("visibility","hidden"); + } + } + + this._loudness.setAttribute("x",this.width - 84 - (this.isShowMicMute ? 20 : 0)); + this._loudness.bringToFront(); + + this.initialHeight = this.height; + //this.setAttribute("height",20); + this._minimizeZoom.setAttribute("to",20); + this._minimizeZoom.setAttribute('started', true); + ]]> + </method> + + <method name="reminimize"> + <![CDATA[ + this.setAttribute("minimized",false); + + this._toolbar._minimize.setAttribute("visibility","visible"); + this._toolbar._maximize2.setAttribute("visibility","hidden"); + + this._loudness.setAttribute("x",1); + + //this.setAttribute("height",this.initialHeight); + if ($debug) Debug.write("this.initialHeight ",this.initialHeight); + this._minimizeZoom.setAttribute("to",this.initialHeight); + this._minimizeZoom.setAttribute('started', true); + ]]> + </method> + + <method name="reminimizeComplete"> + <![CDATA[ + if (!this.minimized) { + for (var eg in this.subviews) { + if (this.subviews[eg].name != "_toolbar" + && this.subviews[eg].name != "_innertop" + && this.subviews[eg].name != "_loudness" + && this.subviews[eg].name != "_innerbottom") { + this.subviews[eg].setAttribute("visibility","visible"); + } + } + if (isMicrophonesRoom) { + this._innerbottom.setAttribute("visibility", "visible"); + } + this.respectRatio = true; + } + ]]> + </method> + + <view name="_innertop" width="${parent.width-2 }" height="18" x="1" y="1" + bgcolor="$once{ canvas.getThemeColor('basebgcolorizer') }"> + <text text="${ parent.parent.chatpartnername }" onmousedown="parent.parent._startDragState(this)" + onmouseup="parent.parent._removeDragState(this)" + width="${ parent.width-2 }" fgcolor="white" fontsize="9"> + <handler name="onmouseover"> + //cursor="arrow_draw_panel_cursor" + lz.Cursor.setCursorGlobal("arrow_draw_panel_cursor"); + </handler> + + <handler name="onmouseout"> + lz.Cursor.unlock(); + </handler> + </text> + </view> + + <view name="_innerbottom" width="${parent.width - 2}" x="1" y="${parent.height - 19}" height="18" + bgcolor="$once{ canvas.getThemeColor('basebgcolorizer') }"> + <text text="${canvas.getLabelName(1434)}" width="${ parent.width-2 }" fgcolor="white" name="title" fontsize="9" /> + </view> + + <view name="_loudness" x="1" visible="${parent.isremote}" y="${parent.height - 20 - ((parent._innerbottom.visible) ? 18 : 0) }"> + <method name="setSpeaking" args="bool"> + this.loudness.setAttribute('opacity', bool ? 1 : 0.2); + </method> + <view x="2" y="2" name="loudness" resource="speaking" opacity="0.2" onmouseover="" onmouseout=""> + <handler name="onclick"> + <![CDATA[ + if (canvas.ismoderator || canvas.isAllowedToGiveExclusiveAudio) { + parent.parent.confirmExclusiveAudio(); + } else { + new lz.labelerrorPopup(canvas,{errorlabelid:1478}); + } + ]]> + </handler> + <labelTooltip inittwice="true" labelid="372" /> + </view> + </view> + + <view name="_resizeview" x="${ this.parent.width - 16 }" valign="bottom" resource="explorer_resize_rsc" cursor="explorer_resizemouse_rsc" + onmousedown="this.parent.doResize(true)" onmouseup="this.parent.doResize(false)"> + <handler name="oninit"> + //if ($debug) Debug.write("setTint"); + //TODO: Fix this, does not work at the moment + //canvas.protocol + '://code.google.com/p/openmeetings/issues/detail?id=470 + this.setAttribute("color", canvas.getThemeColor('baseMousecolorizer')); + </handler> + </view> + + <method name="resync"> + resetValues(); + if (!isremote) { + canvas.commonVideoViewContent.removeVideoByUser(this.publicSID); + canvas.commonVideoViewContent._startAvBroadcast(true); + } + </method> + + <view name="_toolbar" x="${ parent.width-this.width-2 }" layout="axis:x;spacing:0" y="2"> + <attribute name="isload" value="true" type="boolean" /> + + <miniIconsPresenter name="_resync" iconRessourceName="resyncuser_rsc"> + <handler name="onclick"> + parent.parent.resync(); + </handler> + <labelTooltip name="_tip" labelid="540" /> + </miniIconsPresenter> + + <miniIconsPresenter name="_mute" width="16" height="16" iconRessourceName="mute_micro_btn_rsc"> + <handler name="onclick"> + parent.parent.silenceMicrophone(!parent.parent.micMuted); + </handler> + <labelTooltip name="_tip" labelid="1405" /> + </miniIconsPresenter> + + <miniIconsPresenter x="0" y="0" name="_volume" width="16" height="16" iconRessourceName="volume"> + <handler name="oninit"> + _tip.setAttribute("labelid", parent.parent.isremote ? 1511 : 1512); + </handler> + <handler name="onclick"> + var volume = parent.parent.getStreamVolume(); + + var sliderHeight = 120; + var sliderX = this.getAttributeRelative('x',canvas) - 2; + var pick = new lz.VolumeSlider(canvas, { + height:sliderHeight, + x:sliderX, + y:(parent.getAttributeRelative('y',canvas) - sliderHeight/2), + initialNumber:volume, + videoObject:parent.parent + }); + lz.ModeManager.makeModal(pick); + </handler> + <labelTooltip name="_tip" /> + </miniIconsPresenter> + + <miniIconsPresenter name="_minimize" iconRessourceName="btn_presenter_minimize"> + <handler name="onclick"> + this.parent.parent.minimize(); + </handler> + <labelTooltip labelid="856" /> + </miniIconsPresenter> + + <miniIconsPresenter name="_maximize2" visibility="hidden" iconRessourceName="btn_presenter_maximize"> + <handler name="onclick"> + this.parent.parent.reminimize(); + </handler> + <labelTooltip labelid="857" /> + </miniIconsPresenter> + + </view> + + <view name="_giveExclusiveAudioView" valign="middle" align="center" visible="false"> + <view name="_micButton" width="40" height="40" resource="mic_rsc" showhandcursor="true"> + <labelTooltip name="_toolTipTextExclusiveAudio" labelid="1386" /> + </view> + </view> + + <method name="allowedExclusiveAudio"> + <![CDATA[ + return (canvas.ismoderator || canvas.isAllowedToGiveExclusiveAudio) + && this.clientVars.avsettings.indexOf('a') > -1; + ]]> + </method> + + <handler name="onmouseover"> + <![CDATA[ + if (this.isInterview || this.minimized) { + return; + } + if (allowedExclusiveAudio()) { + this._giveExclusiveAudioView._micButton._toolTipTextExclusiveAudio.doonmouseover(); + this._giveExclusiveAudioView.setAttribute("visible", true); + } + ]]> + </handler> + + <handler name="onmouseout"> + <![CDATA[ + if (this.isInterview || this.minimized) { + return; + } + if (allowedExclusiveAudio()) { + this._giveExclusiveAudioView._micButton._toolTipTextExclusiveAudio.cleanHolder(); + this._giveExclusiveAudioView.setAttribute("visible", false); + } + ]]> + </handler> + + <handler name="onclick"> + <![CDATA[ + if (allowedExclusiveAudio()) { + this._giveExclusiveAudioView._micButton._toolTipTextExclusiveAudio.cleanHolder(); + this.confirmExclusiveAudio(); + } + ]]> + </handler> + + <dragstate name="dragger" /> + <resizestatemin name="rs" resize_min_width="70" resize_min_height="70" /> + <dragHelper name="dragHelper" /> + + <animator name="_minimizeZoom" attribute="height" duration="750" to="20" started="false"> + <handler name="onstop" args="s"> + parent.reminimizeComplete(); + </handler> + </animator> + + <handler name="onismoderator" reference="canvas" args="m"> + <![CDATA[ + if ($debug) Debug.write("###### ismoderator ", m); + + if (this.minimized) { + this._loudness.setAttribute("x",this.width - 84 - (this.isShowMicMute ? 20 : 0)); + this._loudness.bringToFront(); + } + ]]> + </handler> + + <method name="confirmExclusiveAudio"> + var so:SharedObject = SharedObject.getLocal('userdata'); + var userData = so.data; + var dontShowExclusiveAudioConfirmation = userData["dontShowExclusiveAudioConfirmation"]; + var exclusiveAudioListener = new Object(); + exclusiveAudioListener.sendNoConfirmation = function(none) {}; + exclusiveAudioListener.sendConfirmation = function(answer, remember) { + if (answer) { + canvas.thishib.giveExclusiveAudio(this.publicSID); + if (remember) { + userData["dontShowExclusiveAudioConfirmation"] = true; + so.flush(); + } + } + }; + if (dontShowExclusiveAudioConfirmation == true) { + exclusiveAudioListener.sendConfirmation(true, true); + } else { + new lz.confirmationSingle(canvas,{ + labelid:1428, + labeliderror:1539, + refObj:exclusiveAudioListener, + showCheckBox:true}); + } + </method> + + <!-- This will mute the Microphone only to the person that is speaking if the gain is set to zero NOBODY will hear 'em --> + <method name="muteMicrophone" args="roomClientObj"> + <![CDATA[ + if ($debug) Debug.write("############ muteMicrophone ", roomClientObj.micMuted, roomClientObj.publicSID, this.publicSID); + + if (roomClientObj.publicSID == this.publicSID) { + if ($debug) Debug.write("Set Mute for Client :: ", roomClientObj); + if ($debug) Debug.write("############ SET GAIN " + roomClientObj.micMuted); + this._chatvideoinner._videostream.muteMicro(roomClientObj.micMuted); + this.isMutedByModerator = roomClientObj.micMuted; + this.setMicMuted(roomClientObj.micMuted); + } + ]]> + </method> + + <!-- This will mute it only locally, that means on other screens the user might be still online and loud --> + <method name="silenceMicrophone" args="mute"> + <![CDATA[ + if ($debug) Debug.write("############ silenceMicrophone ", this.publicSID); + if (this.publicSID == canvas.publicSID) { + //self sound turned off + canvas.thishib.switchMicMuted.publicSID = this.publicSID; + canvas.thishib.switchMicMuted.mute = mute; + canvas.thishib.switchMicMuted.doCall(); + if (!mute) { + this._chatvideoinner._videostream.muteMicro(false); + } + } else { + //disable this action for now + if (!canvas.ismoderator) { + new lz.labelerrorPopup(canvas,{errorlabelid:1409}); + return; + } + //you can not unmute it locally by putting sound to 100 cause the gain is set to zero globally in the micro of the sender! + //so setting the sound/volume on the other remote clients has zero effect + if (this.isMutedByModerator && !canvas.ismoderator) { + //FIXME: That is not true, you could restart audio/video ... + var errorlabelid = this.publicSID == canvas.publicSID ? 1387 : 1402; + new lz.labelerrorPopup(canvas,{errorlabelid:errorlabelid}); + return; + } + if (canvas.ismoderator) { + canvas.thishib.switchMicMuted.publicSID = this.publicSID; + canvas.thishib.switchMicMuted.mute = mute; + canvas.thishib.switchMicMuted.doCall(); + } else { + this._chatvideoinner._videostream.setSoundVolume(mute ? 0 : 100); + } + } + this.setMicMuted(mute); + ]]> + </method> + + <method name="setMicMuted" args="micMuted"> + <![CDATA[ + this.micMuted = micMuted; + this._toolbar._mute._tip.setAttribute("labelid", micMuted ? "1406" : "1405"); + this._toolbar._mute._itemRsc.setAttribute('frame', micMuted ? 2 : 1); + if (isMicrophonesRoom) { + var label = canvas.getLabelName(micMuted ? 1435 : 1434); + var color = micMuted ? canvas.getThemeColor('basebgcolorizer') : "0xFF6600"; + this._innertop.setAttribute('bgcolor', color); + this._innerbottom.setAttribute('bgcolor', color); + this._innerbottom.title.setAttribute('text', label); + } + ]]> + </method> + + <method name="setStreamVolume" args="v"> + if ($debug) Debug.write("############ setStreamVolume ", v, this.publicSID); + var stream = this._chatvideoinner._videostream; + if (this.isremote) { + stream.setSoundVolume(v); + } else { + stream.setAttribute('micGain', v); + stream.micro.gain = v; + if (0 == v) { + this.setMicMuted(true); + canvas.thishib.switchMicMuted.publicSID = this.publicSID; + canvas.thishib.switchMicMuted.mute = true; + canvas.thishib.switchMicMuted.doCall(); + } else if (micMuted) { + this.silenceMicrophone(false); + } + } + </method> + + <method name="getStreamVolume"> + var stream = this._chatvideoinner._videostream; + return this.isremote ? Number(stream._ns.soundTransform.volume * 100) : stream.micro.gain; + </method> + + <handler name="onheight" args="value"> + if (null == initRatio || !respectRatio) { + return; + } + var videoHeight = value - this.videoInsetY - this.bottomBarHeight; + var expectedVideoWidth = videoHeight * initRatio; + var expectedPodWidth = expectedVideoWidth + this.videoInsetX; + if (this.width != expectedPodWidth) { + this.setAttribute("width", expectedPodWidth); + } + </handler> + + <handler name="onwidth" args="value"> + if (null == initRatio || !respectRatio) { + return; + } + var videoWidth = value - this.videoInsetX; + var expectedVideoHeight = videoWidth / initRatio; + var expectedPodHeight = expectedVideoHeight + this.videoInsetY + this.bottomBarHeight; + if (this.height != expectedPodHeight) { + this.setAttribute("height", expectedPodHeight); + } + </handler> + </class> +</library>
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1cb3518f/openmeetings-flash/src/main/swf/video/editRecordStreamSWF10.lzx ---------------------------------------------------------------------- diff --git a/openmeetings-flash/src/main/swf/video/editRecordStreamSWF10.lzx b/openmeetings-flash/src/main/swf/video/editRecordStreamSWF10.lzx index 2ef2c35..875489d 100644 --- a/openmeetings-flash/src/main/swf/video/editRecordStreamSWF10.lzx +++ b/openmeetings-flash/src/main/swf/video/editRecordStreamSWF10.lzx @@ -1,499 +1,499 @@ -<?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 editRecordStream - - Description: - This Class shows a window where you can alter you Video-/Microphone- Input-Resources - and start to stream. The app could also use the default values for Cam/Mic but - most users don't know how to alter this (weather in System-Control-Panel or by Right Clicking - on the Flash-Screen and *>Preferences>Camera* ) - So I think it is better if Users are forced to choose something from this list - - --> - -<class name="editRecordStreamSWF10" extends="labelExplorerBox" labelid="51" - width="680" height="540" x="14" y="-540" > - <switch> - <when property="$as3"> - <passthrough> - import flash.events.StatusEvent; - import flash.media.Camera; - import flash.media.Microphone; - </passthrough> - </when> - </switch> - - <attribute name="initY" value="40" type="number" /> - - <!--- - if true the user will see the dialog no matter if he has choosen "do not show again" or not - --> - <attribute name="doDefaultAnimation" value="true" type="boolean" /> - <attribute name="cam_default_width" value="320" type="number" /> - <attribute name="cam_default_height" value="260" type="number" /> - <attribute name="lastRecorded" value="" type="string" /> - <attribute name="isRunning" value="false" type="boolean" /> - <attribute name="recordingsCounter" value="5" type="number" /> - <attribute name="timerIsRunning" value="false" type="boolean" /> - <attribute name="counterDelegate" value="null" /> - <attribute name="executeAttachCamera" value="false" type="boolean" /> - - <method name="startTimer"> - this.timerIsRunning = true; - this.timerWasUnmutedTheFirstTime = true; - lz.Timer.addTimer( this.counterDelegate, 1000 ); - </method> - - <method name="count" args="calleeObj"> - if (this.recordingsCounter != 0){ - this.recordingsCounter -= 1; - lz.Timer.resetTimer(this.counterDelegate, 1000); - - this._text._info.setAttribute("text",""+this.recordingsCounter+" sec"); - } else { - this._text.setAttribute("visibility","hidden"); - this.doStop(); - this.timerIsRunning = false; - lz.Timer.removeTimer(this.counterDelegate); - this.doPlay(); - } - </method> - - <method name="startTimerToCount"> - if (!this.timerIsRunning) { - this.startTimer(); - } - </method> - - <handler name="oninit"> - <![CDATA[ - if (canvas.editRecordStream != null) { - canvas.editRecordStream.destroy(); - } - canvas.editRecordStream = this; - - this.counterDelegate = new LzDelegate(this, "count"); - - if ($debug) Debug.write("editrecordstream ###################### "); - - initItems(); - if (this.doDefaultAnimation && !canvas.isInterview) { - this._chooseDeviceAnimation.setAttribute('started', true); - } else { - this.setAttribute("y", initY); - } - this.executeAttachCamera = true; - this.attachCamera(); - ]]> - </handler> - - <handler name="ondestroy"> - <![CDATA[ - if ($debug) Debug.write("editrecordstream::ondestroy "); - cleanVideos(); - canvas.editRecordStream = null; - ]]> - </handler> - - <method name="storeAVsettings"> - canvas.commonVideoViewContent.storeAVsettings( - this.availableCams.getValue() - , this.availableMics.getValue() - , this.cam_default_width - , this.cam_default_height - ); - </method> - - <method name="doStartRecording"> - <![CDATA[ - this._btnStartRecording.setAttribute("enabled",false); - this._play.setAttribute("enabled",false); - this.recordingsCounter = 5; - this._text.setAttribute("visibility","visible"); - this._text._info.setAttribute("text","5 sec"); - this.isRunning = true; - - var videoview = this._video.content._publisher._chatvideoinner._videostream; - var _micro = canvas.commonVideoViewContent.getMic(this.availableMics.getValue()); - var _camera = canvas.commonVideoViewContent.getCam(this.availableCams.getValue(), cam_default_width, cam_default_height); - if ($debug) Debug.write(_camera, _micro); - - if ($debug && _camera != null) Debug.warn("_camera.muted ", _camera.muted); - if ($debug && _micro != null) Debug.warn("_micro.muted ", _micro.muted); - if ((_camera != null && !_camera.muted) || (_micro != null && !_micro.muted)) { - this.startTimer(); - } - - //start recording of client stream - var t = new Date(); - this.lastRecorded = "TEST_SETUP_"+t.getTime(); - this._video.content._publisher.setAttribute("visibility","visible"); - this._video.content._viewer.setAttribute("visibility","hidden"); - videoview.record(this.lastRecorded,_camera,_micro); - ]]> - </method> - - <method name="doPlay"> - <![CDATA[ - if (this.lastRecorded == "") { - //Error - nothing recorded yet - if ($debug) Debug.warn("Nothing to Play"); - } else { - this._play.setAttribute("enabled",true); - this._video.content._publisher.setAttribute("visibility","hidden"); - this._video.content._viewer.setAttribute("visibility","visible"); - var videoview = this._video.content._viewer._chatvideoinner._videostream; - videoview.justPlayStream(this.lastRecorded+".flv",0); - } - ]]> - </method> - - <method name="doStop"> - if (this.isRunning) { - this.isRunning = false; - var videoview = this._video.content._publisher._chatvideoinner._videostream; - this._btnStartRecording.setAttribute("enabled",true); - videoview._stop(); - this.doPlay(); - } - var videoviewViewer = this._video.content._viewer._chatvideoinner._videostream; - videoviewViewer._stop(); - </method> - - <animator name="_chooseDeviceAnimation" started="false" attribute="y" to="40" duration="750" /> - - <labelText fontstyle="bold" labelid="758" width="${ parent.width-2 }" height="30" multiline="true" y="20" /> - - <method name="fillDeviceList" args="list,combo,prop"> - <![CDATA[ - //Initialize and get eventually stored property - var dev = canvas.commonVideoViewContent.getAvSetting(prop); - if ($debug) Debug.write("fillDeviceList:: ", prop, dev); - - //Get all availible devices - var foundStoredDev = null; - combo.addItem(canvas.getLabelName(159), -1); - if ("-1" == dev) { - foundStoredDev = "-1"; - } - for (var eg = 0; eg < list.length; ++eg) { - combo.addItem(list[eg], eg); - var r = "" + eg; - if (r == dev) { - foundStoredDev = r; - } - } - return foundStoredDev; - ]]> - </method> - - <method name="selectListItem" args="combo, selected, select"> - if (selected != null) { - combo.selectItem(selected); - } else { - combo.selectItemAt(select ? 1 : 0); - } - </method> - - <!-- - Initialize the default settings for cam and resolution and attach the camera - after we have made sure the values are there one time - --> - <method name="initItems"> - <![CDATA[ - //fill list of Cameras - var cameras = Camera.names; - var foundStoredCam = fillDeviceList(cameras, availableCams, "cam"); - selectListItem(availableCams, foundStoredCam, cameras.length > 0); - - //fill list of Mics - var mics = Microphone.names; - var foundStoredMic = fillDeviceList(mics, availableMics, "mic"); - selectListItem(availableMics, foundStoredMic, mics.length > 0); - - // settings - var addCams = !canvas.currentRoomObj.audioOnly && cameras.length > 0; - var addMics = mics.length > 0; - ]]> - </method> - - <method name="attachCamera"> - <![CDATA[ - //Don't execute before combobox items are not initialized - if (!this.executeAttachCamera) { - if ($debug) Debug.write("Return, executeAttachCamera is false"); - return; - } - - if (_video == undefined) { - if ($debug) Debug.write("Return, video not yet ready"); - return; - } - _video.content._publisher.setAttribute("visible", true); - _video.content._viewer.setAttribute("visible", false); - var videoview = this._video.content._publisher._chatvideoinner._videostream; - //stop will not call clear as there is no NetStream - videoview._stop(); - videoview.clear(); - var _camera = canvas.commonVideoViewContent.getCam(availableCams.getValue(), cam_default_width, cam_default_height); - if (_camera != null) { - videoview.attachCamera(_camera); - } - ]]> - </method> - - <method name="cleanVideos"> - if (_video == undefined) return; - //make sure stop and clear is called, as the _stop method does not work for all - //videoviews in the device settings. - _video.content._publisher._chatvideoinner._videostream._stop(); - _video.content._viewer._chatvideoinner._videostream._stop(); - _video.content._publisher._chatvideoinner._videostream.clear(); - _video.content._viewer._chatvideoinner._videostream.clear(); - if ($debug) Debug.write("Cleaned up videos and free resources"); - </method> - - <method name="updateVisibility"> - <![CDATA[ - var camVisible = availableCams.getValue() > -1; - var micVisible = availableMics.getValue() > -1; - var textVisible = !camVisible && !micVisible; - this._btnStartRecording.setAttribute("visible", camVisible || micVisible); - this._video.setAttribute("visible", camVisible); - this._play.setAttribute("visible", camVisible || micVisible); - this._level_meter.setAttribute("visible", micVisible); - this.infoTextNoAV.setAttribute("visible", textVisible); - this.availibleResolutionsLabel.setAttribute("visible", ((canvas.isInterview) ? false : camVisible)); - this.availibleResolutionsWarning.setAttribute("visible", ((canvas.isInterview) ? false : camVisible)); - this.availibleResolutions.setAttribute("visible", ((canvas.isInterview) ? false : camVisible)); - ]]> - </method> - - <labelText name="availableCamsLabel" labelid="52" fontsize="11" x="10" y="80" width="$once{ parent.width-20 }" /> - <resetCombobox fontsize="11" name="availableCams" x="10" y="100" width="280" editable="false"> - <handler name="onselect"> - parent.updateVisibility(); - parent.attachCamera(); - </handler> - </resetCombobox> - - <labelText name="availableMicsLabel" labelid="53" fontsize="11" x="10" y="120" width="$once{ parent.width-20 }" /> - <resetCombobox fontsize="11" name="availableMics" x="10" y="140" width="280" editable="false"> - <handler name="onselect"> - parent.updateVisibility(); - </handler> - </resetCombobox> - - <labelText name="infoTextNoAV" labelid="452" multiline="true" width="280" - fontsize="11" x="10" y="164" visibility="hidden" /> - - <labelText name="availibleResolutionsLabel" labelid="1429" - fontsize="11" x="10" y="164" width="$once{ parent.width-20 }" /> - - <view name="availibleResolutionsWarning" x="272" y="164" - resource="warning_icon_popup_devices_rsc" clickable="true"> - <labelTooltip multiline="true" labelid="1430" /> - </view> - - <resetCombobox fontsize="11" name="availibleResolutions" x="10" shownitems="10" - y="184" width="280" editable="false"> - <!--- @keywords private --> - <attribute name="counter" value="0" /> - <handler name="oninit"> - <![CDATA[ - var i = getItemAt(0); - if ($debug) Debug.write("oninit ", this.selected, this, i); - if (!this.selected && !!i) { - selectItemAt(0); - onselect.sendEvent(i); - } - ]]> - </handler> - <handler name="onselect" args="item"> - <![CDATA[ - if (!canvas.isInterview) { - if ($debug) Debug.write("availibleResolutions::onselect cam [W x H] ", item.cam_width, item.cam_height); - parent.setAttribute("cam_default_width", item.cam_width); - parent.setAttribute("cam_default_height", item.cam_height); - - var py = parent.y < 0 ? 5 : parent.y; - var maxWidth = Math.min(600, canvas.width - parent.x - 10) - , maxHeight = Math.min(500, canvas.height - py - 10) - , newWidth = maxWidth, newHeight = maxHeight; - if (item.cam_width > 240) { - newWidth = maxWidth + item.cam_width - 240; - } - if (item.cam_height > 180) { - newHeight = maxHeight + item.cam_height - 180; - } - - if (newWidth + parent.x + 10 > canvas.width) { - newWidth = maxWidth; - } - if (newHeight + py + 10 > canvas.height) { - newHeight = maxHeight; - } - parent.setAttribute("width", newWidth); - parent.setAttribute("height", newHeight); - } - parent.attachCamera(); - ]]> - </handler> - <textlistitem datapath="myConfigSet:/config/availableCameraResolutions/resolution" > - <attribute name="cam_width" value="320" type="number" /> - <attribute name="cam_height" value="240" type="number" /> - <handler name="ondata"> - <![CDATA[ - //if ($debug) Debug.write("ondata ", this); - var type = this.datapath.xpathQuery('@type'); - this.cam_width = Number(this.datapath.xpathQuery('@width')); - this.cam_height = Number(this.datapath.xpathQuery('@height')); - this.setAttribute("text", "" + this.cam_width + "x" + this.cam_height + " [" + type + "]"); - var isDefault = this.datapath.xpathQuery('@isDefault') == "true"; - - var width = canvas.commonVideoViewContent.getAvSetting("width"); - var height = canvas.commonVideoViewContent.getAvSetting("height"); - if (!!width && !!height && width == this.cam_width && height == this.cam_height) { - parent.selectItemAt(parent.counter); - parent.onselect.sendEvent(this); - parent.selected = this; - } else if (isDefault) { - if ($debug) Debug.write("Found default one ", type); - parent.selectItemAt(parent.counter); - parent.onselect.sendEvent(this); - } - parent.counter++; - ]]> - </handler> - </textlistitem> - </resetCombobox> - - <simpleLabelButton name="_btnStartRecording" labelid="775" width="140" x="150" y="220" height="28"> - <handler name="onclick"> - parent._level_meter.startLevel(); - parent.doStartRecording(); - </handler> - </simpleLabelButton> - - <view x="340" y="60" name="_video" clip="true" - width="${ parent.width-this.x-10 }" height="${ parent.height-260 }"> - <view name="content"> - <videoObjectTestBroadcast name="_publisher" - width="${ parent.parent.parent.cam_default_width }" - height="${ parent.parent.parent.cam_default_height }"> - <handler name="sendCameraStatus" args="camStatus"> - if ($debug) Debug.write("sendCameraStatus -1- ",camStatus); - if (camStatus == "Camera.Unmuted") { - parent.parent.parent.startTimerToCount(); - } - </handler> - - <handler name="sendMicroStatus" args="micStatus"> - if ($debug) Debug.write("sendMicroStatus -1- ",micStatus); - if (micStatus == "Microphone.Unmuted") { - parent.parent.parent.startTimerToCount(); - } - </handler> - </videoObjectTestBroadcast> - - <videoObjectPlayTestBroadcast name="_viewer" visibility="hidden" - width="${ parent.parent.parent.cam_default_width }" - height="${ parent.parent.parent.cam_default_height }" /> - </view> - - <om_vscrollbar /> - <om_hscrollbar /> - </view> - - <view name="_text" x="340" y="60" width="240" height="180" visibility="hidden"> - <text name="_info" resize="true" bgcolor="0xFFFFFF" align="right" fontsize="12" fontstyle="bold" /> - </view> - - <simpleLabelButton name="_play" y="${ parent.height-166 }" x="490" enabled="false" width="90" labelid="764"> - <handler name="onclick"> - parent.doPlay(); - </handler> - </simpleLabelButton> - - <view name="_level_meter" x="340" y="${ parent.height-190 }" width="240" height="20" clip="true" bgcolor="0x000000"> - <!--- Level delegate, used to track level changes. - @keywords private --> - <attribute name="_leveldel" value="$once{new LzDelegate(this, '_updateLevel')}"/> - - <method name="_updateLevel" args="no"> - <![CDATA[ - if (parent._video.content._publisher._chatvideoinner._videostream.micro == null) { - return; - } - this.setNewLevel(parent._video.content._publisher._chatvideoinner._videostream.micro.activityLevel); - ]]> - </method> - - <method name="startLevel"> - this._leveldel.register(lz.Idle, "onidle"); - </method> - - <method name="resetNewLevel"> - this._leveldel.unregisterAll(); - this.setNewLevel(0); - </method> - - <method name="setNewLevel" args="no"> - <![CDATA[ - var newLevel = (238 / 100) * no; - this._over.setAttribute("width", 238 - newLevel); - this._over.setAttribute("x", 1 + newLevel); - ]]> - </method> - - <view name="_bg" width="238" height="18" x="1" y="1" bgcolor="0xFFFFFF" /> - <view name="_grip" resource="level_meter_rsc" x="1" y="1" /> - <view name="_over" width="238" height="18" x="1" y="1" bgcolor="0xFFFFFF" /> - <labelText labelid="767" x="2" y="2" height="16" width="236" resize="false" /> - </view> - - <view y="${ parent.height-98 }" resource="test_setup_info_rsc" x="16" /> - - <labelText fontstyle="bold" labelid="765" x="39" y="${ parent.height-100 }" - width="${ parent.width-50 }" multiline="true" /> - - <simpleLabelButton fontsize="11" labelid="918" x="${ parent.width-220 }" y="${ parent.height-50 }" - height="28" width="100"> - <handler name="onclick"> - parent.cleanVideos(); - parent.close(); - </handler> - </simpleLabelButton> - - <simpleLabelButton fontsize="11" labelid="144" x="${ parent.width-110 }" y="${ parent.height-50 }" - height="28" width="100" > - <handler name="onclick"> - parent.cleanVideos(); - parent.storeAVsettings(); - parent.close(); - </handler> - </simpleLabelButton> -</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 editRecordStream + + Description: + This Class shows a window where you can alter you Video-/Microphone- Input-Resources + and start to stream. The app could also use the default values for Cam/Mic but + most users don't know how to alter this (weather in System-Control-Panel or by Right Clicking + on the Flash-Screen and *>Preferences>Camera* ) + So I think it is better if Users are forced to choose something from this list + + --> + +<class name="editRecordStreamSWF10" extends="labelExplorerBox" labelid="51" + width="680" height="540" x="14" y="-540" > + <switch> + <when property="$as3"> + <passthrough> + import flash.events.StatusEvent; + import flash.media.Camera; + import flash.media.Microphone; + </passthrough> + </when> + </switch> + + <attribute name="initY" value="40" type="number" /> + + <!--- + if true the user will see the dialog no matter if he has choosen "do not show again" or not + --> + <attribute name="doDefaultAnimation" value="true" type="boolean" /> + <attribute name="cam_default_width" value="320" type="number" /> + <attribute name="cam_default_height" value="260" type="number" /> + <attribute name="lastRecorded" value="" type="string" /> + <attribute name="isRunning" value="false" type="boolean" /> + <attribute name="recordingsCounter" value="5" type="number" /> + <attribute name="timerIsRunning" value="false" type="boolean" /> + <attribute name="counterDelegate" value="null" /> + <attribute name="executeAttachCamera" value="false" type="boolean" /> + + <method name="startTimer"> + this.timerIsRunning = true; + this.timerWasUnmutedTheFirstTime = true; + lz.Timer.addTimer( this.counterDelegate, 1000 ); + </method> + + <method name="count" args="calleeObj"> + if (this.recordingsCounter != 0){ + this.recordingsCounter -= 1; + lz.Timer.resetTimer(this.counterDelegate, 1000); + + this._text._info.setAttribute("text",""+this.recordingsCounter+" sec"); + } else { + this._text.setAttribute("visibility","hidden"); + this.doStop(); + this.timerIsRunning = false; + lz.Timer.removeTimer(this.counterDelegate); + this.doPlay(); + } + </method> + + <method name="startTimerToCount"> + if (!this.timerIsRunning) { + this.startTimer(); + } + </method> + + <handler name="oninit"> + <![CDATA[ + if (canvas.editRecordStream != null) { + canvas.editRecordStream.destroy(); + } + canvas.editRecordStream = this; + + this.counterDelegate = new LzDelegate(this, "count"); + + if ($debug) Debug.write("editrecordstream ###################### "); + + initItems(); + if (this.doDefaultAnimation && !canvas.isInterview) { + this._chooseDeviceAnimation.setAttribute('started', true); + } else { + this.setAttribute("y", initY); + } + this.executeAttachCamera = true; + this.attachCamera(); + ]]> + </handler> + + <handler name="ondestroy"> + <![CDATA[ + if ($debug) Debug.write("editrecordstream::ondestroy "); + cleanVideos(); + canvas.editRecordStream = null; + ]]> + </handler> + + <method name="storeAVsettings"> + canvas.commonVideoViewContent.storeAVsettings( + this.availableCams.getValue() + , this.availableMics.getValue() + , this.cam_default_width + , this.cam_default_height + ); + </method> + + <method name="doStartRecording"> + <![CDATA[ + this._btnStartRecording.setAttribute("enabled",false); + this._play.setAttribute("enabled",false); + this.recordingsCounter = 5; + this._text.setAttribute("visibility","visible"); + this._text._info.setAttribute("text","5 sec"); + this.isRunning = true; + + var videoview = this._video.content._publisher._chatvideoinner._videostream; + var _micro = canvas.commonVideoViewContent.getMic(this.availableMics.getValue()); + var _camera = canvas.commonVideoViewContent.getCam(this.availableCams.getValue(), cam_default_width, cam_default_height); + if ($debug) Debug.write(_camera, _micro); + + if ($debug && _camera != null) Debug.warn("_camera.muted ", _camera.muted); + if ($debug && _micro != null) Debug.warn("_micro.muted ", _micro.muted); + if ((_camera != null && !_camera.muted) || (_micro != null && !_micro.muted)) { + this.startTimer(); + } + + //start recording of client stream + var t = new Date(); + this.lastRecorded = "TEST_SETUP_"+t.getTime(); + this._video.content._publisher.setAttribute("visibility","visible"); + this._video.content._viewer.setAttribute("visibility","hidden"); + videoview.record(this.lastRecorded,_camera,_micro); + ]]> + </method> + + <method name="doPlay"> + <![CDATA[ + if (this.lastRecorded == "") { + //Error - nothing recorded yet + if ($debug) Debug.warn("Nothing to Play"); + } else { + this._play.setAttribute("enabled",true); + this._video.content._publisher.setAttribute("visibility","hidden"); + this._video.content._viewer.setAttribute("visibility","visible"); + var videoview = this._video.content._viewer._chatvideoinner._videostream; + videoview.justPlayStream(this.lastRecorded+".flv",0); + } + ]]> + </method> + + <method name="doStop"> + if (this.isRunning) { + this.isRunning = false; + var videoview = this._video.content._publisher._chatvideoinner._videostream; + this._btnStartRecording.setAttribute("enabled",true); + videoview._stop(); + this.doPlay(); + } + var videoviewViewer = this._video.content._viewer._chatvideoinner._videostream; + videoviewViewer._stop(); + </method> + + <animator name="_chooseDeviceAnimation" started="false" attribute="y" to="40" duration="750" /> + + <labelText fontstyle="bold" labelid="758" width="${ parent.width-2 }" height="30" multiline="true" y="20" /> + + <method name="fillDeviceList" args="list,combo,prop"> + <![CDATA[ + //Initialize and get eventually stored property + var dev = canvas.commonVideoViewContent.getAvSetting(prop); + if ($debug) Debug.write("fillDeviceList:: ", prop, dev); + + //Get all availible devices + var foundStoredDev = null; + combo.addItem(canvas.getLabelName(159), -1); + if ("-1" == dev) { + foundStoredDev = "-1"; + } + for (var eg = 0; eg < list.length; ++eg) { + combo.addItem(list[eg], eg); + var r = "" + eg; + if (r == dev) { + foundStoredDev = r; + } + } + return foundStoredDev; + ]]> + </method> + + <method name="selectListItem" args="combo, selected, select"> + if (selected != null) { + combo.selectItem(selected); + } else { + combo.selectItemAt(select ? 1 : 0); + } + </method> + + <!-- + Initialize the default settings for cam and resolution and attach the camera + after we have made sure the values are there one time + --> + <method name="initItems"> + <![CDATA[ + //fill list of Cameras + var cameras = Camera.names; + var foundStoredCam = fillDeviceList(cameras, availableCams, "cam"); + selectListItem(availableCams, foundStoredCam, cameras.length > 0); + + //fill list of Mics + var mics = Microphone.names; + var foundStoredMic = fillDeviceList(mics, availableMics, "mic"); + selectListItem(availableMics, foundStoredMic, mics.length > 0); + + // settings + var addCams = !canvas.currentRoomObj.audioOnly && cameras.length > 0; + var addMics = mics.length > 0; + ]]> + </method> + + <method name="attachCamera"> + <![CDATA[ + //Don't execute before combobox items are not initialized + if (!this.executeAttachCamera) { + if ($debug) Debug.write("Return, executeAttachCamera is false"); + return; + } + + if (_video == undefined) { + if ($debug) Debug.write("Return, video not yet ready"); + return; + } + _video.content._publisher.setAttribute("visible", true); + _video.content._viewer.setAttribute("visible", false); + var videoview = this._video.content._publisher._chatvideoinner._videostream; + //stop will not call clear as there is no NetStream + videoview._stop(); + videoview.clear(); + var _camera = canvas.commonVideoViewContent.getCam(availableCams.getValue(), cam_default_width, cam_default_height); + if (_camera != null) { + videoview.attachCamera(_camera); + } + ]]> + </method> + + <method name="cleanVideos"> + if (_video == undefined) return; + //make sure stop and clear is called, as the _stop method does not work for all + //videoviews in the device settings. + _video.content._publisher._chatvideoinner._videostream._stop(); + _video.content._viewer._chatvideoinner._videostream._stop(); + _video.content._publisher._chatvideoinner._videostream.clear(); + _video.content._viewer._chatvideoinner._videostream.clear(); + if ($debug) Debug.write("Cleaned up videos and free resources"); + </method> + + <method name="updateVisibility"> + <![CDATA[ + var camVisible = availableCams.getValue() > -1; + var micVisible = availableMics.getValue() > -1; + var textVisible = !camVisible && !micVisible; + this._btnStartRecording.setAttribute("visible", camVisible || micVisible); + this._video.setAttribute("visible", camVisible); + this._play.setAttribute("visible", camVisible || micVisible); + this._level_meter.setAttribute("visible", micVisible); + this.infoTextNoAV.setAttribute("visible", textVisible); + this.availibleResolutionsLabel.setAttribute("visible", ((canvas.isInterview) ? false : camVisible)); + this.availibleResolutionsWarning.setAttribute("visible", ((canvas.isInterview) ? false : camVisible)); + this.availibleResolutions.setAttribute("visible", ((canvas.isInterview) ? false : camVisible)); + ]]> + </method> + + <labelText name="availableCamsLabel" labelid="52" fontsize="11" x="10" y="80" width="$once{ parent.width-20 }" /> + <resetCombobox fontsize="11" name="availableCams" x="10" y="100" width="280" editable="false"> + <handler name="onselect"> + parent.updateVisibility(); + parent.attachCamera(); + </handler> + </resetCombobox> + + <labelText name="availableMicsLabel" labelid="53" fontsize="11" x="10" y="120" width="$once{ parent.width-20 }" /> + <resetCombobox fontsize="11" name="availableMics" x="10" y="140" width="280" editable="false"> + <handler name="onselect"> + parent.updateVisibility(); + </handler> + </resetCombobox> + + <labelText name="infoTextNoAV" labelid="452" multiline="true" width="280" + fontsize="11" x="10" y="164" visibility="hidden" /> + + <labelText name="availibleResolutionsLabel" labelid="1429" + fontsize="11" x="10" y="164" width="$once{ parent.width-20 }" /> + + <view name="availibleResolutionsWarning" x="272" y="164" + resource="warning_icon_popup_devices_rsc" clickable="true"> + <labelTooltip multiline="true" labelid="1430" /> + </view> + + <resetCombobox fontsize="11" name="availibleResolutions" x="10" shownitems="10" + y="184" width="280" editable="false"> + <!--- @keywords private --> + <attribute name="counter" value="0" /> + <handler name="oninit"> + <![CDATA[ + var i = getItemAt(0); + if ($debug) Debug.write("oninit ", this.selected, this, i); + if (!this.selected && !!i) { + selectItemAt(0); + onselect.sendEvent(i); + } + ]]> + </handler> + <handler name="onselect" args="item"> + <![CDATA[ + if (!canvas.isInterview) { + if ($debug) Debug.write("availibleResolutions::onselect cam [W x H] ", item.cam_width, item.cam_height); + parent.setAttribute("cam_default_width", item.cam_width); + parent.setAttribute("cam_default_height", item.cam_height); + + var py = parent.y < 0 ? 5 : parent.y; + var maxWidth = Math.min(600, canvas.width - parent.x - 10) + , maxHeight = Math.min(500, canvas.height - py - 10) + , newWidth = maxWidth, newHeight = maxHeight; + if (item.cam_width > 240) { + newWidth = maxWidth + item.cam_width - 240; + } + if (item.cam_height > 180) { + newHeight = maxHeight + item.cam_height - 180; + } + + if (newWidth + parent.x + 10 > canvas.width) { + newWidth = maxWidth; + } + if (newHeight + py + 10 > canvas.height) { + newHeight = maxHeight; + } + parent.setAttribute("width", newWidth); + parent.setAttribute("height", newHeight); + } + parent.attachCamera(); + ]]> + </handler> + <textlistitem datapath="myConfigSet:/config/availableCameraResolutions/resolution" > + <attribute name="cam_width" value="320" type="number" /> + <attribute name="cam_height" value="240" type="number" /> + <handler name="ondata"> + <![CDATA[ + //if ($debug) Debug.write("ondata ", this); + var type = this.datapath.xpathQuery('@type'); + this.cam_width = Number(this.datapath.xpathQuery('@width')); + this.cam_height = Number(this.datapath.xpathQuery('@height')); + this.setAttribute("text", "" + this.cam_width + "x" + this.cam_height + " [" + type + "]"); + var isDefault = this.datapath.xpathQuery('@isDefault') == "true"; + + var width = canvas.commonVideoViewContent.getAvSetting("width"); + var height = canvas.commonVideoViewContent.getAvSetting("height"); + if (!!width && !!height && width == this.cam_width && height == this.cam_height) { + parent.selectItemAt(parent.counter); + parent.onselect.sendEvent(this); + parent.selected = this; + } else if (isDefault) { + if ($debug) Debug.write("Found default one ", type); + parent.selectItemAt(parent.counter); + parent.onselect.sendEvent(this); + } + parent.counter++; + ]]> + </handler> + </textlistitem> + </resetCombobox> + + <simpleLabelButton name="_btnStartRecording" labelid="775" width="140" x="150" y="220" height="28"> + <handler name="onclick"> + parent._level_meter.startLevel(); + parent.doStartRecording(); + </handler> + </simpleLabelButton> + + <view x="340" y="60" name="_video" clip="true" + width="${ parent.width-this.x-10 }" height="${ parent.height-260 }"> + <view name="content"> + <videoObjectTestBroadcast name="_publisher" + width="${ parent.parent.parent.cam_default_width }" + height="${ parent.parent.parent.cam_default_height }"> + <handler name="sendCameraStatus" args="camStatus"> + if ($debug) Debug.write("sendCameraStatus -1- ",camStatus); + if (camStatus == "Camera.Unmuted") { + parent.parent.parent.startTimerToCount(); + } + </handler> + + <handler name="sendMicroStatus" args="micStatus"> + if ($debug) Debug.write("sendMicroStatus -1- ",micStatus); + if (micStatus == "Microphone.Unmuted") { + parent.parent.parent.startTimerToCount(); + } + </handler> + </videoObjectTestBroadcast> + + <videoObjectPlayTestBroadcast name="_viewer" visibility="hidden" + width="${ parent.parent.parent.cam_default_width }" + height="${ parent.parent.parent.cam_default_height }" /> + </view> + + <om_vscrollbar /> + <om_hscrollbar /> + </view> + + <view name="_text" x="340" y="60" width="240" height="180" visibility="hidden"> + <text name="_info" resize="true" bgcolor="0xFFFFFF" align="right" fontsize="12" fontstyle="bold" /> + </view> + + <simpleLabelButton name="_play" y="${ parent.height-166 }" x="490" enabled="false" width="90" labelid="764"> + <handler name="onclick"> + parent.doPlay(); + </handler> + </simpleLabelButton> + + <view name="_level_meter" x="340" y="${ parent.height-190 }" width="240" height="20" clip="true" bgcolor="0x000000"> + <!--- Level delegate, used to track level changes. + @keywords private --> + <attribute name="_leveldel" value="$once{new LzDelegate(this, '_updateLevel')}"/> + + <method name="_updateLevel" args="no"> + <![CDATA[ + if (parent._video.content._publisher._chatvideoinner._videostream.micro == null) { + return; + } + this.setNewLevel(parent._video.content._publisher._chatvideoinner._videostream.micro.activityLevel); + ]]> + </method> + + <method name="startLevel"> + this._leveldel.register(lz.Idle, "onidle"); + </method> + + <method name="resetNewLevel"> + this._leveldel.unregisterAll(); + this.setNewLevel(0); + </method> + + <method name="setNewLevel" args="no"> + <![CDATA[ + var newLevel = (238 / 100) * no; + this._over.setAttribute("width", 238 - newLevel); + this._over.setAttribute("x", 1 + newLevel); + ]]> + </method> + + <view name="_bg" width="238" height="18" x="1" y="1" bgcolor="0xFFFFFF" /> + <view name="_grip" resource="level_meter_rsc" x="1" y="1" /> + <view name="_over" width="238" height="18" x="1" y="1" bgcolor="0xFFFFFF" /> + <labelText labelid="767" x="2" y="2" height="16" width="236" resize="false" /> + </view> + + <view y="${ parent.height-98 }" resource="test_setup_info_rsc" x="16" /> + + <labelText fontstyle="bold" labelid="765" x="39" y="${ parent.height-100 }" + width="${ parent.width-50 }" multiline="true" /> + + <simpleLabelButton fontsize="11" labelid="918" x="${ parent.width-220 }" y="${ parent.height-50 }" + height="28" width="100"> + <handler name="onclick"> + parent.cleanVideos(); + parent.close(); + </handler> + </simpleLabelButton> + + <simpleLabelButton fontsize="11" labelid="144" x="${ parent.width-110 }" y="${ parent.height-50 }" + height="28" width="100" > + <handler name="onclick"> + parent.cleanVideos(); + parent.storeAVsettings(); + parent.close(); + </handler> + </simpleLabelButton> +</class> + +</library>
