SCOPE在Red5 中是以树的形式组织的。对于叶子结点,我们称之为BasicScope,如果有子结点的Scope,就叫Scope。 Red5当中有两种预定义的BasicScope,SharedObject Scope 和 BrodcastStream Scope。对于每一个应用来说,顶层是WebScope,而GlobalScope是Root结点,每一个Scope都有一个名称,如下。
GlobalScope(default) --> WebScope(oflaDemo) --> Scope(room0) --> BroadcastStream(live0), SharedObject(so1)
--> Scope(room1) --> SharedObject(so0)
--> WebScope(fitcDemo) --> Scope(room1) --> BroadcastStream(live0)
对于客户端来说,不可以连接GlobalScope和BasicScope,其它的Scope是可以连接的。对于WebScope的子Scope是可以自动创建的,比方说 客户端连接oflaDemo/lobby0/room0 ,如果lobby0/room0都没有创建的话,服务端会自动创建起来。
Scope提供了资源解析和注册服务的功能,它也能够管理当前连接到该Scope的连接对象。
Context 被绑定在Scope对象当中,为Scope对象提供额外的服务。IContext.getScope()可以获取Context对象实例。由于Context包装了Spring的 application context,因此通过spring的查找bean能够很快得到预先被加载的服务对象。Scope对象还提供了 "clientRegistry", "serviceInvoker", "persistenceStore", "mappingStrategy" 等等服务。在red5当中主要用到这两种上下文对象Default和Web两种上下文。
The scope handler methods are:
· start – Called only once, when a scope is created for the first time.
· connect – Called right before every connection to a scope.
· join – Called right before the client enters the scope.
· leave – Called right after a client leaves the scope.
· disconnect – Called just after the connection is disconnected from the scope.
· stop – Called right before a scope is destroyed. When this is called at application level, the application will be stopped. If called at room level,
it will simply stop handling on that scope.· addChildScope – Called just before a child scope is added.
· removeChildScope – Called right after a child scope is removed.
· serviceCall – Called when a service method is requested.
The application adapter methods are:
· appStart – Called on the first request for an application or room.
· appConnect – Called when a connection is made to an application.
· appJoin – Called every time a client joins an application.
· appLeave – Called when a client leaves an application.
· appDisconnect – Called when a connection disconnects from an application.
· appStop – Called when an application is destroyed, this occurs when an application is stopped.
· roomStart – Called the only once when a room is started.
· roomConnect – Called on every connection to a room.
· roomJoin – Called every time a client joins a room.
· roomLeave – Called when a client leaves a room.
· roomDisconnect – Called when a connection disconnects from a room.
· roomStop – Called when a room is disposed.
An incoming connection will proceed through the following steps:
1. roomStart is called for the requested scope if the connection is the first connection to the
scope
2. connect is called on the application scope
3. appConnect is called
4. appJoin is called
5. connect is called on the room scope
6. roomConnect is called
7. roomJoin is called
A connection which is disconnecting from our application will go through the following steps:
1. disconnect is called on the room scope
2. roomDisconnect is called
3. leave is called on the room scope
4. roomLeave is called
5. disconnect is called on the application scope
6. appDisconnect is called
7. leave is called on the application scope
8. appLeave is called
假设服务端启动了一个red5serv的应用,客户端连接该应用时rtmp://localhost/red5serv/lobby0/room0 并离开服务器。
服务器启动
start 创建red5serv应用时调用
appStart 启动时调用一次
客户端连接rtmp://localhost/red5serv/lobby0/room0
start lobby0创建时调用
roomStart lobby0创建完成后调用
start room0 创建时调用
roomStart room0 创建时调用
connect 连接
appConnect 连接red5serv应用
join 加入
appJoin 加入red5serv应用
connect 连接
roomConnect 连接lobby0
join 加入
roomJoin 加入lobby0
connect 连接
roomConnect 连接room0
join 加入
roomJoin 加入room0
disconnect 断开
roomDisconnect 断开room0
leave 离开
roomLeave 离开room0
stop 停止
roomStop 停止room0
disconnect 断开
roomDisconnect 断开lobby0
leave 离开
roomLeave 离开lobby0
stop 停止
roomStop 销毁lobby0
disconnect
appDisconnect 断开应用
leave 离开
appLeave 离开应用red5serv
分享到:
相关推荐
RED5最重要的例程"oflaDemo 。但是,现在的网络这个例程一般都在线下不来;更要命的是,下下来用不了,会提示No scope "oflaDemo" on this server。我被这个搞得想自杀!换RED5的版本,从0.8-1.0,不行!从CSDN下载...
<bean id="myApp.context" class="org.red5.server.Context"> <property name="scopeResolver" ref="red5.scopeResolver" /> <bean id="myApp.scope" class="org.red5.server.WebScope" init-...
Red5_0.9.1 + MyEclipse10.7 中单步调试Demo Publisher : 编译通过Red_091 后,调试参数设置如下 。 右键项目 - Debug As -- Debug Configurations --Environment : 设置 RED5_HOME 环境变量 "Main class...
Red5 基于 Java 和一些功能强大的开源框架,为企业级应用奠定了标准。它使用 RTMP,RTMPT,RTMPS 和 RTMPE 流媒体协议, 支持:将音频(MP3)和视频(FLV,MP4,F4V,3GP)转换成播放流;录制客户端播放流;共享对象...
red5 与 tomcat项目集成
red5 免安装版 red5 1.00 自己试过了!可以正常运行和启动
关于使用 Flex 和Java servlets 将文件上传到 RED5 服务器的步骤,请参考博客:http://blog.csdn.net/defonds/article/details/7639058。 关于 Red5 服务器应用配置,请参考文档《red5配置.doc》,下载地址:...
本文档记录了利用ffmpeg将摄像机采集的rtsp视频流转换为rtmp视频流,并推送到rtmp服务器red5的详细步骤。最终可以供VLC、web页面访问并展示rtmp视频。
Red5的0.9.1版本
red5 1.0 final 与 tomcat 整合 ,导入myeclipse可以直接使用。
关于red5的一些学习文档,资料很齐全。 d5_demo 服务器端调用客户端as的方法 as3.0+red5 --- hello world FMS&Red5 RED5 – Project Roadmap Open Source Flash 等等文档
red5入门,tomcat+red5+myeclipse集成,原创禁止转载,欢迎补充!
Red5+H5实现点播和直播
red5-1.0.5免安装版,适用于window64位(需要先安装jdk1.7,注意是red5-1.0.5需要的是1.7,在这之前装了好几个最新的red5,比如1.0.8,需要的jdk是1.8),解压后,可以设置conf中的red5.properties,也可不设置。...
red5项目示例,简单配置使用RED5入门
使用red5开发基于flex的视频会议系统, red5视频流的发布和使用。
《使用Red5入门》 《red5入门》 《red5入门教程》 《RED5安装与配置》 《red5流媒体服务器入门基础》
Red5的Web视频、音频系统开发
red5 0.8 reference Red5 - Reference Documentation Red5 Open Source Flash Server
Red5+的安装和使用.doc配置Red5详解