blob: 461b3413b37824cf7202faafdccb0cd839a41416 [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="whiteboardVideoPlayer" extends="labelExplorerBox" allowDragging="false"
docking="false" resizeable="false" closable="false"
x="0" y="0" width="${ parent.width }" height="${ parent.height }">
<attribute name="fileExplorerItemId" value="0" type="number" />
<attribute name="timerDelegateStarted" value="false" type="boolean" />
<attribute name="deltaInSeconds" value="0" type="number" />
<attribute name="currentTime" value="0" type="number" />
<attribute name="recordingName" value="" type="string" />
<attribute name="isLoaded" value="false" type="boolean" />
<attribute name="sendInit" value="false" type="boolean" />
<attribute name="flv_width" value="0" type="number" />
<attribute name="flv_height" value="0" type="number" />
<attribute name="isPaused" value="true" type="boolean" />
<handler name="oninit">
if ($debug) Debug.write("whiteboardVideoPlayer :: ",this.fileExplorerItemId);
this.recordingName = "UPLOADFLV_" + this.fileExplorerItemId + ".flv";
calcVideoWidthHeight();
this.copyFileToCurrentRoom.doCall();
var t = this;
canvas.videoComp_lc.stopRecordingStream = function(tName) {
if (t.name == tName) {
t.stopStream();
}
}
canvas.videoComp_lc.metaWhiteboardPlaybackStream = function(tName,duration) {
if (t.name == tName) {
t.deltaInSeconds = duration;
t.setDuration();
}
}
canvas.videoComp_lc.updateWhiteboardStreamTime = function(tName,time) {
if (t.name == tName) {
t.currentTime = time;
t.calcProgressBar();
}
}
</handler>
<handler name="prepareForDelete" args="tRef">
if ($debug) Debug.write("--- prepareForDelete ");
this.stopStream();
</handler>
<handler name="onclose">
this.stopStreamPlay();
</handler>
<handler name="onwidth" args="w">
calcVideoWidthHeight();
</handler>
<handler name="onheight" args="h">
calcVideoWidthHeight();
</handler>
<!--
public Long copyFileToCurrentRoom(String SID, Long flvFileExplorerId)
-->
<netRemoteCallHib name="copyFileToCurrentRoom" funcname="fileservice.copyFileToCurrentRoom"
remotecontext="$once{ canvas.thishib }" >
<netparam><method name="getValue">return canvas.sessionId;</method></netparam>
<netparam><method name="getValue">return parent.parent.fileExplorerItemId;</method></netparam>
<handler name="ondata" args="value">
<![CDATA[
if ($debug) Debug.write("deleteFileOrFolder: ",value);
parent.isLoaded = true;
var downloadurl = canvas.getUrl()+'DownloadHandler?fileName=UPLOADFLV_'+parent.fileExplorerItemId+'.jpg'
+'&moduleName=lzRecorderApp&parentPath=&room_id='
+'&sid='+canvas.sessionId;
parent._content._preview.imagePreview.setAttribute("src",downloadurl)
parent._content._preview.bringToFront();
if (parent.sendInit) {
parent.parent.sendNewVideoRemote(parent);
}
]]>
</handler>
</netRemoteCallHib>
<method name="startStreamPlay">
parent.playFLV(this,true);
this.startStream();
</method>
<method name="stopStreamPlay">
parent.playFLV(this,false);
this.stopStream();
</method>
<method name="playRemote">
this.startStream();
</method>
<method name="stopRemote">
this.stopStream();
</method>
<method name="startStream">
<![CDATA[
if (!this.isLoaded) {
return;
}
if ($debug) Debug.write("startStream ",this.recordingName);
if (this.recordingName != "") {
this.isPaused = false;
if (!this.timerDelegateStarted) {
this.timerDelegateStarted = true;
}
if ($debug) Debug.write("PLAY STREAM ",this.recordingName);
var tObjectDimension = calcVideoWidthHeight();
if ($debug) Debug.write("SEND ",this.recordingName,0,tObjectDimension.x,tObjectDimension.y,tObjectDimension.width,tObjectDimension.height);
// this._content._videostream.playStream(this.recordingName,0,tObjectDimension.x,tObjectDimension.y,tObjectDimension.width,tObjectDimension.height);
var tx = this.getAttributeRelative("x",canvas)+tObjectDimension.x+this._content.x;
var ty = this.getAttributeRelative("y",canvas)+tObjectDimension.y+this._content.y;
canvas.sendViaLocalConnection(canvas.rtmp_lc_name, "playbackWhiteboardVideo", [this.name,this.recordingName,0,tx,ty,tObjectDimension.width,tObjectDimension.height]);
}
]]>
</method>
<!---
calculates the new x, y, width and height of the video so that it is 100%
visible in the container
-->
<method name="calcVideoWidthHeight">
<![CDATA[
if ($debug) Debug.write("calcVideoWidthHeight ",this.flv_width,this.flv_height);
var ratio = this.flv_width / this.flv_height;
//max height of container is new height of video;
//calc new width and x-position of video
var newHeight = this._content.height;
var newWidth = ratio * newHeight;
var newx = (this._content.width - newWidth) / 2;
var newy = 0;
if ($debug) Debug.write("calcVideoWidthHeight",ratio,this._content.width,this._content.height,newWidth,newHeight,newx,newy);
if (newWidth > this._content.width) {
newWidth = this._content.width;
newHeight = newWidth / ratio;
newx = 0;
newy = (this._content.height - newHeight) / 2;
}
var t = {'x':newx,'y':newy,'width':newWidth,'height':newHeight};
if ($debug) Debug.write("t",t);
this._content._preview.setAttribute("x",newx);
this._content._preview.setAttribute("y",newy);
this._content._preview.setAttribute("width",newWidth);
this._content._preview.setAttribute("height",newHeight);
return {'x':newx,'y':newy,'width':newWidth,'height':newHeight};
]]>
</method>
<method name="setDuration">
<![CDATA[
if ($debug) Debug.write("setDuration ",this.deltaInSeconds);
var tString = "";
if (this.deltaInSeconds > 60) {
var minutes = Math.floor(this.deltaInSeconds/60);
var restSeconds = Math.round(this.deltaInSeconds) - ( minutes * 60 );
tString = minutes + " min " + restSeconds + " sec";
} else {
tString = Math.round(this.deltaInSeconds) + " sec";
}
this._progress._progressbar._duration.setAttribute("text",tString);
]]>
</method>
<method name="calcProgressBar">
<![CDATA[
if ($debug) Debug.write("calcProgressBar ",this.currentTime);
this._progress._progressbar._pointer.setAttribute("visibility","visible");
var tString = "";
if (this.currentTime > 60) {
var minutes = Math.floor(this.currentTime/60);
var restSeconds = Math.round(this.currentTime) - ( minutes * 60 );
tString = minutes + " min " + restSeconds + " sec";
} else {
tString = Math.round(this.currentTime) + " sec";
}
var tNewX = Math.round((this._progress._progressbar.width / this.deltaInSeconds) * this.currentTime);
this._progress._progressbar._time.setAttribute("text",tString);
this._progress._progressbar._pointer.setAttribute("x",tNewX);
]]>
</method>
<method name="stopStream">
if (this.timerDelegateStarted) {
this.timerDelegateStarted = false;
}
this._progress._progressbar._time.setAttribute("text","");
this._progress._progressbar._pointer.setAttribute("x",0);
if ($debug) Debug.write("SEND stopWhiteboardVideo ",this.name);
canvas.sendViaLocalConnection(canvas.rtmp_lc_name, "stopWhiteboardVideo",[this.name]);
this.isPaused = true;
</method>
<method name="toggleStream">
if (canvas.ismoderator &amp;&amp; this.isPaused) {
this.startStreamPlay();
}
</method>
<view name="_content" height="${ parent.height-62 }" bgcolor="0x000000"
y="22" x="1" width="${ parent.width-1 }">
<view name="_preview" width="0" height="0" >
<image name="imagePreview" stretches="both"
width="${parent.width}" height="${parent.height}" />
<handler name="onclick">
if ($debug) Debug.write("onclick -- toggleStream");
parent.parent.toggleStream();
</handler>
<view width="60" height="40" valign="middle" opacity="0.7"
align="center" bgcolor="0xFFFFFF">
<view resource="lz_recorder_play" valign="middle" align="center" />
</view>
</view>
</view>
<view name="_progress" height="18" y="${ parent.height - 40 }" width="${ parent.width-2 }"
x="1" bgcolor="$once{ canvas.getThemeColor('basebgcolorizer') }">
<view resource="flv_recorder_play_small_rsc" y="1" height="16" width="16"
bgcolor="$once{ canvas.getThemeColor('baseMouseOvercolorizer') }">
<handler name="onmouseover">
this.setAttribute("bgcolor",0xFFFFFF);
</handler>
<handler name="onmouseout">
this.setAttribute("bgcolor",canvas.getThemeColor('baseMouseOvercolorizer'));
</handler>
<handler name="onclick">
if (canvas.ismoderator &amp;&amp; parent.parent.isPaused) {
parent.parent.startStreamPlay();
}
</handler>
<labelTooltip labelid="875" />
</view>
<view name="_progressbar" x="16" width="${ parent.width - 32 }" y="1"
height="16" bgcolor="$once{ canvas.getThemeColor('baseMouseOvercolorizer') }">
<view x="0" width="${ parent.width }" y="0" height="16" bgcolor="0xFFFFFF" opacity="0.5" />
<handler name="onclick">
//parent.parent.seekStream(this.getMouse("x"));
</handler>
<view name="_pointer" resource="flv_progress_pointer_rsc" visibility="hidden" />
<text name="_time" resize="true" fontsize="10" />
<text name="_duration" align="right" resize="true" fontsize="10" />
</view>
<view resource="flv_recorder_stop_small_rsc" align="right" y="1" height="16" width="16"
bgcolor="$once{ canvas.getThemeColor('baseMouseOvercolorizer') }">
<handler name="onmouseover">
this.setAttribute("bgcolor",0xFFFFFF);
</handler>
<handler name="onmouseout">
this.setAttribute("bgcolor",canvas.getThemeColor('baseMouseOvercolorizer'));
</handler>
<handler name="onclick">
if (canvas.ismoderator) {
parent.parent.stopStreamPlay();
}
</handler>
<labelTooltip labelid="876" />
</view>
</view>
<simpleLabelButton labelid="85" width="100" x="${ parent.width-118 }"
y="${ parent.height-20 }" >
<handler name="onclick">
if (canvas.ismoderator) {
this.parent.stopRemote();
this.parent.parent.deleteItemByName(this.parent.name);
this.parent.parent.deleteItemByNameSync(this.parent.name);
}
</handler>
</simpleLabelButton>
</class>
</library>