1.修改red5-web.xml
添加xml代码块
<bean id="streamFilenameGenerator" class="com.custom.CustomFilenameGenerator"></bean>
2.创建CustomFilenameGenerator.java
public class CustomFilenameGenerator implements 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) {
// 具体需要构造的文件路径
return name;
}
@Override
public boolean resolvesToAbsolutePath() {
// 此处需要返回true,读取路径将采取generateFilename中返回的路径
return true;
}
}