聚合全网技术文章,根据你的阅读喜好进行个性推荐
目前在一家公司实习,公司开发的平台需要用到流媒体技术,所以采用了red5,但需要将red5下的stream目录下的流媒体文件(.flv)放置到其他盘或者其他服务器上,从而调用red5目录以外的流媒体文件,哪位高手教教我?我一直无法实现!!
我也需要这个答案!找到一个方法试了一下,不行
建立以下类:
package com.cyh;
import org.red5.server.api.IScope;
import org.red5.server.api.stream.IStreamFilenameGenerator.GenerationType;
public class PathBean {
public String recordPath = "streams/";
public String playbackPath ="streams/";
public String generateFilename(IScope scope, String name, GenerationType type) {
return this.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)
filename += extension;
return filename;
public String getRecordPath() {
return recordPath;
public void setRecordPath(String recordPath) {
this.recordPath = recordPath;
public String getPlaybackPath() {
return playbackPath;
public void setPlaybackPath(String playbackPath) {
this.playbackPath = playbackPath;
public boolean resolvesToAbsolutePath() {
// TODO Auto-generated method stub
return true;
在red5-web.xml中添加以下bean:
<bean id="streamFilenameGenerator"
class="com.cyh.PathBean">
<property name="recordPath" value="D:\voice\streams\" />
<property name="playbackPath" value="E:\streams\" />
</bean>
实现IStreamFilenameGenerator接口
@Override public String generateFilename(IScope scope, String name, GenerationType type) { return generateFilename(scope,name,null,type); }
@Override public String generateFilename(IScope scope, String name, String extension, GenerationType type) { String result = name; if(extension!=null && !extension.equals("")){ result += extension; } return result; }
@Override public boolean resolvesToAbsolutePath() { return true; }
rtmp播放地址带上绝对路径,如:rtmp://localhost:1935/vod/F:/a/v/c/a.flv
如有疑问,qq:1512161790
我也需要这个答案!找到一个方法试了一下,不行
建立以下类:
package com.cyh;
import org.red5.server.api.IScope;
import org.red5.server.api.stream.IStreamFilenameGenerator.GenerationType;
public class PathBean {
public String recordPath = "streams/";
public String playbackPath ="streams/";
public String generateFilename(IScope scope, String name, GenerationType type) {
return this.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)
filename += extension;
return filename;
}
public String getRecordPath() {
return recordPath;
}
public void setRecordPath(String recordPath) {
this.recordPath = recordPath;
}
public String getPlaybackPath() {
return playbackPath;
}
public void setPlaybackPath(String playbackPath) {
this.playbackPath = playbackPath;
}
public boolean resolvesToAbsolutePath() {
// TODO Auto-generated method stub
return true;
}
}
在red5-web.xml中添加以下bean:
<bean id="streamFilenameGenerator"
class="com.cyh.PathBean">
<property name="recordPath" value="D:\voice\streams\" />
<property name="playbackPath" value="E:\streams\" />
</bean>
实现IStreamFilenameGenerator接口
@Override
public String generateFilename(IScope scope, String name, GenerationType type) {
return generateFilename(scope,name,null,type);
}
@Override
public String generateFilename(IScope scope, String name, String extension,
GenerationType type) {
String result = name;
if(extension!=null && !extension.equals("")){
result += extension;
}
return result;
}
@Override
public boolean resolvesToAbsolutePath() {
return true;
}
rtmp播放地址带上绝对路径,如:rtmp://localhost:1935/vod/F:/a/v/c/a.flv
如有疑问,qq:1512161790