This file is indexed.

/usr/share/doc/red5/html/stream-paths.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
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
   <title>Chapter&nbsp;12.&nbsp;Customize Stream Paths</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&nbsp;II.&nbsp;Red5 Core Components"><link rel="prev" href="tomcat-deployment.html" title="Chapter&nbsp;11.&nbsp;Deploying Red5 To Tomcat"><link rel="next" href="security.html" title="Chapter&nbsp;13.&nbsp;Security"></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="stream-paths"></a>Chapter&nbsp;12.&nbsp;Customize Stream Paths</h2></div></div></div>
	
	<p>This document describes how applications can stream ondemand videos (VOD) from or 
		record to custom directories other than the default streams folder inside the webapp. </p>
	<div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d5e1901"></a>12.1.&nbsp;Filename generator service</h2></div></div></div>
		
		<p>Red5 uses a concept called scope services for functionality that is provided for a certain 
			scope. One of these scope services is IStreamFilenameGenerator 
			<a class="ulink" href="http://dl.fancycode.com/red5/api/org/red5/server/api/stream/IStreamFilenameGenerator.html" target="_top">http://dl.fancycode.com/red5/api/org/red5/server/api/stream/IStreamFilenameGenerator.html</a> that generates 
			filenames for VOD streams that should be played or recorded. 
		</p>
	</div>
	<div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d5e1905"></a>12.2.&nbsp;Custom generator</h2></div></div></div>
		
		<p>To generate filename in different folders, a new filename generator must be implemented: </p>
		<pre class="programlisting">


import org.red5.server.api.IScope; 
import org.red5.server.api.stream.IStreamFilenameGenerator; 
public class CustomFilenameGenerator implements IStreamFilenameGenerator { 
 /** Path that will store recorded videos. */ 
 public String recordPath = "recordedStreams/"; 
 /** Path that contains VOD streams. */ 
 public String playbackPath = "videoStreams/"; 
 /** Set if the path is absolute or relative */ 
 public boolean resolvesAbsolutePath = false; 
 public String generateFilename(IScope scope, String name, GenerationType type) { 
  // Generate filename without an extension. 
  return generateFilename(scope, name, null, type); 
 } 
 public String generateFilename(IScope scope, String name, String extension, GenerationType type) { 
  String filename; 
  if (type == GenerationType.RECORD) 
   filename = recordPath + name; 
  else 
   filename = playbackPath + name; 
  
  if (extension != null) 
   // Add extension 
   filename += extension; 
  
  return filename; 
 } 
 
 public boolean resolvesToAbsolutePath() 
    { 
     return resolvesAbsolutePath; 
    } 
} 

</pre>
		<p>The above class will generate filenames for recorded streams like recordedStreams/ 
			red5RecordDemo1234.flv and use the directory videoStreams as source for all VOD 
			streams.</p>
	</div>
	<div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d5e1910"></a>12.3.&nbsp;Activate custom generator</h2></div></div></div>
		
		<p>In the next step, the custom generator must be activate in the configuration files for the 
			desired application. </p>
		<p>Add the following definition to yourApp/WEB-INF/red5-web.xml: </p>
		<pre class="programlisting">


&lt;bean id="streamFilenameGenerator" 
    class="path.to.your.CustomFilenameGenerator" /&gt; 

</pre>
		<p>This will use the class defined above to generate stream filenames. </p>
	</div>
	<div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d5e1916"></a>12.4.&nbsp;Change paths through configuration</h2></div></div></div>
		
		<p>While the class described here works as expected, it's a bit unhandy to change the paths 
			inside the code as every change requires recompilation of the class. </p>
		<p>Therefore you can pass parameters to the bean defined in the previous step to specify the 
			paths to use inside the configuration file. </p>
		<p>Add three methods to your class that will be executed while the configuration file is parsed:</p>
		<pre class="programlisting">


public void setRecordPath(String path) { 
 recordPath = path; 
} 
public void setPlaybackPath(String path) { 
 playbackPath = path; 
} 
public void setAbsolutePath(Boolean absolute) { 
 resolvesAbsolutePath = absolute; 
} 

</pre>
		<p>Now you can set the paths inside the bean definition: </p>
		<pre class="programlisting">


&lt;bean id="streamFilenameGenerator" 
   class="path.to.your.CustomFilenameGenerator"&gt; 
   &lt;property name="recordPath" value="recordedStreams/" /&gt; 
   &lt;property name="playbackPath" value="videoStreams/" /&gt; 
   &lt;property name="absolutePath" value="false" /&gt; 
&lt;/bean&gt; 
&lt;bean id="streamFilenameGenerator" 
   class="path.to.your.CustomFilenameGenerator"&gt; 
   &lt;property name="recordPath" value="/path/to/recordedStreams/" /&gt; 
   &lt;property name="playbackPath" value="/path/to/videoStreams/" /&gt; 
   &lt;property name="absolutePath" value="true" /&gt; 
&lt;/bean&gt; 

</pre>
		<p>You can also move the paths to the yourApp/WEB-INF/red5-web.properties file and use 
			parameters to access them: </p>
		<pre class="programlisting">


&lt;bean id="streamFilenameGenerator" 
   class="path.to.your.CustomFilenameGenerator"&gt; 
   &lt;property name="recordPath" value="${recordPath}" /&gt; 
   &lt;property name="playbackPath" value="${playbackPath}" /&gt; 
   &lt;property name="absolutePath" value="${absolutePath}" /&gt; 
&lt;/bean&gt; 

</pre>
		<p>In that case you will have to add the following lines to your properties file: </p>
		<p>red5-web.properties -</p>
		<div class="literallayout"><p><br>
recordPath=recordedStreams/&nbsp;<br>
playbackPath=videoStreams/&nbsp;<br>
absolutePath=false&nbsp;<br>
recordPath=/path/to/recordedStreams/&nbsp;<br>
playbackPath=/path/to/videoStreams/&nbsp;<br>
absolutePath=true&nbsp;<br>
</p></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="tomcat-deployment.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="security.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter&nbsp;11.&nbsp;Deploying Red5 To Tomcat&nbsp;</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">&nbsp;Chapter&nbsp;13.&nbsp;Security</td></tr></table></div></body></html>