/usr/share/doc/red5/html/demo-applications.html is in red5-doc 1.0~svn4374-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | <html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Chapter 17. Red5 Demo Applications</title><link rel="stylesheet" type="text/css" href="html.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Red5 - Reference Documentation"><link rel="up" href="core-components.html" title="Part II. Red5 Core Components"><link rel="prev" href="management.html" title="Chapter 16. Management"><link rel="next" href="testing.html" title="Chapter 18. Testing Red5"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div xmlns="http://www.w3.org/TR/xhtml1/transitional" style="background-color:white;border:none;height:73px;border:1px solid black;"><a style="border:none;" href="http://osflash.org/red5" title="Red5 Open Source Flash Server"><img style="border:none;" src="images/red5-banner.png"></img></a><a style="border:none;" href="http://osflash.org/red5" title="Red5 Open Source Flash Server"><img style="border:none;position:absolute;padding-top:5px;right:42px;" src="images/red5-banner-logo.png"></img></a></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="demo-applications"></a>Chapter 17. Red5 Demo Applications</h2></div></div></div>
<p>The Red5 demo applications are available for downloaded on demand using the installer application located at
<a class="ulink" href="http://localhost:5080/installer" target="_top">http://localhost:5080/installer</a>.
</p>
<div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d5e2241"></a>17.1. Getting Red5 Demo Applications Server-Side and Client-Side Source</h2></div></div></div>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<p>With your favourite SVN client check out the source code from svn at this address
<a class="ulink" href="http://red5.googlecode.com/svn/java/example/trunk/" target="_top">http://red5.googlecode.com/svn/java/example/trunk/</a> or
<a class="ulink" href="https://red5.googlecode.com/svn/java/example/trunk/" target="_top">https://red5.googlecode.com/svn/java/example/trunk/</a> if you have a google code login.
</p>
</li></ol></div>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<p>With your favourite SVN client check out the source code from svn at this address
<a class="ulink" href="http://red5.googlecode.com/svn/flash/trunk/" target="_top">http://red5.googlecode.com/svn/flash/trunk/</a> or
<a class="ulink" href="https://red5.googlecode.com/svn/flash/trunk/" target="_top">https://red5.googlecode.com/svn/flash/trunk/</a> if you have a google code login.
</p>
</li></ol></div>
<div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="d5e2253"></a>17.1.1. List Of Available Demo Applications (Server Side)</h3></div></div></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
<p>SOSample - A simple shared ball demo that makes use of Shared Objects.</p>
</li><li class="listitem">
<p>admin - The Red5 administration panel.</p>
</li><li class="listitem">
<p>echo - A test application that runs RTMP/AMF datatype tests.</p>
</li><li class="listitem">
<p>oflaDemo - Simple video player as shown on the Online Open Source Flash conference.</p>
</li><li class="listitem">
<p>bwcheck - Demo application that detects the client bandwidth.</p>
</li><li class="listitem">
<p>fitcDemo - Video conference with chat.</p>
</li></ul></div>
</div>
<div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="d5e2268"></a>17.1.2. List Of Available Demo Applications (Client Side)</h3></div></div></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
<p>admin - The admin panel client application</p>
</li><li class="listitem">
<p>bwcheck - Demo to interface with the bandwidth check application, tests both download and upload rates.</p>
</li><li class="listitem">
<p>echo - Simple echo test AMF client</p>
</li><li class="listitem">
<p>loadtest - Simple loading testing tool, requesting a file multiple times.</p>
</li><li class="listitem">
<p>port-tester - Open port tester application.</p>
</li><li class="listitem">
<p>publisher - Simple broadcaster application</p>
</li></ul></div>
</div>
</div>
<div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d5e2283"></a>17.2. Environment Build Setup</h2></div></div></div>
<p>To build the demo applications and add WAR snapshots to the subversion repository, the ant environment requires a SvnAnt task library added to the ant common library directory:</p>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<p>Go here:
<a class="ulink" href="http://subclipse.tigris.org/svnant.html" target="_top">http://subclipse.tigris.org/svnant.html</a>
</p>
</li><li class="listitem">
<p>Download the latest SvnAnt</p>
</li></ol></div>
<p> ex:
<a class="ulink" href="http://subclipse.tigris.org/files/documents/906/43359/svnant-1.2.0-RC1.zip" target="_top">http://subclipse.tigris.org/files/documents/906/43359/svnant-1.2.0-RC1.zip</a>
</p>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<p>Unzip the archive and place the jar files in your Ant lib directory</p>
</li></ol></div>
<pre class="screen">
C:\dev\ant\lib
</pre>
<p>
4. Using your svn client or subclipse svn client in eclipse checkout or update the snapshots repository
<a class="ulink" href="https://red5.googlecode.com/svn/snapshots" target="_top">https://red5.googlecode.com/svn/snapshots</a>. It will keep the registry.xml file up to date for modifying later.
</p>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<p>Add these variables to a build.properties file into user home directory </p>
</li></ol></div>
<div class="literallayout"><p> <br>
svn.url=http://red5.googlecode.com/svn/snapshots/<br>
svn.login=youruser<br>
svn.password=the google code password<br>
snapshot.path=/www/red5_snapshots/<br>
Where snapshot.path is the path to the checked out snapshots directory. <br>
</p></div>
</div>
<div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d5e2304"></a>17.3. Building The Demo Application</h2></div></div></div>
<p>To build the application and upload the created WAR file to the snapshots repository run the following ant target.</p>
<pre class="screen">
$ ant upload-snapshot
</pre>
</div>
<div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d5e2308"></a>17.4. Updating The Applications Registry</h2></div></div></div>
<p>Once the updated WAR has been uploaded to the snapshots repository, the registry.xml file requires to be updated so the demo applications installer will collect the update. </p>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<p>Locate in the console output after uploading snapshot something like Destination: /www/red5_snapshots/admin-
<a class="ulink" href="nullchangeset/3197" target="_top">r3197</a>-java6.war the file of the new war will be admin-
<a class="ulink" href="nullchangeset/3197" target="_top">r3197</a>-java6.war.
</p>
</li><li class="listitem">
<p>Edit the registry.xml in the snapshots checkout update the webapp entry with the new filename and commit the change</p>
</li></ol></div>
<p>ie</p>
<pre class="programlisting">
<application name="admin">
<author>Martin M, Dan Rossi</author>
<desc>Administration console</desc>
<filename>admin-r3197-java6.war</filename>
</application>
</pre>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/admons/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top">
<p>
Subclipse version for committing changes also made by svnant in the snapshots repository, needs to be version 1.4 which is bound to subversion version 1.5 using this update site http://subclipse.tigris.org/update_1.4.x.
Other svn clients also need to be bound to subversion 1.5 or you will get client too old errors.
</p>
</td></tr></table></div>
</div>
<div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d5e2322"></a>17.5. Demo Applications Documentation</h2></div></div></div>
<p>Following is documentation for the demo applications:</p>
<div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="d5e2325"></a>17.5.1. Bandwidth Check Application</h3></div></div></div>
<p> This section explains the bandwidth check application and how to use it. The bandwidth check application handles two service method calls to trigger a download or upload rate check and return information to the flash client to determine what video bitrate to use. </p>
<div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="d5e2328"></a>17.5.1.1. Source Code</h4></div></div></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
<p>Server Side -
<a class="ulink" href="http://code.google.com/p/red5/source/browse/#svn/java/example/trunk/bwcheck" target="_top">http://code.google.com/p/red5/source/browse/#svn/java/example/trunk/bwcheck</a>
</p>
</li><li class="listitem">
<p>Client Side -
<a class="ulink" href="http://code.google.com/p/red5/source/browse/#svn/flash/trunk/bwcheck" target="_top">http://code.google.com/p/red5/source/browse/#svn/flash/trunk/bwcheck</a>
</p>
</li></ul></div>
</div>
<div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="d5e2337"></a>17.5.1.2. Bandwidth Check Service Methods</h4></div></div></div>
<p>The service method is enabled in the bean with a name bwCheckService.service.</p>
<pre class="programlisting">
<bean id="bwCheckService.service" class="org.red5.demos.bwcheck.BandwidthDetection" />
</pre>
<p>Inside the BandwidthDetection class there are two service methods:</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
<p>Trigger a server to client rate check</p>
</li></ul></div>
<pre class="programlisting">
public void onServerClientBWCheck(Object[] params) {
IConnection conn = Red5.getConnectionLocal();
ServerClientDetection serverClient = new ServerClientDetection();
serverClient.checkBandwidth(conn);
}
</pre>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
<p>Trigger a client to server rate check</p>
</li></ul></div>
<pre class="programlisting">
public Map<String, Object> onClientBWCheck(Object[] params) {
ClientServerDetection clientServer = new ClientServerDetection();
return clientServer.onClientBWCheck(params);
}
</pre>
</div>
<div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="d5e2350"></a>17.5.1.3. ServerClientDetection</h4></div></div></div>
<p>The ServerClientDetection class detects server to client bandwidth. 3 set of payload data arrays are intialized, the first with 1200 keys, and the next two with 12000 keys ie</p>
<pre class="programlisting">
for (int i = 0; i < 12000; i++) {
payload_1[i] = Math.random();
}
p_client.setAttribute("payload_1", payload_1);
</pre>
<p>The start microtime is recorded, along with an initial number of bytes sent to the client. </p>
<p>To initiate the handshake with the client method
<span class="bold"><strong>onBWCheck</strong></span> is called with parameters
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
<p>count - the number of times a result has been received from the client</p>
</li><li class="listitem">
<p>sent - the number of times the client method onBWCheck has been called</p>
</li><li class="listitem">
<p>timePassed - The interval time in milliseconds since the beginning of the bandwidth checking has occured.</p>
</li><li class="listitem">
<p>latency - </p>
</li><li class="listitem">
<p>cumLatency - the value of the increased passes from server to client. </p>
</li></ul></div>
<pre class="programlisting">
private void callBWCheck(Object payload)
{
IConnection conn = Red5.getConnectionLocal();
Map<String, Object> statsValues = new HashMap<String, Object>();
statsValues.put("count", this.count);
statsValues.put("sent", this.sent);
statsValues.put("timePassed", this.timePassed);
statsValues.put("latency", this.latency);
statsValues.put("cumLatency", this.cumLatency);
statsValues.put("payload", payload);
if (conn instanceof IServiceCapableConnection) {
((IServiceCapableConnection) conn).invoke("onBWCheck", new Object[]{statsValues}, this);
}
}
</pre>
<p>An initial payload is sent with a size of 1200 keys, of the second pass, if the pass count is less than 3 and the time interval passed is less than 1 second progressively increase the payload packet sent with a size of 12000 keys. </p>
<p>On the next pass if its between 3 and less than 6 times and less than 1 second, send the 3rd payload packet. </p>
<p>On the next pass if its greater than 6 times and less than 1 second, send the 4th payload packet.</p>
<p>Once the times passed reaches the amount of times sent, send the client the calculated rate, calculated by the following</p>
<pre class="programlisting">
this.deltaDown = (endStats.getWrittenBytes() - beginningValues.get("b_down")) * 8 / 1000; // bytes to kbits
this.deltaTime = ((now - beginningValues.get("time")) - (latency * cumLatency)) / 1000; // total dl time - latency for each packet sent in secs
if (Math.round(deltaTime) <= 0) {
this.deltaTime = (now - beginningValues.get("time") + latency) / 1000;
}
this.kbitDown = Math.round(deltaDown / deltaTime); // kbits / sec
if (kbitDown < 100) this.kbitDown = 100;
log.info("onBWDone: kbitDown: {} deltaDown: {} deltaTime: {} latency: {} ", new Object[]{kbitDown, deltaDown, deltaTime, this.latency});
this.callBWDone();
</pre>
<p>This will call a client method
<span class="bold"><strong>onBWDone</strong></span>
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
<p>kbitDown - the kbits down value</p>
</li><li class="listitem">
<p>deltaDown - </p>
</li><li class="listitem">
<p>deltaTime - </p>
</li><li class="listitem">
<p>latency - The latency delay calculated between server and client</p>
</li></ul></div>
<pre class="programlisting">
private void callBWDone()
{
IConnection conn = Red5.getConnectionLocal();
Map<String, Object> statsValues = new HashMap<String, Object>();
statsValues.put("kbitDown", this.kbitDown);
statsValues.put("deltaDown", this.deltaDown);
statsValues.put("deltaTime", this.deltaTime);
statsValues.put("latency", this.latency);
if (conn instanceof IServiceCapableConnection) {
((IServiceCapableConnection) conn).invoke("onBWDone", new Object[]{statsValues});
}
}
</pre>
<div class="section"><div class="titlepage"><div><div><h5 class="title"><a name="d5e2386"></a>17.5.1.3.1. Client Side Download Detection</h5></div></div></div>
<p>Client side callback methods are setup to enable the detection.</p>
<div class="literallayout"><p><br>
public function onBWCheck(obj:Object):void<br>
{<br>
dispatchStatus(obj);<br>
}<br>
<br>
public function onBWDone(obj:Object):void <br>
{ <br>
dispatchComplete(obj);<br>
} <br>
<br>
</p></div>
<p>And then the information is obtainable on the Object argument</p>
<div class="literallayout"><p><br>
public function onServerClientComplete(event:BandwidthDetectEvent):void<br>
{<br>
txtLog.data += "\n\n kbit Down: " + event.info.kbitDown + " Delta Down: " + event.info.deltaDown + " Delta Time: " + event.info.deltaTime + " Latency: " + event.info.latency;<br>
txtLog.data += "\n\n Server Client Bandwidth Detect Complete";<br>
txtLog.data += "\n\n Detecting Client Server Bandwidth\n\n";<br>
ClientServer();<br>
}<br>
</p></div>
</div>
</div>
<div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="d5e2392"></a>17.5.1.4. ClientServerDetection</h4></div></div></div>
<p>The ClientServerDetection class helps detect client to server bandwidth. The server side method
<span class="bold"><strong>onClientBWCheck</strong></span> is called with some information to help the client to determine the bandwidth.
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
<p>cOutBytes - The bytes read from the client</p>
</li><li class="listitem">
<p>cInBytes - The bytes sent to the client</p>
</li><li class="listitem">
<p>time - </p>
</li></ul></div>
<pre class="programlisting">
public Map<String, Object> onClientBWCheck(Object[] params) {
final IStreamCapableConnection stats = this.getStats();
Map<String, Object> statsValues = new HashMap<String, Object>();
Integer time = (Integer) (params.length > 0 ? params[0] : 0);
statsValues.put("cOutBytes", stats.getReadBytes());
statsValues.put("cInBytes", stats.getWrittenBytes());
statsValues.put("time", time);
log.info("cOutBytes: {} cInBytes: {} time: {}", new Object[]{stats.getReadBytes(), stats.getWrittenBytes(), time});
return statsValues;
}
</pre>
</div>
</div>
</div>
</div><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navfooter"><hr></hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="management.html">Prev</a> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right"> <a accesskey="n" href="testing.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 16. Management </td><td width="20%" align="center"><span style="color:white;font-size:90%;"><a href="http://osflash.org/red5" title="Red5">Red5 Open Source Flash Server</a></span></td><td width="40%" align="right" valign="top"> Chapter 18. Testing Red5</td></tr></table></div></body></html>
|