rtmp学习(一)
rtmp播放流程:
1、客户端 和服务器握手(HandShake)、建立一个网络连接(NetConnection);
握手 :双方分别发送三个数据块C0、C1、S0、S1、C2、S2
C0和S0就是一个字节(version(1)),表示协议版本号,现在是03
C1和S1长度1536个字节(time(4)、zero(4)、random(1528))
C2和S2长度也是1536个字节(time(4)、time2(4)、random echo(1528))
网络连接:connect->
windows acknowledgement size<-
set Peer Bandwidth<-
windows acknowledgement size->
user control message(StreamBegin)<-
command message(_result connect response)<-
2、建立网络流(NetStream)通道;
command message(CreateStream)->
command message(_result createStream response)
3、拉流play;
command message(play)->
setChunkSize<-
userControl(StreamBegin)<-告知流ID
command message(onStatus-play reset)<-
command message(onStatus-play start)<-
audio message<-
video message<-
媒体流必须发布到已经在流媒体服务器上注册过的应用程序上,在服务器的Applications文件夹下新建一个"live"文件夹,即课注册一个名为"live"的应用程序,不需要编写任何代码