blob: fc11cb10878b990ade247348ad98f9087fe81d1a [file] [log] [blame]
<?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.net.LocalConnection;
</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" />
<handler name="oninit">
<![CDATA[
var client = {};
client.t = this;
client.createEditRecordStream = this.createEditRecordStream;
client.createVideoObject = this.createVideoObject;
client.createVideo = this.createVideo;
client.getVideoObjectByPublicSID = this.getVideoObjectByPublicSID;
client.getNewVideoObject = this.getNewVideoObject;
client.getVideoObjectFreePos = this.getVideoObjectFreePos;
client.disconnectclient = this.disconnectclient;
client.resetAllValues = this.resetAllValues;
client.closeStreamClient = this.closeStreamClient;
client.setSpeakingByPos = this.setSpeakingByPos;
client.setAVSettingsToClient = this.setAVSettingsToClient;
client.startStream = this.startStream;
client.removeVideoByUser = this.removeVideoByUser;
client.muteSound = this.muteSound;
client.updateMuteStatusVideoView = this.updateMuteStatusVideoView;
client.ismoderatorChanged = this.ismoderatorChanged;
// update rights to SWF10 client
client.updateModerationFlag = this.updateModerationFlag;
client.changeDevice = this.changeDevice;
client.setDrawAllowStatus = this.setDrawAllowStatus;
client.setExclusiveAudioAllowStatus = this.setExclusiveAudioAllowStatus;
client.exitRoom = this.exitRoom;
client.immediateExitRoom = this.immediateExitRoom;
client.closeWhiteboard = this.closeWhiteboard;
client.arrangeWindows = this.arrangeWindows;
client.updateFirstLastName = this.updateFirstLastName;
client.setSessionId = this.setSessionId;
var lc:LocalConnection = new LocalConnection();
lc.connect(canvas.vid_lc_name);
lc.client = client;
canvas.setAttribute("lc", lc);
]]>
</handler>
<method name="createEditRecordStream" args="syncUpdate,isInterview,interviewPodId">
if($debug) Debug.info("createEditRecordStream,",syncUpdate,isInterview,interviewPodId);
if (canvas.inner.editRecordStream != null)
canvas.inner.editRecordStream.destroy();
new lz.editRecordStreamSWF10(canvas.inner, {
name:"editRecordStream",
isSyncUpdate:syncUpdate,
isInterview:isInterview,
interviewPodId:interviewPodId
});
return;
</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);
if (canvas.isInterview) {
if ($debug) Debug.write("Is interview ",interviewPodId,"x",canvas["interviewPod"+interviewPodId+"_x"]);
if (interviewPodId != null) {
vidContainer.setAttribute("interviewPodId", interviewPodId);
vidContainer.setAttribute("x",canvas["interviewPod"+interviewPodId+"_x"]);
vidContainer.setAttribute("y",canvas["interviewPod"+interviewPodId+"_y"]);
}
vidContainer.setAttribute("width",322);
vidContainer.setAttribute("height",281);
}
vidContainer.clientVars = object;
vidContainer.setAttribute('visibility','hidden');
return vidContainer;
</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="publicSID,displayName,broadcastId,avsettings,interviewPodId,object">
<![CDATA[
if ($debug) Debug.info("createVideo, publicSID: ",publicSID,"broadcastId: ",broadcastId,"AVsettings: ",avsettings);
if ($debug) Debug.write(" createVideo ALL vars ",object);
var vidContainer = getVideoObjectByPublicSID(publicSID);
if(vidContainer == null) {
vidContainer = this.getNewVideoObjectByPos(publicSID);
vidContainer.clientVars = object;
vidContainer.setAttribute('chatpartnername',displayName);
if (avsettings=="n"){
vidContainer.setVideouserProfilePic(object);
vidContainer.setAttribute("visibility","hidden");
} else if (avsettings=="a"){
vidContainer.setVideouserProfilePic(object);
if ($debug) Debug.warn("start play");
vidContainer._chatvideoinner._videostream.playStream(broadcastId,-1);
vidContainer.setAttribute("visibility","hidden");
} else if (avsettings=="v" || avsettings=="av") {
//this means avsettings is either: "v" or "av"
vidContainer.setDefaultVideoSize(object.VWidth,object.VHeight);
vidContainer._chatvideoinner._videostream.playStream(broadcastId,-1);
vidContainer.setAttribute("visibility","visible");
} else {
//this means user did not select anything yet and streaming has not started
vidContainer.setAttribute("visibility","hidden");
}
vidContainer.setAttribute("interviewPodId", interviewPodId);
vidContainer.updateAVSettingsSymbol(object);
if (object.micMuted) {
vidContainer.setMicMuted(object.micMuted);
}
}
if ($debug) Debug.write("Is interview ? ",canvas.isInterview);
if (canvas.isInterview && interviewPodId != null && interviewPodId > 0) {
if ($debug) Debug.write("Is interview ",interviewPodId,"x",canvas["interviewPod"+interviewPodId+"_x"]);
vidContainer.setAttribute("interviewPodId", interviewPodId);
vidContainer.setAttribute("x",canvas["interviewPod"+interviewPodId+"_x"]);
vidContainer.setAttribute("y",canvas["interviewPod"+interviewPodId+"_y"]);
vidContainer.setAttribute("width",322);
vidContainer.setAttribute("height",281);
}
return;
]]>
</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[
var obj = this.getVideoObjectByPublicSID(publicSID);
if (obj!=null){
return obj;
}
//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[
var obj = this.getVideoObjectByPublicSID(publicSID);
if (obj!=null){
this.broadCastViewRef = obj;
} else {
this.broadCastViewRef = getNewVideoObjectByPos(publicSID);
this.broadCastViewRef._chatvideoinner.r.destroy();
if ($debug) Debug.write("getNewVideoObject canvas.userobject ",publicSID,canvas.userobject);
this.broadCastViewRef.setAttribute('chatpartnername',canvas.userobject.firstname+' '+canvas.userobject.lastname);
}
return this.broadCastViewRef;
]]>
</method>
<method name="getVideoObjectByInterviewPodId" args="interviewPodId">
<![CDATA[
for (var i=0;i<this.subviews.length;i++){
if (this.subviews[i].interviewPodId==interviewPodId){
return this.subviews[i];
}
}
if ($debug) Debug.warn(" - getVideoObjectByInterviewPodId - DID NOT FIND THE USER BY ",interviewPodId);
return null;
]]>
</method>
<method name="getVideoObjectFreePos" args="offsetLength,videoWidth,videoHeight">
<![CDATA[
var newx = 20;
if (canvas.currentRoomObject.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.currentRoomObject.hideWhiteboard) {
newx += SIDEPANEL_WIDTH;
}
newy += 10;
posFound = false;
}
}
}
if ((newy + videoHeight) >= canvas.height) {
newy = 0;
}
var result = [newx, newy];
return result;
]]>
</method>
<method name="disconnectclient" args="publicSID">
<![CDATA[
if ($debug) Debug.write("disconnectclient: ",publicSID);
var obj = this.getVideoObjectByPublicSID(publicSID);
//if ($debug) Debug.write("disconnecclient obj: ",obj);
if (obj == null) {
if ($debug) Debug.warn("Could Not find this To disconnect",publicSID);
}
if (obj != null){
obj.resetValues();
obj.destroy();
}
]]>
</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("closeStreamthis: ",publicSID);
var obj = this.getVideoObjectByPublicSID(publicSID);
if ($debug) Debug.write("closeStreamthis obj: ",obj);
if (obj != null){
obj.resetValues();
}
return obj;
]]>
</method>
<method name="removeVideoByUser" args="publicSID"><![CDATA[
var obj = this.closeStreamclient(publicSID);
if(obj != null) {
obj.destroy();
}
return;
]]></method>
<method name="updateMuteStatusVideoView" args="roomClient">
<![CDATA[
var obj = this.getVideoObjectByPublicSID(roomClient.publicSID);
if (obj != null) {
obj.muteMicrophone(roomClient);
}
]]>
</method>
<method name="ismoderatorChanged" args="m">
canvas.setAttribute("ismoderator", m);
return;
</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">
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);
}
if (rcl.avsettings=="n"){
obj.setAttribute("visibility","hidden");
obj.setVideouserProfilePic(rcl);
} else if (rcl.avsettings=="a"){
obj.setVideouserProfilePic(rcl);
obj.setAttribute("visibility","hidden");
} else {
obj.deleteVideoConfProfilePic();
obj.setAttribute("visibility","visible");
}
obj.thisVars = rcl;
obj.updateAVSettingsSymbol(rcl);
return;
</method>
<method name="startStream" args="publicSID,broadcastId,firstname,lastname,interviewPodId,width,height">
<![CDATA[
if ($debug) Debug.write("startStream: ", publicSID,broadcastId,firstname,lastname,interviewPodId,width,height);
var obj = this.getVideoObjectByPublicSID(publicSID);
//if ($debug) Debug.write("startStream obj: ",obj);
if (obj != null ){
obj._chatvideoinner._videostream.playStream(broadcastId,-1);
obj.setDefaultVideoSize(width,height);
obj.setAttribute('chatpartnername',firstname+' '+lastname);
}
//we have to do this again when the stream starts, the initial video
//component does not know the interviewPodId as the user has not selected
//which interview video pod he is going to use
if (canvas.isInterview && interviewPodId != null && interviewPodId > 0) {
if ($debug) Debug.write("Is interview ",interviewPodId,"x",canvas["interviewPod"+interviewPodId+"_x"]);
obj.setAttribute("interviewPodId", interviewPodId);
obj.setAttribute("x",canvas["interviewPod"+interviewPodId+"_x"]);
obj.setAttribute("y",canvas["interviewPod"+interviewPodId+"_y"]);
obj.setAttribute("width",322);
obj.setAttribute("height",281);
}
return;
]]>
</method>
<!---
Clear all views, probably this is caleld whenever a user leaves the room for example
-->
<method name="clearAll">
<![CDATA[
if ($debug) Debug.write("clearAll", this.subviews);
while(this.subviews.length > 0) {
this.subviews[0]._chatvideoinner._videostream._stop();
this.subviews[0].destroy();
}
if (canvas.inner.editRecordStream != null) {
canvas.inner.editRecordStream.destroy();
}
return;
]]>
</method>
<!---
Update the ismoderator flag, there is no need to check here which user
this happened already before sending it to the SWF10 app
-->
<method name="updateModerationFlag" args="moderator">
<![CDATA[
if ($debug) Debug.write("updateModerationFlag :: ",moderator);
this.setAttribute('ismoderator',moderator);
return;
]]>
</method>
<!---
Update the canDraw,canShare,canRemote flag, there is no need to check here which user
this happened already before sending it to the SWF10 app
-->
<method name="setDrawAllowStatus" args="canDraw,canShare,canRemote">
<![CDATA[
if ($debug) Debug.write("setDrawAllowStatus :: ",canDraw,canShare,canRemote);
canvas.setAttribute("isAllowedToDraw",canDraw);
canvas.setAttribute("isAllowedToScreenShare",canShare);
canvas.setAttribute("isAllowedToRemoteControl",canRemote);
return;
]]>
</method>
<method name="setExclusiveAudioAllowStatus" args="canGiveAudio">
<![CDATA[
if ($debug) Debug.write("setExclusiveAudioAllowStatus :: ",canGiveAudio);
canvas.setAttribute("isAllowedToGiveExclusiveAudio",canGiveAudio);
return;
]]>
</method>
<!---
Shows the window with device settings
-->
<method name="changeDevice">
<![CDATA[
if ($debug) Debug.write("changeDevice");
new lz.changeDevice(canvas.inner, {
name:"changeDeviceDialog"
});
return;
]]>
</method>
<!---
Shows the exit dialog
-->
<method name="exitRoom">
if ($debug) Debug.write("exitRoom");
new lz.confirmationSingleSWF10(canvas,{
refObj:this,
labelid:791,
labeliderror:790,
refReturnMethod:'immediateExitRoom',
showCheckBox:false
});
return;
</method>
<method name="immediateExitRoom" args="bool,ctx">
canvas.videoComp_lc.send(canvas.videoComp_lc_name, 'exitRoom', bool);
</method>
<method name="updateFirstLastName" args="publicSID,first,last">
var v = getVideoObjectByPublicSID(publicSID);
if (v != null) {
v.setAttribute('chatpartnername', first + ' ' + last);
}
</method>
<!---
Shows the close whiteboard dialog
-->
<method name="closeWhiteboard">
if ($debug) Debug.write("closeWhiteboard");
if (canvas.ismoderator || canvas.isAllowedToDraw) {
canvas.closeWhiteboardDialog = new lz.confirmationSingleSWF10(canvas,{
refObj:this,
labeliderror:1313,
refReturnMethod:'closeWhiteboardConfirmMethod',
showCheckBox:false
});
} else {
new lz.labelerrorPopupSWF10(canvas,{labelid:1366, errorlabelid:1365});
}
return;
</method>
<method name="closeWhiteboardConfirmMethod" args="bool,sharedObjectData">
canvas.videoComp_lc.send(canvas.videoComp_lc_name, 'closeWhiteboard', bool);
</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>
<method name="setSessionId" args="session_id">
canvas.setAttribute("sessionId", session_id);
</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>
</class>
</library>