[red5]red5流媒体环境做防止盗链的处理方法
[red5]red5流媒体环境做防止盗链的处理方法
[red5]red5流媒体环境做防止盗链的处理方法
- package first;
- import java.util.Map;
- import org.apache.commons.lang.StringUtils;
- import org.red5.server.adapter.ApplicationAdapter;
- import org.red5.server.api.IConnection;
- import org.red5.server.api.IScope;
- import org.red5.server.api.stream.IServerStream;
- import com.cqa.platform.util.SystemGlobals;
- public class Application extends ApplicationAdapter{
- private IScope appScope;
- private IServerStream serverStream;
- public Application()
- {
- System.out.println("Application构造函数 ");
- }
- //appStart将在链接开始时自动触发
- public boolean appStart(IScope app)
- {
- return true;
- }
- //链接时触发的函数
- public boolean appConnect(IConnection conn, Object[] params)
- {
- Map<String, Object> hm = conn.getConnectParams();
- String host = (String) hm.get("pageUrl");
- String allowHost = "http://localhost:18082/red5/";
- boolean ret = false;
- if(allowHost == null || StringUtils.isBlank(allowHost )){
- ret = true;
- }else {
- String[] args = allowHost.split(",");
- ret = false;
- if(host != null && StringUtils.isNotBlank(host) ){
- for(int i=0;i<args.length;++i){
- if(host.indexOf( args[i])>=0){
- ret = true;
- break;
- }
- }
- }
- }
- if(ret){
- return super.appConnect(conn, params);
- }else {
- return false;
- }
- }
- public void appDisconnect(IConnection conn)
- {
- if ((this.appScope == conn.getScope()) && (this.serverStream != null)) {
- this.serverStream.close();
- }
- super.appDisconnect(conn);
- }
- }
热门文章推荐
- [Red5]Red5之Flash流媒体服务器的安装与使用教程完整版(组图)
- [RED5]搭建RED5直播用流媒体服务(搭直播环境)
- [RED5]Red5的直播与点播的压力测试(并发数的测试)
- [RED5]red5流媒体服务器(开源免费)的安装方法
- [RED5]用red5做视频直播(red5流媒体直播)
- [RED5]Red5在线录制音视频源代码示例
- [RED5]Red5 Client 连接 Red5Server java代码
- [RED5]red5流媒体播放平台搭建环境方法
请稍候...